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.
Files changed (477) hide show
  1. package/.env.local.example +2 -0
  2. package/.github/workflows/publish.yml +73 -0
  3. package/.prettierignore +2 -0
  4. package/.prettierrc.json +8 -0
  5. package/README.adoc +84 -0
  6. package/dist/8e23286c2fdf41fd795f.svg +32 -0
  7. package/dist/CNAME +1 -0
  8. package/dist/app.js +2 -0
  9. package/dist/app.js.map +1 -0
  10. package/dist/brick-engine.js +2 -0
  11. package/dist/brick-engine.js.map +1 -0
  12. package/dist/config/configs.d.ts +180 -0
  13. package/dist/config/configs.test.d.ts +1 -0
  14. package/dist/config/env.d.ts +2 -0
  15. package/dist/config/env.test.d.ts +1 -0
  16. package/dist/config/styles.d.ts +0 -0
  17. package/dist/core/Game.d.ts +107 -0
  18. package/dist/core/Game.test.d.ts +1 -0
  19. package/dist/core/InitialStateSnapshot.d.ts +19 -0
  20. package/dist/core/InitialStateSnapshot.test.d.ts +1 -0
  21. package/dist/core/helpers/CellHelper.d.ts +13 -0
  22. package/dist/core/helpers/CellHelper.test.d.ts +1 -0
  23. package/dist/core/helpers/ControlInputHandlerHelper.d.ts +32 -0
  24. package/dist/core/helpers/ControlInputHandlerHelper.test.d.ts +1 -0
  25. package/dist/core/helpers/CoordinateHelper.d.ts +54 -0
  26. package/dist/core/helpers/CoordinateHelper.test.d.ts +1 -0
  27. package/dist/core/helpers/InterfaceIdentifierHelper.d.ts +7 -0
  28. package/dist/core/helpers/InterfaceIdentifierHelper.test.d.ts +1 -0
  29. package/dist/core/helpers/RelativeValuesHelper.d.ts +23 -0
  30. package/dist/core/helpers/RelativeValuesHelper.test.d.ts +1 -0
  31. package/dist/core/module/control/GameControl.d.ts +62 -0
  32. package/dist/core/module/control/GameControl.test.d.ts +1 -0
  33. package/dist/core/module/control/GameControlKeyBinding.d.ts +36 -0
  34. package/dist/core/module/control/GameControlKeyBinding.test.d.ts +1 -0
  35. package/dist/core/module/grid/GameGrid.d.ts +399 -0
  36. package/dist/core/module/grid/GameGrid.test.d.ts +1 -0
  37. package/dist/core/module/grid/GameHudGrid.d.ts +24 -0
  38. package/dist/core/module/grid/GameHudGrid.test.d.ts +1 -0
  39. package/dist/core/module/grid/engines/GridAnalysisEngine.d.ts +29 -0
  40. package/dist/core/module/grid/engines/GridAnalysisEngine.test.d.ts +1 -0
  41. package/dist/core/module/grid/engines/GridLineEngine.d.ts +56 -0
  42. package/dist/core/module/grid/engines/GridLineEngine.test.d.ts +1 -0
  43. package/dist/core/module/grid/engines/GridMovementEngine.d.ts +29 -0
  44. package/dist/core/module/grid/engines/GridMovementEngine.test.d.ts +1 -0
  45. package/dist/core/module/grid/engines/GridRegionEngine.d.ts +26 -0
  46. package/dist/core/module/grid/engines/GridRegionEngine.test.d.ts +1 -0
  47. package/dist/core/module/grid/engines/GridTransformEngine.d.ts +24 -0
  48. package/dist/core/module/grid/engines/GridTransformEngine.test.d.ts +1 -0
  49. package/dist/core/module/renderer/DisplayRenderer.d.ts +51 -0
  50. package/dist/core/module/renderer/DisplayRenderer.test.d.ts +1 -0
  51. package/dist/core/module/renderer/GameRenderer.d.ts +59 -0
  52. package/dist/core/module/renderer/GameRenderer.test.d.ts +1 -0
  53. package/dist/core/module/renderer/HudRenderer.d.ts +56 -0
  54. package/dist/core/module/renderer/HudRenderer.test.d.ts +1 -0
  55. package/dist/core/module/score/GameScore.d.ts +117 -0
  56. package/dist/core/module/score/GameScore.test.d.ts +1 -0
  57. package/dist/core/module/session/GameSession.d.ts +20 -0
  58. package/dist/core/module/session/GameSession.test.d.ts +1 -0
  59. package/dist/core/module/sound/GameSound.d.ts +85 -0
  60. package/dist/core/module/sound/GameSound.test.d.ts +1 -0
  61. package/dist/core/module/state/GameState.d.ts +172 -0
  62. package/dist/core/module/state/GameState.test.d.ts +1 -0
  63. package/dist/core/module/text/GameText.d.ts +87 -0
  64. package/dist/core/module/text/GameText.test.d.ts +1 -0
  65. package/dist/core/module/time/GameTime.d.ts +76 -0
  66. package/dist/core/module/time/GameTime.test.d.ts +1 -0
  67. package/dist/core/types/Interfaces.d.ts +53 -0
  68. package/dist/core/types/Types.d.ts +114 -0
  69. package/dist/core/types/enums.d.ts +106 -0
  70. package/dist/core/types/modules.d.ts +723 -0
  71. package/dist/css/app.743066d8e4172b0e73f9.css +824 -0
  72. package/dist/css/app.743066d8e4172b0e73f9.css.map +1 -0
  73. package/dist/docs/GAME_DEVELOPER_GUIDE.html +727 -0
  74. package/dist/docs/brick-engine-guide.html +610 -0
  75. package/dist/docs/diagrams/lifecycle.mmd +19 -0
  76. package/dist/docs/documentation_style_guide.html +994 -0
  77. package/dist/docs/getting-started.html +648 -0
  78. package/dist/docs/images/lifecycle.svg +1 -0
  79. package/dist/docs/index.html +593 -0
  80. package/dist/docs/jsdoc_standard.html +656 -0
  81. package/dist/docs/publishing.html +573 -0
  82. package/dist/docs/reference/enums/Color.html +533 -0
  83. package/dist/docs/reference/enums/ControlEventType.html +505 -0
  84. package/dist/docs/reference/enums/ControlKey.html +529 -0
  85. package/dist/docs/reference/enums/FontAlignment.html +545 -0
  86. package/dist/docs/reference/enums/FontSize.html +517 -0
  87. package/dist/docs/reference/enums/Sound.html +558 -0
  88. package/dist/docs/reference/enums/StateProperty.html +525 -0
  89. package/dist/docs/reference/helpers/CellHelper.html +520 -0
  90. package/dist/docs/reference/helpers/ControlInputHandlerHelper.html +569 -0
  91. package/dist/docs/reference/helpers/CoordinateHelper.html +703 -0
  92. package/dist/docs/reference/helpers/RelativeValuesHelper.html +560 -0
  93. package/dist/docs/reference/interfaces/Debuggable.html +501 -0
  94. package/dist/docs/reference/interfaces/GameModules.html +544 -0
  95. package/dist/docs/reference/interfaces/Initializable.html +495 -0
  96. package/dist/docs/reference/interfaces/RendererInitializable.html +517 -0
  97. package/dist/docs/reference/interfaces/StateSyncable.html +542 -0
  98. package/dist/docs/reference/interfaces/modules/Control.html +648 -0
  99. package/dist/docs/reference/interfaces/modules/Grid.html +1256 -0
  100. package/dist/docs/reference/interfaces/modules/Renderer.html +522 -0
  101. package/dist/docs/reference/interfaces/modules/RendererComposite.html +577 -0
  102. package/dist/docs/reference/interfaces/modules/Score.html +669 -0
  103. package/dist/docs/reference/interfaces/modules/Session.html +585 -0
  104. package/dist/docs/reference/interfaces/modules/State.html +897 -0
  105. package/dist/docs/reference/interfaces/modules/Text.html +668 -0
  106. package/dist/docs/reference/interfaces/modules/Time.html +684 -0
  107. package/dist/docs/reference/modules/Debugger.html +579 -0
  108. package/dist/docs/reference/modules/DisplayRenderer.html +557 -0
  109. package/dist/docs/reference/modules/Game.html +909 -0
  110. package/dist/docs/reference/modules/GameControl.html +716 -0
  111. package/dist/docs/reference/modules/GameGrid.html +1910 -0
  112. package/dist/docs/reference/modules/GameHudGrid.html +508 -0
  113. package/dist/docs/reference/modules/GameMenu.html +538 -0
  114. package/dist/docs/reference/modules/GameRenderer.html +589 -0
  115. package/dist/docs/reference/modules/GameScore.html +664 -0
  116. package/dist/docs/reference/modules/GameSession.html +533 -0
  117. package/dist/docs/reference/modules/GameSound.html +636 -0
  118. package/dist/docs/reference/modules/GameState.html +922 -0
  119. package/dist/docs/reference/modules/GameText.html +701 -0
  120. package/dist/docs/reference/modules/GameTime.html +696 -0
  121. package/dist/docs/reference/modules/HudRenderer.html +568 -0
  122. package/dist/docs/reference/modules/InitialStateSnapshot.html +557 -0
  123. package/dist/docs/reference/modules/SessionModal.html +520 -0
  124. package/dist/docs/reference/types/Axis.html +505 -0
  125. package/dist/docs/reference/types/Cell.html +514 -0
  126. package/dist/docs/reference/types/ControlCallback.html +488 -0
  127. package/dist/docs/reference/types/Coordinate.html +510 -0
  128. package/dist/docs/reference/types/GameEntry.html +514 -0
  129. package/dist/docs/reference/types/GameEvent.html +514 -0
  130. package/dist/docs/reference/types/Piece.html +506 -0
  131. package/dist/docs/reference/types/RendererMetrics.html +514 -0
  132. package/dist/docs/reference/types/Vector.html +509 -0
  133. package/dist/docs/testing_best_practices.html +770 -0
  134. package/dist/favicon.ico +0 -0
  135. package/dist/fonts/digital-7.monoitalic.ttf +0 -0
  136. package/dist/images/cell.svg +32 -0
  137. package/dist/images/close.png +0 -0
  138. package/dist/images/games.png +0 -0
  139. package/dist/images/github.png +0 -0
  140. package/dist/images/letter-a.png +0 -0
  141. package/dist/images/letter-d.png +0 -0
  142. package/dist/images/letter-j.png +0 -0
  143. package/dist/images/letter-s.png +0 -0
  144. package/dist/images/letter-w.png +0 -0
  145. package/dist/images/meta-image.png +0 -0
  146. package/dist/images/number-1.png +0 -0
  147. package/dist/images/number-2.png +0 -0
  148. package/dist/images/number-3.png +0 -0
  149. package/dist/images/number-4.png +0 -0
  150. package/dist/images/number-5.png +0 -0
  151. package/dist/images/number-6.png +0 -0
  152. package/dist/images/splash.gif +0 -0
  153. package/dist/index.d.ts +8 -0
  154. package/dist/index.html +1 -0
  155. package/dist/index.test.d.ts +1 -0
  156. package/dist/main.d.ts +3 -0
  157. package/dist/main.test.d.ts +1 -0
  158. package/dist/menu/GameMenu.d.ts +15 -0
  159. package/dist/menu/GameMenu.test.d.ts +1 -0
  160. package/dist/menu/GameMenuSingleton.d.ts +6 -0
  161. package/dist/menu/GameMenuSingleton.test.d.ts +1 -0
  162. package/dist/menu/GameRepository.d.ts +7 -0
  163. package/dist/menu/GameRepository.test.d.ts +1 -0
  164. package/dist/menu/manager/GameManager.d.ts +6 -0
  165. package/dist/menu/manager/GameManager.test.d.ts +1 -0
  166. package/dist/sounds/sound_00.wav +0 -0
  167. package/dist/sounds/sound_01.wav +0 -0
  168. package/dist/sounds/sound_02.wav +0 -0
  169. package/dist/sounds/sound_03.wav +0 -0
  170. package/dist/sounds/sound_04.wav +0 -0
  171. package/dist/sounds/sound_05.wav +0 -0
  172. package/dist/sounds/sound_06.wav +0 -0
  173. package/dist/sounds/sound_07.wav +0 -0
  174. package/dist/sounds/sound_08.wav +0 -0
  175. package/dist/sounds/sound_09.wav +0 -0
  176. package/dist/sounds/sound_10.wav +0 -0
  177. package/dist/sounds/sound_11.wav +0 -0
  178. package/dist/sounds/sound_12.wav +0 -0
  179. package/dist/sounds/sound_13.wav +0 -0
  180. package/dist/sounds/sound_14.wav +0 -0
  181. package/dist/sounds/sound_15.wav +0 -0
  182. package/dist/types/interfaces.d.ts +5 -0
  183. package/dist/vendor/p5.min.js +1 -0
  184. package/dist/view/Debugger.d.ts +12 -0
  185. package/dist/view/Debugger.test.d.ts +1 -0
  186. package/dist/view/GameView.d.ts +101 -0
  187. package/dist/view/GameView.test.d.ts +1 -0
  188. package/dist/view/SessionModal.d.ts +12 -0
  189. package/dist/view/SessionModal.test.d.ts +4 -0
  190. package/dist/view/components/layout/ButtonLayout.d.ts +25 -0
  191. package/dist/view/components/layout/ButtonLayout.test.d.ts +1 -0
  192. package/dist/view/components/layout/ContainerLayout.d.ts +23 -0
  193. package/dist/view/components/layout/ContainerLayout.test.d.ts +1 -0
  194. package/dist/view/components/layout/FrameLayout.d.ts +11 -0
  195. package/dist/view/components/layout/FrameLayout.test.d.ts +1 -0
  196. package/dist/view/components/ui/BigButton.d.ts +13 -0
  197. package/dist/view/components/ui/BigButton.test.d.ts +1 -0
  198. package/dist/view/components/ui/Button.d.ts +12 -0
  199. package/dist/view/components/ui/Button.test.d.ts +1 -0
  200. package/dist/view/components/ui/Canvas.d.ts +22 -0
  201. package/dist/view/components/ui/Canvas.test.d.ts +1 -0
  202. package/dist/view/components/ui/SmallButton.d.ts +13 -0
  203. package/dist/view/components/ui/SmallButton.test.d.ts +1 -0
  204. package/dist/view/theme/applyColors.d.ts +10 -0
  205. package/dist/view/theme/applyColors.test.d.ts +1 -0
  206. package/dist/view/theme/dimensions.d.ts +13 -0
  207. package/dist/view/theme/dimensions.test.d.ts +1 -0
  208. package/docs/GAME_DEVELOPER_GUIDE.adoc +167 -0
  209. package/docs/brick-engine-guide.adoc +87 -0
  210. package/docs/diagrams/lifecycle.mmd +19 -0
  211. package/docs/documentation_style_guide.adoc +210 -0
  212. package/docs/getting-started.adoc +147 -0
  213. package/docs/images/lifecycle.svg +1 -0
  214. package/docs/jsdoc_standard.adoc +109 -0
  215. package/docs/publishing.adoc +58 -0
  216. package/docs/reference/enums/Color.adoc +35 -0
  217. package/docs/reference/enums/ControlEventType.adoc +28 -0
  218. package/docs/reference/enums/ControlKey.adoc +34 -0
  219. package/docs/reference/enums/FontAlignment.adoc +43 -0
  220. package/docs/reference/enums/FontSize.adoc +31 -0
  221. package/docs/reference/enums/Sound.adoc +42 -0
  222. package/docs/reference/enums/StateProperty.adoc +33 -0
  223. package/docs/reference/helpers/CellHelper.adoc +37 -0
  224. package/docs/reference/helpers/ControlInputHandlerHelper.adoc +57 -0
  225. package/docs/reference/helpers/CoordinateHelper.adoc +118 -0
  226. package/docs/reference/helpers/RelativeValuesHelper.adoc +53 -0
  227. package/docs/reference/interfaces/Debuggable.adoc +29 -0
  228. package/docs/reference/interfaces/GameModules.adoc +35 -0
  229. package/docs/reference/interfaces/Initializable.adoc +24 -0
  230. package/docs/reference/interfaces/RendererInitializable.adoc +33 -0
  231. package/docs/reference/interfaces/StateSyncable.adoc +41 -0
  232. package/docs/reference/interfaces/modules/Control.adoc +98 -0
  233. package/docs/reference/interfaces/modules/Grid.adoc +411 -0
  234. package/docs/reference/interfaces/modules/Renderer.adoc +34 -0
  235. package/docs/reference/interfaces/modules/RendererComposite.adoc +57 -0
  236. package/docs/reference/interfaces/modules/Score.adoc +107 -0
  237. package/docs/reference/interfaces/modules/Session.adoc +66 -0
  238. package/docs/reference/interfaces/modules/State.adoc +290 -0
  239. package/docs/reference/interfaces/modules/Text.adoc +110 -0
  240. package/docs/reference/interfaces/modules/Time.adoc +119 -0
  241. package/docs/reference/modules/Debugger.adoc +71 -0
  242. package/docs/reference/modules/DisplayRenderer.adoc +55 -0
  243. package/docs/reference/modules/Game.adoc +256 -0
  244. package/docs/reference/modules/GameControl.adoc +139 -0
  245. package/docs/reference/modules/GameGrid.adoc +794 -0
  246. package/docs/reference/modules/GameHudGrid.adoc +38 -0
  247. package/docs/reference/modules/GameMenu.adoc +39 -0
  248. package/docs/reference/modules/GameRenderer.adoc +79 -0
  249. package/docs/reference/modules/GameScore.adoc +138 -0
  250. package/docs/reference/modules/GameSession.adoc +43 -0
  251. package/docs/reference/modules/GameSound.adoc +111 -0
  252. package/docs/reference/modules/GameState.adoc +318 -0
  253. package/docs/reference/modules/GameText.adoc +139 -0
  254. package/docs/reference/modules/GameTime.adoc +141 -0
  255. package/docs/reference/modules/HudRenderer.adoc +56 -0
  256. package/docs/reference/modules/InitialStateSnapshot.adoc +47 -0
  257. package/docs/reference/modules/SessionModal.adoc +34 -0
  258. package/docs/reference/types/Axis.adoc +28 -0
  259. package/docs/reference/types/Cell.adoc +29 -0
  260. package/docs/reference/types/ControlCallback.adoc +23 -0
  261. package/docs/reference/types/Coordinate.adoc +29 -0
  262. package/docs/reference/types/GameEntry.adoc +29 -0
  263. package/docs/reference/types/GameEvent.adoc +29 -0
  264. package/docs/reference/types/Piece.adoc +32 -0
  265. package/docs/reference/types/RendererMetrics.adoc +29 -0
  266. package/docs/reference/types/Vector.adoc +28 -0
  267. package/docs/testing_best_practices.adoc +190 -0
  268. package/eslint.config.mjs +29 -0
  269. package/package.json +54 -0
  270. package/public/CNAME +1 -0
  271. package/public/docs/GAME_DEVELOPER_GUIDE.html +727 -0
  272. package/public/docs/brick-engine-guide.html +610 -0
  273. package/public/docs/diagrams/lifecycle.mmd +19 -0
  274. package/public/docs/documentation_style_guide.html +994 -0
  275. package/public/docs/getting-started.html +648 -0
  276. package/public/docs/images/lifecycle.svg +1 -0
  277. package/public/docs/index.html +593 -0
  278. package/public/docs/jsdoc_standard.html +656 -0
  279. package/public/docs/publishing.html +573 -0
  280. package/public/docs/reference/enums/Color.html +533 -0
  281. package/public/docs/reference/enums/ControlEventType.html +505 -0
  282. package/public/docs/reference/enums/ControlKey.html +529 -0
  283. package/public/docs/reference/enums/FontAlignment.html +545 -0
  284. package/public/docs/reference/enums/FontSize.html +517 -0
  285. package/public/docs/reference/enums/Sound.html +558 -0
  286. package/public/docs/reference/enums/StateProperty.html +525 -0
  287. package/public/docs/reference/helpers/CellHelper.html +520 -0
  288. package/public/docs/reference/helpers/ControlInputHandlerHelper.html +569 -0
  289. package/public/docs/reference/helpers/CoordinateHelper.html +703 -0
  290. package/public/docs/reference/helpers/RelativeValuesHelper.html +560 -0
  291. package/public/docs/reference/interfaces/Debuggable.html +501 -0
  292. package/public/docs/reference/interfaces/GameModules.html +544 -0
  293. package/public/docs/reference/interfaces/Initializable.html +495 -0
  294. package/public/docs/reference/interfaces/RendererInitializable.html +517 -0
  295. package/public/docs/reference/interfaces/StateSyncable.html +542 -0
  296. package/public/docs/reference/interfaces/modules/Control.html +648 -0
  297. package/public/docs/reference/interfaces/modules/Grid.html +1256 -0
  298. package/public/docs/reference/interfaces/modules/Renderer.html +522 -0
  299. package/public/docs/reference/interfaces/modules/RendererComposite.html +577 -0
  300. package/public/docs/reference/interfaces/modules/Score.html +669 -0
  301. package/public/docs/reference/interfaces/modules/Session.html +585 -0
  302. package/public/docs/reference/interfaces/modules/State.html +897 -0
  303. package/public/docs/reference/interfaces/modules/Text.html +668 -0
  304. package/public/docs/reference/interfaces/modules/Time.html +684 -0
  305. package/public/docs/reference/modules/Debugger.html +579 -0
  306. package/public/docs/reference/modules/DisplayRenderer.html +557 -0
  307. package/public/docs/reference/modules/Game.html +909 -0
  308. package/public/docs/reference/modules/GameControl.html +716 -0
  309. package/public/docs/reference/modules/GameGrid.html +1910 -0
  310. package/public/docs/reference/modules/GameHudGrid.html +508 -0
  311. package/public/docs/reference/modules/GameMenu.html +538 -0
  312. package/public/docs/reference/modules/GameRenderer.html +589 -0
  313. package/public/docs/reference/modules/GameScore.html +664 -0
  314. package/public/docs/reference/modules/GameSession.html +533 -0
  315. package/public/docs/reference/modules/GameSound.html +636 -0
  316. package/public/docs/reference/modules/GameState.html +922 -0
  317. package/public/docs/reference/modules/GameText.html +701 -0
  318. package/public/docs/reference/modules/GameTime.html +696 -0
  319. package/public/docs/reference/modules/HudRenderer.html +568 -0
  320. package/public/docs/reference/modules/InitialStateSnapshot.html +557 -0
  321. package/public/docs/reference/modules/SessionModal.html +520 -0
  322. package/public/docs/reference/types/Axis.html +505 -0
  323. package/public/docs/reference/types/Cell.html +514 -0
  324. package/public/docs/reference/types/ControlCallback.html +488 -0
  325. package/public/docs/reference/types/Coordinate.html +510 -0
  326. package/public/docs/reference/types/GameEntry.html +514 -0
  327. package/public/docs/reference/types/GameEvent.html +514 -0
  328. package/public/docs/reference/types/Piece.html +506 -0
  329. package/public/docs/reference/types/RendererMetrics.html +514 -0
  330. package/public/docs/reference/types/Vector.html +509 -0
  331. package/public/docs/testing_best_practices.html +770 -0
  332. package/public/favicon.ico +0 -0
  333. package/public/fonts/digital-7.monoitalic.ttf +0 -0
  334. package/public/images/cell.svg +32 -0
  335. package/public/images/close.png +0 -0
  336. package/public/images/games.png +0 -0
  337. package/public/images/github.png +0 -0
  338. package/public/images/letter-a.png +0 -0
  339. package/public/images/letter-d.png +0 -0
  340. package/public/images/letter-j.png +0 -0
  341. package/public/images/letter-s.png +0 -0
  342. package/public/images/letter-w.png +0 -0
  343. package/public/images/meta-image.png +0 -0
  344. package/public/images/number-1.png +0 -0
  345. package/public/images/number-2.png +0 -0
  346. package/public/images/number-3.png +0 -0
  347. package/public/images/number-4.png +0 -0
  348. package/public/images/number-5.png +0 -0
  349. package/public/images/number-6.png +0 -0
  350. package/public/images/splash.gif +0 -0
  351. package/public/index.html +15 -0
  352. package/public/sounds/sound_00.wav +0 -0
  353. package/public/sounds/sound_01.wav +0 -0
  354. package/public/sounds/sound_02.wav +0 -0
  355. package/public/sounds/sound_03.wav +0 -0
  356. package/public/sounds/sound_04.wav +0 -0
  357. package/public/sounds/sound_05.wav +0 -0
  358. package/public/sounds/sound_06.wav +0 -0
  359. package/public/sounds/sound_07.wav +0 -0
  360. package/public/sounds/sound_08.wav +0 -0
  361. package/public/sounds/sound_09.wav +0 -0
  362. package/public/sounds/sound_10.wav +0 -0
  363. package/public/sounds/sound_11.wav +0 -0
  364. package/public/sounds/sound_12.wav +0 -0
  365. package/public/sounds/sound_13.wav +0 -0
  366. package/public/sounds/sound_14.wav +0 -0
  367. package/public/sounds/sound_15.wav +0 -0
  368. package/public/style/body.css +86 -0
  369. package/public/style/buttons.css +233 -0
  370. package/public/style/debugger.css +117 -0
  371. package/public/style/sessionModal.css +155 -0
  372. package/public/style/sourceCodeAndCommands.css +74 -0
  373. package/public/style/splash.css +13 -0
  374. package/public/style/theme.css +137 -0
  375. package/scripts/generate-diagrams.sh +20 -0
  376. package/scripts/generate-docs.js +111 -0
  377. package/src/client-game.d.ts +1 -0
  378. package/src/config/configs.test.ts +20 -0
  379. package/src/config/configs.ts +197 -0
  380. package/src/config/env.test.ts +59 -0
  381. package/src/config/env.ts +7 -0
  382. package/src/config/styles.ts +5 -0
  383. package/src/core/Game.test.ts +167 -0
  384. package/src/core/Game.ts +307 -0
  385. package/src/core/InitialStateSnapshot.test.ts +51 -0
  386. package/src/core/InitialStateSnapshot.ts +46 -0
  387. package/src/core/helpers/CellHelper.test.ts +33 -0
  388. package/src/core/helpers/CellHelper.ts +21 -0
  389. package/src/core/helpers/ControlInputHandlerHelper.test.ts +116 -0
  390. package/src/core/helpers/ControlInputHandlerHelper.ts +68 -0
  391. package/src/core/helpers/CoordinateHelper.test.ts +113 -0
  392. package/src/core/helpers/CoordinateHelper.ts +82 -0
  393. package/src/core/helpers/InterfaceIdentifierHelper.test.ts +122 -0
  394. package/src/core/helpers/InterfaceIdentifierHelper.ts +43 -0
  395. package/src/core/helpers/RelativeValuesHelper.test.ts +47 -0
  396. package/src/core/helpers/RelativeValuesHelper.ts +29 -0
  397. package/src/core/module/control/GameControl.test.ts +82 -0
  398. package/src/core/module/control/GameControl.ts +142 -0
  399. package/src/core/module/control/GameControlKeyBinding.test.ts +59 -0
  400. package/src/core/module/control/GameControlKeyBinding.ts +92 -0
  401. package/src/core/module/grid/GameGrid.test.ts +83 -0
  402. package/src/core/module/grid/GameGrid.ts +610 -0
  403. package/src/core/module/grid/GameHudGrid.test.ts +22 -0
  404. package/src/core/module/grid/GameHudGrid.ts +40 -0
  405. package/src/core/module/grid/engines/GridAnalysisEngine.test.ts +157 -0
  406. package/src/core/module/grid/engines/GridAnalysisEngine.ts +124 -0
  407. package/src/core/module/grid/engines/GridLineEngine.test.ts +132 -0
  408. package/src/core/module/grid/engines/GridLineEngine.ts +165 -0
  409. package/src/core/module/grid/engines/GridMovementEngine.test.ts +125 -0
  410. package/src/core/module/grid/engines/GridMovementEngine.ts +113 -0
  411. package/src/core/module/grid/engines/GridRegionEngine.test.ts +136 -0
  412. package/src/core/module/grid/engines/GridRegionEngine.ts +52 -0
  413. package/src/core/module/grid/engines/GridTransformEngine.test.ts +98 -0
  414. package/src/core/module/grid/engines/GridTransformEngine.ts +70 -0
  415. package/src/core/module/renderer/DisplayRenderer.test.ts +86 -0
  416. package/src/core/module/renderer/DisplayRenderer.ts +152 -0
  417. package/src/core/module/renderer/GameRenderer.test.ts +103 -0
  418. package/src/core/module/renderer/GameRenderer.ts +144 -0
  419. package/src/core/module/renderer/HudRenderer.test.ts +108 -0
  420. package/src/core/module/renderer/HudRenderer.ts +203 -0
  421. package/src/core/module/score/GameScore.test.ts +71 -0
  422. package/src/core/module/score/GameScore.ts +188 -0
  423. package/src/core/module/session/GameSession.test.ts +176 -0
  424. package/src/core/module/session/GameSession.ts +103 -0
  425. package/src/core/module/sound/GameSound.test.ts +117 -0
  426. package/src/core/module/sound/GameSound.ts +229 -0
  427. package/src/core/module/state/GameState.test.ts +101 -0
  428. package/src/core/module/state/GameState.ts +339 -0
  429. package/src/core/module/text/GameText.test.ts +87 -0
  430. package/src/core/module/text/GameText.ts +150 -0
  431. package/src/core/module/time/GameTime.test.ts +86 -0
  432. package/src/core/module/time/GameTime.ts +144 -0
  433. package/src/core/types/Interfaces.ts +59 -0
  434. package/src/core/types/Types.ts +124 -0
  435. package/src/core/types/enums.ts +113 -0
  436. package/src/core/types/modules.ts +841 -0
  437. package/src/index.test.ts +15 -0
  438. package/src/index.ts +9 -0
  439. package/src/main.test.ts +137 -0
  440. package/src/main.ts +77 -0
  441. package/src/menu/GameMenu.test.ts +157 -0
  442. package/src/menu/GameMenu.ts +124 -0
  443. package/src/menu/GameMenuSingleton.test.ts +26 -0
  444. package/src/menu/GameMenuSingleton.ts +13 -0
  445. package/src/menu/GameRepository.test.ts +46 -0
  446. package/src/menu/GameRepository.ts +47 -0
  447. package/src/menu/manager/GameManager.test.ts +68 -0
  448. package/src/menu/manager/GameManager.ts +50 -0
  449. package/src/types/global.d.ts +8 -0
  450. package/src/types/interfaces.ts +5 -0
  451. package/src/view/Debugger.test.ts +152 -0
  452. package/src/view/Debugger.ts +124 -0
  453. package/src/view/GameView.test.ts +95 -0
  454. package/src/view/GameView.ts +244 -0
  455. package/src/view/SessionModal.test.ts +141 -0
  456. package/src/view/SessionModal.ts +73 -0
  457. package/src/view/components/layout/ButtonLayout.test.ts +28 -0
  458. package/src/view/components/layout/ButtonLayout.ts +63 -0
  459. package/src/view/components/layout/ContainerLayout.test.ts +48 -0
  460. package/src/view/components/layout/ContainerLayout.ts +50 -0
  461. package/src/view/components/layout/FrameLayout.test.ts +24 -0
  462. package/src/view/components/layout/FrameLayout.ts +25 -0
  463. package/src/view/components/ui/BigButton.test.ts +28 -0
  464. package/src/view/components/ui/BigButton.ts +31 -0
  465. package/src/view/components/ui/Button.test.ts +30 -0
  466. package/src/view/components/ui/Button.ts +30 -0
  467. package/src/view/components/ui/Canvas.test.ts +32 -0
  468. package/src/view/components/ui/Canvas.ts +34 -0
  469. package/src/view/components/ui/SmallButton.test.ts +48 -0
  470. package/src/view/components/ui/SmallButton.ts +32 -0
  471. package/src/view/theme/applyColors.test.ts +47 -0
  472. package/src/view/theme/applyColors.ts +38 -0
  473. package/src/view/theme/dimensions.test.ts +34 -0
  474. package/src/view/theme/dimensions.ts +53 -0
  475. package/tsconfig.json +16 -0
  476. package/vitest.config.ts +14 -0
  477. package/webpack.config.js +133 -0
@@ -0,0 +1,723 @@
1
+ import p5 from 'p5';
2
+ import { Color, ControlKey, FontAlign, FontSize, FontVerticalAlign, Sound } from './enums';
3
+ import { Debuggable, Initializable, RendererInitializable, StateSyncable, Serializable } from './Interfaces';
4
+ import { Cell, ControlCallback, ControlEventType, Coordinate, RendererMetrics, GameModules, StateProperty, Vector, Piece, Axis } from './Types';
5
+ /**
6
+ * Interface for a specific rendering layer.
7
+ * Extensions of this interface implement specific drawing logic (e.g., Grid, HUD).
8
+ */
9
+ export interface Renderer extends RendererInitializable {
10
+ /**
11
+ * Renders the visual content for this layer.
12
+ *
13
+ * @param {Cell[][]} grid - The current state of the game grid.
14
+ * @param {GameModules} modules - Access to other engine modules for context (e.g., Score, State).
15
+ */
16
+ render(grid: Cell[][], modules: GameModules): void;
17
+ }
18
+ /**
19
+ * Interface for the composite renderer that manages multiple rendering layers.
20
+ */
21
+ export interface RendererComposite {
22
+ /**
23
+ * Registers a new renderer layer to the composite system.
24
+ *
25
+ * @param {Renderer} renderer - The renderer instance to add.
26
+ */
27
+ addRenderer(renderer: Renderer): void;
28
+ /**
29
+ * Orchestrates the rendering process by delegating to all registered renderers.
30
+ *
31
+ * @param {Cell[][]} grid - The current state of the game grid.
32
+ * @param {GameModules} modules - Access to other engine modules.
33
+ */
34
+ render(grid: Cell[][], modules: GameModules): void;
35
+ /**
36
+ * The calculated display metrics shared across all renderers.
37
+ */
38
+ rendererMetrics: RendererMetrics;
39
+ }
40
+ /**
41
+ * Interface for the text rendering module.
42
+ * Handles font sizing, alignment, and writing text to relative coordinates.
43
+ */
44
+ export interface Text extends Initializable {
45
+ /**
46
+ * Sets the display metrics used for coordinate calculations.
47
+ *
48
+ * @param {RendererMetrics} rendererMetrics - The calculated layout metrics.
49
+ */
50
+ setRendererMetrics(rendererMetrics: RendererMetrics): void;
51
+ /**
52
+ * Sets the text color to the "active" theme color.
53
+ */
54
+ setActiveText(): void;
55
+ /**
56
+ * Sets the text color to the "inactive" theme color.
57
+ */
58
+ setInactiveText(): void;
59
+ /**
60
+ * Sets the current font size.
61
+ *
62
+ * @param {FontSize} fontSize - The desired size enum value.
63
+ */
64
+ setTextSize(fontSize: FontSize): void;
65
+ /**
66
+ * Configures the text alignment settings.
67
+ *
68
+ * @param {FontAlign} fontAlign - The horizontal alignment.
69
+ * @param {FontVerticalAlign} fontVerticalAlign - The vertical alignment.
70
+ */
71
+ setTextAlign(fontAlign: FontAlign, fontVerticalAlign: FontVerticalAlign): void;
72
+ /**
73
+ * Renders text on the HUD area.
74
+ *
75
+ * @param {string} text - The string content to display.
76
+ * @param {Coordinate} coordinate - The normalized position (0.0 to 1.0) within the HUD.
77
+ */
78
+ textOnHud(text: string, coordinate: Coordinate): void;
79
+ /**
80
+ * Renders text on the main display area.
81
+ *
82
+ * @param {string} text - The string content to display.
83
+ * @param {Coordinate} coordinate - The normalized position (0.0 to 1.0) within the Display.
84
+ */
85
+ textOnDisplay(text: string, coordinate: Coordinate): void;
86
+ }
87
+ /**
88
+ * Interface for the grid module.
89
+ * Manages the state and manipulation of the game's cell matrix.
90
+ */
91
+ export interface Grid extends Initializable {
92
+ /**
93
+ * Retrieves the current 2D grid of cells.
94
+ *
95
+ * @returns {Cell[][]} The matrix of cells.
96
+ */
97
+ getGrid(): Cell[][];
98
+ /** The number of columns in the grid. */
99
+ width: number;
100
+ /** The number of rows in the grid. */
101
+ height: number;
102
+ /**
103
+ * Resets the entire grid to its empty state.
104
+ */
105
+ resetGrid(): void;
106
+ /**
107
+ * Iterates over every cell in the grid.
108
+ *
109
+ * @param {function(Cell): void} callback - The function to execute for each cell.
110
+ */
111
+ forEach(callback: (cell: Cell) => void): void;
112
+ /**
113
+ * Validates if a coordinate exists within the grid boundaries.
114
+ *
115
+ * @param {Coordinate} coordinate - The coordinate to check.
116
+ * @returns {boolean} `true` if valid, `false` otherwise.
117
+ */
118
+ isValidCoordinate(coordinate: Coordinate): boolean;
119
+ /**
120
+ * Retrieves a cell at a specific location.
121
+ *
122
+ * @param {Coordinate} coordinate - The location of the cell.
123
+ * @returns {Cell | null} The cell object, or `null` if the coordinate is invalid.
124
+ */
125
+ getCell(coordinate: Coordinate): Cell | null;
126
+ /**
127
+ * Sets the state value of a specific cell.
128
+ *
129
+ * @param {Coordinate} coordinate - The target location.
130
+ * @param {number} value - The new value (0 for empty).
131
+ */
132
+ setCellValue(coordinate: Coordinate, value: number): void;
133
+ /**
134
+ * Sets the color of a specific cell.
135
+ *
136
+ * @param {Coordinate} coordinate - The target location.
137
+ * @param {Color} color - The new color.
138
+ */
139
+ setCellColor(coordinate: Coordinate, color: Color): void;
140
+ /**
141
+ * Checks if a cell is occupied (value > 0).
142
+ *
143
+ * @param {Coordinate} coordinate - The location to check.
144
+ * @returns {boolean} `true` if active.
145
+ */
146
+ isCellActive(coordinate: Coordinate): boolean;
147
+ /**
148
+ * Checks if a cell is empty (value == 0).
149
+ *
150
+ * @param {Coordinate} coordinate - The location to check.
151
+ * @returns {boolean} `true` if inactive.
152
+ */
153
+ isCellInactive(coordinate: Coordinate): boolean;
154
+ /**
155
+ * Checks if a specific row is completely full.
156
+ *
157
+ * @param {number} y - The row index.
158
+ * @returns {boolean} `true` if all cells in the row are active.
159
+ */
160
+ isRowFull(y: number): boolean;
161
+ /**
162
+ * Checks if a specific row is completely empty.
163
+ *
164
+ * @param {number} y - The row index.
165
+ * @returns {boolean} `true` if all cells in the row are inactive.
166
+ */
167
+ isRowEmpty(y: number): boolean;
168
+ /**
169
+ * Clears all cells in a specific row.
170
+ *
171
+ * @param {number} y - The row index.
172
+ */
173
+ clearRow(y: number): void;
174
+ /**
175
+ * Shifts all rows above the specified index down by one.
176
+ *
177
+ * @param {number} fromY - The row index to start from.
178
+ */
179
+ shiftRowsDown(fromY: number): void;
180
+ /**
181
+ * Shifts all rows below the specified index up by one.
182
+ *
183
+ * @param {number} fromY - The row index to start from.
184
+ */
185
+ shiftRowsUp(fromY: number): void;
186
+ /**
187
+ * Detects and clears all full rows, shifting the grid accordingly.
188
+ *
189
+ * @returns {number} The count of rows cleared.
190
+ */
191
+ clearFullRows(): number;
192
+ /**
193
+ * Checks if a specific column is completely full.
194
+ *
195
+ * @param {number} x - The column index.
196
+ * @returns {boolean} `true` if all cells in the column are active.
197
+ */
198
+ isColumnFull(x: number): boolean;
199
+ /**
200
+ * Checks if a specific column is completely empty.
201
+ *
202
+ * @param {number} x - The column index.
203
+ * @returns {boolean} `true` if all cells in the column are inactive.
204
+ */
205
+ isColumnEmpty(x: number): boolean;
206
+ /**
207
+ * Clears all cells in a specific column.
208
+ *
209
+ * @param {number} x - The column index.
210
+ */
211
+ clearColumn(x: number): void;
212
+ /**
213
+ * Shifts all columns to the right of the specified index.
214
+ *
215
+ * @param {number} fromX - The column index to start from.
216
+ */
217
+ shiftColumnsRight(fromX: number): void;
218
+ /**
219
+ * Shifts all columns to the left of the specified index.
220
+ *
221
+ * @param {number} fromX - The column index to start from.
222
+ */
223
+ shiftColumnsLeft(fromX: number): void;
224
+ /**
225
+ * Detects and clears all full columns.
226
+ *
227
+ * @returns {number} The count of columns cleared.
228
+ */
229
+ clearFullColumns(): number;
230
+ /**
231
+ * Checks if any of the provided coordinates are occupied.
232
+ *
233
+ * @param {Coordinate[]} coordinates - The list of coordinates to test.
234
+ * @returns {boolean} `true` if any coordinate is active or invalid.
235
+ */
236
+ isAreaOccupied(coordinates: Coordinate[]): boolean;
237
+ /**
238
+ * Fills a rectangular area with a value and color.
239
+ *
240
+ * @param {Coordinate} start - Top-left coordinate.
241
+ * @param {Coordinate} end - Bottom-right coordinate.
242
+ * @param {number} value - The value to fill.
243
+ * @param {Color} color - The color to fill.
244
+ */
245
+ fillArea(start: Coordinate, end: Coordinate, value: number, color: Color): void;
246
+ /**
247
+ * Updates multiple coordinates simultaneously with their specific values and colors.
248
+ *
249
+ * @param {Piece} piece - The collection of cells to stamp.
250
+ */
251
+ stampPiece(piece: Piece): void;
252
+ /**
253
+ * Updates a single coordinate with a specific value and color from a Cell.
254
+ *
255
+ * @param {Cell} cell - The cell containing coordinate, value and color.
256
+ */
257
+ stampCell(cell: Cell): void;
258
+ /**
259
+ * Attempts to move a piece in a given direction.
260
+ *
261
+ * @param {Piece} piece - The current piece coordinates.
262
+ * @param {Vector} direction - The movement vector.
263
+ * @returns {Piece | null} The new piece or null if blocked.
264
+ */
265
+ movePiece(piece: Piece, direction: Vector): Piece | null;
266
+ /**
267
+ * Attempts to move a piece one unit to the left.
268
+ *
269
+ * @param {Piece} piece - The current piece coordinates.
270
+ * @returns {Piece | null} The new piece or null if blocked.
271
+ */
272
+ movePieceLeft(piece: Piece): Piece | null;
273
+ /**
274
+ * Attempts to move a piece one unit to the right.
275
+ *
276
+ * @param {Piece} piece - The current piece coordinates.
277
+ * @returns {Piece | null} The new piece or null if blocked.
278
+ */
279
+ movePieceRight(piece: Piece): Piece | null;
280
+ /**
281
+ * Attempts to move a piece one unit up.
282
+ *
283
+ * @param {Piece} piece - The current piece coordinates.
284
+ * @returns {Piece | null} The new piece or null if blocked.
285
+ */
286
+ movePieceUp(piece: Piece): Piece | null;
287
+ /**
288
+ * Attempts to move a piece one unit down.
289
+ *
290
+ * @param {Piece} piece - The current piece coordinates.
291
+ * @returns {Piece | null} The new piece or null if blocked.
292
+ */
293
+ movePieceDown(piece: Piece): Piece | null;
294
+ /**
295
+ * Attempts to move a single coordinate in a given direction.
296
+ *
297
+ * @param {Cell} cell - The current cell.
298
+ * @param {Vector} direction - The movement vector.
299
+ * @returns {Cell | null} The new cell or null if blocked.
300
+ */
301
+ moveCell(cell: Cell, direction: Vector): Cell | null;
302
+ /**
303
+ * Attempts to move a single coordinate one unit to the left.
304
+ *
305
+ * @param {Cell} cell - The current cell.
306
+ * @returns {Cell | null} The new cell or null if blocked.
307
+ */
308
+ moveCellLeft(cell: Cell): Cell | null;
309
+ /**
310
+ * Attempts to move a single coordinate one unit to the right.
311
+ *
312
+ * @param {Cell} cell - The current cell.
313
+ * @returns {Cell | null} The new cell or null if blocked.
314
+ */
315
+ moveCellRight(cell: Cell): Cell | null;
316
+ /**
317
+ * Attempts to move a single coordinate one unit up.
318
+ *
319
+ * @param {Cell} cell - The current cell.
320
+ * @returns {Cell | null} The new cell or null if blocked.
321
+ */
322
+ moveCellUp(cell: Cell): Cell | null;
323
+ /**
324
+ * Attempts to move a single coordinate one unit down.
325
+ *
326
+ * @param {Cell} cell - The current cell.
327
+ * @returns {Cell | null} The new cell or null if blocked.
328
+ */
329
+ moveCellDown(cell: Cell): Cell | null;
330
+ /**
331
+ * Attempts to rotate a piece 90 degrees around a specific origin.
332
+ *
333
+ * @param {Piece} piece - The current piece.
334
+ * @param {Coordinate} origin - The center of rotation.
335
+ * @param {boolean} [clockwise=true] - Direction of rotation.
336
+ * @returns {Piece | null} The new piece or null if blocked.
337
+ */
338
+ rotatePiece(piece: Piece, origin: Coordinate, clockwise?: boolean): Piece | null;
339
+ /**
340
+ * Identifies all rows that are completely filled with active cells.
341
+ *
342
+ * @returns {number[]} Array of row indices (y).
343
+ */
344
+ getFullRows(): number[];
345
+ /**
346
+ * Identifies all columns that are completely filled with active cells.
347
+ *
348
+ * @returns {number[]} Array of column indices (x).
349
+ */
350
+ getFullColumns(): number[];
351
+ /**
352
+ * Calculates the final resting position of a piece if it were dropped continuously.
353
+ *
354
+ * @param {Piece} piece - The piece to project.
355
+ * @returns {Piece} The piece at its final vertical resting position.
356
+ */
357
+ getDropPath(piece: Piece): Piece;
358
+ /**
359
+ * Calculates the final resting position of a piece if it were moved continuously upwards.
360
+ *
361
+ * @param {Piece} piece - The piece to project.
362
+ * @returns {Piece} The piece at its highest vertical resting position.
363
+ */
364
+ getRisePath(piece: Piece): Piece;
365
+ /**
366
+ * Calculates the final resting position of a piece if it were moved continuously to the left.
367
+ *
368
+ * @param {Piece} piece - The piece to project.
369
+ * @returns {Piece} The piece at its leftmost resting position.
370
+ */
371
+ getReachPathLeft(piece: Piece): Piece;
372
+ /**
373
+ * Calculates the final resting position of a piece if it were moved continuously to the right.
374
+ *
375
+ * @param {Piece} piece - The piece to project.
376
+ * @returns {Piece} The piece at its rightmost resting position.
377
+ */
378
+ getReachPathRight(piece: Piece): Piece;
379
+ /**
380
+ * Returns the active cells adjacent to a specific coordinate.
381
+ *
382
+ * @param {Coordinate} coord - The center coordinate.
383
+ * @param {boolean} [includeDiagonal=false] - Whether to include 8 neighbors or just 4.
384
+ * @returns {Cell[]} List of neighboring cells.
385
+ */
386
+ getNeighbors(coord: Coordinate, includeDiagonal?: boolean): Cell[];
387
+ /**
388
+ * Finds all connected active cells of the same value starting from a specific coordinate.
389
+ *
390
+ * @param {Coordinate} coord - Starting coordinate.
391
+ * @returns {Piece} Collection of connected cells.
392
+ */
393
+ findConnectedCells(coord: Coordinate): Piece;
394
+ /**
395
+ * Mirrors a piece across a specific axis relative to its bounding box.
396
+ *
397
+ * @param {Piece} piece - The piece to mirror.
398
+ * @param {Axis} axis - The axis to flip across.
399
+ * @returns {Piece} The mirrored piece.
400
+ */
401
+ mirrorPiece(piece: Piece, axis: Axis): Piece;
402
+ /**
403
+ * Swaps the values and colors of two cells.
404
+ *
405
+ * @param {Coordinate} a - First coordinate.
406
+ * @param {Coordinate} b - Second coordinate.
407
+ */
408
+ swapCells(a: Coordinate, b: Coordinate): void;
409
+ }
410
+ /**
411
+ * Interface for the state module.
412
+ * Represents the central hub for game lifecycle and user preferences.
413
+ */
414
+ export interface State extends Initializable {
415
+ /**
416
+ * Checks if the game system is "on" (powered up).
417
+ *
418
+ * @returns {boolean} `true` if the system is on.
419
+ */
420
+ isOn(): boolean;
421
+ /**
422
+ * Checks if the game system is "off" (powered down).
423
+ *
424
+ * @returns {boolean} `true` if the system is off.
425
+ */
426
+ isOff(): boolean;
427
+ /**
428
+ * Checks if a game session has fully started (passed the title screen).
429
+ *
430
+ * @returns {boolean} `true` if gameplay is active or paused.
431
+ */
432
+ isStarted(): boolean;
433
+ /**
434
+ * Checks if the game is currently efficiently playing (logic is updating).
435
+ *
436
+ * @returns {boolean} `true` if playing (not paused).
437
+ */
438
+ isPlaying(): boolean;
439
+ /**
440
+ * Checks if the game is paused.
441
+ *
442
+ * @returns {boolean} `true` if started but not playing.
443
+ */
444
+ isPaused(): boolean;
445
+ /**
446
+ * Checks if the game is in a game over state.
447
+ *
448
+ * @returns {boolean} `true` if the game ended.
449
+ */
450
+ isGameOver(): boolean;
451
+ /**
452
+ * Checks if color rendering is enabled.
453
+ *
454
+ * @returns {boolean} `true` if colors are enabled.
455
+ */
456
+ isColorEnabled(): boolean;
457
+ /**
458
+ * Sets the color rendering preference.
459
+ *
460
+ * @param {boolean} value - The new state.
461
+ */
462
+ setColorEnabled(value: boolean): void;
463
+ /**
464
+ * Checks if audio is globally muted.
465
+ *
466
+ * @returns {boolean} `true` if muted.
467
+ */
468
+ isMuted(): boolean;
469
+ /**
470
+ * Sets the master mute state.
471
+ *
472
+ * @param {boolean} value - The new mute state.
473
+ */
474
+ setMuted(value: boolean): void;
475
+ /**
476
+ * Subscribes to changes in a specific state property.
477
+ *
478
+ * @param {StateProperty} property - The state property to monitor.
479
+ * @param {function(boolean | number): void} callback - The function to execute when the property changes.
480
+ */
481
+ subscribe(property: StateProperty, callback: (value: boolean | number) => void): void;
482
+ /**
483
+ * Unsubscribes a callback from a specific state property.
484
+ *
485
+ * @param {StateProperty} property - The state property being monitored.
486
+ * @param {function(boolean | number): void} callback - The callback reference to remove.
487
+ */
488
+ unsubscribe(property: StateProperty, callback: (value: boolean | number) => void): void;
489
+ /** Turn the game system on. */
490
+ turnOn(): void;
491
+ /** Turn the game system off. */
492
+ turnOff(): void;
493
+ /** Initiate a new game (transition from Title Screen to Gameplay). */
494
+ startGame(): void;
495
+ /** Exit the current game session (transition to Title Screen). */
496
+ exitGame(): void;
497
+ /** Pause the current game logic. */
498
+ pause(): void;
499
+ /** Resume the game logic from a paused state. */
500
+ resume(): void;
501
+ /** Trigger a game over state. */
502
+ triggerGameOver(): void;
503
+ /** Reset the game state flags for a new round (post-Game Over). */
504
+ resetGame(): void;
505
+ /** Toggles the {@link StateProperty.COLOR_ENABLED} state. */
506
+ toggleColorEnabled(): void;
507
+ /** Toggles the {@link StateProperty.MUTED} state. */
508
+ toggleMuted(): void;
509
+ /**
510
+ * Resets the game over state and starts the game again.
511
+ */
512
+ resetGameOver(): void;
513
+ }
514
+ /**
515
+ * Interface for the control module.
516
+ * Manages input handling, binding, and event notification.
517
+ */
518
+ export interface Control extends Initializable {
519
+ /**
520
+ * Triggers a control event manually.
521
+ *
522
+ * @param {ControlKey} key - The key identity.
523
+ * @param {ControlEventType} type - The type of event (press/hold).
524
+ */
525
+ notify(key: ControlKey, type: ControlEventType): void;
526
+ /**
527
+ * Injects the module references required for populating the event context.
528
+ *
529
+ * @param {GameModules} modules - The collection of system modules.
530
+ */
531
+ setModules(modules: GameModules): void;
532
+ /**
533
+ * Registers a callback for a specific control event.
534
+ *
535
+ * @param {ControlKey} key - The key to listen for.
536
+ * @param {ControlEventType} type - The event trigger type.
537
+ * @param {ControlCallback} callback - The function to execute.
538
+ */
539
+ subscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
540
+ /**
541
+ * Removes an existing subscription.
542
+ *
543
+ * @param {ControlKey} key - The key to stop listening for.
544
+ * @param {ControlEventType} type - The event trigger type.
545
+ * @param {ControlCallback} callback - The function reference to remove.
546
+ */
547
+ unsubscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
548
+ /**
549
+ * Detaches all hardware/DOM event listeners.
550
+ */
551
+ unbindControls(): void;
552
+ /**
553
+ * Attaches all hardware/DOM event listeners.
554
+ */
555
+ bindControls(): void;
556
+ }
557
+ /**
558
+ * Interface for the time module.
559
+ * Manages the game loop timing, ticks, and delta time.
560
+ */
561
+ export interface Time extends Initializable {
562
+ /** The interval between logic ticks in milliseconds. */
563
+ tickInterval: number;
564
+ /**
565
+ * Accumulates passed time and calculates FPS/TPS.
566
+ *
567
+ * @param {number} deltaTime - Time elapsed since last frame in milliseconds.
568
+ */
569
+ update(deltaTime: number): void;
570
+ /**
571
+ * Determines if a logic tick should occur based on the accumulator.
572
+ *
573
+ * @returns {boolean} `true` if a tick is due.
574
+ */
575
+ shouldTick(): boolean;
576
+ /**
577
+ * Resets internal time accumulators and counters.
578
+ */
579
+ reset(): void;
580
+ /**
581
+ * Increases the tick interval (slowing down the game logic).
582
+ *
583
+ * @param {number} amount - Milliseconds to add.
584
+ */
585
+ incrementTickInterval(amount: number): void;
586
+ /**
587
+ * Decreases the tick interval (speeding up the game logic).
588
+ *
589
+ * @param {number} amount - Milliseconds to subtract.
590
+ */
591
+ decrementTickInterval(amount: number): void;
592
+ /**
593
+ * Sets the tick interval.
594
+ *
595
+ * @param {number} interval - The new tick interval in milliseconds.
596
+ */
597
+ setTickInterval(interval: number): void;
598
+ /**
599
+ * Sets the minimum tick interval.
600
+ *
601
+ * @param {number} interval - The new minimum tick interval in milliseconds.
602
+ */
603
+ setMinTickInterval(interval: number): void;
604
+ }
605
+ /**
606
+ * Interface for the audio module.
607
+ */
608
+ export interface SoundModule extends Initializable {
609
+ /**
610
+ * Plays a sound effect.
611
+ *
612
+ * @param {Sound} sound - The {@link Sound} enum to play.
613
+ * @returns {Promise<void>} Resolves when playback starts.
614
+ */
615
+ play(sound: Sound): Promise<void>;
616
+ /**
617
+ * Stops all active instances of a specific sound.
618
+ *
619
+ * @param {Sound} sound - The {@link Sound} enum to stop.
620
+ * @returns {Promise<void>} Resolves when stopped.
621
+ */
622
+ stop(sound: Sound): Promise<void>;
623
+ /**
624
+ * Stops all audio playback immediately.
625
+ *
626
+ * @returns {Promise<void>} Resolves when all sounds are stopped.
627
+ */
628
+ stopAll(): Promise<void>;
629
+ /**
630
+ * Toggles the master mute setting.
631
+ */
632
+ toggleMute(): void;
633
+ /** Current master mute state. */
634
+ muted: boolean;
635
+ }
636
+ /**
637
+ * Interface for the time performance monitoring module.
638
+ */
639
+ export interface TimePerformanceMonitor {
640
+ /** Accessor for the enabled state of the monitor. */
641
+ enabled: boolean;
642
+ /**
643
+ * Updates performance calculations.
644
+ *
645
+ * @param {number} deltaTime - Time elapsed since last frame.
646
+ */
647
+ update(deltaTime: number): void;
648
+ /**
649
+ * Records a logic tick occurrence for TPS calculation.
650
+ */
651
+ logTick(): void;
652
+ /**
653
+ * Renders the performance overlay stats.
654
+ *
655
+ * @param {p5} p - The P5 instance to draw on.
656
+ * @param {number} tickInterval - The expected tick interval.
657
+ */
658
+ render(p: p5, tickInterval: number): void;
659
+ }
660
+ /**
661
+ * Interface for the score and progression module.
662
+ */
663
+ export interface Score extends Initializable {
664
+ /** Current session score points. */
665
+ score: number;
666
+ /** Current high score. */
667
+ highScore: number;
668
+ /**
669
+ * Adds points to the score, applying the current multiplier.
670
+ *
671
+ * @param {number} amount - Base points to add.
672
+ */
673
+ increaseScore(amount: number): void;
674
+ /**
675
+ * Resets the score to zero.
676
+ */
677
+ resetScore(): void;
678
+ /**
679
+ * Formats the current score as a padded string.
680
+ *
681
+ * @param {number} [digits] - Total characters (default: 6).
682
+ * @returns {string} The formatted score (e.g., "000100").
683
+ */
684
+ getFormattedScore(digits?: number): string;
685
+ /** Current point multiplier factor. */
686
+ multiplier: number;
687
+ /** Current game difficulty level. */
688
+ level: number;
689
+ /** Maximum allowed game level. */
690
+ maxLevel: number;
691
+ /**
692
+ * Increases the difficulty level.
693
+ *
694
+ * @param {number} amount - Levels to advance.
695
+ */
696
+ increaseLevel(amount: number): void;
697
+ /**
698
+ * Resets the level to the starting value (1).
699
+ */
700
+ resetLevel(): void;
701
+ }
702
+ export interface Session extends StateSyncable, Debuggable {
703
+ gameId: string;
704
+ /**
705
+ * Registers a serializable object to be saved in the session.
706
+ *
707
+ * @param {Serializable} serializable - The object to register.
708
+ */
709
+ register(serializable: Serializable): void;
710
+ /**
711
+ * Creates or updates the current session.
712
+ */
713
+ saveSession(): void;
714
+ /**
715
+ * Clears the current session.
716
+ */
717
+ clearSession(): void;
718
+ /**
719
+ * Sets the function to be called when the session modal should be shown.
720
+ * @param {function} callback - The function to be called.
721
+ */
722
+ setShowModalFunction(showModal: (onConfirm: () => void, onCancel: () => void) => void): void;
723
+ }