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,144 @@
|
|
|
1
|
+
import { Debuggable } from '../../types/Interfaces';
|
|
2
|
+
import { Time } from '../../types/modules';
|
|
3
|
+
import { Serializable } from '../../types/Interfaces';
|
|
4
|
+
import configs from '../../../config/configs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Manages game time, frame rates, and tick intervals.
|
|
8
|
+
* Handles the game loop timing and debug statistics (FPS, TPS).
|
|
9
|
+
*/
|
|
10
|
+
export default class GameTime implements Time, Debuggable, Serializable {
|
|
11
|
+
// Time accumulator
|
|
12
|
+
protected _accumulatedTime: number = 0;
|
|
13
|
+
protected _initialTickInterval: number = configs.game.tickInterval;
|
|
14
|
+
protected _minTickInterval: number = configs.game.minTickInterval;
|
|
15
|
+
protected _tickInterval: number = configs.game.tickInterval;
|
|
16
|
+
protected _fps: number = 0;
|
|
17
|
+
protected _tps: number = 0;
|
|
18
|
+
protected _tickCounter: number = 0;
|
|
19
|
+
protected _timeSinceLastTpsUpdate: number = 0;
|
|
20
|
+
|
|
21
|
+
serialId: string = 'time';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Initializes the time module.
|
|
25
|
+
* Resets all timers and counters.
|
|
26
|
+
*/
|
|
27
|
+
setup(): void {
|
|
28
|
+
this.reset();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Updates the time accumulator and calculates FPS/TPS.
|
|
33
|
+
* Should be called once per frame.
|
|
34
|
+
*
|
|
35
|
+
* @param {number} deltaTime - Time elapsed since last frame in milliseconds.
|
|
36
|
+
*/
|
|
37
|
+
update(deltaTime: number) {
|
|
38
|
+
this._accumulatedTime += deltaTime;
|
|
39
|
+
this._fps = 1000 / deltaTime;
|
|
40
|
+
|
|
41
|
+
this._timeSinceLastTpsUpdate += deltaTime;
|
|
42
|
+
if (this._timeSinceLastTpsUpdate >= 1000) {
|
|
43
|
+
this._tps = this._tickCounter;
|
|
44
|
+
this._tickCounter = 0;
|
|
45
|
+
this._timeSinceLastTpsUpdate -= 1000;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Checks if enough time has passed for a game tick.
|
|
51
|
+
* Consumes accumulated time if a tick occurs.
|
|
52
|
+
*
|
|
53
|
+
* @returns {boolean} True if a tick should occur.
|
|
54
|
+
*/
|
|
55
|
+
shouldTick(): boolean {
|
|
56
|
+
if (this._accumulatedTime >= this._tickInterval) {
|
|
57
|
+
this._accumulatedTime -= this._tickInterval;
|
|
58
|
+
this._tickCounter++;
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Resets the time accumulator and debug counters.
|
|
66
|
+
*/
|
|
67
|
+
reset() {
|
|
68
|
+
this._accumulatedTime = 0;
|
|
69
|
+
this._fps = 0;
|
|
70
|
+
this._tps = 0;
|
|
71
|
+
this._tickCounter = 0;
|
|
72
|
+
this._timeSinceLastTpsUpdate = 0;
|
|
73
|
+
this._tickInterval = this._initialTickInterval;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Gets the current tick interval.
|
|
78
|
+
*
|
|
79
|
+
* @returns {number} The tick interval in milliseconds.
|
|
80
|
+
*/
|
|
81
|
+
get tickInterval(): number {
|
|
82
|
+
return this._tickInterval;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Sets the tick interval and resets timing.
|
|
87
|
+
*
|
|
88
|
+
* @param {number} interval - The new tick interval in milliseconds.
|
|
89
|
+
*/
|
|
90
|
+
set tickInterval(interval: number) {
|
|
91
|
+
this._tickInterval = interval;
|
|
92
|
+
// this.reset(); // Removed reset to prevent stuttering on speed change
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Increments the tick interval (slowing down the game).
|
|
97
|
+
*
|
|
98
|
+
* @param {number} amount - The amount to add to the interval.
|
|
99
|
+
*/
|
|
100
|
+
incrementTickInterval(amount: number) {
|
|
101
|
+
this.tickInterval = this._tickInterval + amount;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Decrements the tick interval (speeding up the game).
|
|
106
|
+
* Enforces a minimum interval of 10ms.
|
|
107
|
+
*
|
|
108
|
+
* @param {number} amount - The amount to subtract from the interval.
|
|
109
|
+
*/
|
|
110
|
+
decrementTickInterval(amount: number) {
|
|
111
|
+
const newInterval = Math.max(this._minTickInterval, this._tickInterval - amount);
|
|
112
|
+
this.tickInterval = newInterval;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Retrieves debug information about the time system.
|
|
117
|
+
*
|
|
118
|
+
* @returns {Record<string, string | number | boolean>} The debug data.
|
|
119
|
+
*/
|
|
120
|
+
getDebugData(): Record<string, string | number | boolean> {
|
|
121
|
+
return {
|
|
122
|
+
fps: Math.round(this._fps),
|
|
123
|
+
tps: this._tps,
|
|
124
|
+
tick_interval: this._tickInterval.toFixed(2),
|
|
125
|
+
accumulated_time: this._accumulatedTime.toFixed(2),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
serialize(): string {
|
|
130
|
+
return JSON.stringify({
|
|
131
|
+
tickInterval: this._tickInterval,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
deserialize(data: string): void {
|
|
135
|
+
const parsed = JSON.parse(data);
|
|
136
|
+
this._tickInterval = parsed.tickInterval;
|
|
137
|
+
}
|
|
138
|
+
setTickInterval(interval: number): void {
|
|
139
|
+
this._tickInterval = interval;
|
|
140
|
+
}
|
|
141
|
+
setMinTickInterval(interval: number): void {
|
|
142
|
+
this._minTickInterval = interval;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { State } from './modules';
|
|
2
|
+
import { RendererMetrics } from './Types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Defines a contract for modules that require an initialization step.
|
|
6
|
+
*/
|
|
7
|
+
export interface Initializable {
|
|
8
|
+
/**
|
|
9
|
+
* Initializes the module.
|
|
10
|
+
* Should be called after the instance is created and dependencies are injected.
|
|
11
|
+
*/
|
|
12
|
+
setup(): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Defines a contract for modules that need to synchronize with the global game state.
|
|
17
|
+
* This is primarily used for persistence and state reactivity.
|
|
18
|
+
*/
|
|
19
|
+
export interface StateSyncable {
|
|
20
|
+
/** Reference to the central state module. */
|
|
21
|
+
_state: State;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Binds the module to the game state.
|
|
25
|
+
*
|
|
26
|
+
* @param {State} state - The game state instance to sync with.
|
|
27
|
+
*/
|
|
28
|
+
syncState(state: State): void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Defines a contract for renderers that require initialization with layout metrics.
|
|
33
|
+
*/
|
|
34
|
+
export interface RendererInitializable {
|
|
35
|
+
/**
|
|
36
|
+
* Initializes the renderer with calculated screen metrics.
|
|
37
|
+
*
|
|
38
|
+
* @param {RendererMetrics} rendererMetrics - The layout metrics (dimensions, origins).
|
|
39
|
+
*/
|
|
40
|
+
setup(rendererMetrics: RendererMetrics): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Defines a contract for modules that expose internal data to the debug overlay.
|
|
45
|
+
*/
|
|
46
|
+
export interface Debuggable {
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves key-multivalue pairs of debug information.
|
|
49
|
+
*
|
|
50
|
+
* @returns {Record<string, string | number | boolean>} A dictionary of debug data.
|
|
51
|
+
*/
|
|
52
|
+
getDebugData(): Record<string, string | number | boolean>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface Serializable {
|
|
56
|
+
serialId: string;
|
|
57
|
+
serialize(): string;
|
|
58
|
+
deserialize(data: string): void;
|
|
59
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Color, ControlKey, ControlEventType, StateProperty } from './enums';
|
|
2
|
+
import { Control, Grid, RendererComposite, Score, Session, SoundModule, State, Text, Time } from './modules';
|
|
3
|
+
|
|
4
|
+
export { Color, ControlKey, ControlEventType, StateProperty };
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a single cell within the game grid.
|
|
8
|
+
*/
|
|
9
|
+
export type Cell = {
|
|
10
|
+
/** The cell's state value. `0` indicates inactive/empty, values > 0 indicate occupancy or type. */
|
|
11
|
+
value: number;
|
|
12
|
+
/** The color of the cell, defined by the {@link Color} enum. */
|
|
13
|
+
color: Color;
|
|
14
|
+
/** The logical grid coordinate of this cell. */
|
|
15
|
+
coordinate: Coordinate;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Represents a 2D direction vector with X and Y components.
|
|
20
|
+
* Values are restricted to -1, 0, or 1 to ensure unit-based movement.
|
|
21
|
+
*/
|
|
22
|
+
export type Vector = {
|
|
23
|
+
/** The X component (-1: left, 0: none, 1: right). */
|
|
24
|
+
x: -1 | 0 | 1;
|
|
25
|
+
/** The Y component (-1: up, 0: none, 1: down). */
|
|
26
|
+
y: -1 | 0 | 1;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Represents an axis in a 2D coordinate system.
|
|
31
|
+
*/
|
|
32
|
+
export type Axis = 'x' | 'y';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents a piece which is a collection of cells.
|
|
36
|
+
*/
|
|
37
|
+
export type Piece = Cell[];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Represents a 2D point in a coordinate system.
|
|
41
|
+
* Typically used for grid positions or normalized screen coordinates.
|
|
42
|
+
*/
|
|
43
|
+
export type Coordinate = {
|
|
44
|
+
/** The horizontal position. */
|
|
45
|
+
x: number;
|
|
46
|
+
/** The vertical position. */
|
|
47
|
+
y: number;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Defines the calculated layout metrics for the game renderer.
|
|
52
|
+
* These values are used to position elements on the HTML5 Canvas.
|
|
53
|
+
*/
|
|
54
|
+
export interface RendererMetrics {
|
|
55
|
+
/** Metrics for the main game display area. */
|
|
56
|
+
display: {
|
|
57
|
+
/** The computed width of the display in pixels. */
|
|
58
|
+
width: number;
|
|
59
|
+
/** The computed height of the display in pixels. */
|
|
60
|
+
height: number;
|
|
61
|
+
/** The top-left origin point of the display relative to the canvas. */
|
|
62
|
+
origin: Coordinate;
|
|
63
|
+
};
|
|
64
|
+
/** Metrics for the Head-Up Display (HUD) area. */
|
|
65
|
+
hud: {
|
|
66
|
+
/** The computed width of the HUD in pixels. */
|
|
67
|
+
width: number;
|
|
68
|
+
/** The computed height of the HUD in pixels. */
|
|
69
|
+
height: number;
|
|
70
|
+
/** The top-left origin point of the HUD relative to the canvas. */
|
|
71
|
+
origin: Coordinate;
|
|
72
|
+
};
|
|
73
|
+
/** Metrics for individual grid cells. */
|
|
74
|
+
cell: {
|
|
75
|
+
/** The computed size (width/height) of a cell in pixels. */
|
|
76
|
+
size: number;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Aggregates all core engine modules.
|
|
82
|
+
* This object is passed around to allow inter-module communication.
|
|
83
|
+
*/
|
|
84
|
+
export type GameModules = {
|
|
85
|
+
/** The main game grid module. */
|
|
86
|
+
grid: Grid;
|
|
87
|
+
/** The HUD grid module (usually 4x4 for previews). */
|
|
88
|
+
hudGrid: Grid;
|
|
89
|
+
/** The text rendering module. */
|
|
90
|
+
text: Text;
|
|
91
|
+
/** The game state and lifecycle module. */
|
|
92
|
+
state: State;
|
|
93
|
+
/** The input control module. */
|
|
94
|
+
control: Control;
|
|
95
|
+
/** The main renderer compositor module. */
|
|
96
|
+
renderer: RendererComposite;
|
|
97
|
+
/** The game loop timing module. */
|
|
98
|
+
time: Time;
|
|
99
|
+
/** The audio system module. */
|
|
100
|
+
sound: SoundModule;
|
|
101
|
+
/** The scoring and progression module. */
|
|
102
|
+
score: Score;
|
|
103
|
+
/** The game session module. */
|
|
104
|
+
session: Session;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Represents an input event triggered by the Control module.
|
|
109
|
+
*/
|
|
110
|
+
export interface GameEvent {
|
|
111
|
+
/** The control key associated with the event. */
|
|
112
|
+
key: ControlKey;
|
|
113
|
+
/** The type of event (Pressed or Held). */
|
|
114
|
+
type: ControlEventType;
|
|
115
|
+
/** Reference to the game modules for context-aware callbacks. */
|
|
116
|
+
modules: GameModules;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Callback function type for handling input events.
|
|
121
|
+
*
|
|
122
|
+
* @param {GameEvent} event - The event data containing key, type, and module access.
|
|
123
|
+
*/
|
|
124
|
+
export type ControlCallback = (event: GameEvent) => void;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumerates all available colors for grid cells and UI elements.
|
|
3
|
+
*/
|
|
4
|
+
export enum Color {
|
|
5
|
+
DEFAULT = 'rgb(19, 26, 18)',
|
|
6
|
+
BLUE = 'rgb(0, 0, 128)',
|
|
7
|
+
CYAN = 'rgb(0, 128, 128)',
|
|
8
|
+
GRAY = 'rgb(128, 128, 128)',
|
|
9
|
+
GREEN = 'rgb(0, 128, 0)',
|
|
10
|
+
PURPLE = 'rgb(128, 0, 128)',
|
|
11
|
+
RED = 'rgb(128, 0, 0)',
|
|
12
|
+
YELLOW = 'rgb(128, 128, 0)',
|
|
13
|
+
INACTIVE = 'rgb(166, 183, 165)',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Enumerates all available horizontal text alignments.
|
|
18
|
+
*/
|
|
19
|
+
export enum FontAlign {
|
|
20
|
+
/** Aligns text to the center. */
|
|
21
|
+
CENTER = 'center',
|
|
22
|
+
/** Aligns text to the left. */
|
|
23
|
+
LEFT = 'left',
|
|
24
|
+
/** Aligns text to the right. */
|
|
25
|
+
RIGHT = 'right',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Enumerates all available font size presets.
|
|
30
|
+
* These correspond to specific pixel values calculated at runtime based on screen size.
|
|
31
|
+
*/
|
|
32
|
+
export enum FontSize {
|
|
33
|
+
EXTRA_SMALL = 0,
|
|
34
|
+
SMALL = 1,
|
|
35
|
+
MEDIUM = 2,
|
|
36
|
+
LARGE = 3,
|
|
37
|
+
EXTRA_LARGE = 4,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Enumerates all available vertical text alignments.
|
|
42
|
+
*/
|
|
43
|
+
export enum FontVerticalAlign {
|
|
44
|
+
/** Aligns text to the vertical center. */
|
|
45
|
+
CENTER = 'center',
|
|
46
|
+
/** Aligns text to the top. */
|
|
47
|
+
TOP = 'top',
|
|
48
|
+
/** Aligns text to the bottom. */
|
|
49
|
+
BOTTOM = 'bottom',
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Enumerates all available sound assets.
|
|
54
|
+
* Each value corresponds to the path of the audio file.
|
|
55
|
+
*/
|
|
56
|
+
export enum Sound {
|
|
57
|
+
SPAWN = './sounds/sound_01.wav',
|
|
58
|
+
SCORE_1 = './sounds/sound_15.wav',
|
|
59
|
+
SCORE_2 = './sounds/sound_03.wav',
|
|
60
|
+
SCORE_3 = './sounds/sound_02.wav',
|
|
61
|
+
KEY_PRESS = './sounds/sound_14.wav',
|
|
62
|
+
ACTION_1 = './sounds/sound_05.wav',
|
|
63
|
+
ACTION_2 = './sounds/sound_13.wav',
|
|
64
|
+
HIT_1 = './sounds/sound_06.wav',
|
|
65
|
+
HIT_2 = './sounds/sound_08.wav',
|
|
66
|
+
DODGE = './sounds/sound_07.wav',
|
|
67
|
+
DROP = './sounds/sound_11.wav',
|
|
68
|
+
EXPLOSION = './sounds/sound_09.wav',
|
|
69
|
+
GAME_START = './sounds/sound_04.wav',
|
|
70
|
+
SHOT = './sounds/sound_12.wav',
|
|
71
|
+
START_THEME = './sounds/sound_10.wav',
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Enumerates all logical control keys used in the engine.
|
|
76
|
+
* These are mapped to physical keys in the Control module.
|
|
77
|
+
*/
|
|
78
|
+
export enum ControlKey {
|
|
79
|
+
UP = 'up;control',
|
|
80
|
+
DOWN = 'down;control',
|
|
81
|
+
LEFT = 'left;control',
|
|
82
|
+
RIGHT = 'right;control',
|
|
83
|
+
ACTION = 'action;control',
|
|
84
|
+
POWER = 'power;system',
|
|
85
|
+
START_PAUSE = 'start_pause;system',
|
|
86
|
+
SOUND = 'sound;system',
|
|
87
|
+
RESET = 'reset;system',
|
|
88
|
+
EXIT = 'exit;system',
|
|
89
|
+
COLOR = 'color;system',
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Enumerates the types of input events.
|
|
94
|
+
*/
|
|
95
|
+
export enum ControlEventType {
|
|
96
|
+
/** Triggered once when the key is pressed down. */
|
|
97
|
+
PRESSED = 'pressed',
|
|
98
|
+
/** Triggered continuously while the key is held down. */
|
|
99
|
+
HELD = 'held',
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Enumerates all observable state properties.
|
|
104
|
+
* These keys are used for state subscriptions and persistence.
|
|
105
|
+
*/
|
|
106
|
+
export enum StateProperty {
|
|
107
|
+
ON = 'on',
|
|
108
|
+
START = 'start',
|
|
109
|
+
PLAYING = 'playing',
|
|
110
|
+
GAME_OVER = 'gameOver',
|
|
111
|
+
COLOR_ENABLED = 'colorEnabled',
|
|
112
|
+
MUTED = 'muted',
|
|
113
|
+
}
|