src/systems/InputManager.ts/*** Unified input. Reads keyboard (arrows + WASD) and exposes a normalized* direction vector each frame. Also tracks pointer state and supports* subscribing to discrete key events (jump, pause, etc.).** Touch support: a virtual joystick is not included by default — most polished* 2D games render a custom on-screen control. Hook touchstart/touchmove on* scenes that need it, or extend this class.*/type KeyHandler = () => void;export class InputManager {/*** Movement keys the game always consumes. Combined with any key that has an* active onPress handler, these get preventDefault()'d on keydown so the* browser doesn't scroll the page (Arrow keys + Space) while playing.*/private static readonly MOVE_KEYS = new Set(['ArrowUp','ArrowDown',
Showing the first 20 lines.
Get full code