diff --git a/UNIFIED_API.md b/UNIFIED_API_OLD.md similarity index 100% rename from UNIFIED_API.md rename to UNIFIED_API_OLD.md diff --git a/example/src/App.tsx b/example/src/App.tsx index 9167d4b..1ef555e 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -11,10 +11,52 @@ function App() { const rows = isMobile ? 8 : 24; const gameManager = useGame({ cols, rows }, useKeyBindings); - const { containerRef, gameStatus } = gameManager; + const { containerRef, gameStatus, scoreManager } = gameManager; + const { timeValue, keystrokes, efficiency, optimalSteps, finalScore } = scoreManager; + + const formatTime = (ms: number) => { + const seconds = Math.floor(ms / 1000); + const minutes = Math.floor(seconds / 60); + const secs = seconds % 60; + return `${minutes}:${secs.toString().padStart(2, '0')}`; + }; return ( -
Press space to start
} {gameStatus === "started" &&Use hjkl to change direction • Press q to quit
} {gameStatus === "game-over" &&Game Over! Press space to restart
} + {gameStatus === "game-won" &&You Won! Press space to play again
}