html5 canvas instead of DOM

This commit is contained in:
2025-12-19 02:31:49 +00:00
parent 41473f3b24
commit 2757d54dbb
10 changed files with 871 additions and 440 deletions
+2 -2
View File
@@ -37,6 +37,7 @@ export type GameOptions = {
maxLevel?: number;
initialSnakeSize?: number;
initialFoodCount?: number;
cellSize?: number;
};
// ============================================================================
@@ -74,13 +75,12 @@ export type SnakeCursorManager = CursorManager & {
snakeBody: SnakeBody;
direction: Direction;
changeDirection: (dir: Direction) => void;
// Snake-specific for internal use
snakeBodyRef: MutableRefObject<SnakeBody>;
directionRef: MutableRefObject<Direction>;
initSnake: () => void;
clearSnake: () => void;
applyBufferedDirection: () => void;
moveSnake: (grow?: boolean) => 'continue' | 'wall-collision' | 'self-collision';
renderSnake: (body: SnakeBody) => void;
};
// ============================================================================