brick-engine-js 1.0.21 → 1.0.23

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 (98) hide show
  1. package/README.adoc +2 -2
  2. package/dist/docs/index.html +3 -3
  3. package/dist/docs/jsdoc_standard.html +30 -13
  4. package/dist/docs/reference/bootstrap.html +556 -0
  5. package/dist/docs/reference/context/RendererContext.html +19 -9
  6. package/dist/docs/reference/enums/Color.html +11 -5
  7. package/dist/docs/reference/enums/ControlEventType.html +7 -5
  8. package/dist/docs/reference/enums/ControlKey.html +7 -5
  9. package/dist/docs/reference/enums/EventSuffix.html +7 -5
  10. package/dist/docs/reference/enums/FontAlignment.html +9 -7
  11. package/dist/docs/reference/enums/FontSize.html +7 -5
  12. package/dist/docs/reference/enums/Sound.html +7 -5
  13. package/dist/docs/reference/enums/StateProperty.html +7 -5
  14. package/dist/docs/reference/helpers/CellHelper.html +6 -2
  15. package/dist/docs/reference/helpers/ControlInputHandlerHelper.html +9 -5
  16. package/dist/docs/reference/helpers/CoordinateHelper.html +14 -10
  17. package/dist/docs/reference/helpers/RelativeValuesHelper.html +7 -3
  18. package/dist/docs/reference/interfaces/Debuggable.html +9 -7
  19. package/dist/docs/reference/interfaces/GameModules.html +7 -5
  20. package/dist/docs/reference/interfaces/Initializable.html +9 -7
  21. package/dist/docs/reference/interfaces/RendererInitializable.html +9 -7
  22. package/dist/docs/reference/interfaces/StateContext.html +7 -5
  23. package/dist/docs/reference/interfaces/StateSyncable.html +11 -9
  24. package/dist/docs/reference/interfaces/modules/Control.html +19 -17
  25. package/dist/docs/reference/interfaces/modules/Grid.html +77 -55
  26. package/dist/docs/reference/interfaces/modules/Renderer.html +9 -7
  27. package/dist/docs/reference/interfaces/modules/RendererComposite.html +13 -11
  28. package/dist/docs/reference/interfaces/modules/Score.html +21 -19
  29. package/dist/docs/reference/interfaces/modules/Session.html +64 -18
  30. package/dist/docs/reference/interfaces/modules/State.html +59 -57
  31. package/dist/docs/reference/interfaces/modules/Text.html +21 -19
  32. package/dist/docs/reference/interfaces/modules/Time.html +80 -24
  33. package/dist/docs/reference/modules/Debugger.html +16 -14
  34. package/dist/docs/reference/modules/DisplayRenderer.html +10 -8
  35. package/dist/docs/reference/modules/EventEmitter.html +34 -26
  36. package/dist/docs/reference/modules/Game.html +55 -30
  37. package/dist/docs/reference/modules/GameControl.html +49 -44
  38. package/dist/docs/reference/modules/GameEventRegistry.html +17 -34
  39. package/dist/docs/reference/modules/GameGrid.html +174 -116
  40. package/dist/docs/reference/modules/GameHudGrid.html +10 -8
  41. package/dist/docs/reference/modules/GameRenderer.html +14 -12
  42. package/dist/docs/reference/modules/GameScore.html +36 -34
  43. package/dist/docs/reference/modules/GameSession.html +37 -19
  44. package/dist/docs/reference/modules/GameSound.html +20 -18
  45. package/dist/docs/reference/modules/GameState.html +70 -68
  46. package/dist/docs/reference/modules/GameText.html +29 -27
  47. package/dist/docs/reference/modules/GameTime.html +98 -30
  48. package/dist/docs/reference/modules/HudRenderer.html +10 -8
  49. package/dist/docs/reference/modules/InitialStateSnapshot.html +13 -11
  50. package/dist/docs/reference/modules/SessionModal.html +11 -9
  51. package/dist/docs/reference/types/Axis.html +7 -5
  52. package/dist/docs/reference/types/Cell.html +7 -5
  53. package/dist/docs/reference/types/ControlCallback.html +7 -5
  54. package/dist/docs/reference/types/Coordinate.html +7 -5
  55. package/dist/docs/reference/types/GameEvent.html +7 -5
  56. package/dist/docs/reference/types/Piece.html +7 -5
  57. package/dist/docs/reference/types/RendererMetrics.html +7 -5
  58. package/dist/docs/reference/types/Vector.html +7 -5
  59. package/dist/docs/reference/view/GameView.html +29 -21
  60. package/dist/docs/testing_best_practices.html +2 -2
  61. package/dist/game.bundle.js +1 -1
  62. package/dist/types/bootstrap.d.ts +12 -11
  63. package/dist/types/core/Game.d.ts +46 -39
  64. package/dist/types/core/InitialStateSnapshot.d.ts +18 -6
  65. package/dist/types/core/context/RendererContext.d.ts +32 -10
  66. package/dist/types/core/event/EventEmitter.d.ts +64 -21
  67. package/dist/types/core/event/GameEventRegistry.d.ts +17 -3
  68. package/dist/types/core/helpers/CellHelper.d.ts +11 -4
  69. package/dist/types/core/helpers/ControlInputHandlerHelper.d.ts +20 -11
  70. package/dist/types/core/helpers/CoordinateHelper.d.ts +28 -23
  71. package/dist/types/core/helpers/InterfaceIdentifierHelper.d.ts +34 -0
  72. package/dist/types/core/helpers/RelativeValuesHelper.d.ts +10 -8
  73. package/dist/types/core/module/control/GameControl.d.ts +26 -14
  74. package/dist/types/core/module/grid/GameGrid.d.ts +92 -53
  75. package/dist/types/core/module/grid/GameHudGrid.d.ts +9 -7
  76. package/dist/types/core/module/grid/engines/GridAnalysisEngine.d.ts +25 -6
  77. package/dist/types/core/module/grid/engines/GridLineEngine.d.ts +51 -13
  78. package/dist/types/core/module/grid/engines/GridMovementEngine.d.ts +97 -13
  79. package/dist/types/core/module/grid/engines/GridRegionEngine.d.ts +24 -5
  80. package/dist/types/core/module/grid/engines/GridTransformEngine.d.ts +21 -5
  81. package/dist/types/core/module/renderer/DisplayRenderer.d.ts +27 -15
  82. package/dist/types/core/module/renderer/GameRenderer.d.ts +20 -13
  83. package/dist/types/core/module/renderer/HudRenderer.d.ts +27 -19
  84. package/dist/types/core/module/score/GameScore.d.ts +29 -18
  85. package/dist/types/core/module/session/GameSession.d.ts +56 -0
  86. package/dist/types/core/module/sound/GameSound.d.ts +39 -23
  87. package/dist/types/core/module/state/GameState.d.ts +38 -14
  88. package/dist/types/core/module/text/GameText.d.ts +40 -25
  89. package/dist/types/core/module/time/GameTime.d.ts +52 -18
  90. package/dist/types/core/types/Interfaces.d.ts +15 -0
  91. package/dist/types/core/types/Types.d.ts +1 -0
  92. package/dist/types/core/types/enums.d.ts +2 -1
  93. package/dist/types/core/types/modules.d.ts +214 -45
  94. package/dist/types/view/Debugger.d.ts +23 -0
  95. package/dist/types/view/GameView.d.ts +44 -27
  96. package/dist/types/view/SessionModal.d.ts +24 -0
  97. package/package.json +1 -1
  98. package/dist/CNAME +0 -1
@@ -443,35 +443,38 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
443
443
  <div id="toc" class="toc2">
444
444
  <div id="toctitle">Table of Contents</div>
445
445
  <ul class="sectlevel1">
446
- <li><a href="#properties">1. Properties</a></li>
447
- <li><a href="#api-reference">2. API Reference</a>
446
+ <li><a href="#architectural-purpose">1. Architectural Purpose</a></li>
447
+ <li><a href="#properties">2. Properties</a></li>
448
+ <li><a href="#api-reference">3. API Reference</a>
448
449
  <ul class="sectlevel2">
449
- <li><a href="#addserializableserializable-serializable-void">2.1. <code>addSerializable(serializable: Serializable): void</code></a></li>
450
- <li><a href="#updatedeltatime-number-void">2.2. <code>update(deltaTime: number): void</code></a></li>
451
- <li><a href="#updatedeltatime-number-void-2">2.3. <code>update(deltaTime: number): void</code></a></li>
452
- <li><a href="#render-void">2.4. <code>render(): void</code></a></li>
453
- <li><a href="#setupgame-void">2.5. <code>setupGame(): void</code></a></li>
454
- <li><a href="#drawtitlescreen-void">2.6. <code>drawTitleScreen(): void</code></a></li>
455
- <li><a href="#drawgameoverscreen-void">2.7. <code>drawGameOverScreen(): void</code></a></li>
456
- <li><a href="#destroy-void">2.8. <code>destroy(): void</code></a></li>
450
+ <li><a href="#addserializableserializable-serializable-void">3.1. <code>addSerializable(serializable: Serializable): void</code></a></li>
451
+ <li><a href="#updatedeltatime-number-void">3.2. <code>update(deltaTime: number): void</code></a></li>
452
+ <li><a href="#updatedeltatime-number-void-2">3.3. <code>update(deltaTime: number): void</code></a></li>
453
+ <li><a href="#render-void">3.4. <code>render(): void</code></a></li>
454
+ <li><a href="#setupgame-void">3.5. <code>setupGame(): void</code></a></li>
455
+ <li><a href="#drawtitlescreen-void">3.6. <code>drawTitleScreen(): void</code></a></li>
456
+ <li><a href="#drawgameoverscreen-void">3.7. <code>drawGameOverScreen(): void</code></a></li>
457
+ <li><a href="#reset-void">3.8. <code>reset(): void</code></a></li>
458
+ <li><a href="#destroy-void">3.9. <code>destroy(): void</code></a></li>
457
459
  </ul>
458
460
  </li>
459
- <li><a href="#session-management">3. Session Management</a></li>
460
- <li><a href="#automatic-state-restoration-reset">4. Automatic State Restoration (Reset)</a></li>
461
- <li><a href="#automated-system-controls">5. Automated System Controls</a></li>
461
+ <li><a href="#session-management">4. Session Management</a></li>
462
+ <li><a href="#automatic-state-restoration-reset">5. Automatic State Restoration (Reset)</a></li>
463
+ <li><a href="#automated-system-controls">6. Automated System Controls</a></li>
462
464
  </ul>
463
465
  </div>
464
466
  </div>
465
467
  <div id="content">
466
- <div id="preamble">
468
+ <div class="sect1">
469
+ <h2 id="architectural-purpose"><a class="link" href="#architectural-purpose">1. Architectural Purpose</a></h2>
467
470
  <div class="sectionbody">
468
471
  <div class="paragraph">
469
- <p>The <code>Game</code> class is the heart of your application. It manages the game loop (ticks and frames), initialization of core modules, and integration with P5.js. All games must extend this class.</p>
472
+ <p>The <code>Game</code> class establishes the central integration boundary encapsulating physical logic away from native visual outputs. Acting as the core orchestrator, it explicitly synchronizes frame drawing metrics while processing isolated mathematical model iterations. This architecture guarantees the internal data state remains cleanly decoupled and uncorrupted regardless of overlapping browser interfaces or runtime execution layers.</p>
470
473
  </div>
471
474
  </div>
472
475
  </div>
473
476
  <div class="sect1">
474
- <h2 id="properties"><a class="link" href="#properties">1. Properties</a></h2>
477
+ <h2 id="properties"><a class="link" href="#properties">2. Properties</a></h2>
475
478
  <div class="sectionbody">
476
479
  <table class="tableblock frame-all grid-all stretch">
477
480
  <colgroup>
@@ -500,11 +503,11 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
500
503
  </div>
501
504
  </div>
502
505
  <div class="sect1">
503
- <h2 id="api-reference"><a class="link" href="#api-reference">2. API Reference</a></h2>
506
+ <h2 id="api-reference"><a class="link" href="#api-reference">3. API Reference</a></h2>
504
507
  <div class="sectionbody">
505
508
  <hr>
506
509
  <div class="sect2">
507
- <h3 id="addserializableserializable-serializable-void"><a class="link" href="#addserializableserializable-serializable-void">2.1. <code>addSerializable(serializable: Serializable): void</code></a></h3>
510
+ <h3 id="addserializableserializable-serializable-void"><a class="link" href="#addserializableserializable-serializable-void">3.1. <code>addSerializable(serializable: Serializable): void</code></a></h3>
508
511
  <div class="paragraph">
509
512
  <p>Registers a custom object or module for session persistence.</p>
510
513
  </div>
@@ -539,7 +542,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
539
542
  <hr>
540
543
  </div>
541
544
  <div class="sect2">
542
- <h3 id="updatedeltatime-number-void"><a class="link" href="#updatedeltatime-number-void">2.2. <code>update(deltaTime: number): void</code></a></h3>
545
+ <h3 id="updatedeltatime-number-void"><a class="link" href="#updatedeltatime-number-void">3.2. <code>update(deltaTime: number): void</code></a></h3>
543
546
  <div class="paragraph">
544
547
  <p>Abstract method for processing game logic.</p>
545
548
  </div>
@@ -568,7 +571,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
568
571
  <hr>
569
572
  </div>
570
573
  <div class="sect2">
571
- <h3 id="updatedeltatime-number-void-2"><a class="link" href="#updatedeltatime-number-void-2">2.3. <code>update(deltaTime: number): void</code></a></h3>
574
+ <h3 id="updatedeltatime-number-void-2"><a class="link" href="#updatedeltatime-number-void-2">3.3. <code>update(deltaTime: number): void</code></a></h3>
572
575
  <div class="paragraph">
573
576
  <p>Abstract method for processing game logic.</p>
574
577
  </div>
@@ -614,7 +617,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
614
617
  <hr>
615
618
  </div>
616
619
  <div class="sect2">
617
- <h3 id="render-void"><a class="link" href="#render-void">2.4. <code>render(): void</code></a></h3>
620
+ <h3 id="render-void"><a class="link" href="#render-void">3.4. <code>render(): void</code></a></h3>
618
621
  <div class="paragraph">
619
622
  <p>Abstract method for processing visual frames.</p>
620
623
  </div>
@@ -637,7 +640,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
637
640
  <hr>
638
641
  </div>
639
642
  <div class="sect2">
640
- <h3 id="setupgame-void"><a class="link" href="#setupgame-void">2.5. <code>setupGame(): void</code></a></h3>
643
+ <h3 id="setupgame-void"><a class="link" href="#setupgame-void">3.5. <code>setupGame(): void</code></a></h3>
641
644
  <div class="paragraph">
642
645
  <p>Abstract method for setting up the specific game instance.</p>
643
646
  </div>
@@ -660,7 +663,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
660
663
  <hr>
661
664
  </div>
662
665
  <div class="sect2">
663
- <h3 id="drawtitlescreen-void"><a class="link" href="#drawtitlescreen-void">2.6. <code>drawTitleScreen(): void</code></a></h3>
666
+ <h3 id="drawtitlescreen-void"><a class="link" href="#drawtitlescreen-void">3.6. <code>drawTitleScreen(): void</code></a></h3>
664
667
  <div class="paragraph">
665
668
  <p>Abstract method for rendering the game&#8217;s welcome screen.</p>
666
669
  </div>
@@ -673,7 +676,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
673
676
  <hr>
674
677
  </div>
675
678
  <div class="sect2">
676
- <h3 id="drawgameoverscreen-void"><a class="link" href="#drawgameoverscreen-void">2.7. <code>drawGameOverScreen(): void</code></a></h3>
679
+ <h3 id="drawgameoverscreen-void"><a class="link" href="#drawgameoverscreen-void">3.7. <code>drawGameOverScreen(): void</code></a></h3>
677
680
  <div class="paragraph">
678
681
  <p>Abstract method for rendering the screen after a game ends.</p>
679
682
  </div>
@@ -684,10 +687,29 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
684
687
  <p>Called when the game state is <code>gameOver</code>. Executed as the primary rendering logic during Game Over, replacing the standard <code>render()</code> call to allow for clean menus or high-score displays.</p>
685
688
  </div>
686
689
  <hr>
687
- <hr>
688
690
  </div>
689
691
  <div class="sect2">
690
- <h3 id="destroy-void"><a class="link" href="#destroy-void">2.8. <code>destroy(): void</code></a></h3>
692
+ <h3 id="reset-void"><a class="link" href="#reset-void">3.8. <code>reset(): void</code></a></h3>
693
+ <div class="paragraph">
694
+ <p>Resets the game to its initial state.</p>
695
+ </div>
696
+ <div class="paragraph">
697
+ <p><strong>Behavior</strong></p>
698
+ </div>
699
+ <div class="paragraph">
700
+ <p>This method performs a comprehensive reset of the game, including:
701
+ - Clearing the <code><a href="../interfaces/modules/Grid.html">Grid</a></code>.
702
+ - Resetting the <code><a href="../interfaces/modules/Score.html">Score</a></code> and level.
703
+ - Resetting the <code><a href="../interfaces/modules/Time.html">Time</a></code> accumulators.
704
+ - Clearing the active <code><a href="../interfaces/modules/Session.html">Session</a></code>.
705
+ - Restoring all custom game properties to their post-setup values via the <code><a href="InitialStateSnapshot.html">InitialStateSnapshot</a></code>.</p>
706
+ </div>
707
+ <div class="paragraph">
708
+ <p>This method is called by the <code><a href="GameEventRegistry.html">GameEventRegistry</a></code> during power cycles and manual restarts.</p>
709
+ </div>
710
+ </div>
711
+ <div class="sect2">
712
+ <h3 id="destroy-void"><a class="link" href="#destroy-void">3.9. <code>destroy(): void</code></a></h3>
691
713
  <div class="paragraph">
692
714
  <p>Cleans up the game instance.</p>
693
715
  </div>
@@ -701,7 +723,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
701
723
  </div>
702
724
  </div>
703
725
  <div class="sect1">
704
- <h2 id="session-management"><a class="link" href="#session-management">3. Session Management</a></h2>
726
+ <h2 id="session-management"><a class="link" href="#session-management">4. Session Management</a></h2>
705
727
  <div class="sectionbody">
706
728
  <div class="paragraph">
707
729
  <p>The <code>Game</code> base class automatically orchestrates gameplay sessions by subscribing to system-level <code><a href="GameState.html">GameState</a></code> events:</p>
@@ -709,7 +731,10 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
709
731
  <div class="ulist">
710
732
  <ul>
711
733
  <li>
712
- <p><strong>Restoring Sessions</strong>: When the state changes to <code>PLAYING</code>, the <code>Game</code> checks if there are any active sessions stored for its registered <code>Serializable</code> instances. If an active session is detected, it triggers a UI modal asking the user if they wish to resume their previous session.</p>
734
+ <p><strong>Restoring Sessions</strong>: When the state changes to <code>PLAYING</code>, the <code>Game</code> checks if there are any active sessions stored. If detected, it triggers a UI modal.</p>
735
+ </li>
736
+ <li>
737
+ <p><strong>Loop Blocking</strong>: While the session restoration modal is open (<code>session.isModalOpen()</code>), the engine <strong>completely skips</strong> the <code>draw()</code> loop content (both logic and rendering) to prevent any background interaction while the user is choosing whether to resume. See <code><a href="../interfaces/modules/Session.html">Session</a></code> for more details.</p>
713
738
  </li>
714
739
  <li>
715
740
  <p><strong>Clearing Sessions</strong>: The active session is automatically wiped when the state changes to <code>GAME_OVER</code>, ensuring that players do not resume a lost game.</p>
@@ -719,7 +744,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
719
744
  </div>
720
745
  </div>
721
746
  <div class="sect1">
722
- <h2 id="automatic-state-restoration-reset"><a class="link" href="#automatic-state-restoration-reset">4. Automatic State Restoration (Reset)</a></h2>
747
+ <h2 id="automatic-state-restoration-reset"><a class="link" href="#automatic-state-restoration-reset">5. Automatic State Restoration (Reset)</a></h2>
723
748
  <div class="sectionbody">
724
749
  <div class="paragraph">
725
750
  <p>To provide a seamless developer experience, the <code>Game</code> class implements an internal mechanism to transparently cache and restore custom client properties.</p>
@@ -733,7 +758,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
733
758
  </div>
734
759
  </div>
735
760
  <div class="sect1">
736
- <h2 id="automated-system-controls"><a class="link" href="#automated-system-controls">5. Automated System Controls</a></h2>
761
+ <h2 id="automated-system-controls"><a class="link" href="#automated-system-controls">6. Automated System Controls</a></h2>
737
762
  <div class="sectionbody">
738
763
  <div class="paragraph">
739
764
  <p>The <code>Game</code> base class automatically registers listeners for system-level buttons:</p>
@@ -443,38 +443,40 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
443
443
  <div id="toc" class="toc2">
444
444
  <div id="toctitle">Table of Contents</div>
445
445
  <ul class="sectlevel1">
446
- <li><a href="#supported-keys-controlkey">1. Supported Keys (<code>ControlKey</code>)</a></li>
447
- <li><a href="#api-reference">2. API Reference</a>
446
+ <li><a href="#architectural-purpose">1. Architectural Purpose</a></li>
447
+ <li><a href="#supported-keys-controlkey">2. Supported Keys (<code>ControlKey</code>)</a></li>
448
+ <li><a href="#api-reference">3. API Reference</a>
448
449
  <ul class="sectlevel2">
449
- <li><a href="#subscribekey-controlkey-type-controleventtype-callback-controlcallback-void">2.1. <code>subscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
450
- <li><a href="#unsubscribekey-controlkey-type-controleventtype-callback-controlcallback-void">2.2. <code>unsubscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
451
- <li><a href="#subscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.3. <code>subscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
452
- <li><a href="#unsubscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.4. <code>unsubscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
453
- <li><a href="#subscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.5. <code>subscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
454
- <li><a href="#unsubscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.6. <code>unsubscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
455
- <li><a href="#subscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.7. <code>subscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
456
- <li><a href="#unsubscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.8. <code>unsubscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
457
- <li><a href="#subscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.9. <code>subscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
458
- <li><a href="#unsubscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.10. <code>unsubscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
459
- <li><a href="#bindcontrols-void">2.11. <code>bindControls(): void</code></a></li>
460
- <li><a href="#unbindcontrols-void">2.12. <code>unbindControls(): void</code></a></li>
461
- <li><a href="#notifykey-controlkey-type-controleventtype-void">2.13. <code>notify(key: ControlKey, type: ControlEventType): void</code></a></li>
462
- <li><a href="#getdebugdata-recordstring-string-number-boolean">2.14. <code>getDebugData(): Record&lt;string, string | number | boolean&gt;</code></a></li>
450
+ <li><a href="#subscribekey-controlkey-type-controleventtype-callback-controlcallback-void">3.1. <code>subscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
451
+ <li><a href="#unsubscribekey-controlkey-type-controleventtype-callback-controlcallback-void">3.2. <code>unsubscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
452
+ <li><a href="#subscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.3. <code>subscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
453
+ <li><a href="#unsubscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.4. <code>unsubscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
454
+ <li><a href="#subscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.5. <code>subscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
455
+ <li><a href="#unsubscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.6. <code>unsubscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
456
+ <li><a href="#subscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.7. <code>subscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
457
+ <li><a href="#unsubscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.8. <code>unsubscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
458
+ <li><a href="#subscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.9. <code>subscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
459
+ <li><a href="#unsubscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.10. <code>unsubscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></li>
460
+ <li><a href="#bindcontrols-void">3.11. <code>bindControls(): void</code></a></li>
461
+ <li><a href="#unbindcontrols-void">3.12. <code>unbindControls(): void</code></a></li>
462
+ <li><a href="#notifykey-controlkey-type-controleventtype-void">3.13. <code>notify(key: ControlKey, type: ControlEventType): void</code></a></li>
463
+ <li><a href="#getdebugdata-recordstring-string-number-boolean">3.14. <code>getDebugData(): Record&lt;string, string | number | boolean&gt;</code></a></li>
463
464
  </ul>
464
465
  </li>
465
466
  </ul>
466
467
  </div>
467
468
  </div>
468
469
  <div id="content">
469
- <div id="preamble">
470
+ <div class="sect1">
471
+ <h2 id="architectural-purpose"><a class="link" href="#architectural-purpose">1. Architectural Purpose</a></h2>
470
472
  <div class="sectionbody">
471
473
  <div class="paragraph">
472
- <p>The <code>GameControl</code> module handles user input from physical keyboards and virtual buttons. It provides an event-based system for reacting to player actions.</p>
474
+ <p>The <code>GameControl</code> module functions as the central event bus translating physical browser and hardware DOM inputs into abstract game behaviors. It encapsulates raw environment listeners so distinct module parts can effortlessly subscribe to simplified <code><a href="../enums/ControlKey.html">ControlKey</a></code> hooks. Vitally, it centrally gates input propagation depending intelligently on the global engine <code><a href="GameState.html">GameState</a></code> (e.g. blocking game keys while in modals).</p>
473
475
  </div>
474
476
  </div>
475
477
  </div>
476
478
  <div class="sect1">
477
- <h2 id="supported-keys-controlkey"><a class="link" href="#supported-keys-controlkey">1. Supported Keys (<code>ControlKey</code>)</a></h2>
479
+ <h2 id="supported-keys-controlkey"><a class="link" href="#supported-keys-controlkey">2. Supported Keys (<code>ControlKey</code>)</a></h2>
478
480
  <div class="sectionbody">
479
481
  <div class="paragraph">
480
482
  <p>The engine maps physical keys to virtual engine keys:</p>
@@ -511,10 +513,10 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
511
513
  </div>
512
514
  </div>
513
515
  <div class="sect1">
514
- <h2 id="api-reference"><a class="link" href="#api-reference">2. API Reference</a></h2>
516
+ <h2 id="api-reference"><a class="link" href="#api-reference">3. API Reference</a></h2>
515
517
  <div class="sectionbody">
516
518
  <div class="sect2">
517
- <h3 id="subscribekey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#subscribekey-controlkey-type-controleventtype-callback-controlcallback-void">2.1. <code>subscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
519
+ <h3 id="subscribekey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#subscribekey-controlkey-type-controleventtype-callback-controlcallback-void">3.1. <code>subscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
518
520
  <div class="paragraph">
519
521
  <p>Registers a callback for a specific input event.</p>
520
522
  </div>
@@ -536,17 +538,17 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
536
538
  <tr>
537
539
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>key</code></p></td>
538
540
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlKey.html">ControlKey</a></code></p></td>
539
- <td class="tableblock halign-left valign-top"><p class="tableblock">The virtual key to monitor (e.g., <code>ControlKey.ACTION</code>).</p></td>
541
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The explicit abstract virtual key string mapping to monitor cleanly (e.g., <code>ControlKey.ACTION</code>).</p></td>
540
542
  </tr>
541
543
  <tr>
542
544
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>type</code></p></td>
543
545
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlEventType.html">ControlEventType</a></code></p></td>
544
- <td class="tableblock halign-left valign-top"><p class="tableblock">The type of trigger (<code>PRESSED</code> or <code>HELD</code>).</p></td>
546
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The lifecycle trigger distinction (<code>PRESSED</code> or <code>HELD</code>).</p></td>
545
547
  </tr>
546
548
  <tr>
547
549
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>callback</code></p></td>
548
550
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../types/ControlCallback.html">ControlCallback</a></code></p></td>
549
- <td class="tableblock halign-left valign-top"><p class="tableblock">The function to execute when the event occurs.</p></td>
551
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The injected execution sequence called securely when the payload completes.</p></td>
550
552
  </tr>
551
553
  </tbody>
552
554
  </table>
@@ -569,7 +571,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
569
571
  <hr>
570
572
  </div>
571
573
  <div class="sect2">
572
- <h3 id="unsubscribekey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#unsubscribekey-controlkey-type-controleventtype-callback-controlcallback-void">2.2. <code>unsubscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
574
+ <h3 id="unsubscribekey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#unsubscribekey-controlkey-type-controleventtype-callback-controlcallback-void">3.2. <code>unsubscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
573
575
  <div class="paragraph">
574
576
  <p>Removes an existing subscription.</p>
575
577
  </div>
@@ -591,17 +593,17 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
591
593
  <tr>
592
594
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>key</code></p></td>
593
595
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlKey.html">ControlKey</a></code></p></td>
594
- <td class="tableblock halign-left valign-top"><p class="tableblock">The virtual key.</p></td>
596
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The registered virtual key name.</p></td>
595
597
  </tr>
596
598
  <tr>
597
599
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>type</code></p></td>
598
600
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlEventType.html">ControlEventType</a></code></p></td>
599
- <td class="tableblock halign-left valign-top"><p class="tableblock">The trigger type.</p></td>
601
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The exact behavior trigger.</p></td>
600
602
  </tr>
601
603
  <tr>
602
604
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>callback</code></p></td>
603
605
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../types/ControlCallback.html">ControlCallback</a></code></p></td>
604
- <td class="tableblock halign-left valign-top"><p class="tableblock">The reference to the function to remove.</p></td>
606
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The exact memory reference mapping previously used to construct the subscription block.</p></td>
605
607
  </tr>
606
608
  </tbody>
607
609
  </table>
@@ -614,7 +616,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
614
616
  <hr>
615
617
  </div>
616
618
  <div class="sect2">
617
- <h3 id="subscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#subscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.3. <code>subscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
619
+ <h3 id="subscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#subscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.3. <code>subscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
618
620
  <div class="paragraph">
619
621
  <p>Registers a callback for a specific input event ONLY when the game is on the Title Screen.</p>
620
622
  </div>
@@ -653,14 +655,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
653
655
  <hr>
654
656
  </div>
655
657
  <div class="sect2">
656
- <h3 id="unsubscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#unsubscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.4. <code>unsubscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
658
+ <h3 id="unsubscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#unsubscribefortitlescreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.4. <code>unsubscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
657
659
  <div class="paragraph">
658
660
  <p>Removes an existing Title Screen subscription.</p>
659
661
  </div>
660
662
  <hr>
661
663
  </div>
662
664
  <div class="sect2">
663
- <h3 id="subscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#subscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.5. <code>subscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
665
+ <h3 id="subscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#subscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.5. <code>subscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
664
666
  <div class="paragraph">
665
667
  <p>Registers a callback for a specific input event ONLY when the game is on the Game Over Screen.</p>
666
668
  </div>
@@ -699,28 +701,28 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
699
701
  <hr>
700
702
  </div>
701
703
  <div class="sect2">
702
- <h3 id="unsubscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#unsubscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.6. <code>unsubscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
704
+ <h3 id="unsubscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#unsubscribeforgameoverscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.6. <code>unsubscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
703
705
  <div class="paragraph">
704
706
  <p>Removes an existing Game Over Screen subscription.</p>
705
707
  </div>
706
708
  <hr>
707
709
  </div>
708
710
  <div class="sect2">
709
- <h3 id="subscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#subscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.7. <code>subscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
711
+ <h3 id="subscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#subscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.7. <code>subscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
710
712
  <div class="paragraph">
711
713
  <p>Registers a callback for a specific input event ONLY during active gameplay. This is functionally equivalent to <code>subscribe</code> for control keys, but provides explicit intent.</p>
712
714
  </div>
713
715
  <hr>
714
716
  </div>
715
717
  <div class="sect2">
716
- <h3 id="unsubscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#unsubscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.8. <code>unsubscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
718
+ <h3 id="unsubscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#unsubscribeforplayingscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.8. <code>unsubscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
717
719
  <div class="paragraph">
718
720
  <p>Removes an existing Playing Screen subscription.</p>
719
721
  </div>
720
722
  <hr>
721
723
  </div>
722
724
  <div class="sect2">
723
- <h3 id="subscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#subscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.9. <code>subscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
725
+ <h3 id="subscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#subscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.9. <code>subscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
724
726
  <div class="paragraph">
725
727
  <p>Registers a callback for a specific input event ONLY when the game is in a Paused state.</p>
726
728
  </div>
@@ -759,14 +761,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
759
761
  <hr>
760
762
  </div>
761
763
  <div class="sect2">
762
- <h3 id="unsubscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#unsubscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">2.10. <code>unsubscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
764
+ <h3 id="unsubscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void"><a class="link" href="#unsubscribeforpausedscreenkey-controlkey-type-controleventtype-callback-controlcallback-void">3.10. <code>unsubscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void</code></a></h3>
763
765
  <div class="paragraph">
764
766
  <p>Removes an existing Paused Screen subscription.</p>
765
767
  </div>
766
768
  <hr>
767
769
  </div>
768
770
  <div class="sect2">
769
- <h3 id="bindcontrols-void"><a class="link" href="#bindcontrols-void">2.11. <code>bindControls(): void</code></a></h3>
771
+ <h3 id="bindcontrols-void"><a class="link" href="#bindcontrols-void">3.11. <code>bindControls(): void</code></a></h3>
770
772
  <div class="paragraph">
771
773
  <p>Attaches low-level event listeners to the environment.</p>
772
774
  </div>
@@ -779,7 +781,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
779
781
  <hr>
780
782
  </div>
781
783
  <div class="sect2">
782
- <h3 id="unbindcontrols-void"><a class="link" href="#unbindcontrols-void">2.12. <code>unbindControls(): void</code></a></h3>
784
+ <h3 id="unbindcontrols-void"><a class="link" href="#unbindcontrols-void">3.12. <code>unbindControls(): void</code></a></h3>
783
785
  <div class="paragraph">
784
786
  <p>Detaches all input listeners and clears subscriptions.</p>
785
787
  </div>
@@ -792,7 +794,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
792
794
  <hr>
793
795
  </div>
794
796
  <div class="sect2">
795
- <h3 id="notifykey-controlkey-type-controleventtype-void"><a class="link" href="#notifykey-controlkey-type-controleventtype-void">2.13. <code>notify(key: ControlKey, type: ControlEventType): void</code></a></h3>
797
+ <h3 id="notifykey-controlkey-type-controleventtype-void"><a class="link" href="#notifykey-controlkey-type-controleventtype-void">3.13. <code>notify(key: ControlKey, type: ControlEventType): void</code></a></h3>
796
798
  <div class="paragraph">
797
799
  <p>Manually triggers an input event.</p>
798
800
  </div>
@@ -814,12 +816,12 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
814
816
  <tr>
815
817
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>key</code></p></td>
816
818
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlKey.html">ControlKey</a></code></p></td>
817
- <td class="tableblock halign-left valign-top"><p class="tableblock">The key to notify.</p></td>
819
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The exact abstracted key intent generating the signal.</p></td>
818
820
  </tr>
819
821
  <tr>
820
822
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>type</code></p></td>
821
823
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlEventType.html">ControlEventType</a></code></p></td>
822
- <td class="tableblock halign-left valign-top"><p class="tableblock">The trigger type to simulate.</p></td>
824
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The physical user behavior type causing the event (e.g., <code>PRESSED</code>).</p></td>
823
825
  </tr>
824
826
  </tbody>
825
827
  </table>
@@ -827,11 +829,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
827
829
  <p><strong>Behavior</strong></p>
828
830
  </div>
829
831
  <div class="paragraph">
830
- <p>Executes all callbacks associated with the given key and event type, subject to the following state-based rules:</p>
832
+ <p>Executes all callbacks associated with the given key and event type, subject to the following logic:</p>
831
833
  </div>
832
834
  <div class="ulist">
833
835
  <ul>
834
836
  <li>
837
+ <p><strong>Session Modal / Unresolved (<code>isModalOpen() || !isSessionResolved()</code>)</strong>: All inputs are BLOCKED to prevent interactions while the user is making a session restoration choice via the <code><a href="../interfaces/modules/Session.html">Session</a></code> module.</p>
838
+ </li>
839
+ <li>
835
840
  <p><strong>System Off (<code>isOff()</code>)</strong>: Only the <code><a href="../enums/ControlKey.html">POWER</a></code> key is processed. All other keys are ignored.</p>
836
841
  </li>
837
842
  <li>
@@ -843,12 +848,12 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
843
848
  </ul>
844
849
  </div>
845
850
  <div class="paragraph">
846
- <p><strong>Throws an error</strong> if the game modules have not been initialized. It is primarily used internally by the input handler but can be used for automated testing or input simulation.</p>
851
+ <p><strong>Throws an error</strong> if the game modules have not been initialized.</p>
847
852
  </div>
848
853
  <hr>
849
854
  </div>
850
855
  <div class="sect2">
851
- <h3 id="getdebugdata-recordstring-string-number-boolean"><a class="link" href="#getdebugdata-recordstring-string-number-boolean">2.14. <code>getDebugData(): Record&lt;string, string | number | boolean&gt;</code></a></h3>
856
+ <h3 id="getdebugdata-recordstring-string-number-boolean"><a class="link" href="#getdebugdata-recordstring-string-number-boolean">3.14. <code>getDebugData(): Record&lt;string, string | number | boolean&gt;</code></a></h3>
852
857
  <div class="paragraph">
853
858
  <p>Returns metadata for the real-time debugger.</p>
854
859
  </div>
@@ -443,27 +443,28 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
443
443
  <div id="toc" class="toc2">
444
444
  <div id="toctitle">Table of Contents</div>
445
445
  <ul class="sectlevel1">
446
- <li><a href="#core-responsibilities">1. Core Responsibilities</a></li>
447
- <li><a href="#api-reference">2. API Reference</a>
446
+ <li><a href="#architectural-purpose">1. Architectural Purpose</a></li>
447
+ <li><a href="#core-responsibilities">2. Core Responsibilities</a></li>
448
+ <li><a href="#api-reference">3. API Reference</a>
448
449
  <ul class="sectlevel2">
449
- <li><a href="#setupcontroleventsmodules-gamemodules-onreset-void-void">2.1. <code>setupControlEvents(modules: GameModules, onReset: () &#8658; void): void</code></a></li>
450
- <li><a href="#setupstateeventsmodules-gamemodules-void">2.2. <code>setupStateEvents(modules: GameModules): void</code></a></li>
450
+ <li><a href="#setupcontroleventsmodules-gamemodules-onreset-void-void">3.1. <code>setupControlEvents(modules: GameModules, onReset: () &#8658; void): void</code></a></li>
451
+ <li><a href="#setupstateeventsmodules-gamemodules-void">3.2. <code>setupStateEvents(modules: GameModules): void</code></a></li>
451
452
  </ul>
452
453
  </li>
453
- <li><a href="#internal-reset-logic">3. Internal Reset Logic</a></li>
454
454
  </ul>
455
455
  </div>
456
456
  </div>
457
457
  <div id="content">
458
- <div id="preamble">
458
+ <div class="sect1">
459
+ <h2 id="architectural-purpose"><a class="link" href="#architectural-purpose">1. Architectural Purpose</a></h2>
459
460
  <div class="sectionbody">
460
461
  <div class="paragraph">
461
- <p>The <code>GameEventRegistry</code> is a static helper class that centralizes the logic for system-level event subscriptions. It ensures a consistent behavior for power management, game resets, and state transitions across the engine.</p>
462
+ <p>The <code>GameEventRegistry</code> is a static helper class that centralizes the logic for system-level event subscriptions. By moving these registrations out of the core Game class, it maintains a clean startup sequence and ensures that all modules remain decoupled while still reacting systematically to global lifecycle changes like turning on/off or Game Over.</p>
462
463
  </div>
463
464
  </div>
464
465
  </div>
465
466
  <div class="sect1">
466
- <h2 id="core-responsibilities"><a class="link" href="#core-responsibilities">1. Core Responsibilities</a></h2>
467
+ <h2 id="core-responsibilities"><a class="link" href="#core-responsibilities">2. Core Responsibilities</a></h2>
467
468
  <div class="sectionbody">
468
469
  <div class="olist arabic">
469
470
  <ol class="arabic">
@@ -485,12 +486,12 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
485
486
  </div>
486
487
  </div>
487
488
  <div class="sect1">
488
- <h2 id="api-reference"><a class="link" href="#api-reference">2. API Reference</a></h2>
489
+ <h2 id="api-reference"><a class="link" href="#api-reference">3. API Reference</a></h2>
489
490
  <div class="sectionbody">
490
491
  <div class="sect2">
491
- <h3 id="setupcontroleventsmodules-gamemodules-onreset-void-void"><a class="link" href="#setupcontroleventsmodules-gamemodules-onreset-void-void">2.1. <code>setupControlEvents(modules: GameModules, onReset: () &#8658; void): void</code></a></h3>
492
+ <h3 id="setupcontroleventsmodules-gamemodules-onreset-void-void"><a class="link" href="#setupcontroleventsmodules-gamemodules-onreset-void-void">3.1. <code>setupControlEvents(modules: GameModules, onReset: () &#8658; void): void</code></a></h3>
492
493
  <div class="paragraph">
493
- <p>Sets up all system-level control event subscriptions.</p>
494
+ <p>Sets up all system-level control event subscriptions. Injects handlers for core game hardware button mappings like power cycling, resetting the active game, unpausing, or modifying hardware toggles like sound and color.</p>
494
495
  </div>
495
496
  <div class="paragraph">
496
497
  <p><strong>Parameters</strong></p>
@@ -510,12 +511,12 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
510
511
  <tr>
511
512
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>modules</code></p></td>
512
513
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../types/GameModules.html">GameModules</a></code></p></td>
513
- <td class="tableblock halign-left valign-top"><p class="tableblock">The collection of engine modules.</p></td>
514
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The collection of initialized game modules to bind.</p></td>
514
515
  </tr>
515
516
  <tr>
516
517
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>onReset</code></p></td>
517
518
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>Function</code></p></td>
518
- <td class="tableblock halign-left valign-top"><p class="tableblock">Callback to restore the initial state of the game instance.</p></td>
519
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Callback to be executed immediately to restore the initial properties of the game instance during soft resets.</p></td>
519
520
  </tr>
520
521
  </tbody>
521
522
  </table>
@@ -533,9 +534,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
533
534
  <hr>
534
535
  </div>
535
536
  <div class="sect2">
536
- <h3 id="setupstateeventsmodules-gamemodules-void"><a class="link" href="#setupstateeventsmodules-gamemodules-void">2.2. <code>setupStateEvents(modules: GameModules): void</code></a></h3>
537
+ <h3 id="setupstateeventsmodules-gamemodules-void"><a class="link" href="#setupstateeventsmodules-gamemodules-void">3.2. <code>setupStateEvents(modules: GameModules): void</code></a></h3>
537
538
  <div class="paragraph">
538
- <p>Sets up all system-level state property subscriptions.</p>
539
+ <p>Sets up all system-level state property subscriptions. Binds lifecycle behaviors to state property changes, such as clearing current session data upon encountering Game Over, or fully purging rendering/grid variables when the system is virtually powered down.</p>
539
540
  </div>
540
541
  <div class="paragraph">
541
542
  <p><strong>Parameters</strong></p>
@@ -555,7 +556,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
555
556
  <tr>
556
557
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>modules</code></p></td>
557
558
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../types/GameModules.html">GameModules</a></code></p></td>
558
- <td class="tableblock halign-left valign-top"><p class="tableblock">The collection of engine modules.</p></td>
559
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The structured collection of engine modules.</p></td>
559
560
  </tr>
560
561
  </tbody>
561
562
  </table>
@@ -571,24 +572,6 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
571
572
  </div>
572
573
  </div>
573
574
  </div>
574
- <div class="sect1">
575
- <h2 id="internal-reset-logic"><a class="link" href="#internal-reset-logic">3. Internal Reset Logic</a></h2>
576
- <div class="sectionbody">
577
- <div class="paragraph">
578
- <p>The registry uses private methods to ensure data consistency during resets:</p>
579
- </div>
580
- <div class="ulist">
581
- <ul>
582
- <li>
583
- <p><strong><code>resetModules</code></strong>: Resets <code>Grid</code>, <code>Score</code>, <code>Level</code>, and <code>Time</code> to their defaults.</p>
584
- </li>
585
- <li>
586
- <p><strong><code>fullReset</code></strong>: Combines <code>resetModules</code> with <code>Session</code> clearing and execution of the <code>onReset</code> callback.</p>
587
- </li>
588
- </ul>
589
- </div>
590
- </div>
591
- </div>
592
575
  </div>
593
576
  <div id="footer">
594
577
  <div id="footer-text">