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,38 @@
|
|
|
1
|
+
= GameHudGrid Reference
|
|
2
|
+
:description: Specialized 4x4 grid implementation for HUD elements and meta-information.
|
|
3
|
+
:keywords: hud, grid, ui, display
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
The `GameHudGrid` is a specialized implementation of the `GameGrid` class. It is hard-coded to a **4x4** dimension and is intended for use in the HUD area to display meta-information, such as "Next Piece" in a Tetris-style game.
|
|
16
|
+
|
|
17
|
+
== Inheritance
|
|
18
|
+
|
|
19
|
+
`GameHudGrid` extends xref:GameGrid.adoc[GameGrid]. It inherits all methods for filling areas, stamping pieces, and checking occupancy.
|
|
20
|
+
|
|
21
|
+
== Usage
|
|
22
|
+
|
|
23
|
+
Accessible via `modules.hudGrid`.
|
|
24
|
+
|
|
25
|
+
[source,typescript]
|
|
26
|
+
----
|
|
27
|
+
const { hudGrid } = this.modules;
|
|
28
|
+
|
|
29
|
+
// Reset HUD grid for a new piece
|
|
30
|
+
hudGrid.resetGrid();
|
|
31
|
+
|
|
32
|
+
// Stamp the "Next Piece" into the 4x4 HUD grid
|
|
33
|
+
hudGrid.stampPiece(nextPieceCoords, 1, Color.BLUE);
|
|
34
|
+
----
|
|
35
|
+
|
|
36
|
+
== Implementation Specifics
|
|
37
|
+
|
|
38
|
+
The `GameHudGrid` overrides the dimensions provided in the global configuration, strictly enforcing a 4x4 matrix. This ensures consistency for HUD-specific rendering logic.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
= GameMenu Module Reference
|
|
2
|
+
:description: Represents the orchestrator entry state, allowing navigation between games.
|
|
3
|
+
:keywords: menu, selection, entry point, root
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
|
|
10
|
+
The `GameMenu` is a concrete implementation of `xref:Game.adoc[Game]`. It serves as the primary gateway or entry screen for players, allowing them to browse and select which logic/game module to initialize from the central `GameRepository`.
|
|
11
|
+
|
|
12
|
+
== Initialization & Configuration
|
|
13
|
+
|
|
14
|
+
=== `setupGame(): void`
|
|
15
|
+
|
|
16
|
+
Adjusts formatting and presentation logic specific to the menu's state (e.g., Font setup). Unbinds standard game inputs and hooks into UP/DOWN/ENTER for menu navigation.
|
|
17
|
+
|
|
18
|
+
=== `gameId` Property
|
|
19
|
+
|
|
20
|
+
Set to `game-menu` upon instantiation. This ensures the menu state is intentionally ignored by the `xref:GameSession.adoc[GameSession]` mechanism, averting logic conflicts that would try to parse the "menu" as a playable state.
|
|
21
|
+
|
|
22
|
+
== Rendering
|
|
23
|
+
|
|
24
|
+
=== `drawTitleScreen(): void`
|
|
25
|
+
|
|
26
|
+
Renders the interactive menu. Reads from `GameRepository` and formats the available games interactively according to the internal active pointer value (`_gameSelectionPointer`). Updates dynamically when UP/DOWN are pressed.
|
|
27
|
+
|
|
28
|
+
=== `drawGameOverScreen(): void`
|
|
29
|
+
|
|
30
|
+
The `GameMenu` does not have a Game Over logic screen hook. Attempting to enter the `GAME_OVER` state will have no visual effect.
|
|
31
|
+
|
|
32
|
+
== Event Handling
|
|
33
|
+
|
|
34
|
+
=== Menu Controls
|
|
35
|
+
|
|
36
|
+
- **UP**: Decrements the selection pointer.
|
|
37
|
+
- **DOWN**: Increments the selection pointer.
|
|
38
|
+
- **START_PAUSE** (Enter): Instantiates the game at the current selection pointer and invokes `this.switchGame()` to seamlessly hand over control.
|
|
39
|
+
- **EXIT**: In the context of the menu, it does not apply switching behaviors.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
= GameRenderer Module Reference
|
|
2
|
+
:description: Orchestrates multiple specialized renderers to draw the game grid, background, and HUD.
|
|
3
|
+
:keywords: rendering, orchestration, graphics, canvas, layers
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
The `GameRenderer` module is the visual engine of the application. It orchestrates multiple specialized renderers to draw the game grid, background, borders, and HUD elements on the HTML5 canvas.
|
|
16
|
+
|
|
17
|
+
== API Reference
|
|
18
|
+
|
|
19
|
+
=== `rendererMetrics: RendererMetrics`
|
|
20
|
+
|
|
21
|
+
Read-only property containing the calculated dimensions and origins for all UI components.
|
|
22
|
+
|
|
23
|
+
**Returns**
|
|
24
|
+
|
|
25
|
+
`xref:../types/RendererMetrics.adoc[RendererMetrics]` - An object containing geometric data for `display`, `hud`, and individual `cells`.
|
|
26
|
+
|
|
27
|
+
**Behavior**
|
|
28
|
+
|
|
29
|
+
Calculates metrics once during initialization based on the current canvas size and configuration. These values are used by all other modules (like `xref:GameText.adoc[GameText]`) to ensure pixel-perfect alignment.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
'''
|
|
33
|
+
|
|
34
|
+
=== `addRenderer(renderer: Renderer): void`
|
|
35
|
+
|
|
36
|
+
Registers a new rendering layer.
|
|
37
|
+
|
|
38
|
+
**Parameters**
|
|
39
|
+
|
|
40
|
+
[cols="1,1,3"]
|
|
41
|
+
|===
|
|
42
|
+
|Name |Type |Description
|
|
43
|
+
|`renderer` |`xref:../interfaces/modules/Renderer.adoc[Renderer]` |An implementation of the `xref:../interfaces/modules/Renderer.adoc[Renderer]` interface (e.g., `xref:DisplayRenderer.adoc[DisplayRenderer]`).
|
|
44
|
+
|===
|
|
45
|
+
|
|
46
|
+
**Behavior**
|
|
47
|
+
|
|
48
|
+
Adds the renderer to an internal stack. Layers are executed in the order they are added.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
'''
|
|
52
|
+
|
|
53
|
+
=== `render(grid: Cell[][], modules: GameModules): void`
|
|
54
|
+
|
|
55
|
+
The main drawing execution call.
|
|
56
|
+
|
|
57
|
+
**Parameters**
|
|
58
|
+
|
|
59
|
+
[cols="1,1,3"]
|
|
60
|
+
|===
|
|
61
|
+
|Name |Type |Description
|
|
62
|
+
|`grid` |`xref:../types/Cell.adoc[Cell][][]` |The current 2D matrix of cells to visualize.
|
|
63
|
+
|`modules` |`xref:../interfaces/GameModules.adoc[GameModules]` |Reference to all available modules for context-aware rendering.
|
|
64
|
+
|===
|
|
65
|
+
|
|
66
|
+
**Behavior**
|
|
67
|
+
|
|
68
|
+
Called by the engine's main loop. It iterates through all registered renderers and executes their specific `render` logic.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
'''
|
|
72
|
+
|
|
73
|
+
=== `getDebugData(): Record<string, string | number | boolean>`
|
|
74
|
+
|
|
75
|
+
Returns metadata for the real-time debugger.
|
|
76
|
+
|
|
77
|
+
**Returns**
|
|
78
|
+
|
|
79
|
+
`Record<string, string | number | boolean>` - Object containing `display_width`, `display_height`, `hud_width`, `hud_height`, and `cell_size`.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
= GameScore Module Reference
|
|
2
|
+
:description: Tracks session player performance, including score, levels, and point multipliers.
|
|
3
|
+
:keywords: score, tracking, levels, multipliers, metrics
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
The `GameScore` module tracks player performance during a session. It manages the current score, game levels, multipliers, and acts as the authority for the game's `highScore`, persisting it directly to `LocalStorage`. It also fully supports Session serialization out of the box.
|
|
16
|
+
|
|
17
|
+
== API Reference
|
|
18
|
+
|
|
19
|
+
=== `score: number`
|
|
20
|
+
|
|
21
|
+
Read-only property returning the current session's points.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
'''
|
|
25
|
+
|
|
26
|
+
=== `level: number`
|
|
27
|
+
|
|
28
|
+
Read-only property returning the current difficulty level.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
'''
|
|
32
|
+
|
|
33
|
+
=== `multiplier: number`
|
|
34
|
+
|
|
35
|
+
Read and Write property for the current points multiplier.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
'''
|
|
39
|
+
|
|
40
|
+
=== `highScore: number`
|
|
41
|
+
|
|
42
|
+
Read and Write property for the highest overall score achieved.
|
|
43
|
+
|
|
44
|
+
**Behavior**
|
|
45
|
+
|
|
46
|
+
When set, it automatically persists the value directly to `LocalStorage` under the `highScore` key. It does not use `GameState` for this persistence.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
'''
|
|
50
|
+
|
|
51
|
+
=== `increaseScore(amount: number): void`
|
|
52
|
+
|
|
53
|
+
Adds points to the current session.
|
|
54
|
+
|
|
55
|
+
**Parameters**
|
|
56
|
+
|
|
57
|
+
[cols="1,1,3"]
|
|
58
|
+
|===
|
|
59
|
+
|Name |Type |Description
|
|
60
|
+
|`amount` |`number` |Base points to add.
|
|
61
|
+
|===
|
|
62
|
+
|
|
63
|
+
**Behavior**
|
|
64
|
+
|
|
65
|
+
Increases the score by `amount * multiplier`. Automatically compares the new score against the internal `highScore` property and updates it if a new record is reached (which in turn persists the new record to `LocalStorage`).
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
'''
|
|
69
|
+
|
|
70
|
+
=== `resetScore(): void`
|
|
71
|
+
|
|
72
|
+
Resets the session score to zero.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
'''
|
|
76
|
+
|
|
77
|
+
=== `increaseLevel(amount: number): void`
|
|
78
|
+
|
|
79
|
+
Increases the game difficulty level.
|
|
80
|
+
|
|
81
|
+
**Parameters**
|
|
82
|
+
|
|
83
|
+
[cols="1,1,3"]
|
|
84
|
+
|===
|
|
85
|
+
|Name |Type |Description
|
|
86
|
+
|`amount` |`number` |Number of levels to add.
|
|
87
|
+
|===
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
'''
|
|
91
|
+
|
|
92
|
+
=== `resetLevel(): void`
|
|
93
|
+
|
|
94
|
+
Resets the level counter to 1.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
'''
|
|
98
|
+
|
|
99
|
+
=== `getFormattedScore(digits: number): string`
|
|
100
|
+
|
|
101
|
+
Returns the score as a padded string suitable for HUD display.
|
|
102
|
+
|
|
103
|
+
**Parameters**
|
|
104
|
+
|
|
105
|
+
[cols="1,1,3"]
|
|
106
|
+
|===
|
|
107
|
+
|Name |Type |Description
|
|
108
|
+
|`digits` |`number` |Total length of the string (e.g., 6 for "000150").
|
|
109
|
+
|===
|
|
110
|
+
|
|
111
|
+
**Returns**
|
|
112
|
+
|
|
113
|
+
`string` - The zero-padded score string.
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
'''
|
|
117
|
+
|
|
118
|
+
=== `serialize(): string`
|
|
119
|
+
|
|
120
|
+
**Behavior**
|
|
121
|
+
|
|
122
|
+
Implements `xref:../interfaces/Serializable.adoc[Serializable]`. Packs the current `score`, `level`, `max_level`, `multiplier`, and `highScore` into a JSON string to be managed by the active game session.
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
'''
|
|
126
|
+
|
|
127
|
+
=== `deserialize(data: string): void`
|
|
128
|
+
|
|
129
|
+
**Behavior**
|
|
130
|
+
|
|
131
|
+
Implements `xref:../interfaces/Serializable.adoc[Serializable]`. Restores all progress from a saved session string.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
'''
|
|
135
|
+
|
|
136
|
+
=== `getDebugData(): Record<string, string | number | boolean>`
|
|
137
|
+
|
|
138
|
+
Returns metadata for the real-time debugger.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
= GameSession Module Reference
|
|
2
|
+
:description: Core implementation of the session interface, orchestrating the state synchronization for game persistence.
|
|
3
|
+
:keywords: session, GameSession, state sync, persistence
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
|
|
10
|
+
The `GameSession` module implements the `xref:../interfaces/modules/Session.adoc[Session]` interface. It acts as the default engine implementation for persistence lifecycle hooks.
|
|
11
|
+
|
|
12
|
+
== Session Management
|
|
13
|
+
|
|
14
|
+
=== `saveSession(): void`
|
|
15
|
+
|
|
16
|
+
Creates or updates the session. Early returns if the `GameID` belongs to the main menu (`game-menu`) or if the `SessionModal` (if existing) has not been confirmed/rejected yet.
|
|
17
|
+
|
|
18
|
+
=== `clearSession(): void`
|
|
19
|
+
|
|
20
|
+
Removes the saved instances from `localStorage`.
|
|
21
|
+
|
|
22
|
+
=== `syncState(state: State): void`
|
|
23
|
+
|
|
24
|
+
Subscribes to `xref:GameState.adoc[GameState]` interactions.
|
|
25
|
+
|
|
26
|
+
**Parameters**
|
|
27
|
+
|
|
28
|
+
[cols="1,1,3"]
|
|
29
|
+
|===
|
|
30
|
+
|Name |Type |Description
|
|
31
|
+
|`state` |`xref:../interfaces/modules/State.adoc[State]` |The game state orchestrator.
|
|
32
|
+
|===
|
|
33
|
+
|
|
34
|
+
**Behavior**
|
|
35
|
+
|
|
36
|
+
Reacts to:
|
|
37
|
+
- `PLAYING`: If a session for the current `gameId` exists, is NOT the game menu, and the modal hasn't been closed, it invokes the modal via `_showSessionModal`. If accepted, calls deserialize on all registered targets. If canceled or if no previous session exists, proceeds normally. The modal state is tracked to prevent re-triggering during the same power cycle.
|
|
38
|
+
- `ON` (when false): Resets the modal state tracking closure, allowing the session modal to appear again after the device is powered back on.
|
|
39
|
+
- `GAME_OVER`: Clears active session entirely.
|
|
40
|
+
|
|
41
|
+
== Internals
|
|
42
|
+
|
|
43
|
+
The system scopes data internally via the `${gameId}::${serialId}` key pattern within the `localStorage`. Under the hood, the engine identifies instances that implements the `xref:../interfaces/Serializable.adoc[Serializable]` capability and registers them here implicitly during the bootstrap.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
= GameSound Module Reference
|
|
2
|
+
:description: Manages audio playback using the Web Audio API for low-latency sound effects.
|
|
3
|
+
:keywords: sound, audio, web-audio, effects, mute
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
The `GameSound` module manages audio playback for the engine using the **Web Audio API**. It provides low-latency sound effects and automatic synchronization with the game's mute state.
|
|
16
|
+
|
|
17
|
+
== API Reference
|
|
18
|
+
|
|
19
|
+
=== `play(sound: Sound): Promise<void>`
|
|
20
|
+
|
|
21
|
+
Plays a preloaded sound effect.
|
|
22
|
+
|
|
23
|
+
**Parameters**
|
|
24
|
+
|
|
25
|
+
[cols="1,1,3"]
|
|
26
|
+
|===
|
|
27
|
+
|Name |Type |Description
|
|
28
|
+
|`sound` |`xref:../enums/Sound.adoc[Sound]` |The enum identifier of the sound to play.
|
|
29
|
+
|===
|
|
30
|
+
|
|
31
|
+
**Returns**
|
|
32
|
+
|
|
33
|
+
`Promise<void>` - Resolves when the sound starts playing.
|
|
34
|
+
|
|
35
|
+
**Behavior**
|
|
36
|
+
|
|
37
|
+
Automatically resumes the `AudioContext` if it was suspended by the browser. Multiple overlapping instances of the same sound are supported (e.g., rapid-fire effects).
|
|
38
|
+
|
|
39
|
+
**Example**
|
|
40
|
+
|
|
41
|
+
[source,typescript]
|
|
42
|
+
----
|
|
43
|
+
this.modules.sound.play(Sound.ACTION_1);
|
|
44
|
+
----
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
'''
|
|
48
|
+
|
|
49
|
+
=== `stop(sound: Sound): void`
|
|
50
|
+
|
|
51
|
+
Stops all active instances of a specific sound.
|
|
52
|
+
|
|
53
|
+
**Parameters**
|
|
54
|
+
|
|
55
|
+
[cols="1,1,3"]
|
|
56
|
+
|===
|
|
57
|
+
|Name |Type |Description
|
|
58
|
+
|`sound` |`xref:../enums/Sound.adoc[Sound]` |The enum identifier of the sound to stop.
|
|
59
|
+
|===
|
|
60
|
+
|
|
61
|
+
**Behavior**
|
|
62
|
+
|
|
63
|
+
Iterates through all currently playing sources of the specified type and stops them immediately.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
'''
|
|
67
|
+
|
|
68
|
+
=== `stopAll(): void`
|
|
69
|
+
|
|
70
|
+
Stops every sound currently playing in the engine.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
'''
|
|
74
|
+
|
|
75
|
+
=== `toggleMute(): void`
|
|
76
|
+
|
|
77
|
+
Toggles the master mute status.
|
|
78
|
+
|
|
79
|
+
**Behavior**
|
|
80
|
+
|
|
81
|
+
Inverts the `muted` property in `xref:GameState.adoc[GameState]`. This change is automatically persisted to `LocalStorage` and reflected in the audio output.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
'''
|
|
85
|
+
|
|
86
|
+
=== `syncState(state: State): void`
|
|
87
|
+
|
|
88
|
+
Synchronizes audio settings with the global game state.
|
|
89
|
+
|
|
90
|
+
**Parameters**
|
|
91
|
+
|
|
92
|
+
[cols="1,1,3"]
|
|
93
|
+
|===
|
|
94
|
+
|Name |Type |Description
|
|
95
|
+
|`state` |`xref:../interfaces/modules/State.adoc[State]` |The `xref:GameState.adoc[GameState]` instance to link with.
|
|
96
|
+
|===
|
|
97
|
+
|
|
98
|
+
**Behavior**
|
|
99
|
+
|
|
100
|
+
Implements the `xref:../interfaces/StateSyncable.adoc[StateSyncable]` interface. Subscribes to changes in the `MUTED` property of the provided state and updates the master gain node accordingly.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
'''
|
|
104
|
+
|
|
105
|
+
=== `getDebugData(): Record<string, string | number | boolean>`
|
|
106
|
+
|
|
107
|
+
Returns metadata for the real-time debugger.
|
|
108
|
+
|
|
109
|
+
**Returns**
|
|
110
|
+
|
|
111
|
+
`Record<string, string | number | boolean>` - Object containing `muted`, `active_sources`, and `loaded_buffers`.
|