diff --git a/.gitignore b/.gitignore index c9f41f9..394f3e9 100644 --- a/.gitignore +++ b/.gitignore @@ -225,3 +225,6 @@ dist # Turbo .turbo/ + +#nx +.nx/ diff --git a/apps/website/src/game/game.ts b/apps/website/src/game/game.ts index b87f208..7ed3056 100644 --- a/apps/website/src/game/game.ts +++ b/apps/website/src/game/game.ts @@ -6,12 +6,12 @@ import { changeWindowToGame } from "../window"; const logger = new Logger("Game"); -export const runGame = (mainModule: any, options: Omit) => { +export const runGame = (mainModule: any, options: Omit) => { logger.info("Starting game"); changeWindowToGame(); mainModule.main({ ...options, - canvas: getElementById(IDS.canvas) as HTMLCanvasElement, + container: getElementById(IDS.container) as HTMLDivElement, }); logger.info("Game started"); }; diff --git a/apps/website/src/ids.ts b/apps/website/src/ids.ts index bea4561..1102c86 100644 --- a/apps/website/src/ids.ts +++ b/apps/website/src/ids.ts @@ -1,5 +1,5 @@ export const IDS = { - canvas: "nanoforge-canvas", + container: "nanoforge-container", loader: "nanoforge-loader", loadingStatus: "loading-status", diff --git a/apps/website/src/index.html b/apps/website/src/index.html index 4475c0b..dfd610b 100644 --- a/apps/website/src/index.html +++ b/apps/website/src/index.html @@ -23,10 +23,10 @@ - + > diff --git a/apps/website/src/types/game.type.ts b/apps/website/src/types/game.type.ts index 632ff52..7d4a70b 100644 --- a/apps/website/src/types/game.type.ts +++ b/apps/website/src/types/game.type.ts @@ -1,5 +1,5 @@ export interface IGameOptions { - canvas: HTMLCanvasElement; + container: HTMLDivElement; files: Map; env: Record; } diff --git a/apps/website/src/window.ts b/apps/website/src/window.ts index 9a2b0cc..6c0031e 100644 --- a/apps/website/src/window.ts +++ b/apps/website/src/window.ts @@ -8,7 +8,7 @@ let totalFiles = 0; export const changeWindowToGame = async () => { setHiddenStatusOnId(IDS.loader, true); - setHiddenStatusOnId(IDS.canvas, false); + setHiddenStatusOnId(IDS.container, false); await delay(500); const loader = document.getElementById(IDS.loader); if (loader) loader.classList.add("fade-out"); @@ -16,7 +16,7 @@ export const changeWindowToGame = async () => { }; export const changeWindowToLoader = async () => { - setHiddenStatusOnId(IDS.canvas, true); + setHiddenStatusOnId(IDS.container, true); setHiddenStatusOnId(IDS.loader, false); logger.info("Change window to loader"); }; diff --git a/docs/docs/architecture.rst b/docs/docs/architecture.rst index b8c5a85..1fc527c 100644 --- a/docs/docs/architecture.rst +++ b/docs/docs/architecture.rst @@ -164,7 +164,7 @@ The website package provides the browser-side game loader: 4. **Game Loading**: Imports the main module and creates a file map for the game to access assets. -5. **Game Execution**: Calls the game's ``main()`` function with canvas +5. **Game Execution**: Calls the game's ``main()`` function with container and file references. 6. **Watch Integration**: Subscribes to the WebSocket for hot reload diff --git a/docs/docs/website.rst b/docs/docs/website.rst index a924cd5..fa3f8f7 100644 --- a/docs/docs/website.rst +++ b/docs/docs/website.rst @@ -15,7 +15,7 @@ The website is a client-side application that: - Fetches the game manifest from the loader server - Caches game files in browser storage - Loads and executes the game's main module -- Provides a canvas and file access to the game +- Provides a container and file access to the game - Supports hot reload via WebSocket Modules @@ -57,11 +57,11 @@ Handles game execution and window management. function runGame( mainModule: any, - options: Omit + options: Omit ): void - Switches the UI to game mode -- Gets the canvas element +- Gets the container element - Calls the game's ``main()`` function with options cache @@ -226,7 +226,7 @@ Options passed to the game's main function: .. code-block:: typescript interface IGameOptions { - canvas: HTMLCanvasElement; + container: HTMLDivElement; files: Map; }