organized types

This commit is contained in:
2025-10-19 16:11:38 +01:00
parent 252027dab2
commit a69b7bbb5f
27 changed files with 231 additions and 203 deletions
+1
View File
@@ -1 +1,2 @@
export * from './types';
export * from './useGameStatus';
+9
View File
@@ -0,0 +1,9 @@
export type GameStatus = 'waiting' | 'started' | 'has-key' | 'paused' | 'game-over' | 'game-won';
export type GameStatusManager = {
gameStatus: GameStatus;
setGameStatus: (status: GameStatus) => void;
startGame: () => void;
togglePause: (pause?: boolean) => void;
quitGame: () => void;
};
+2 -1
View File
@@ -1,5 +1,6 @@
import { useState } from 'react';
import type { GameStatus, BoardManager, Coord } from '../types';
import type { GameStatus } from './types';
import type { BoardManager, Coord } from '../useBoard/types';
export function useGameStatus(board?: BoardManager, setHeroPos?: (pos: Coord) => void) {
const [gameStatus, setGameStatus] = useState<GameStatus>('waiting');