brick-engine-js 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.local.example +2 -0
- package/.github/workflows/publish.yml +73 -0
- package/.prettierignore +2 -0
- package/.prettierrc.json +8 -0
- package/README.adoc +84 -0
- package/dist/8e23286c2fdf41fd795f.svg +32 -0
- package/dist/CNAME +1 -0
- package/dist/app.js +2 -0
- package/dist/app.js.map +1 -0
- package/dist/brick-engine.js +2 -0
- package/dist/brick-engine.js.map +1 -0
- package/dist/config/configs.d.ts +180 -0
- package/dist/config/configs.test.d.ts +1 -0
- package/dist/config/env.d.ts +2 -0
- package/dist/config/env.test.d.ts +1 -0
- package/dist/config/styles.d.ts +0 -0
- package/dist/core/Game.d.ts +107 -0
- package/dist/core/Game.test.d.ts +1 -0
- package/dist/core/InitialStateSnapshot.d.ts +19 -0
- package/dist/core/InitialStateSnapshot.test.d.ts +1 -0
- package/dist/core/helpers/CellHelper.d.ts +13 -0
- package/dist/core/helpers/CellHelper.test.d.ts +1 -0
- package/dist/core/helpers/ControlInputHandlerHelper.d.ts +32 -0
- package/dist/core/helpers/ControlInputHandlerHelper.test.d.ts +1 -0
- package/dist/core/helpers/CoordinateHelper.d.ts +54 -0
- package/dist/core/helpers/CoordinateHelper.test.d.ts +1 -0
- package/dist/core/helpers/InterfaceIdentifierHelper.d.ts +7 -0
- package/dist/core/helpers/InterfaceIdentifierHelper.test.d.ts +1 -0
- package/dist/core/helpers/RelativeValuesHelper.d.ts +23 -0
- package/dist/core/helpers/RelativeValuesHelper.test.d.ts +1 -0
- package/dist/core/module/control/GameControl.d.ts +62 -0
- package/dist/core/module/control/GameControl.test.d.ts +1 -0
- package/dist/core/module/control/GameControlKeyBinding.d.ts +36 -0
- package/dist/core/module/control/GameControlKeyBinding.test.d.ts +1 -0
- package/dist/core/module/grid/GameGrid.d.ts +399 -0
- package/dist/core/module/grid/GameGrid.test.d.ts +1 -0
- package/dist/core/module/grid/GameHudGrid.d.ts +24 -0
- package/dist/core/module/grid/GameHudGrid.test.d.ts +1 -0
- package/dist/core/module/grid/engines/GridAnalysisEngine.d.ts +29 -0
- package/dist/core/module/grid/engines/GridAnalysisEngine.test.d.ts +1 -0
- package/dist/core/module/grid/engines/GridLineEngine.d.ts +56 -0
- package/dist/core/module/grid/engines/GridLineEngine.test.d.ts +1 -0
- package/dist/core/module/grid/engines/GridMovementEngine.d.ts +29 -0
- package/dist/core/module/grid/engines/GridMovementEngine.test.d.ts +1 -0
- package/dist/core/module/grid/engines/GridRegionEngine.d.ts +26 -0
- package/dist/core/module/grid/engines/GridRegionEngine.test.d.ts +1 -0
- package/dist/core/module/grid/engines/GridTransformEngine.d.ts +24 -0
- package/dist/core/module/grid/engines/GridTransformEngine.test.d.ts +1 -0
- package/dist/core/module/renderer/DisplayRenderer.d.ts +51 -0
- package/dist/core/module/renderer/DisplayRenderer.test.d.ts +1 -0
- package/dist/core/module/renderer/GameRenderer.d.ts +59 -0
- package/dist/core/module/renderer/GameRenderer.test.d.ts +1 -0
- package/dist/core/module/renderer/HudRenderer.d.ts +56 -0
- package/dist/core/module/renderer/HudRenderer.test.d.ts +1 -0
- package/dist/core/module/score/GameScore.d.ts +117 -0
- package/dist/core/module/score/GameScore.test.d.ts +1 -0
- package/dist/core/module/session/GameSession.d.ts +20 -0
- package/dist/core/module/session/GameSession.test.d.ts +1 -0
- package/dist/core/module/sound/GameSound.d.ts +85 -0
- package/dist/core/module/sound/GameSound.test.d.ts +1 -0
- package/dist/core/module/state/GameState.d.ts +172 -0
- package/dist/core/module/state/GameState.test.d.ts +1 -0
- package/dist/core/module/text/GameText.d.ts +87 -0
- package/dist/core/module/text/GameText.test.d.ts +1 -0
- package/dist/core/module/time/GameTime.d.ts +76 -0
- package/dist/core/module/time/GameTime.test.d.ts +1 -0
- package/dist/core/types/Interfaces.d.ts +53 -0
- package/dist/core/types/Types.d.ts +114 -0
- package/dist/core/types/enums.d.ts +106 -0
- package/dist/core/types/modules.d.ts +723 -0
- package/dist/css/app.743066d8e4172b0e73f9.css +824 -0
- package/dist/css/app.743066d8e4172b0e73f9.css.map +1 -0
- package/dist/docs/GAME_DEVELOPER_GUIDE.html +727 -0
- package/dist/docs/brick-engine-guide.html +610 -0
- package/dist/docs/diagrams/lifecycle.mmd +19 -0
- package/dist/docs/documentation_style_guide.html +994 -0
- package/dist/docs/getting-started.html +648 -0
- package/dist/docs/images/lifecycle.svg +1 -0
- package/dist/docs/index.html +593 -0
- package/dist/docs/jsdoc_standard.html +656 -0
- package/dist/docs/publishing.html +573 -0
- package/dist/docs/reference/enums/Color.html +533 -0
- package/dist/docs/reference/enums/ControlEventType.html +505 -0
- package/dist/docs/reference/enums/ControlKey.html +529 -0
- package/dist/docs/reference/enums/FontAlignment.html +545 -0
- package/dist/docs/reference/enums/FontSize.html +517 -0
- package/dist/docs/reference/enums/Sound.html +558 -0
- package/dist/docs/reference/enums/StateProperty.html +525 -0
- package/dist/docs/reference/helpers/CellHelper.html +520 -0
- package/dist/docs/reference/helpers/ControlInputHandlerHelper.html +569 -0
- package/dist/docs/reference/helpers/CoordinateHelper.html +703 -0
- package/dist/docs/reference/helpers/RelativeValuesHelper.html +560 -0
- package/dist/docs/reference/interfaces/Debuggable.html +501 -0
- package/dist/docs/reference/interfaces/GameModules.html +544 -0
- package/dist/docs/reference/interfaces/Initializable.html +495 -0
- package/dist/docs/reference/interfaces/RendererInitializable.html +517 -0
- package/dist/docs/reference/interfaces/StateSyncable.html +542 -0
- package/dist/docs/reference/interfaces/modules/Control.html +648 -0
- package/dist/docs/reference/interfaces/modules/Grid.html +1256 -0
- package/dist/docs/reference/interfaces/modules/Renderer.html +522 -0
- package/dist/docs/reference/interfaces/modules/RendererComposite.html +577 -0
- package/dist/docs/reference/interfaces/modules/Score.html +669 -0
- package/dist/docs/reference/interfaces/modules/Session.html +585 -0
- package/dist/docs/reference/interfaces/modules/State.html +897 -0
- package/dist/docs/reference/interfaces/modules/Text.html +668 -0
- package/dist/docs/reference/interfaces/modules/Time.html +684 -0
- package/dist/docs/reference/modules/Debugger.html +579 -0
- package/dist/docs/reference/modules/DisplayRenderer.html +557 -0
- package/dist/docs/reference/modules/Game.html +909 -0
- package/dist/docs/reference/modules/GameControl.html +716 -0
- package/dist/docs/reference/modules/GameGrid.html +1910 -0
- package/dist/docs/reference/modules/GameHudGrid.html +508 -0
- package/dist/docs/reference/modules/GameMenu.html +538 -0
- package/dist/docs/reference/modules/GameRenderer.html +589 -0
- package/dist/docs/reference/modules/GameScore.html +664 -0
- package/dist/docs/reference/modules/GameSession.html +533 -0
- package/dist/docs/reference/modules/GameSound.html +636 -0
- package/dist/docs/reference/modules/GameState.html +922 -0
- package/dist/docs/reference/modules/GameText.html +701 -0
- package/dist/docs/reference/modules/GameTime.html +696 -0
- package/dist/docs/reference/modules/HudRenderer.html +568 -0
- package/dist/docs/reference/modules/InitialStateSnapshot.html +557 -0
- package/dist/docs/reference/modules/SessionModal.html +520 -0
- package/dist/docs/reference/types/Axis.html +505 -0
- package/dist/docs/reference/types/Cell.html +514 -0
- package/dist/docs/reference/types/ControlCallback.html +488 -0
- package/dist/docs/reference/types/Coordinate.html +510 -0
- package/dist/docs/reference/types/GameEntry.html +514 -0
- package/dist/docs/reference/types/GameEvent.html +514 -0
- package/dist/docs/reference/types/Piece.html +506 -0
- package/dist/docs/reference/types/RendererMetrics.html +514 -0
- package/dist/docs/reference/types/Vector.html +509 -0
- package/dist/docs/testing_best_practices.html +770 -0
- package/dist/favicon.ico +0 -0
- package/dist/fonts/digital-7.monoitalic.ttf +0 -0
- package/dist/images/cell.svg +32 -0
- package/dist/images/close.png +0 -0
- package/dist/images/games.png +0 -0
- package/dist/images/github.png +0 -0
- package/dist/images/letter-a.png +0 -0
- package/dist/images/letter-d.png +0 -0
- package/dist/images/letter-j.png +0 -0
- package/dist/images/letter-s.png +0 -0
- package/dist/images/letter-w.png +0 -0
- package/dist/images/meta-image.png +0 -0
- package/dist/images/number-1.png +0 -0
- package/dist/images/number-2.png +0 -0
- package/dist/images/number-3.png +0 -0
- package/dist/images/number-4.png +0 -0
- package/dist/images/number-5.png +0 -0
- package/dist/images/number-6.png +0 -0
- package/dist/images/splash.gif +0 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.html +1 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.test.d.ts +1 -0
- package/dist/menu/GameMenu.d.ts +15 -0
- package/dist/menu/GameMenu.test.d.ts +1 -0
- package/dist/menu/GameMenuSingleton.d.ts +6 -0
- package/dist/menu/GameMenuSingleton.test.d.ts +1 -0
- package/dist/menu/GameRepository.d.ts +7 -0
- package/dist/menu/GameRepository.test.d.ts +1 -0
- package/dist/menu/manager/GameManager.d.ts +6 -0
- package/dist/menu/manager/GameManager.test.d.ts +1 -0
- package/dist/sounds/sound_00.wav +0 -0
- package/dist/sounds/sound_01.wav +0 -0
- package/dist/sounds/sound_02.wav +0 -0
- package/dist/sounds/sound_03.wav +0 -0
- package/dist/sounds/sound_04.wav +0 -0
- package/dist/sounds/sound_05.wav +0 -0
- package/dist/sounds/sound_06.wav +0 -0
- package/dist/sounds/sound_07.wav +0 -0
- package/dist/sounds/sound_08.wav +0 -0
- package/dist/sounds/sound_09.wav +0 -0
- package/dist/sounds/sound_10.wav +0 -0
- package/dist/sounds/sound_11.wav +0 -0
- package/dist/sounds/sound_12.wav +0 -0
- package/dist/sounds/sound_13.wav +0 -0
- package/dist/sounds/sound_14.wav +0 -0
- package/dist/sounds/sound_15.wav +0 -0
- package/dist/types/interfaces.d.ts +5 -0
- package/dist/vendor/p5.min.js +1 -0
- package/dist/view/Debugger.d.ts +12 -0
- package/dist/view/Debugger.test.d.ts +1 -0
- package/dist/view/GameView.d.ts +101 -0
- package/dist/view/GameView.test.d.ts +1 -0
- package/dist/view/SessionModal.d.ts +12 -0
- package/dist/view/SessionModal.test.d.ts +4 -0
- package/dist/view/components/layout/ButtonLayout.d.ts +25 -0
- package/dist/view/components/layout/ButtonLayout.test.d.ts +1 -0
- package/dist/view/components/layout/ContainerLayout.d.ts +23 -0
- package/dist/view/components/layout/ContainerLayout.test.d.ts +1 -0
- package/dist/view/components/layout/FrameLayout.d.ts +11 -0
- package/dist/view/components/layout/FrameLayout.test.d.ts +1 -0
- package/dist/view/components/ui/BigButton.d.ts +13 -0
- package/dist/view/components/ui/BigButton.test.d.ts +1 -0
- package/dist/view/components/ui/Button.d.ts +12 -0
- package/dist/view/components/ui/Button.test.d.ts +1 -0
- package/dist/view/components/ui/Canvas.d.ts +22 -0
- package/dist/view/components/ui/Canvas.test.d.ts +1 -0
- package/dist/view/components/ui/SmallButton.d.ts +13 -0
- package/dist/view/components/ui/SmallButton.test.d.ts +1 -0
- package/dist/view/theme/applyColors.d.ts +10 -0
- package/dist/view/theme/applyColors.test.d.ts +1 -0
- package/dist/view/theme/dimensions.d.ts +13 -0
- package/dist/view/theme/dimensions.test.d.ts +1 -0
- package/docs/GAME_DEVELOPER_GUIDE.adoc +167 -0
- package/docs/brick-engine-guide.adoc +87 -0
- package/docs/diagrams/lifecycle.mmd +19 -0
- package/docs/documentation_style_guide.adoc +210 -0
- package/docs/getting-started.adoc +147 -0
- package/docs/images/lifecycle.svg +1 -0
- package/docs/jsdoc_standard.adoc +109 -0
- package/docs/publishing.adoc +58 -0
- package/docs/reference/enums/Color.adoc +35 -0
- package/docs/reference/enums/ControlEventType.adoc +28 -0
- package/docs/reference/enums/ControlKey.adoc +34 -0
- package/docs/reference/enums/FontAlignment.adoc +43 -0
- package/docs/reference/enums/FontSize.adoc +31 -0
- package/docs/reference/enums/Sound.adoc +42 -0
- package/docs/reference/enums/StateProperty.adoc +33 -0
- package/docs/reference/helpers/CellHelper.adoc +37 -0
- package/docs/reference/helpers/ControlInputHandlerHelper.adoc +57 -0
- package/docs/reference/helpers/CoordinateHelper.adoc +118 -0
- package/docs/reference/helpers/RelativeValuesHelper.adoc +53 -0
- package/docs/reference/interfaces/Debuggable.adoc +29 -0
- package/docs/reference/interfaces/GameModules.adoc +35 -0
- package/docs/reference/interfaces/Initializable.adoc +24 -0
- package/docs/reference/interfaces/RendererInitializable.adoc +33 -0
- package/docs/reference/interfaces/StateSyncable.adoc +41 -0
- package/docs/reference/interfaces/modules/Control.adoc +98 -0
- package/docs/reference/interfaces/modules/Grid.adoc +411 -0
- package/docs/reference/interfaces/modules/Renderer.adoc +34 -0
- package/docs/reference/interfaces/modules/RendererComposite.adoc +57 -0
- package/docs/reference/interfaces/modules/Score.adoc +107 -0
- package/docs/reference/interfaces/modules/Session.adoc +66 -0
- package/docs/reference/interfaces/modules/State.adoc +290 -0
- package/docs/reference/interfaces/modules/Text.adoc +110 -0
- package/docs/reference/interfaces/modules/Time.adoc +119 -0
- package/docs/reference/modules/Debugger.adoc +71 -0
- package/docs/reference/modules/DisplayRenderer.adoc +55 -0
- package/docs/reference/modules/Game.adoc +256 -0
- package/docs/reference/modules/GameControl.adoc +139 -0
- package/docs/reference/modules/GameGrid.adoc +794 -0
- package/docs/reference/modules/GameHudGrid.adoc +38 -0
- package/docs/reference/modules/GameMenu.adoc +39 -0
- package/docs/reference/modules/GameRenderer.adoc +79 -0
- package/docs/reference/modules/GameScore.adoc +138 -0
- package/docs/reference/modules/GameSession.adoc +43 -0
- package/docs/reference/modules/GameSound.adoc +111 -0
- package/docs/reference/modules/GameState.adoc +318 -0
- package/docs/reference/modules/GameText.adoc +139 -0
- package/docs/reference/modules/GameTime.adoc +141 -0
- package/docs/reference/modules/HudRenderer.adoc +56 -0
- package/docs/reference/modules/InitialStateSnapshot.adoc +47 -0
- package/docs/reference/modules/SessionModal.adoc +34 -0
- package/docs/reference/types/Axis.adoc +28 -0
- package/docs/reference/types/Cell.adoc +29 -0
- package/docs/reference/types/ControlCallback.adoc +23 -0
- package/docs/reference/types/Coordinate.adoc +29 -0
- package/docs/reference/types/GameEntry.adoc +29 -0
- package/docs/reference/types/GameEvent.adoc +29 -0
- package/docs/reference/types/Piece.adoc +32 -0
- package/docs/reference/types/RendererMetrics.adoc +29 -0
- package/docs/reference/types/Vector.adoc +28 -0
- package/docs/testing_best_practices.adoc +190 -0
- package/eslint.config.mjs +29 -0
- package/package.json +54 -0
- package/public/CNAME +1 -0
- package/public/docs/GAME_DEVELOPER_GUIDE.html +727 -0
- package/public/docs/brick-engine-guide.html +610 -0
- package/public/docs/diagrams/lifecycle.mmd +19 -0
- package/public/docs/documentation_style_guide.html +994 -0
- package/public/docs/getting-started.html +648 -0
- package/public/docs/images/lifecycle.svg +1 -0
- package/public/docs/index.html +593 -0
- package/public/docs/jsdoc_standard.html +656 -0
- package/public/docs/publishing.html +573 -0
- package/public/docs/reference/enums/Color.html +533 -0
- package/public/docs/reference/enums/ControlEventType.html +505 -0
- package/public/docs/reference/enums/ControlKey.html +529 -0
- package/public/docs/reference/enums/FontAlignment.html +545 -0
- package/public/docs/reference/enums/FontSize.html +517 -0
- package/public/docs/reference/enums/Sound.html +558 -0
- package/public/docs/reference/enums/StateProperty.html +525 -0
- package/public/docs/reference/helpers/CellHelper.html +520 -0
- package/public/docs/reference/helpers/ControlInputHandlerHelper.html +569 -0
- package/public/docs/reference/helpers/CoordinateHelper.html +703 -0
- package/public/docs/reference/helpers/RelativeValuesHelper.html +560 -0
- package/public/docs/reference/interfaces/Debuggable.html +501 -0
- package/public/docs/reference/interfaces/GameModules.html +544 -0
- package/public/docs/reference/interfaces/Initializable.html +495 -0
- package/public/docs/reference/interfaces/RendererInitializable.html +517 -0
- package/public/docs/reference/interfaces/StateSyncable.html +542 -0
- package/public/docs/reference/interfaces/modules/Control.html +648 -0
- package/public/docs/reference/interfaces/modules/Grid.html +1256 -0
- package/public/docs/reference/interfaces/modules/Renderer.html +522 -0
- package/public/docs/reference/interfaces/modules/RendererComposite.html +577 -0
- package/public/docs/reference/interfaces/modules/Score.html +669 -0
- package/public/docs/reference/interfaces/modules/Session.html +585 -0
- package/public/docs/reference/interfaces/modules/State.html +897 -0
- package/public/docs/reference/interfaces/modules/Text.html +668 -0
- package/public/docs/reference/interfaces/modules/Time.html +684 -0
- package/public/docs/reference/modules/Debugger.html +579 -0
- package/public/docs/reference/modules/DisplayRenderer.html +557 -0
- package/public/docs/reference/modules/Game.html +909 -0
- package/public/docs/reference/modules/GameControl.html +716 -0
- package/public/docs/reference/modules/GameGrid.html +1910 -0
- package/public/docs/reference/modules/GameHudGrid.html +508 -0
- package/public/docs/reference/modules/GameMenu.html +538 -0
- package/public/docs/reference/modules/GameRenderer.html +589 -0
- package/public/docs/reference/modules/GameScore.html +664 -0
- package/public/docs/reference/modules/GameSession.html +533 -0
- package/public/docs/reference/modules/GameSound.html +636 -0
- package/public/docs/reference/modules/GameState.html +922 -0
- package/public/docs/reference/modules/GameText.html +701 -0
- package/public/docs/reference/modules/GameTime.html +696 -0
- package/public/docs/reference/modules/HudRenderer.html +568 -0
- package/public/docs/reference/modules/InitialStateSnapshot.html +557 -0
- package/public/docs/reference/modules/SessionModal.html +520 -0
- package/public/docs/reference/types/Axis.html +505 -0
- package/public/docs/reference/types/Cell.html +514 -0
- package/public/docs/reference/types/ControlCallback.html +488 -0
- package/public/docs/reference/types/Coordinate.html +510 -0
- package/public/docs/reference/types/GameEntry.html +514 -0
- package/public/docs/reference/types/GameEvent.html +514 -0
- package/public/docs/reference/types/Piece.html +506 -0
- package/public/docs/reference/types/RendererMetrics.html +514 -0
- package/public/docs/reference/types/Vector.html +509 -0
- package/public/docs/testing_best_practices.html +770 -0
- package/public/favicon.ico +0 -0
- package/public/fonts/digital-7.monoitalic.ttf +0 -0
- package/public/images/cell.svg +32 -0
- package/public/images/close.png +0 -0
- package/public/images/games.png +0 -0
- package/public/images/github.png +0 -0
- package/public/images/letter-a.png +0 -0
- package/public/images/letter-d.png +0 -0
- package/public/images/letter-j.png +0 -0
- package/public/images/letter-s.png +0 -0
- package/public/images/letter-w.png +0 -0
- package/public/images/meta-image.png +0 -0
- package/public/images/number-1.png +0 -0
- package/public/images/number-2.png +0 -0
- package/public/images/number-3.png +0 -0
- package/public/images/number-4.png +0 -0
- package/public/images/number-5.png +0 -0
- package/public/images/number-6.png +0 -0
- package/public/images/splash.gif +0 -0
- package/public/index.html +15 -0
- package/public/sounds/sound_00.wav +0 -0
- package/public/sounds/sound_01.wav +0 -0
- package/public/sounds/sound_02.wav +0 -0
- package/public/sounds/sound_03.wav +0 -0
- package/public/sounds/sound_04.wav +0 -0
- package/public/sounds/sound_05.wav +0 -0
- package/public/sounds/sound_06.wav +0 -0
- package/public/sounds/sound_07.wav +0 -0
- package/public/sounds/sound_08.wav +0 -0
- package/public/sounds/sound_09.wav +0 -0
- package/public/sounds/sound_10.wav +0 -0
- package/public/sounds/sound_11.wav +0 -0
- package/public/sounds/sound_12.wav +0 -0
- package/public/sounds/sound_13.wav +0 -0
- package/public/sounds/sound_14.wav +0 -0
- package/public/sounds/sound_15.wav +0 -0
- package/public/style/body.css +86 -0
- package/public/style/buttons.css +233 -0
- package/public/style/debugger.css +117 -0
- package/public/style/sessionModal.css +155 -0
- package/public/style/sourceCodeAndCommands.css +74 -0
- package/public/style/splash.css +13 -0
- package/public/style/theme.css +137 -0
- package/scripts/generate-diagrams.sh +20 -0
- package/scripts/generate-docs.js +111 -0
- package/src/client-game.d.ts +1 -0
- package/src/config/configs.test.ts +20 -0
- package/src/config/configs.ts +197 -0
- package/src/config/env.test.ts +59 -0
- package/src/config/env.ts +7 -0
- package/src/config/styles.ts +5 -0
- package/src/core/Game.test.ts +167 -0
- package/src/core/Game.ts +307 -0
- package/src/core/InitialStateSnapshot.test.ts +51 -0
- package/src/core/InitialStateSnapshot.ts +46 -0
- package/src/core/helpers/CellHelper.test.ts +33 -0
- package/src/core/helpers/CellHelper.ts +21 -0
- package/src/core/helpers/ControlInputHandlerHelper.test.ts +116 -0
- package/src/core/helpers/ControlInputHandlerHelper.ts +68 -0
- package/src/core/helpers/CoordinateHelper.test.ts +113 -0
- package/src/core/helpers/CoordinateHelper.ts +82 -0
- package/src/core/helpers/InterfaceIdentifierHelper.test.ts +122 -0
- package/src/core/helpers/InterfaceIdentifierHelper.ts +43 -0
- package/src/core/helpers/RelativeValuesHelper.test.ts +47 -0
- package/src/core/helpers/RelativeValuesHelper.ts +29 -0
- package/src/core/module/control/GameControl.test.ts +82 -0
- package/src/core/module/control/GameControl.ts +142 -0
- package/src/core/module/control/GameControlKeyBinding.test.ts +59 -0
- package/src/core/module/control/GameControlKeyBinding.ts +92 -0
- package/src/core/module/grid/GameGrid.test.ts +83 -0
- package/src/core/module/grid/GameGrid.ts +610 -0
- package/src/core/module/grid/GameHudGrid.test.ts +22 -0
- package/src/core/module/grid/GameHudGrid.ts +40 -0
- package/src/core/module/grid/engines/GridAnalysisEngine.test.ts +157 -0
- package/src/core/module/grid/engines/GridAnalysisEngine.ts +124 -0
- package/src/core/module/grid/engines/GridLineEngine.test.ts +132 -0
- package/src/core/module/grid/engines/GridLineEngine.ts +165 -0
- package/src/core/module/grid/engines/GridMovementEngine.test.ts +125 -0
- package/src/core/module/grid/engines/GridMovementEngine.ts +113 -0
- package/src/core/module/grid/engines/GridRegionEngine.test.ts +136 -0
- package/src/core/module/grid/engines/GridRegionEngine.ts +52 -0
- package/src/core/module/grid/engines/GridTransformEngine.test.ts +98 -0
- package/src/core/module/grid/engines/GridTransformEngine.ts +70 -0
- package/src/core/module/renderer/DisplayRenderer.test.ts +86 -0
- package/src/core/module/renderer/DisplayRenderer.ts +152 -0
- package/src/core/module/renderer/GameRenderer.test.ts +103 -0
- package/src/core/module/renderer/GameRenderer.ts +144 -0
- package/src/core/module/renderer/HudRenderer.test.ts +108 -0
- package/src/core/module/renderer/HudRenderer.ts +203 -0
- package/src/core/module/score/GameScore.test.ts +71 -0
- package/src/core/module/score/GameScore.ts +188 -0
- package/src/core/module/session/GameSession.test.ts +176 -0
- package/src/core/module/session/GameSession.ts +103 -0
- package/src/core/module/sound/GameSound.test.ts +117 -0
- package/src/core/module/sound/GameSound.ts +229 -0
- package/src/core/module/state/GameState.test.ts +101 -0
- package/src/core/module/state/GameState.ts +339 -0
- package/src/core/module/text/GameText.test.ts +87 -0
- package/src/core/module/text/GameText.ts +150 -0
- package/src/core/module/time/GameTime.test.ts +86 -0
- package/src/core/module/time/GameTime.ts +144 -0
- package/src/core/types/Interfaces.ts +59 -0
- package/src/core/types/Types.ts +124 -0
- package/src/core/types/enums.ts +113 -0
- package/src/core/types/modules.ts +841 -0
- package/src/index.test.ts +15 -0
- package/src/index.ts +9 -0
- package/src/main.test.ts +137 -0
- package/src/main.ts +77 -0
- package/src/menu/GameMenu.test.ts +157 -0
- package/src/menu/GameMenu.ts +124 -0
- package/src/menu/GameMenuSingleton.test.ts +26 -0
- package/src/menu/GameMenuSingleton.ts +13 -0
- package/src/menu/GameRepository.test.ts +46 -0
- package/src/menu/GameRepository.ts +47 -0
- package/src/menu/manager/GameManager.test.ts +68 -0
- package/src/menu/manager/GameManager.ts +50 -0
- package/src/types/global.d.ts +8 -0
- package/src/types/interfaces.ts +5 -0
- package/src/view/Debugger.test.ts +152 -0
- package/src/view/Debugger.ts +124 -0
- package/src/view/GameView.test.ts +95 -0
- package/src/view/GameView.ts +244 -0
- package/src/view/SessionModal.test.ts +141 -0
- package/src/view/SessionModal.ts +73 -0
- package/src/view/components/layout/ButtonLayout.test.ts +28 -0
- package/src/view/components/layout/ButtonLayout.ts +63 -0
- package/src/view/components/layout/ContainerLayout.test.ts +48 -0
- package/src/view/components/layout/ContainerLayout.ts +50 -0
- package/src/view/components/layout/FrameLayout.test.ts +24 -0
- package/src/view/components/layout/FrameLayout.ts +25 -0
- package/src/view/components/ui/BigButton.test.ts +28 -0
- package/src/view/components/ui/BigButton.ts +31 -0
- package/src/view/components/ui/Button.test.ts +30 -0
- package/src/view/components/ui/Button.ts +30 -0
- package/src/view/components/ui/Canvas.test.ts +32 -0
- package/src/view/components/ui/Canvas.ts +34 -0
- package/src/view/components/ui/SmallButton.test.ts +48 -0
- package/src/view/components/ui/SmallButton.ts +32 -0
- package/src/view/theme/applyColors.test.ts +47 -0
- package/src/view/theme/applyColors.ts +38 -0
- package/src/view/theme/dimensions.test.ts +34 -0
- package/src/view/theme/dimensions.ts +53 -0
- package/tsconfig.json +16 -0
- package/vitest.config.ts +14 -0
- package/webpack.config.js +133 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
= Publishing Your Game
|
|
2
|
+
:description: Guide on how to bundle and publish your game to the Brick Engine library.
|
|
3
|
+
:keywords: publish, cli, bundle, deployment
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
|
|
11
|
+
This guide explains how to use the **Brick Engine CLI** `publish` command to bundle your game and submit it to the central repository, making it available for everyone in the main engine menu.
|
|
12
|
+
|
|
13
|
+
== Prerequisites
|
|
14
|
+
|
|
15
|
+
Before you can publish your game, ensure you have:
|
|
16
|
+
* **Completed Development**: Your game should be fully playable and tested locally (`npm start`).
|
|
17
|
+
* **Author Details**: Ensure you know the author email you want associated with this publication.
|
|
18
|
+
|
|
19
|
+
== The `publish` Command
|
|
20
|
+
|
|
21
|
+
The `publish` command connects your local project to the central Brick Engine repository.
|
|
22
|
+
|
|
23
|
+
Run the following command in the root of your project directory:
|
|
24
|
+
|
|
25
|
+
[source,bash]
|
|
26
|
+
----
|
|
27
|
+
npx brick-engine-cli publish
|
|
28
|
+
----
|
|
29
|
+
|
|
30
|
+
=== What happens during `publish`?
|
|
31
|
+
|
|
32
|
+
When you run the publish command, the CLI will automatically perform the following steps:
|
|
33
|
+
|
|
34
|
+
1. **Build**: It executes `npm run build:bundle` to generate a production-ready, optimized JavaScript bundle of your game in the `dist/` directory.
|
|
35
|
+
2. **Prompt for Details**: It will ask for the developer's email address. This is used to notify you about the status of your publication request.
|
|
36
|
+
3. **Upload**: The CLI securely uploads your generated `game.bundle.js` to Supabase Storage.
|
|
37
|
+
4. **Registration**: It creates a database entry linking your bundle URL with your game's metadata (extracted from `package.json`, including name and version).
|
|
38
|
+
|
|
39
|
+
== The Review Process
|
|
40
|
+
|
|
41
|
+
After a successful upload, your game is placed in a **Pending** status.
|
|
42
|
+
|
|
43
|
+
1. **Approval Required**: To ensure the quality and safety of the central library, all games must be manually reviewed before they appear in the public menu.
|
|
44
|
+
2. **Notification**: You will receive an email (at the address you provided during the prompt) once your game has been reviewed. This email will confirm if the game was approved and is now live, or if it was rejected with feedback.
|
|
45
|
+
|
|
46
|
+
== Troubleshooting Publish Errors
|
|
47
|
+
|
|
48
|
+
=== Duplicate Publication
|
|
49
|
+
|
|
50
|
+
If you attempt to publish the exact same version of a game that is already published or pending, the CLI will reject the upload.
|
|
51
|
+
|
|
52
|
+
**Solution**: If you made changes, increment the `version` field in your `package.json` before running the publish command again.
|
|
53
|
+
|
|
54
|
+
=== Build Failures
|
|
55
|
+
|
|
56
|
+
If the `npm run build:bundle` step fails, the publish process will abort.
|
|
57
|
+
|
|
58
|
+
**Solution**: Check your terminal output for TypeScript or Webpack errors. Fix these issues and ensure that `npm run build:bundle` executes successfully on its own before trying to publish again.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
= Color Reference
|
|
2
|
+
:description: Defines the available visual theme colors for grid cells and text.
|
|
3
|
+
:keywords: color, theme, grid, retro, display
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
Defines the available visual theme colors for grid cells and text.
|
|
16
|
+
|
|
17
|
+
== Values
|
|
18
|
+
|
|
19
|
+
[cols="1,2"]
|
|
20
|
+
|===
|
|
21
|
+
|Value |Description
|
|
22
|
+
|`DEFAULT` |The background color of an empty cell.
|
|
23
|
+
|`BLUE` |Standard blue brick color.
|
|
24
|
+
|`CYAN` |Bright cyan brick color.
|
|
25
|
+
|`GRAY` |Neutral gray color.
|
|
26
|
+
|`GREEN` |Standard green brick color.
|
|
27
|
+
|`PURPLE` |Vibrant purple brick color.
|
|
28
|
+
|`RED` |Warning or obstacle red color.
|
|
29
|
+
|`YELLOW` |Gold/Yellow brick color.
|
|
30
|
+
|`INACTIVE` |Faded color for background/ghost elements.
|
|
31
|
+
|===
|
|
32
|
+
|
|
33
|
+
== General Usage
|
|
34
|
+
|
|
35
|
+
Colors are used throughout the engine to theme the `xref:../modules/GameGrid.adoc[GameGrid]` and the `HUD`. Use these constants when calling methods like `grid.setCellColor(coord, Color.RED)`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
= ControlEventType Reference
|
|
2
|
+
:description: Enumerates the different ways an input can be triggered.
|
|
3
|
+
:keywords: control, events, input, interaction
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
Enumerates the different ways an input can be triggered.
|
|
16
|
+
|
|
17
|
+
== Values
|
|
18
|
+
|
|
19
|
+
[cols="1,2"]
|
|
20
|
+
|===
|
|
21
|
+
|Value |Description
|
|
22
|
+
|`PRESSED` |Triggered exactly once when the key is first engaged.
|
|
23
|
+
|`HELD` |Triggered repeatedly at a fixed interval while the key remains engaged.
|
|
24
|
+
|===
|
|
25
|
+
|
|
26
|
+
== General Usage
|
|
27
|
+
|
|
28
|
+
Crucial for distinguishing between actions like "Rotate Once" (`xref:../enums/ControlEventType.adoc[PRESSED]`) and "Move Continuously" (`xref:../enums/ControlEventType.adoc[HELD]`). Used in subscription filters: `xref:../modules/GameControl.adoc[modules.control].subscribe(key, ControlEventType.HELD, callback)`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
= ControlKey Reference
|
|
2
|
+
:description: Abstraction layer mapping hardware inputs to logical engine actions.
|
|
3
|
+
:keywords: input, keys, mapping, control
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
Abstraction layer mapping hardware inputs to logical engine actions.
|
|
16
|
+
|
|
17
|
+
== Values
|
|
18
|
+
|
|
19
|
+
[cols="1,2"]
|
|
20
|
+
|===
|
|
21
|
+
|Value |Description
|
|
22
|
+
|`UP`, `DOWN`, `LEFT`, `RIGHT` |Directional navigation for players and menus.
|
|
23
|
+
|`ACTION` |Primary interaction button (e.g., jump, rotate, shoot).
|
|
24
|
+
|`START_PAUSE` |Toggles the gameplay state between `PLAYING` and `PAUSED`.
|
|
25
|
+
|`POWER` |Main system toggle (ON/OFF).
|
|
26
|
+
|`RESET` |Triggers a full game session reset.
|
|
27
|
+
|`SOUND` |Mutes or unmutes the audio system.
|
|
28
|
+
|`EXIT` |Exits the current game session back to the menu.
|
|
29
|
+
|`COLOR` |Toggles visual rendering modes.
|
|
30
|
+
|===
|
|
31
|
+
|
|
32
|
+
== General Usage
|
|
33
|
+
|
|
34
|
+
`ControlKey` is used when subscribing to input events via `xref:../modules/GameControl.adoc[GameControl].subscribe()` and when checking the `key` property of a `xref:../types/GameEvent.adoc[GameEvent]`.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
= Font Alignment Reference
|
|
2
|
+
:description: Enums defining the text anchor points on the canvas.
|
|
3
|
+
:keywords: font, alignment, text, display, layout
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
Enums defining the text anchor points on the canvas.
|
|
16
|
+
|
|
17
|
+
== `FontAlign`
|
|
18
|
+
|
|
19
|
+
Horizontal alignment of the text block.
|
|
20
|
+
|
|
21
|
+
[cols="1,3"]
|
|
22
|
+
|===
|
|
23
|
+
|Value |Description
|
|
24
|
+
|`LEFT` |Text starts at the provided X coordinate.
|
|
25
|
+
|`CENTER` |Text is centered relative to X.
|
|
26
|
+
|`RIGHT` |Text ends at the provided X coordinate.
|
|
27
|
+
|===
|
|
28
|
+
|
|
29
|
+
== `FontVerticalAlign`
|
|
30
|
+
|
|
31
|
+
Vertical alignment of the text block.
|
|
32
|
+
|
|
33
|
+
[cols="1,3"]
|
|
34
|
+
|===
|
|
35
|
+
|Value |Description
|
|
36
|
+
|`TOP` |Text top edge aligns with Y.
|
|
37
|
+
|`CENTER` |Text is centered relative to Y.
|
|
38
|
+
|`BOTTOM` |Text bottom edge aligns with Y.
|
|
39
|
+
|===
|
|
40
|
+
|
|
41
|
+
== General Usage
|
|
42
|
+
|
|
43
|
+
Used when calling `xref:../modules/GameText.adoc[GameText].setTextAlign()`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
= FontSize Reference
|
|
2
|
+
:description: Predefined logic scales for the retro pixelated typography.
|
|
3
|
+
:keywords: font, size, typography, display
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
Predefined logic scales for the retro pixelated typography.
|
|
16
|
+
|
|
17
|
+
== Values
|
|
18
|
+
|
|
19
|
+
[cols="1,3"]
|
|
20
|
+
|===
|
|
21
|
+
|Value |Level
|
|
22
|
+
|`EXTRA_SMALL` |Metrics, fine print, or detailed debug data.
|
|
23
|
+
|`SMALL` |Secondary labels.
|
|
24
|
+
|`MEDIUM` |Standard size for interactive elements and messages.
|
|
25
|
+
|`LARGE` |High-visibility status (e.g., "GET READY").
|
|
26
|
+
|`EXTRA_LARGE` |Main titles and "GAME OVER" announcements.
|
|
27
|
+
|===
|
|
28
|
+
|
|
29
|
+
== General Usage
|
|
30
|
+
|
|
31
|
+
Set the active font size via `xref:../modules/GameText.adoc[GameText].setTextSize(FontSize.LARGE)`. The engine automatically handles the scaling based on the display resolution.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
= Sound Reference
|
|
2
|
+
:description: Maps sound identifiers to their relative asset paths.
|
|
3
|
+
:keywords: sound, audio, assets, game-events
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
Maps sound identifiers to their relative asset paths.
|
|
16
|
+
|
|
17
|
+
== Values
|
|
18
|
+
|
|
19
|
+
[cols="1,2"]
|
|
20
|
+
|===
|
|
21
|
+
|Value |Asset Path
|
|
22
|
+
|`SPAWN` |`./sounds/sound_01.wav`
|
|
23
|
+
|`SCORE_1` |`./sounds/sound_15.wav`
|
|
24
|
+
|`SCORE_2` |`./sounds/sound_03.wav`
|
|
25
|
+
|`SCORE_3` |`./sounds/sound_02.wav`
|
|
26
|
+
|`KEY_PRESS` |`./sounds/sound_14.wav`
|
|
27
|
+
|`ACTION_1` |`./sounds/sound_05.wav`
|
|
28
|
+
|`ACTION_2` |`./sounds/sound_13.wav`
|
|
29
|
+
|`HIT_1` |`./sounds/sound_06.wav`
|
|
30
|
+
|`HIT_2` |`./sounds/sound_08.wav`
|
|
31
|
+
|`DODGE` |`./sounds/sound_07.wav`
|
|
32
|
+
|`DROP` |`./sounds/sound_11.wav`
|
|
33
|
+
|`EXPLOSION` |`./sounds/sound_09.wav`
|
|
34
|
+
|`GAME_START` |`./sounds/sound_04.wav`
|
|
35
|
+
|`SHOT` |`./sounds/sound_12.wav`
|
|
36
|
+
|`START_THEME` |`./sounds/sound_10.wav`
|
|
37
|
+
|===
|
|
38
|
+
|
|
39
|
+
== General Usage
|
|
40
|
+
|
|
41
|
+
Use these constants to trigger audio effects via the `xref:../modules/GameSound.adoc[GameSound]` module.
|
|
42
|
+
Example: `modules.sound.play(Sound.EXPLOSION)`.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
= StateProperty Reference
|
|
2
|
+
:description: Enumerates all observable and persistent properties of the game system.
|
|
3
|
+
:keywords: state, persistence, properties, observability
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
Enumerates all observable and persistent properties of the game system.
|
|
16
|
+
|
|
17
|
+
== Values
|
|
18
|
+
|
|
19
|
+
[cols="1,3"]
|
|
20
|
+
|===
|
|
21
|
+
|Value |Description
|
|
22
|
+
|`ON` |Boolean flag for engine power state.
|
|
23
|
+
|`START` |Boolean flag for game session start.
|
|
24
|
+
|`PLAYING` |Boolean flag for active gameplay logic.
|
|
25
|
+
|`GAME_OVER` |Boolean flag for end-of-game state.
|
|
26
|
+
|`COLOR_ENABLED` |Boolean flag for themed rendering.
|
|
27
|
+
|`MUTED` |Boolean flag for audio suppression.
|
|
28
|
+
|`HIGH_SCORE` |Numeric property for the persistent record.
|
|
29
|
+
|===
|
|
30
|
+
|
|
31
|
+
== General Usage
|
|
32
|
+
|
|
33
|
+
Used identifying which property changed in the `xref:../modules/GameState.adoc[GameState].subscribe()` callback.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
= CellHelper Reference
|
|
2
|
+
:description: Static factory methods for creating and initializing Cell objects consistently.
|
|
3
|
+
:keywords: cell, factory, grid, helper
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
The `CellHelper` provides static factory methods for creating and initializing `Cell` objects consistently.
|
|
16
|
+
|
|
17
|
+
== Methods
|
|
18
|
+
|
|
19
|
+
=== `emptyCell(coordinate: xref:../types/Coordinate.adoc[Coordinate]): xref:../types/Cell.adoc[Cell]`
|
|
20
|
+
|
|
21
|
+
Creates a new cell with default "OFF" state values.
|
|
22
|
+
|
|
23
|
+
**Parameters**
|
|
24
|
+
|
|
25
|
+
[cols="1,1,3"]
|
|
26
|
+
|===
|
|
27
|
+
|Name |Type |Description
|
|
28
|
+
|`coordinate` |xref:../types/Coordinate.adoc[Coordinate] |The `{x, y}` position to assign to the new cell.
|
|
29
|
+
|===
|
|
30
|
+
|
|
31
|
+
**Returns**
|
|
32
|
+
|
|
33
|
+
`Cell` - A cell object with `value: 0` and `xref:../enums/Color.adoc[Color].DEFAULT`.
|
|
34
|
+
|
|
35
|
+
**Behavior**
|
|
36
|
+
|
|
37
|
+
This is used primarily by `xref:../modules/GameGrid.adoc[GameGrid]` to populate the initial matrix during allocation or when resetting a row/column.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
= ControlInputHandlerHelper Reference
|
|
2
|
+
:description: Utilities for normalizing raw hardware keyboard events into abstract ControlKey actions.
|
|
3
|
+
:keywords: input, handler, keyboard, normalization, helper
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
The `ControlInputHandlerHelper` manages the complexity of input timing, such as identifying the difference between a quick "press" and a sustained "hold".
|
|
16
|
+
|
|
17
|
+
== Usage
|
|
18
|
+
|
|
19
|
+
This helper is used by the `xref:../modules/GameControl.adoc[GameControl]` module to normalize raw hardware events (like `keydown` and `keyup`) into engine-specific events.
|
|
20
|
+
|
|
21
|
+
== Methods
|
|
22
|
+
|
|
23
|
+
=== `handlePress(key: xref:../enums/ControlKey.adoc[ControlKey]): void`
|
|
24
|
+
|
|
25
|
+
Processes a new interaction with a specific key.
|
|
26
|
+
|
|
27
|
+
**Parameters**
|
|
28
|
+
|
|
29
|
+
[cols="1,1,3"]
|
|
30
|
+
|===
|
|
31
|
+
|Name |Type |Description
|
|
32
|
+
|`key` |xref:../enums/ControlKey.adoc[ControlKey] |The virtual key being interacted with.
|
|
33
|
+
|===
|
|
34
|
+
|
|
35
|
+
**Behavior**
|
|
36
|
+
|
|
37
|
+
1. Triggers the `xref:../enums/ControlEventType.adoc[PRESSED]` event immediately.
|
|
38
|
+
2. Starts a timer based on `configs.buttonHold.holdDelayMs`.
|
|
39
|
+
3. If the key is still active after the delay, it starts an interval that repeatedly triggers the `xref:../enums/ControlEventType.adoc[HELD]` event.
|
|
40
|
+
|
|
41
|
+
'''
|
|
42
|
+
|
|
43
|
+
=== `handleRelease(key: xref:../enums/ControlKey.adoc[ControlKey]): void`
|
|
44
|
+
|
|
45
|
+
Stops tracking an active interaction.
|
|
46
|
+
|
|
47
|
+
**Parameters**
|
|
48
|
+
|
|
49
|
+
[cols="1,1,3"]
|
|
50
|
+
|===
|
|
51
|
+
|Name |Type |Description
|
|
52
|
+
|`key` |xref:../enums/ControlKey.adoc[ControlKey] |The key that was released.
|
|
53
|
+
|===
|
|
54
|
+
|
|
55
|
+
**Behavior**
|
|
56
|
+
|
|
57
|
+
Clears all active timers (delay and interval) for the specified key to stop `xref:../enums/ControlEventType.adoc[HELD]` events from firing.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
= CoordinateHelper Reference
|
|
2
|
+
:description: Specialized math utilities for converting between Grid, Display, and Pixel coordinate systems.
|
|
3
|
+
:keywords: coordinates, math, grid, display, conversion, helper
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
The `CoordinateHelper` is a static utility class that handles translations between different coordinate systems: the logical xref:../modules/GameGrid.adoc[Game Grid], the normalized Display area, and absolute pixel positions.
|
|
16
|
+
|
|
17
|
+
== API Reference
|
|
18
|
+
|
|
19
|
+
=== `getRelativeCoordinate(p: p5, coordinate: xref:../types/Coordinate.adoc[Coordinate]): xref:../types/Coordinate.adoc[Coordinate]`
|
|
20
|
+
|
|
21
|
+
Converts a pixel-based coordinate into a normalized relative coordinate (0.0 to 1.0).
|
|
22
|
+
|
|
23
|
+
**Parameters**
|
|
24
|
+
|
|
25
|
+
[cols="1,1,3"]
|
|
26
|
+
|===
|
|
27
|
+
|Name |Type |Description
|
|
28
|
+
|`p` |`p5` |The P5.js instance.
|
|
29
|
+
|`coordinate` |xref:../types/Coordinate.adoc[Coordinate] |The absolute pixel coordinate.
|
|
30
|
+
|===
|
|
31
|
+
|
|
32
|
+
**Returns**
|
|
33
|
+
|
|
34
|
+
`xref:../types/Coordinate.adoc[Coordinate]` - The normalized `{x, y}` point.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
'''
|
|
38
|
+
|
|
39
|
+
=== `getDisplayPosX(p: p5, x: number, displayWidth: number): number`
|
|
40
|
+
|
|
41
|
+
Calculates the absolute X pixel position on the main game display.
|
|
42
|
+
|
|
43
|
+
**Parameters**
|
|
44
|
+
|
|
45
|
+
[cols="1,1,3"]
|
|
46
|
+
|===
|
|
47
|
+
|Name |Type |Description
|
|
48
|
+
|`p` |`p5` |The P5.js instance.
|
|
49
|
+
|`x` |`number` |Normalized horizontal position (0.0 to 1.0).
|
|
50
|
+
|`displayWidth` |`number` |The total width of the display area.
|
|
51
|
+
|===
|
|
52
|
+
|
|
53
|
+
**Returns**
|
|
54
|
+
|
|
55
|
+
`number` - The absolute horizontal pixel position.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
'''
|
|
59
|
+
|
|
60
|
+
=== `getDisplayPosY(p: p5, y: number, displayHeight: number): number`
|
|
61
|
+
|
|
62
|
+
Calculates the absolute Y pixel position on the main game display.
|
|
63
|
+
|
|
64
|
+
**Parameters**
|
|
65
|
+
|
|
66
|
+
[cols="1,1,3"]
|
|
67
|
+
|===
|
|
68
|
+
|Name |Type |Description
|
|
69
|
+
|`p` |`p5` |The P5.js instance.
|
|
70
|
+
|`y` |`number` |Normalized vertical position (0.0 to 1.0).
|
|
71
|
+
|`displayHeight` |`number` |The total height of the display area.
|
|
72
|
+
|===
|
|
73
|
+
|
|
74
|
+
**Returns**
|
|
75
|
+
|
|
76
|
+
`number` - The absolute vertical pixel position.
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
'''
|
|
80
|
+
|
|
81
|
+
=== `getHudPosX(p: p5, x: number, displayWidth: number): number`
|
|
82
|
+
|
|
83
|
+
Calculates the absolute X pixel position within the HUD area.
|
|
84
|
+
|
|
85
|
+
**Parameters**
|
|
86
|
+
|
|
87
|
+
[cols="1,1,3"]
|
|
88
|
+
|===
|
|
89
|
+
|Name |Type |Description
|
|
90
|
+
|`p` |`p5` |The P5.js instance.
|
|
91
|
+
|`x` |`number` |Normalized horizontal position (0.0 to 1.0) relative to the HUD area.
|
|
92
|
+
|`displayWidth` |`number` |The width of the main display (used to calculate the HUD offset).
|
|
93
|
+
|===
|
|
94
|
+
|
|
95
|
+
**Returns**
|
|
96
|
+
|
|
97
|
+
`number` - The absolute horizontal pixel position within the HUD.
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
'''
|
|
101
|
+
|
|
102
|
+
=== `getHudPosY(p: p5, y: number, displayHeight: number): number`
|
|
103
|
+
|
|
104
|
+
Calculates the absolute Y pixel position within the HUD area.
|
|
105
|
+
|
|
106
|
+
**Parameters**
|
|
107
|
+
|
|
108
|
+
[cols="1,1,3"]
|
|
109
|
+
|===
|
|
110
|
+
|Name |Type |Description
|
|
111
|
+
|`p` |`p5` |The P5.js instance.
|
|
112
|
+
|`y` |`number` |Normalized vertical position (0.0 to 1.0) relative to the HUD area.
|
|
113
|
+
|`displayHeight` |`number` |The total height of the display area.
|
|
114
|
+
|===
|
|
115
|
+
|
|
116
|
+
**Returns**
|
|
117
|
+
|
|
118
|
+
`number` - The absolute vertical pixel position within the HUD.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
= RelativeValuesHelper Reference
|
|
2
|
+
:description: Generic utilities for calculating relative sizes and positions within containers.
|
|
3
|
+
:keywords: relative, sizing, positioning, layout, helper
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
The `RelativeValuesHelper` provides conversion utilities for scaling absolute sizes to the current canvas dimensions, enabling responsive layouts.
|
|
16
|
+
|
|
17
|
+
== Methods
|
|
18
|
+
|
|
19
|
+
=== `getRelativeWidth(p: p5, size: number): number`
|
|
20
|
+
|
|
21
|
+
Calculates a pixel width based on a normalized percentage.
|
|
22
|
+
|
|
23
|
+
**Parameters**
|
|
24
|
+
|
|
25
|
+
[cols="1,1,3"]
|
|
26
|
+
|===
|
|
27
|
+
|Name |Type |Description
|
|
28
|
+
|`p` |`p5` |The P5.js instance.
|
|
29
|
+
|`size` |`number` |A float between 0.0 and 1.0 representing percentage of width.
|
|
30
|
+
|===
|
|
31
|
+
|
|
32
|
+
**Returns**
|
|
33
|
+
|
|
34
|
+
`number` - The calculated absolute pixel width.
|
|
35
|
+
|
|
36
|
+
'''
|
|
37
|
+
|
|
38
|
+
=== `getRelativeHeight(p: p5, size: number): number`
|
|
39
|
+
|
|
40
|
+
Calculates a pixel height based on a normalized percentage.
|
|
41
|
+
|
|
42
|
+
**Parameters**
|
|
43
|
+
|
|
44
|
+
[cols="1,1,3"]
|
|
45
|
+
|===
|
|
46
|
+
|Name |Type |Description
|
|
47
|
+
|`p` |`p5` |The P5.js instance.
|
|
48
|
+
|`size` |`number` |A float between 0.0 and 1.0 representing percentage of height.
|
|
49
|
+
|===
|
|
50
|
+
|
|
51
|
+
**Returns**
|
|
52
|
+
|
|
53
|
+
`number` - The calculated absolute pixel height.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
= Debuggable Reference
|
|
2
|
+
:description: Contract for modules that provide transparency to the developer.
|
|
3
|
+
:keywords: debug, interface, transparency, metrics
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
Contract for modules that provide transparency to the developer.
|
|
16
|
+
|
|
17
|
+
== Methods
|
|
18
|
+
|
|
19
|
+
=== `getDebugData(): Record<string, string | number | boolean>`
|
|
20
|
+
|
|
21
|
+
Returns a dictionary of internal metrics for real-time inspection.
|
|
22
|
+
|
|
23
|
+
**Returns**
|
|
24
|
+
|
|
25
|
+
`Record<string, string | number | boolean>` - Key-value pairs of debug information.
|
|
26
|
+
|
|
27
|
+
== General Usage
|
|
28
|
+
|
|
29
|
+
When implemented, the xref:../modules/Debugger.adoc[Debugger] module will automatically create a UI section for the component and refresh its data every logic tick.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
= GameModules Reference
|
|
2
|
+
:description: The central hub providing component-to-component visibility.
|
|
3
|
+
:keywords: architecture, dependency-injection, registry, modules
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
The central hub providing component-to-component visibility.
|
|
16
|
+
|
|
17
|
+
== Properties
|
|
18
|
+
|
|
19
|
+
[cols="1,1,3"]
|
|
20
|
+
|===
|
|
21
|
+
|Name |Type |Description
|
|
22
|
+
|`grid` |xref:modules/Grid.adoc[Grid] |Main game field manager.
|
|
23
|
+
|`hudGrid` |xref:modules/Grid.adoc[Grid] |Secondary 4x4 grid for HUD elements.
|
|
24
|
+
|`state` |xref:modules/State.adoc[State] |Single source of truth for game flags.
|
|
25
|
+
|`control` |xref:modules/Control.adoc[Control] |Input handling service.
|
|
26
|
+
|`text` |xref:modules/Text.adoc[Text] |Canvas typography service.
|
|
27
|
+
|`time` |xref:modules/Time.adoc[Time] |Logical clock manager.
|
|
28
|
+
|`sound` |xref:Sound.adoc[Sound] |Audio playback service.
|
|
29
|
+
|`score` |xref:modules/Score.adoc[Score] |Session performance tracker.
|
|
30
|
+
|`renderer` |xref:modules/RendererComposite.adoc[RendererComposite] |The visual orchestration layer.
|
|
31
|
+
|===
|
|
32
|
+
|
|
33
|
+
== General Usage
|
|
34
|
+
|
|
35
|
+
This registry is passed to almost every lifecycle method (`update`, `render`, `ControlCallback`). It allows modules to interact without tight coupling. For example, the `xref:modules/Sound.adoc[Sound]` module uses it to play sounds via `modules.sound.play()`.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
= Initializable Reference
|
|
2
|
+
:description: A fundamental contract for modules that require an assembly phase.
|
|
3
|
+
:keywords: lifecycle, initialization, setup, bootstrap
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
A fundamental contract for modules that require an assembly phase.
|
|
16
|
+
|
|
17
|
+
== Methods
|
|
18
|
+
|
|
19
|
+
=== `setup(): void`
|
|
20
|
+
Invoked once by the engine after all modules are constructed.
|
|
21
|
+
|
|
22
|
+
== General Usage
|
|
23
|
+
|
|
24
|
+
Modules implementing `Initializable` use the `setup()` phase to establish internal buffers, bind event listeners, or perform calculations that depend on final configuration values.
|