games: rewrite both games with fixed-timestep accumulator loop

The snake speed instability was caused by cumulative timing drift in the
select()-based loop (nextTick reset to now+speed each step). Both games now
use a fixed-timestep accumulator: elapsed time is accumulated each frame and
the game logic steps when enough has built up, so movement is perfectly
periodic regardless of frame timing or rendering cost. Frame pacing caps
elapsed at 200ms to prevent a spiral of death.

Both files were fully rewritten to eliminate structural corruption (duplicate
function definitions / missing braces) introduced by many incremental edits:
- Snake: turn queue (max 2), batched body rendering, 90 px/sec base, 30 fps.
- Tetris: batched beveled-block rendering (XFillRectangles), Gameboy palette,
  XK_KP_Divide pause, 30 fps accumulator loop.

Both compile cleanly (no -Wall/-Wextra warnings) as valid armv7 ELF.
This commit is contained in:
Luxferre
2026-10-24 10:31:10 +03:00
parent 52ac64e9b3
commit eb78f314a3
6 changed files with 41 additions and 33 deletions
Binary file not shown.
Binary file not shown.