Commit Graph
17 Commits
Author SHA1 Message Date
Luxferre 5e41abe2a8 tetris: register the # key (which emits XK_slash on this device) as pause
The physical # key produces XK_slash, not XK_numbersign, so add XK_slash
to the pause binding. The on-screen label still reads '# PAUSE'.
2026-10-23 20:36:41 +03:00
Luxferre 58071b374c games: fix font glyphs, Snake edge-wrap, snappier Snake
Font: add missing bitmap glyphs (/ # * + =) to both Snake and Tetris so
control labels like '4/6 MOVE' and '# PAUSE' render correctly. Also hoist
XSetForeground out of the per-pixel loop in draw_text (both games).

Snake: remove the wall-collision death; the head now wraps through the
opposite edge ((hx+COLS)%COLS, (hy+ROWS)%ROWS). Base speed raised from
70->100 px/sec (~128ms -> ~90ms per step) so it feels less laggy; the
+1 px/sec per 5 food progressive difficulty is unchanged.
2026-10-23 20:32:50 +03:00
Luxferre fdcdb89684 games: progressive difficulty + Tetris controls panel
Snake: speed derived from pixels/second; +1 px/sec per 5 food eaten
(pps = 70 + food/5, step = cell*1000/pps, floored at 40ms).

Tetris: speed derived from pixels/second; +1 px/sec per 10 lines cleared
(pps = 23 + lines/10, step = CELL*1000/pps, floored at 40ms), replacing
the old level-driven formula. Level still drives the score multiplier.

Tetris: list all controls concisely in the free space of the right panel
(KEYS, 4/6 MOVE, 2 ROTATE, 8 SOFT, 0 DROP, # PAUSE, 5 OK).
2026-10-23 20:17:15 +03:00
Luxferre 10b67c0f30 tetris: let Center/OK/Enter key also hard-drop like 0 2026-10-23 19:55:41 +03:00
Luxferre c9cbc99064 tetris: make next-piece preview frame 1px wider (top-left unchanged, piece untouched) 2026-10-23 19:45:17 +03:00
Luxferre bb48674506 tetris: lower next-piece preview by another 2px 2026-10-23 19:38:11 +03:00
Luxferre 08f3b90228 tetris: lower next-piece preview by another 2px 2026-10-23 19:35:00 +03:00
Luxferre f52b59fd0a tetris: lower the next-piece preview a few more pixels within its frame 2026-10-23 19:29:02 +03:00
Luxferre 36757c3f46 tetris: add vertical separator between playfield and side panel; enlarge next-piece preview
Draw a bright vertical divider in the gap between the playfield and the side
panel so the two areas are clearly separated, and render the NEXT piece larger
(pcell 6 -> 11) centered inside a framed preview box.
2026-10-23 19:18:32 +03:00
Luxferre 70ef9860be fix(games): inset windows so dwm's native border stays on-screen
dwm adds a borderpx (1) border around every client, so a window sized to
fill the usable area (240x296) overflowed the 240x320 screen by 2px on the
right and bottom, clipping the native window border. Offset the requested
position by the border width and shrink by 3*borderpx so the framed window
exactly meets the screen edges with the native border fully visible.
2026-10-23 19:06:31 +03:00
Luxferre 313e137d87 games: auto-size windows to available screen; dmenu shows Sys menu from any app 2026-10-23 18:50:12 +03:00
Luxferre 2a12f8bdb4 fix(games): size windows to content with edge border; add Games to app-context menu 2026-10-23 16:54:13 +03:00
Luxferre bf4652ca5b fix(games): single playfield border, snake score in top strip, no soft-drop scoring, 239x295 window 2026-10-23 16:07:35 +03:00
Luxferre 1dd9fac313 fix(games): correct Tetris rotation, fix input/render lag, visible window frame
- Tetris: replace pivot-based rotation with explicit 4-state SHAPES
  table (classic SRS-style) so rotation is correct and the O piece no
  longer drifts on rotate; keep simple wall-kick offsets.
- Both: render immediately after processing input (not only on gravity
  steps) so rotation/movement is no longer laggy.
- Both: draw the window frame inset by 2-3px (double line) so the right
  and bottom edges are actually visible instead of clipped at the edge.
2026-10-23 15:47:30 +03:00
Luxferre 6bf4139263 fix(games): complete font (U/W + A-Z), fix Tetris gravity, frame + center overlays
- Font: add missing glyphs (U, W and complete A-Z) to both Snake and
  Tetris 5x7 bitmap fonts so PAUSE/RESUME/NEW GAME render correctly.
- Tetris: the gravity loop never advanced nextTick after a step, so the
  piece dropped almost instantly every frame. Advance nextTick by speed
  after each step (matching Snake) so gravity honours the configured rate.
- Both: draw a 1px frame around the whole 240x296 window (right/bottom
  edges were previously absent) and clear the playfield to black behind
  PAUSE/GAME OVER text for contrast.
- Both: fix centering of overlay labels (GAME OVER, 5 RESUME, 5 NEW GAME).
2026-10-23 15:30:29 +03:00
Luxferre 3eb54e4306 fix(games): correct Snake self-collision on spawn, enlarge Tetris, brighten labels
Snake: the snake was initialized with its head at the left end while
moving right, so the first gravity step walked the head into its own
body and the game started at Game Over. Initialize the head at the
right end (cx) so the initial direction is valid.

Tetris: enlarge the playfield cell (10 -> 12px) so pieces are not too
small, and slow gravity (800ms base, gentler per-level ramp, 250ms
floor) so pieces do not fall too fast.

Both: brighten the secondary/dim text colour (0x0a3a0a -> 0x2f9f2f)
so score/label/menu text is actually legible on the black background.

Also wire the Games section into the real main menu: the system menu
is hardcoded in the dwm-plugin dmenu (src/sxmo-dmenu/dmenu.c), not in
sxmo_appmenu.sh, so add a 'games' builtin menu that loads
sxmo_hook_games.sh and a Games entry after Apps in the sys menu, plus
scripts/build-dmenu.sh to cross-compile dmenu.so.
2026-10-23 14:57:59 +03:00
Luxferre 5f467b02fa feat(games): add Snake and Tetris X11 games with menu integration
Add two standalone X11 games (not DWM plugins) for the Nokia 8110 keypad:
- src/games/snake.cpp: Nokia Snake II-style game, 240x296, built-in 5x7 font
- src/games/tetris.cpp: Tetris with next-piece preview, levels, line clears

Both float as dialog windows in dwm, use a self-contained bitmap font (no
font-file dependency), and are controlled via the numeric keypad (2/4/6/8
directions, 5 action) with arrow-key fallbacks.

- scripts/build-games.sh: Docker armv7 cross-compile (mirrors build-sxmo-x11.sh)
- overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_games.sh: Games menu hook
- overlay/rootfs/usr/bin/sxmo_appmenu.sh: add 'Games' entry after 'Apps' and a
  games submenu case

Binaries committed to prebuilt/games and overlay/rootfs/usr/bin per repo
convention. Deployed and verified on the live device (window maps, dwm focuses
it, keypad input reaches the game).
2026-10-23 14:29:48 +03:00