Commit Graph
3 Commits
Author SHA1 Message Date
pastilhas 762bc86878 feat(phase1.2b): implement Nokia-style key buffering system
- Add nextDirectionRef to buffer player input
- Update changeDirection() to queue input instead of immediate execution
- Add applyBufferedDirection() to safely apply buffered input
- Buffer prevents 180° reversals for safe turns
- Call applyBufferedDirection() after each successful move in game loop
- Remove collision grace period - no longer needed with key buffering
- Remove collisionGracePeriodRef and related logic
- Clean up all console.log statements from useGameStatus
- Game now feels responsive at high speeds
- Allows pre-emptive turning on board edges (Nokia Snake style)
- Build and example app work correctly
2025-10-30 22:39:21 +00:00
pastilhas 5c398b556f feat(phase1.2): fix GameManager interface to match Unified API
- Create comprehensive types.ts with all required manager interfaces
- Define GameManager with proper Unified API compliance
- Implement CursorManager interface in useCursor with VIM motions
- Add SnakeCursorManager type with snake-specific extensions
- Update useGame to return proper GameManager interface
- Support both old (cols, rows) and new (options) signatures
- Add quitGame alias for stopGame in useGameStatus
- Wrap renderBoard to match Unified API signature (no parameters)
- Add placeholder for totalKeystrokes and finalScore in ScoreManager
- All TypeScript builds successfully
- Example app builds without errors
2025-10-30 22:22:03 +00:00
pastilhas dcaa93ea08 feat(phase1.1): create hook module structure with proper exports
- Create new hook modules: useBoard, useCursor, useGameStatus
- Move/copy hook implementations to their own directories
- Create index.ts files for clean module exports
- Update all imports to use new module locations
- Rename useSnake -> useCursor for Unified API alignment
- Rename useRenderer -> useBoard for clarity
- Update main src/index.ts to export from all hook modules
- All TypeScript builds successfully
- Example app remains functional
2025-10-30 22:16:13 +00:00