refactor: make all GameOptions optional with sensible defaults

- cols defaults to 30 (was required)
- rows defaults to 20 (was required)
- timeLimit and startingLevel remain optional
- Can now call useGame() with no arguments
- Example: useGame(), useGame({}), useGame({ startingLevel: 5 })
This commit is contained in:
2025-10-31 00:19:43 +00:00
parent ad82eaff7c
commit 5cbb2ee94c
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ import "@vimazing/vim-snake/game.css";
import { useKeyBindings } from "./useKeyBindings";
function App() {
const { containerRef, gameStatus, scoreManager, keyLog, score, level } = useGame({ cols: 30, rows: 20 }, useKeyBindings);
const { containerRef, gameStatus, scoreManager, keyLog, score, level } = useGame({}, useKeyBindings);
const formatTime = (ms: number) => {
const seconds = Math.floor(ms / 1000);