new input system

This commit is contained in:
Jorijn van der Graaf 2026-05-12 00:24:48 +02:00
commit ac2eb7fb0a
31 changed files with 3292 additions and 781 deletions

View file

@ -43,6 +43,27 @@ library does not track widgets or focus.
Drop a TTF in this directory as `font.ttf` before running (the example
loads it via `Font("font.ttf")`).
### [InputSystem](InputSystem/)
Guided tour of `Crafter::Input`: name actions ("Jump", "Move", "Fire",
"Look", "Zoom"), bind them to keys / mouse / gamepad (with composite
bindings for WASD-as-Vector2 and analog sticks), and consume them as
events. Demonstrates:
- The compile-time `Key(CrafterKeys::Space)` helper that folds to a
per-platform raw scancode — bindings stay cross-platform-readable
in source while runtime data stores raw codes only.
- All four action types (Button, Axis1D, Vector2) with multiple
bindings per action (any-of semantics).
- `Map::StartRebind` — press R, then press any input to remap "Jump"
at runtime. Captured input is filtered out for that frame.
- `BindingToString` / `BindingFromString` round-trip — print the
default bindings as the on-disk format.
- Gamepad hot-plug events: plug a controller in mid-run and the
bindings start firing immediately.
Console-driven (no UI rendering needed); focus the window and watch
stdout.
### [CustomShader](CustomShader/)
Tier 1 demo: a user-authored compute shader (`inverse-circle.comp.glsl`)
running alongside the shipped `drawQuads`. The custom shader inverts RGB