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,180 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
/** Colors used for styling the game interface. */
|
|
3
|
+
readonly colors: {
|
|
4
|
+
/** Primary background color for the game screen. */
|
|
5
|
+
readonly background: "rgb(172, 189, 173)";
|
|
6
|
+
/** Active Font/Cell color. */
|
|
7
|
+
readonly active: "rgb(19, 26, 18)";
|
|
8
|
+
/** Inactive Font/Cell color. */
|
|
9
|
+
readonly inactive: "rgba(161, 178, 160, 1)";
|
|
10
|
+
/** Main theme color for the game device body. */
|
|
11
|
+
readonly bodyMain: "rgb(0, 68, 187)";
|
|
12
|
+
/** Secondary theme color for the buttons on the device body. */
|
|
13
|
+
readonly bodyButton: "rgb(247, 222, 57)";
|
|
14
|
+
};
|
|
15
|
+
/** Screen layout configurations. */
|
|
16
|
+
readonly screenLayout: {
|
|
17
|
+
/** Main game grid dimensions. */
|
|
18
|
+
readonly grid: {
|
|
19
|
+
readonly columns: 11;
|
|
20
|
+
readonly rows: 18;
|
|
21
|
+
};
|
|
22
|
+
/** Head-Up Display (HUD) grid dimensions. */
|
|
23
|
+
readonly hudGrid: {
|
|
24
|
+
readonly columns: 4;
|
|
25
|
+
readonly rows: 4;
|
|
26
|
+
};
|
|
27
|
+
/** Logical display settings within the container. */
|
|
28
|
+
readonly display: {
|
|
29
|
+
readonly width: 0.65;
|
|
30
|
+
readonly height: 0.956;
|
|
31
|
+
readonly margin: 0.022;
|
|
32
|
+
readonly borderWeight: 0.0075;
|
|
33
|
+
};
|
|
34
|
+
/** Predefined font scale factors relative to container size. */
|
|
35
|
+
readonly fontSize: {
|
|
36
|
+
readonly extraSmall: 0.05;
|
|
37
|
+
readonly small: 0.065;
|
|
38
|
+
readonly medium: 0.1;
|
|
39
|
+
readonly large: 0.125;
|
|
40
|
+
readonly extraLarge: 0.15;
|
|
41
|
+
};
|
|
42
|
+
/** Sizing and spacing for individual grid cells. */
|
|
43
|
+
readonly cell: {
|
|
44
|
+
readonly margin: 0.1;
|
|
45
|
+
readonly padding: 0.3;
|
|
46
|
+
readonly strokeWeight: 0.075;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/** View layout configurations. */
|
|
50
|
+
readonly viewLayout: {
|
|
51
|
+
/** Aspect ratio multiplier for the device body height relative to width. */
|
|
52
|
+
readonly bodyHeightWidthMultiplier: 1.9;
|
|
53
|
+
/** Screen width threshold for switching to mobile layout (in pixels). */
|
|
54
|
+
readonly mobileBreakpoint: 600;
|
|
55
|
+
/** Responsive canvas scaling and aspect ratio settings. */
|
|
56
|
+
readonly canvas: {
|
|
57
|
+
readonly widthRatio: 0.7;
|
|
58
|
+
readonly aspectRatio: 1.114;
|
|
59
|
+
};
|
|
60
|
+
/** Delay before hiding the splash screen after initialization (in milliseconds). */
|
|
61
|
+
readonly splashHideDelayMs: 250;
|
|
62
|
+
/** Dimensions and ratios for the game interface. */
|
|
63
|
+
readonly dimensions: {
|
|
64
|
+
/** Border radius as a ratio of container width. */
|
|
65
|
+
readonly borderRadiusRatio: 0.05;
|
|
66
|
+
/** Border width as a ratio of container width. */
|
|
67
|
+
readonly borderWidthRatio: 0.006;
|
|
68
|
+
/** Button-specific scaling factors. */
|
|
69
|
+
readonly button: {
|
|
70
|
+
/** Small button size ratio. */
|
|
71
|
+
readonly smSizeRatio: 0.08;
|
|
72
|
+
/** Medium/Standard button size ratio. */
|
|
73
|
+
readonly mdSizeRatio: 0.18;
|
|
74
|
+
/** Large action button size ratio. */
|
|
75
|
+
readonly lgSizeRatio: 0.25;
|
|
76
|
+
/** Scaling factors specifically for mobile viewports. */
|
|
77
|
+
readonly mobile: {
|
|
78
|
+
/** Mobile small button size ratio. */
|
|
79
|
+
readonly smSizeRatio: 0.13;
|
|
80
|
+
/** Mobile medium/standard button size ratio. */
|
|
81
|
+
readonly mdSizeRatio: 0.26;
|
|
82
|
+
/** Mobile large action button size ratio. */
|
|
83
|
+
readonly lgSizeRatio: 0.35;
|
|
84
|
+
/** Standard font ratio for mobile buttons. */
|
|
85
|
+
readonly fontRatio: 0.05;
|
|
86
|
+
/** Small font ratio for mobile buttons. */
|
|
87
|
+
readonly smFontRatio: 0.04;
|
|
88
|
+
/** Large font ratio for mobile buttons. */
|
|
89
|
+
readonly lgFontRatio: 0.055;
|
|
90
|
+
/** Spacing ratio between mobile buttons. */
|
|
91
|
+
readonly spacingRatio: 0.018;
|
|
92
|
+
};
|
|
93
|
+
/** Button border width as a ratio of container width. */
|
|
94
|
+
readonly borderRatio: 0.0045;
|
|
95
|
+
/** Duration for button press animations. */
|
|
96
|
+
readonly animationDuration: "0.15s";
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
/** Standard shadow dispersion size for UI depth. */
|
|
100
|
+
readonly shadowDispersion: "3px";
|
|
101
|
+
};
|
|
102
|
+
/** Input query parameters. */
|
|
103
|
+
readonly inputQueryParams: {
|
|
104
|
+
/** Key for customizing the device body main color. */
|
|
105
|
+
readonly mainColor: "body-color";
|
|
106
|
+
/** Key for customizing the device body button color. */
|
|
107
|
+
readonly buttonColor: "button-color";
|
|
108
|
+
/** Key for detecting if the game is running on a mobile app wrapper. */
|
|
109
|
+
readonly runningOnApp: "mobile";
|
|
110
|
+
};
|
|
111
|
+
/** Selectors for DOM elements. */
|
|
112
|
+
readonly selectors: {
|
|
113
|
+
/** Root container where the p5 instance is attached. */
|
|
114
|
+
readonly parent: "#brick-game";
|
|
115
|
+
/** Splash screen shown during initial load. */
|
|
116
|
+
readonly splash: "#splash";
|
|
117
|
+
/** Modal IDs used for session continuation. */
|
|
118
|
+
readonly modalIds: {
|
|
119
|
+
/** Modal shown when continuing a previous session. */
|
|
120
|
+
readonly sessionModal: "#session-modal";
|
|
121
|
+
/** Confirmation button in the session modal. */
|
|
122
|
+
readonly sessionContinueYes: "#session-modal-yes";
|
|
123
|
+
/** Cancellation button in the session modal. */
|
|
124
|
+
readonly sessionContinueNo: "#session-modal-no";
|
|
125
|
+
};
|
|
126
|
+
/** Explicit IDs assigned to dynamically created DOM elements. */
|
|
127
|
+
readonly viewElementIds: {
|
|
128
|
+
readonly canvas: "brick-game-canvas";
|
|
129
|
+
readonly container: "container";
|
|
130
|
+
readonly frame: "frame";
|
|
131
|
+
readonly buttonContainer: "button-container";
|
|
132
|
+
readonly smallButtonContainer: "small-button-container";
|
|
133
|
+
readonly innerButtonContainer: "inner-button-container";
|
|
134
|
+
readonly mediumButtonContainer: "medium-button-container";
|
|
135
|
+
readonly directionVerticalContainer: "direction-vertical-container";
|
|
136
|
+
readonly directionHorizontalContainer: "direction-horizontal-container";
|
|
137
|
+
readonly largeButtonContainer: "large-button-container";
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
/** Storage keys for persisting data in LocalStorage. */
|
|
141
|
+
readonly storageKeys: {
|
|
142
|
+
/** Key for audio muting preference. */
|
|
143
|
+
readonly muted: "STATE.MUTED";
|
|
144
|
+
/** Key for color mode preference. */
|
|
145
|
+
readonly colorEnabled: "STATE.COLOR_ENABLED";
|
|
146
|
+
/** Key for the current game grid state. */
|
|
147
|
+
readonly grid: "GAME.GRID";
|
|
148
|
+
/** Key for the current HUD grid state. */
|
|
149
|
+
readonly hudGrid: "GAME.HUD_GRID";
|
|
150
|
+
/** Key for the game speed/tick interval. */
|
|
151
|
+
readonly tickInterval: "GAME.TICK_INTERVAL";
|
|
152
|
+
/** Key for the user's high score. */
|
|
153
|
+
readonly score: "GAME.SCORE";
|
|
154
|
+
};
|
|
155
|
+
/** Button hold settings. */
|
|
156
|
+
readonly buttonHold: {
|
|
157
|
+
/** Initial delay before a held button starts repeating (in milliseconds). */
|
|
158
|
+
readonly holdDelayMs: 250;
|
|
159
|
+
/** Interval between repeated actions while a button is held (in milliseconds). */
|
|
160
|
+
readonly holdIntervalMs: 50;
|
|
161
|
+
};
|
|
162
|
+
/** Game settings. */
|
|
163
|
+
readonly game: {
|
|
164
|
+
/** Interval between game ticks (in milliseconds). */
|
|
165
|
+
readonly tickInterval: number;
|
|
166
|
+
/** Minimum interval between game ticks (in milliseconds). */
|
|
167
|
+
readonly minTickInterval: number;
|
|
168
|
+
/** Performance Monitor settings. */
|
|
169
|
+
readonly debugger: {
|
|
170
|
+
/** Number of milliseconds to count before updating the performance. */
|
|
171
|
+
readonly msInterval: 100;
|
|
172
|
+
/** Enable performance overlay. */
|
|
173
|
+
readonly enabled: true;
|
|
174
|
+
};
|
|
175
|
+
readonly sound: {
|
|
176
|
+
readonly volume: 0.025;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import p5 from 'p5';
|
|
2
|
+
import type GameView from '../view/GameView';
|
|
3
|
+
import { Initializable } from './types/Interfaces';
|
|
4
|
+
import { GameModules } from './types/Types';
|
|
5
|
+
/**
|
|
6
|
+
* Base abstract class for the game.
|
|
7
|
+
*
|
|
8
|
+
* It manages the game loop, initialization of core modules, and integration with p5.js.
|
|
9
|
+
* All game logic should be implemented in subclasses by overriding `processTick` and `processFrame`.
|
|
10
|
+
*/
|
|
11
|
+
export default abstract class Game implements Initializable {
|
|
12
|
+
protected _p: p5;
|
|
13
|
+
protected _view: GameView;
|
|
14
|
+
private _modules;
|
|
15
|
+
private _initialStateSnapshot;
|
|
16
|
+
private _gameId;
|
|
17
|
+
private _switchHandler;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the game ID
|
|
20
|
+
*/
|
|
21
|
+
get gameId(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Sets the game ID
|
|
24
|
+
*/
|
|
25
|
+
set gameId(id: string);
|
|
26
|
+
/**
|
|
27
|
+
* Registers the callback to be used when a game requests to switch to another game.
|
|
28
|
+
* This is typically called by the engine's main loop (index.ts).
|
|
29
|
+
* @param handler The callback function.
|
|
30
|
+
*/
|
|
31
|
+
setSwitchHandler(handler: (newGame: Game) => void): void;
|
|
32
|
+
/**
|
|
33
|
+
* Propagates the switch handler to the new game.
|
|
34
|
+
* @param game Game instance that has the switch handler.
|
|
35
|
+
*/
|
|
36
|
+
propagateSwitchHandler(game: Game): void;
|
|
37
|
+
/**
|
|
38
|
+
* Creates an instance of the Game.
|
|
39
|
+
*
|
|
40
|
+
* @param {p5} p - The p5 instance.
|
|
41
|
+
* @param {GameView} view - The view strategy associated with this game.
|
|
42
|
+
*/
|
|
43
|
+
constructor(p: p5, view: GameView);
|
|
44
|
+
/**
|
|
45
|
+
* Gets the game view.
|
|
46
|
+
*
|
|
47
|
+
* @returns {GameView} The game view instance.
|
|
48
|
+
*/
|
|
49
|
+
get view(): GameView;
|
|
50
|
+
/**
|
|
51
|
+
* Switches execution to a new game instance.
|
|
52
|
+
* Use this instead of global window methods.
|
|
53
|
+
*
|
|
54
|
+
* @param {Game} newGame - The new game instance to load.
|
|
55
|
+
*/
|
|
56
|
+
switchGame(newGame: Game): void;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the game modules.
|
|
59
|
+
*
|
|
60
|
+
* @returns {GameModules} The collection of initialized game modules.
|
|
61
|
+
*/
|
|
62
|
+
get modules(): GameModules;
|
|
63
|
+
/**
|
|
64
|
+
* Sets up the game, initializing all modules and viewing components.
|
|
65
|
+
* Called automatically by the engine key sequence.
|
|
66
|
+
*/
|
|
67
|
+
setup(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Main draw loop, called by p5.js.
|
|
70
|
+
* Handles time updates, logic ticks, and rendering.
|
|
71
|
+
*/
|
|
72
|
+
draw(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Destroys the game instance, cleaning up all event listeners and stopping the loop.
|
|
75
|
+
* Call this before switching to another game or when the game is no longer needed.
|
|
76
|
+
*/
|
|
77
|
+
destroy(): void;
|
|
78
|
+
get p(): p5;
|
|
79
|
+
/**
|
|
80
|
+
* Abstract method for processing game logic.
|
|
81
|
+
* Called every tick, but ONLY when the game is in the 'playing' state.
|
|
82
|
+
*
|
|
83
|
+
* @param {number} deltaTime - Time elapsed since last tick.
|
|
84
|
+
*/
|
|
85
|
+
abstract update(deltaTime: number): void;
|
|
86
|
+
/**
|
|
87
|
+
* Abstract method for processing visual frames.
|
|
88
|
+
* Called every frame (depending on frameInterval).
|
|
89
|
+
*/
|
|
90
|
+
abstract render(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Abstract method for setting up the game specific logic.
|
|
93
|
+
* Called after the game modules are initialized.
|
|
94
|
+
*/
|
|
95
|
+
abstract setupGame(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Abstract method for drawing the Title Screen (Welcome).
|
|
98
|
+
* Called when the game is ON but not yet STARTED.
|
|
99
|
+
*/
|
|
100
|
+
abstract drawTitleScreen(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Abstract method for drawing the Game Over Screen.
|
|
103
|
+
* Called when the game is in GAME OVER state.
|
|
104
|
+
*/
|
|
105
|
+
abstract drawGameOverScreen(): void;
|
|
106
|
+
private _subscribeSystemControls;
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default class InitialStateSnapshot {
|
|
2
|
+
private _initialState;
|
|
3
|
+
private _baseProperties;
|
|
4
|
+
/**
|
|
5
|
+
* Captures the base properties of the instance before any custom client properties are added.
|
|
6
|
+
* @param instance The object instance to extract keys from.
|
|
7
|
+
*/
|
|
8
|
+
captureBaseProperties(instance: object): void;
|
|
9
|
+
/**
|
|
10
|
+
* Stores the initial state of custom client properties.
|
|
11
|
+
* @param instance The object instance containing custom properties.
|
|
12
|
+
*/
|
|
13
|
+
captureInitialState(instance: object): void;
|
|
14
|
+
/**
|
|
15
|
+
* Restores the captured custom properties back to the instance.
|
|
16
|
+
* @param instance The object instance to restore properties onto.
|
|
17
|
+
*/
|
|
18
|
+
restoreInitialState(instance: object): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Cell, Coordinate } from '../types/Types';
|
|
2
|
+
/**
|
|
3
|
+
* Utility class for creating and managing grid cells.
|
|
4
|
+
*/
|
|
5
|
+
export default class CellHelper {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new empty cell at the specified coordinate.
|
|
8
|
+
*
|
|
9
|
+
* @param {Coordinate} coordinate - The location of the new cell.
|
|
10
|
+
* @returns {Cell} A new cell object initialized with value 0 and default color.
|
|
11
|
+
*/
|
|
12
|
+
static emptyCell(coordinate: Coordinate): Cell;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ControlKey } from '../types/Types';
|
|
2
|
+
import { Control } from '../types/modules';
|
|
3
|
+
/**
|
|
4
|
+
* Helper class that standardizes input handling logic.
|
|
5
|
+
* It manages the distinction between single 'press' events and continuous 'hold' events
|
|
6
|
+
* for both keyboard and UI button inputs.
|
|
7
|
+
*/
|
|
8
|
+
export default class ControlInputHandlerHelper {
|
|
9
|
+
private _control;
|
|
10
|
+
private _activeKeys;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of the input handler.
|
|
13
|
+
*
|
|
14
|
+
* @param {Control} control - The control module instance to notify.
|
|
15
|
+
*/
|
|
16
|
+
constructor(control: Control);
|
|
17
|
+
/**
|
|
18
|
+
* Processes a key down or button press action.
|
|
19
|
+
* Triggers an immediate {@link ControlEventType.PRESSED} event, and schedules
|
|
20
|
+
* a {@link ControlEventType.HELD} loop if the key remains active.
|
|
21
|
+
*
|
|
22
|
+
* @param {ControlKey} key - The identity of the control key being pressed.
|
|
23
|
+
*/
|
|
24
|
+
handlePress(key: ControlKey): void;
|
|
25
|
+
/**
|
|
26
|
+
* Processes a key up or button release action.
|
|
27
|
+
* Cancels any pending hold timers and cleans up the active key state.
|
|
28
|
+
*
|
|
29
|
+
* @param {ControlKey} key - The identity of the control key being released.
|
|
30
|
+
*/
|
|
31
|
+
handleRelease(key: ControlKey): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import p5 from 'p5';
|
|
2
|
+
import { Coordinate } from '../types/Types';
|
|
3
|
+
/**
|
|
4
|
+
* Static utility class for coordinate transformations.
|
|
5
|
+
* Handles conversions between relative (0-1) coordinates and absolute pixel positions
|
|
6
|
+
* for both the main display and the HUD.
|
|
7
|
+
*/
|
|
8
|
+
export default class CoordinateHelper {
|
|
9
|
+
/**
|
|
10
|
+
* Converts a simplified coordinate object to relative screen dimensions.
|
|
11
|
+
*
|
|
12
|
+
* @param {p5} p - The P5 instance.
|
|
13
|
+
* @param {Coordinate} coordinate - The normal coordinate.
|
|
14
|
+
* @returns {Coordinate} A new coordinate scaled to the canvas width/height.
|
|
15
|
+
*/
|
|
16
|
+
static getRelativeCoordinate(p: p5, coordinate: Coordinate): Coordinate;
|
|
17
|
+
/**
|
|
18
|
+
* Calculates the absolute X pixel position for an element on the Main Display.
|
|
19
|
+
*
|
|
20
|
+
* @param {p5} p - The p5 instance.
|
|
21
|
+
* @param {number} x - The relative or normalized X position.
|
|
22
|
+
* @param {number} displayWidth - The calculated width of the display area.
|
|
23
|
+
* @returns {number} The absolute X pixel coordinate.
|
|
24
|
+
*/
|
|
25
|
+
static getDisplayPosX(p: p5, x: number, displayWidth: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Calculates the absolute Y pixel position for an element on the Main Display.
|
|
28
|
+
*
|
|
29
|
+
* @param {p5} p - The p5 instance.
|
|
30
|
+
* @param {number} y - The relative or normalized Y position.
|
|
31
|
+
* @param {number} displayHeight - The calculated height of the display area.
|
|
32
|
+
* @returns {number} The absolute Y pixel coordinate.
|
|
33
|
+
*/
|
|
34
|
+
static getDisplayPosY(p: p5, y: number, displayHeight: number): number;
|
|
35
|
+
/**
|
|
36
|
+
* Calculates the absolute X pixel position for an element on the HUD.
|
|
37
|
+
* Use this to position elements in the sidebar.
|
|
38
|
+
*
|
|
39
|
+
* @param {p5} p - The p5 instance.
|
|
40
|
+
* @param {number} x - The relative or normalized X position within the HUD.
|
|
41
|
+
* @param {number} displayWidth - The width of the main display (used for offset calculation).
|
|
42
|
+
* @returns {number} The absolute X pixel coordinate.
|
|
43
|
+
*/
|
|
44
|
+
static getHudPosX(p: p5, x: number, displayWidth: number): number;
|
|
45
|
+
/**
|
|
46
|
+
* Calculates the absolute Y pixel position for an element on the HUD.
|
|
47
|
+
*
|
|
48
|
+
* @param {p5} p - The p5 instance.
|
|
49
|
+
* @param {number} y - The relative or normalized Y position within the HUD.
|
|
50
|
+
* @param {number} displayHeight - The height of the main display (used for scaling).
|
|
51
|
+
* @returns {number} The absolute Y pixel coordinate.
|
|
52
|
+
*/
|
|
53
|
+
static getHudPosY(p: p5, y: number, displayHeight: number): number;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Debuggable, Initializable, StateSyncable, Serializable } from '../types/Interfaces';
|
|
2
|
+
export default class InterfaceIdentifierHelper {
|
|
3
|
+
static isSerializable(module: object): module is Serializable;
|
|
4
|
+
static isInitializable(module: object): module is Initializable;
|
|
5
|
+
static isStateSyncable(module: object): module is StateSyncable;
|
|
6
|
+
static isDebuggable(module: object): module is Debuggable;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import p5 from 'p5';
|
|
2
|
+
/**
|
|
3
|
+
* Static utility for calculating pixel values relative to the canvas size.
|
|
4
|
+
* Allows for responsive design by defining sizes as percentages (0.0 - 1.0).
|
|
5
|
+
*/
|
|
6
|
+
export default class RelativeValuesHelper {
|
|
7
|
+
/**
|
|
8
|
+
* Calculates a pixel width based on a percentage of the canvas width.
|
|
9
|
+
*
|
|
10
|
+
* @param {p5} p - The P5 instance.
|
|
11
|
+
* @param {number} size - The percentage (0.0 to 1.0).
|
|
12
|
+
* @returns {number} The absolute width in pixels.
|
|
13
|
+
*/
|
|
14
|
+
static getRelativeWidth(p: p5, size: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* Calculates a pixel height based on a percentage of the canvas height.
|
|
17
|
+
*
|
|
18
|
+
* @param {p5} p - The P5 instance.
|
|
19
|
+
* @param {number} size - The percentage (0.0 to 1.0).
|
|
20
|
+
* @returns {number} The absolute height in pixels.
|
|
21
|
+
*/
|
|
22
|
+
static getRelativeHeight(p: p5, size: number): number;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ControlKey } from '../../types/enums';
|
|
2
|
+
import { Control } from '../../types/modules';
|
|
3
|
+
import { Debuggable } from '../../types/Interfaces';
|
|
4
|
+
import { ControlCallback, ControlEventType, GameModules } from '../../types/Types';
|
|
5
|
+
/**
|
|
6
|
+
* Manages game control inputs and event dispatching.
|
|
7
|
+
* Acts as the central hub for handling user input and notifying subscribers.
|
|
8
|
+
*/
|
|
9
|
+
export default class GameControl implements Control, Debuggable {
|
|
10
|
+
private _modules;
|
|
11
|
+
private _keyBinding;
|
|
12
|
+
private _subscribers;
|
|
13
|
+
/**
|
|
14
|
+
* Initializes the control system.
|
|
15
|
+
* Sets up key bindings and prepares the input handler.
|
|
16
|
+
*/
|
|
17
|
+
setup(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Unbinds all control event listeners.
|
|
20
|
+
*/
|
|
21
|
+
unbindControls(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Binds all control event listeners.
|
|
24
|
+
*/
|
|
25
|
+
bindControls(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Injects the game modules for context-aware events.
|
|
28
|
+
*
|
|
29
|
+
* @param {GameModules} modules - The collected game modules.
|
|
30
|
+
*/
|
|
31
|
+
setModules(modules: GameModules): void;
|
|
32
|
+
/**
|
|
33
|
+
* Subscribes a callback to a specific control event.
|
|
34
|
+
*
|
|
35
|
+
* @param {ControlKey} key - The key to listen for.
|
|
36
|
+
* @param {ControlEventType} type - The event type (pressed/held).
|
|
37
|
+
* @param {ControlCallback} callback - The function to execute.
|
|
38
|
+
*/
|
|
39
|
+
subscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
40
|
+
/**
|
|
41
|
+
* Unsubscribes a callback from a control event.
|
|
42
|
+
*
|
|
43
|
+
* @param {ControlKey} key - The key to stop listening for.
|
|
44
|
+
* @param {ControlEventType} type - The event type.
|
|
45
|
+
* @param {ControlCallback} callback - The function to remove.
|
|
46
|
+
*/
|
|
47
|
+
unsubscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
48
|
+
/**
|
|
49
|
+
* Notifies subscribers of a control event.
|
|
50
|
+
*
|
|
51
|
+
* @param {ControlKey} key - The key triggering the event.
|
|
52
|
+
* @param {ControlEventType} type - The type of event.
|
|
53
|
+
* @throws {Error} If modules have not been initialized.
|
|
54
|
+
*/
|
|
55
|
+
notify(key: ControlKey, type: ControlEventType): void;
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves debug information about the control system.
|
|
58
|
+
*
|
|
59
|
+
* @returns {Record<string, string | number | boolean>} The debug data.
|
|
60
|
+
*/
|
|
61
|
+
getDebugData(): Record<string, string | number | boolean>;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Control } from '../../types/modules';
|
|
2
|
+
/**
|
|
3
|
+
* Handles the binding of physical keyboard events to logical control actions.
|
|
4
|
+
* Translates Browser `KeyboardEvent`s into engine `ControlKey`s.
|
|
5
|
+
*/
|
|
6
|
+
export default class GameControlKeyBinding {
|
|
7
|
+
private _inputHandler;
|
|
8
|
+
private _boundHandleKeyDown;
|
|
9
|
+
private _boundHandleKeyUp;
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of GameControlKeyBinding.
|
|
12
|
+
*
|
|
13
|
+
* @param {Control} control - The parent control module.
|
|
14
|
+
*/
|
|
15
|
+
constructor(control: Control);
|
|
16
|
+
/**
|
|
17
|
+
* Binds keyboard events to the global window object.
|
|
18
|
+
*/
|
|
19
|
+
bindControls(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Unbinds keyboard events from the global window object.
|
|
22
|
+
*/
|
|
23
|
+
unbindControls(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Internal handler for key down events.
|
|
26
|
+
*
|
|
27
|
+
* @param {KeyboardEvent} event - The browser keyboard event.
|
|
28
|
+
*/
|
|
29
|
+
private _handleKeyDown;
|
|
30
|
+
/**
|
|
31
|
+
* Internal handler for key up events.
|
|
32
|
+
*
|
|
33
|
+
* @param {KeyboardEvent} event - The browser keyboard event.
|
|
34
|
+
*/
|
|
35
|
+
private _handleKeyUp;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|