diff --git a/example/src/App.tsx b/example/src/App.tsx index d5f92e1..82c5bb2 100755 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -3,15 +3,33 @@ import "@vimazing/vim-snake/game.css"; import { useKeyBindings } from "./useKeyBindings"; function App() { - const { containerRef, gameStatus } = useGame(30, 20, useKeyBindings); + const { containerRef, gameStatus, scoreManager, keyLog } = useGame(30, 20, useKeyBindings); + + const formatTime = (ms: number) => { + const seconds = Math.floor(ms / 1000); + const minutes = Math.floor(seconds / 60); + const remainingSeconds = seconds % 60; + return `${minutes}:${remainingSeconds.toString().padStart(2, "0")}`; + }; return (
Press space to start
} - {gameStatus === "started" &&Use hjkl to move • Press q to quit
} + {gameStatus === "started" &&Use hjkl to change direction • Press q to quit
} {gameStatus === "game-over" &&Game Over! Press space to restart
}