Commit Graph

12 Commits

Author SHA1 Message Date
arek 81a1b26842 perf(render): redraw on demand and only changed cells
Rendering used to clear the whole canvas and redraw every cell on
every frame callback (~60 fps) even though the simulation ticks at
20 tps and starts paused, keeping CPU usage at ~85% while idle.

Split simulation timing out of redraw() into the event loop and
render only when displayed content can have changed (tick, painting,
pattern placement, preview movement, grid-line toggle, resize);
idle frames commit only a new frame callback. Repaint incrementally
by diffing the grid against a rendered-state snapshot per row and
redrawing just the changed cells, with damage limited to the
repainted bounding box.

Idle CPU drops to ~1% of one core; running frames render at tick
rate (~20 fps) at microsecond cost. Adds grid_copy() snapshot
helper with tests and archives the optimize-render-on-demand change
with the new on-demand-rendering spec.
2026-11-08 20:11:55 +01:00
arek 8c2fbbbbc8 docs: archive more-patterns change and sync specs
Archive completed change and update pattern-placement spec.
2026-11-08 16:22:44 +01:00
arek ed6c9c81f3 feat: add 6 more built-in patterns (Beacon, Boat, Tub, Beehive, R-pentomino, Acorn)
Extend pattern module to 10 patterns and map them to digit keys 5-0.
Update config defaults and tests.
2026-11-08 16:18:48 +01:00
arek 844778d30f docs: add more-patterns OpenSpec change
Plan 6 additional built-in patterns mapped to digit keys 5-0.
2026-11-08 16:16:59 +01:00
arek bf426d1e06 docs: archive arena-size change and sync specs
Archive completed change and add arena-sizing main spec.
2026-11-08 16:11:03 +01:00
arek a607a2441c feat: size arena to ~80% of output with resize-aware grid
Store wl_output mode dimensions and compute the default logical window
size as 80% of the output divided by the active scale, with a fallback.
Grid dimensions continue to update on resize.
2026-11-08 16:07:45 +01:00
arek 9583cab243 docs: add arena-size OpenSpec change
Plan output-aware arena sizing (~80% of screen) with fallback and resize.
2026-11-08 16:05:14 +01:00
arek b7120e67f2 docs: archive gol-simulation change and sync specs
Archive completed change and add gol-simulation main spec.
2026-11-08 15:57:21 +01:00
arek cb974854a3 feat: add Game of Life simulation mechanics
Implement Conway rules with tick timing, pause/resume, single stepping,
speed control, and paused-only cell editing with drag painting. Update
default key bindings for pause/step/speed. Mark verification complete.
2026-11-08 15:47:46 +01:00
arek 00a2b6b03e docs: add gol-simulation OpenSpec change
Plan Game of Life mechanics: Conway rules, pause/resume, stepping,
speed control, and paused-only cell editing with drag painting.
2026-11-08 15:39:25 +01:00
arek 7874a5f7c6 feat: implement keyboard and mouse input, pattern placement, and HiDPI scaling
Add configurable key bindings (TOML), modifier-aware dispatch, mouse-driven
pattern placement with preview and rotation, cell grid storage/rendering,
and fractional/integer HiDPI scaling. Archive the input-and-placement change
and sync its specs to main specs.

Tests: Hashtable, Config, Grid, Pattern (4/4 pass).
2026-11-08 14:46:04 +01:00
arek 5e7abfb56b docs: add input-and-placement OpenSpec change and update AGENTS.md
Plan input handling and pattern placement before Game of Life mechanics:
keyboard bindings config, mouse placement with preview/rotation,
HiDPI scaling, and cell grid. Update AGENTS.md project notes.
2026-11-08 14:30:09 +01:00