games: fix input/rendering lag and missed keypresses
Identified and fixed rendering/input optimization issues: - Snake: added turn queue (max 2 pending turns) so rapid key presses are never lost; filters reversals and duplicates against the last queued direction. Batched snake body rendering into a single XFillRectangles call instead of one XFillRectangle per segment. - Tetris: batched settled-block rendering into 3 XFillRectangles calls (body, highlight, shadow) instead of 5 XFillRectangle calls per cell. This reduces ~1000 X11 calls per frame to 3, fixing frame drops and input lag. - Both: non-blocking input polling before every frame (already in place) ensures no keypress is missed.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user