games: jitter-free stepping via timerfd + clearer Snake playfield

Replace the select() timeout sleep with a Linux timerfd high-resolution
timer. It fires on an absolute CLOCK_MONOTONIC deadline, so wakeups are
no longer quantized to the kernel tick (a short final wait was rounded
up to a whole tick, causing +-10-22ms jitter and lurches). The loop now
select()s on both the X connection fd and the timer fd, so input still
wakes it immediately and no busy-spin is needed -- the controls stay
responsive. A select()-timeout fallback is kept for non-timerfd setups.

Snake: draw a bright frame around the actual playfield so its boundary is
unmistakable, and move the SCORE/BEST label down into the margin between
the window frame and the playfield frame.
This commit is contained in:
Luxferre
2026-10-24 14:21:24 +03:00
parent eb78f314a3
commit 0e670d7224
6 changed files with 225 additions and 87 deletions
Binary file not shown.
Binary file not shown.