Replaced the blocking select()-based main loop with a proper game loop: - Process ALL pending X11 input (XPending) before every frame — no more missed keypresses from select() blocking for up to a full frame - Render every frame at 30 fps (FRAME_MS = 33 ms) consistently - Frame pacing uses select() with a timeout that wakes immediately on input, so keypresses are processed within milliseconds - Game logic (snake steps, tetris gravity) still runs at its own rate via nextTick, decoupled from render rate This eliminates input lag and missed keypresses in both Snake and Tetris.
17 KiB
Executable File
17 KiB
Executable File