brick-engine-js 1.0.16 → 1.0.18

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 (53) hide show
  1. package/README.adoc +7 -2
  2. package/dist/docs/getting-started.html +1 -1
  3. package/dist/docs/index.html +17 -1
  4. package/dist/docs/publishing.html +1 -1
  5. package/dist/docs/reference/context/RendererContext.html +584 -0
  6. package/dist/docs/reference/{types/GameEntry.html → enums/EventSuffix.html} +21 -22
  7. package/dist/docs/reference/helpers/CoordinateHelper.html +10 -35
  8. package/dist/docs/reference/helpers/RelativeValuesHelper.html +4 -14
  9. package/dist/docs/reference/interfaces/GameModules.html +14 -9
  10. package/dist/docs/reference/{modules/GameMenu.html → interfaces/StateContext.html} +50 -71
  11. package/dist/docs/reference/interfaces/modules/Score.html +6 -6
  12. package/dist/docs/reference/interfaces/modules/Session.html +31 -1
  13. package/dist/docs/reference/modules/EventEmitter.html +624 -0
  14. package/dist/docs/reference/modules/Game.html +18 -136
  15. package/dist/docs/reference/modules/GameControl.html +170 -9
  16. package/dist/docs/reference/modules/GameEventRegistry.html +605 -0
  17. package/dist/docs/reference/modules/GameScore.html +40 -10
  18. package/dist/docs/reference/modules/GameSession.html +37 -7
  19. package/dist/docs/reference/modules/GameState.html +119 -6
  20. package/dist/docs/reference/modules/InitialStateSnapshot.html +5 -2
  21. package/dist/docs/reference/view/GameView.html +606 -0
  22. package/dist/game.bundle.js +1 -1
  23. package/dist/types/bootstrap.d.ts +1 -1
  24. package/dist/types/core/Game.d.ts +16 -5
  25. package/dist/types/core/context/RendererContext.d.ts +25 -0
  26. package/dist/types/core/context/RendererContext.test.d.ts +1 -0
  27. package/dist/types/core/event/EventEmitter.d.ts +71 -0
  28. package/dist/types/core/event/EventEmitter.test.d.ts +1 -0
  29. package/dist/types/core/event/GameEventRegistry.d.ts +28 -0
  30. package/dist/types/core/event/GameEventRegistry.test.d.ts +1 -0
  31. package/dist/types/core/helpers/CoordinateHelper.d.ts +5 -11
  32. package/dist/types/core/helpers/RelativeValuesHelper.d.ts +2 -5
  33. package/dist/types/core/module/control/GameControl.d.ts +11 -15
  34. package/dist/types/core/module/renderer/DisplayRenderer.d.ts +0 -8
  35. package/dist/types/core/module/renderer/GameRenderer.d.ts +0 -8
  36. package/dist/types/core/module/renderer/HudRenderer.d.ts +0 -8
  37. package/dist/types/core/module/score/GameScore.d.ts +5 -3
  38. package/dist/types/core/module/session/GameSession.d.ts +0 -1
  39. package/dist/types/core/module/state/GameState.d.ts +12 -16
  40. package/dist/types/core/module/text/GameText.d.ts +0 -9
  41. package/dist/types/core/types/modules.d.ts +77 -7
  42. package/dist/types/index.d.ts +2 -0
  43. package/dist/types/view/Debugger.d.ts +1 -3
  44. package/dist/types/view/GameView.d.ts +1 -2
  45. package/dist/types/view/SessionModal.d.ts +1 -3
  46. package/dist/types/view/components/layout/ButtonLayout.d.ts +1 -1
  47. package/dist/types/view/components/layout/ContainerLayout.d.ts +1 -1
  48. package/dist/types/view/components/layout/FrameLayout.d.ts +1 -1
  49. package/dist/types/view/components/ui/BigButton.d.ts +1 -1
  50. package/dist/types/view/components/ui/Button.d.ts +1 -1
  51. package/dist/types/view/components/ui/Canvas.d.ts +1 -1
  52. package/dist/types/view/components/ui/SmallButton.d.ts +1 -1
  53. package/package.json +1 -1
@@ -448,19 +448,16 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
448
448
  <ul class="sectlevel2">
449
449
  <li><a href="#addserializableserializable-serializable-void">2.1. <code>addSerializable(serializable: Serializable): void</code></a></li>
450
450
  <li><a href="#updatedeltatime-number-void">2.2. <code>update(deltaTime: number): void</code></a></li>
451
- <li><a href="#setswitchhandlerhandler-newgame-game-void-void">2.3. <code>setSwitchHandler(handler: (newGame: Game) &#8658; void): void</code></a></li>
452
- <li><a href="#propagateswitchhandlergame-game-void">2.4. <code>propagateSwitchHandler(game: Game): void</code></a></li>
453
- <li><a href="#updatedeltatime-number-void-2">2.5. <code>update(deltaTime: number): void</code></a></li>
454
- <li><a href="#render-void">2.6. <code>render(): void</code></a></li>
455
- <li><a href="#setupgame-void">2.7. <code>setupGame(): void</code></a></li>
456
- <li><a href="#drawtitlescreen-void">2.8. <code>drawTitleScreen(): void</code></a></li>
457
- <li><a href="#drawgameoverscreen-void">2.9. <code>drawGameOverScreen(): void</code></a></li>
458
- <li><a href="#switchgamenewgame-game-void">2.10. <code>switchGame(newGame: Game): void</code></a></li>
459
- <li><a href="#destroy-void">2.11. <code>destroy(): 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>
460
457
  </ul>
461
458
  </li>
462
459
  <li><a href="#session-management">3. Session Management</a></li>
463
- <li><a href="#client-state-snapshot-reset">4. Client State Snapshot (Reset)</a></li>
460
+ <li><a href="#automatic-state-restoration-reset">4. Automatic State Restoration (Reset)</a></li>
464
461
  <li><a href="#automated-system-controls">5. Automated System Controls</a></li>
465
462
  </ul>
466
463
  </div>
@@ -469,7 +466,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
469
466
  <div id="preamble">
470
467
  <div class="sectionbody">
471
468
  <div class="paragraph">
472
- <p>The <code>Game</code> class is the heart of your application. It manages the game loop (ticks and frames), initialization of core modules, session restoration, and integration with P5.js. All games must extend this class.</p>
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>
473
470
  </div>
474
471
  </div>
475
472
  </div>
@@ -571,72 +568,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
571
568
  <hr>
572
569
  </div>
573
570
  <div class="sect2">
574
- <h3 id="setswitchhandlerhandler-newgame-game-void-void"><a class="link" href="#setswitchhandlerhandler-newgame-game-void-void">2.3. <code>setSwitchHandler(handler: (newGame: Game) &#8658; void): void</code></a></h3>
575
- <div class="paragraph">
576
- <p>Registers the callback to be used when a game requests to switch to another game.</p>
577
- </div>
578
- <div class="paragraph">
579
- <p><strong>Parameters</strong></p>
580
- </div>
581
- <table class="tableblock frame-all grid-all stretch">
582
- <colgroup>
583
- <col style="width: 20%;">
584
- <col style="width: 20%;">
585
- <col style="width: 60%;">
586
- </colgroup>
587
- <tbody>
588
- <tr>
589
- <td class="tableblock halign-left valign-top"><p class="tableblock"><code>handler</code></p></td>
590
- <td class="tableblock halign-left valign-top"><p class="tableblock"><code>Function</code></p></td>
591
- <td class="tableblock halign-left valign-top"><p class="tableblock">The callback function receiving the target <code><a href="../modules/Game.html">Game</a></code> instance.</p></td>
592
- </tr>
593
- </tbody>
594
- </table>
595
- <div class="paragraph">
596
- <p><strong>Behavior</strong></p>
597
- </div>
598
- <div class="paragraph">
599
- <p>This method is used by the engine orchestrator (typically in <code>main.ts</code>) to define how game switches should be handled (e.g., re-binding controls, resetting the debugger). It allows the <code>Game</code> class to remain decoupled from the specific implementation of the menu or other games.</p>
600
- </div>
601
- <hr>
602
- </div>
603
- <div class="sect2">
604
- <h3 id="propagateswitchhandlergame-game-void"><a class="link" href="#propagateswitchhandlergame-game-void">2.4. <code>propagateSwitchHandler(game: Game): void</code></a></h3>
605
- <div class="paragraph">
606
- <p>Copies the active switch handler from one game instance to another.</p>
607
- </div>
608
- <div class="paragraph">
609
- <p><strong>Parameters</strong></p>
610
- </div>
611
- <table class="tableblock frame-all grid-all stretch">
612
- <colgroup>
613
- <col style="width: 20%;">
614
- <col style="width: 20%;">
615
- <col style="width: 60%;">
616
- </colgroup>
617
- <tbody>
618
- <tr>
619
- <td class="tableblock halign-left valign-top"><p class="tableblock">Name</p></td>
620
- <td class="tableblock halign-left valign-top"><p class="tableblock">Type</p></td>
621
- <td class="tableblock halign-left valign-top"><p class="tableblock">Description</p></td>
622
- </tr>
623
- <tr>
624
- <td class="tableblock halign-left valign-top"><p class="tableblock"><code>game</code></p></td>
625
- <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../modules/Game.html">Game</a></code></p></td>
626
- <td class="tableblock halign-left valign-top"><p class="tableblock">The source game instance providing the handler.</p></td>
627
- </tr>
628
- </tbody>
629
- </table>
630
- <div class="paragraph">
631
- <p><strong>Behavior</strong></p>
632
- </div>
633
- <div class="paragraph">
634
- <p>Ensures continuity of the orchestration logic during a switch. When a new game is instantiated and about to become active, this method is called to pass the <code>_switchHandler</code> from the current <code>activeGame</code> to the new one.</p>
635
- </div>
636
- <hr>
637
- </div>
638
- <div class="sect2">
639
- <h3 id="updatedeltatime-number-void-2"><a class="link" href="#updatedeltatime-number-void-2">2.5. <code>update(deltaTime: number): void</code></a></h3>
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>
640
572
  <div class="paragraph">
641
573
  <p>Abstract method for processing game logic.</p>
642
574
  </div>
@@ -682,7 +614,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
682
614
  <hr>
683
615
  </div>
684
616
  <div class="sect2">
685
- <h3 id="render-void"><a class="link" href="#render-void">2.6. <code>render(): void</code></a></h3>
617
+ <h3 id="render-void"><a class="link" href="#render-void">2.4. <code>render(): void</code></a></h3>
686
618
  <div class="paragraph">
687
619
  <p>Abstract method for processing visual frames.</p>
688
620
  </div>
@@ -705,7 +637,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
705
637
  <hr>
706
638
  </div>
707
639
  <div class="sect2">
708
- <h3 id="setupgame-void"><a class="link" href="#setupgame-void">2.7. <code>setupGame(): void</code></a></h3>
640
+ <h3 id="setupgame-void"><a class="link" href="#setupgame-void">2.5. <code>setupGame(): void</code></a></h3>
709
641
  <div class="paragraph">
710
642
  <p>Abstract method for setting up the specific game instance.</p>
711
643
  </div>
@@ -728,7 +660,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
728
660
  <hr>
729
661
  </div>
730
662
  <div class="sect2">
731
- <h3 id="drawtitlescreen-void"><a class="link" href="#drawtitlescreen-void">2.8. <code>drawTitleScreen(): void</code></a></h3>
663
+ <h3 id="drawtitlescreen-void"><a class="link" href="#drawtitlescreen-void">2.6. <code>drawTitleScreen(): void</code></a></h3>
732
664
  <div class="paragraph">
733
665
  <p>Abstract method for rendering the game&#8217;s welcome screen.</p>
734
666
  </div>
@@ -741,7 +673,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
741
673
  <hr>
742
674
  </div>
743
675
  <div class="sect2">
744
- <h3 id="drawgameoverscreen-void"><a class="link" href="#drawgameoverscreen-void">2.9. <code>drawGameOverScreen(): void</code></a></h3>
676
+ <h3 id="drawgameoverscreen-void"><a class="link" href="#drawgameoverscreen-void">2.7. <code>drawGameOverScreen(): void</code></a></h3>
745
677
  <div class="paragraph">
746
678
  <p>Abstract method for rendering the screen after a game ends.</p>
747
679
  </div>
@@ -752,60 +684,10 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
752
684
  <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>
753
685
  </div>
754
686
  <hr>
755
- </div>
756
- <div class="sect2">
757
- <h3 id="switchgamenewgame-game-void"><a class="link" href="#switchgamenewgame-game-void">2.10. <code>switchGame(newGame: Game): void</code></a></h3>
758
- <div class="paragraph">
759
- <p>Switches execution to a new game instance.</p>
760
- </div>
761
- <div class="paragraph">
762
- <p><strong>Parameters</strong></p>
763
- </div>
764
- <table class="tableblock frame-all grid-all stretch">
765
- <colgroup>
766
- <col style="width: 20%;">
767
- <col style="width: 20%;">
768
- <col style="width: 60%;">
769
- </colgroup>
770
- <tbody>
771
- <tr>
772
- <td class="tableblock halign-left valign-top"><p class="tableblock">Name</p></td>
773
- <td class="tableblock halign-left valign-top"><p class="tableblock">Type</p></td>
774
- <td class="tableblock halign-left valign-top"><p class="tableblock">Description</p></td>
775
- </tr>
776
- <tr>
777
- <td class="tableblock halign-left valign-top"><p class="tableblock"><code>newGame</code></p></td>
778
- <td class="tableblock halign-left valign-top"><p class="tableblock"><code>Game</code></p></td>
779
- <td class="tableblock halign-left valign-top"><p class="tableblock">The instance of the new game class to load.</p></td>
780
- </tr>
781
- </tbody>
782
- </table>
783
- <div class="paragraph">
784
- <p><strong>Behavior</strong></p>
785
- </div>
786
- <div class="paragraph">
787
- <p>Destroys the current game instance (cleaning up listeners and stopping sound) and passes the new instance to the registered <code>_switchHandler</code>. This is the core mechanism for moving between different games or menus.</p>
788
- </div>
789
- <div class="quoteblock">
790
- <blockquote>
791
- <div class="paragraph">
792
- <p>[!NOTE]
793
- The switch handler must be set or propagated before calling this method, otherwise an error will be logged.</p>
794
- </div>
795
- </blockquote>
796
- </div>
797
- <div class="paragraph">
798
- <p><strong>Example</strong></p>
799
- </div>
800
- <div class="listingblock">
801
- <div class="content">
802
- <pre class="highlightjs highlight"><code class="language-typescript hljs" data-lang="typescript">this.switchGame(new MyOtherGame(this.p, this.view));</code></pre>
803
- </div>
804
- </div>
805
687
  <hr>
806
688
  </div>
807
689
  <div class="sect2">
808
- <h3 id="destroy-void"><a class="link" href="#destroy-void">2.11. <code>destroy(): void</code></a></h3>
690
+ <h3 id="destroy-void"><a class="link" href="#destroy-void">2.8. <code>destroy(): void</code></a></h3>
809
691
  <div class="paragraph">
810
692
  <p>Cleans up the game instance.</p>
811
693
  </div>
@@ -837,16 +719,16 @@ The switch handler must be set or propagated before calling this method, otherwi
837
719
  </div>
838
720
  </div>
839
721
  <div class="sect1">
840
- <h2 id="client-state-snapshot-reset"><a class="link" href="#client-state-snapshot-reset">4. Client State Snapshot (Reset)</a></h2>
722
+ <h2 id="automatic-state-restoration-reset"><a class="link" href="#automatic-state-restoration-reset">4. Automatic State Restoration (Reset)</a></h2>
841
723
  <div class="sectionbody">
842
724
  <div class="paragraph">
843
725
  <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>
844
726
  </div>
845
727
  <div class="paragraph">
846
- <p>When a game is instantiated and its <code>setupGame()</code> method is invoked, the base <code>Game</code> orchestrates a capture of the client&#8217;s custom properties using the <code><a href="InitialStateSnapshot.html">InitialStateSnapshot</a></code> utility. This ensures that any attributes added by the developer (e.g., player lives, custom counters) are saved in memory without requiring manual implementation.</p>
728
+ <p>When a game is instantiated and its <code>setupGame()</code> method is invoked, the base <code>Game</code> automatically captures a snapshot of the client&#8217;s custom properties. This ensures that any attributes added by the developer (e.g., player lives, custom counters, or game-specific flags) are saved in memory without requiring manual implementation.</p>
847
729
  </div>
848
730
  <div class="paragraph">
849
- <p>When the user triggers a <strong>RESET</strong> action, the <code>Game</code> class automatically uses this internal snapshot to restore the custom properties back to their original values, eliminating the need for developers to manually reset their own state variables.</p>
731
+ <p>When a <strong>RESET</strong> action is triggered, the <code>Game</code> class automatically restores these custom properties back to their original post-setup values. This eliminates the need for developers to write boilerplate code for resetting their own state variables. For technical details on how this is achieved, see the <code><a href="InitialStateSnapshot.html">InitialStateSnapshot</a></code> architecture.</p>
850
732
  </div>
851
733
  </div>
852
734
  </div>
@@ -887,7 +769,7 @@ The switch handler must be set or propagated before calling this method, otherwi
887
769
  </div>
888
770
  </li>
889
771
  <li>
890
- <p><strong>EXIT</strong>: Clears the active session and performs a hard stop of the draw loop. In server mode, the orchestrator typically uses the switch handler to return to the <code>GameMenu</code>.</p>
772
+ <p><strong>EXIT</strong>: Clears the active session and performs a hard stop of the draw loop. The specific behavior after stopping depends on the external orchestrator (e.g., returning to a menu).</p>
891
773
  </li>
892
774
  </ul>
893
775
  </div>
@@ -448,10 +448,18 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
448
448
  <ul class="sectlevel2">
449
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
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="#bindcontrols-void">2.3. <code>bindControls(): void</code></a></li>
452
- <li><a href="#unbindcontrols-void">2.4. <code>unbindControls(): void</code></a></li>
453
- <li><a href="#notifykey-controlkey-type-controleventtype-void">2.5. <code>notify(key: ControlKey, type: ControlEventType): void</code></a></li>
454
- <li><a href="#getdebugdata-recordstring-string-number-boolean">2.6. <code>getDebugData(): Record&lt;string, string | number | boolean&gt;</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>
455
463
  </ul>
456
464
  </li>
457
465
  </ul>
@@ -499,6 +507,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
499
507
  </li>
500
508
  </ul>
501
509
  </div>
510
+ <hr>
502
511
  </div>
503
512
  </div>
504
513
  <div class="sect1">
@@ -600,12 +609,164 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
600
609
  <p><strong>Behavior</strong></p>
601
610
  </div>
602
611
  <div class="paragraph">
603
- <p>Removes the specified callback from the list. If the callback is not found, the operation does nothing.</p>
612
+ <p>Removes the specified callback from the central <code><a href="EventEmitter.html">EventEmitter</a></code>. If the callback is not found, the operation does nothing.</p>
613
+ </div>
614
+ <hr>
615
+ </div>
616
+ <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>
618
+ <div class="paragraph">
619
+ <p>Registers a callback for a specific input event ONLY when the game is on the Title Screen.</p>
620
+ </div>
621
+ <div class="paragraph">
622
+ <p><strong>Parameters</strong></p>
623
+ </div>
624
+ <table class="tableblock frame-all grid-all stretch">
625
+ <colgroup>
626
+ <col style="width: 20%;">
627
+ <col style="width: 20%;">
628
+ <col style="width: 60%;">
629
+ </colgroup>
630
+ <tbody>
631
+ <tr>
632
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Name</p></td>
633
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Type</p></td>
634
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Description</p></td>
635
+ </tr>
636
+ <tr>
637
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>key</code></p></td>
638
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlKey.html">ControlKey</a></code></p></td>
639
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The virtual key to monitor.</p></td>
640
+ </tr>
641
+ <tr>
642
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>type</code></p></td>
643
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlEventType.html">ControlEventType</a></code></p></td>
644
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The type of trigger.</p></td>
645
+ </tr>
646
+ <tr>
647
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>callback</code></p></td>
648
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../types/ControlCallback.html">ControlCallback</a></code></p></td>
649
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The function to execute.</p></td>
650
+ </tr>
651
+ </tbody>
652
+ </table>
653
+ <hr>
654
+ </div>
655
+ <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>
657
+ <div class="paragraph">
658
+ <p>Removes an existing Title Screen subscription.</p>
659
+ </div>
660
+ <hr>
661
+ </div>
662
+ <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>
664
+ <div class="paragraph">
665
+ <p>Registers a callback for a specific input event ONLY when the game is on the Game Over Screen.</p>
666
+ </div>
667
+ <div class="paragraph">
668
+ <p><strong>Parameters</strong></p>
669
+ </div>
670
+ <table class="tableblock frame-all grid-all stretch">
671
+ <colgroup>
672
+ <col style="width: 20%;">
673
+ <col style="width: 20%;">
674
+ <col style="width: 60%;">
675
+ </colgroup>
676
+ <tbody>
677
+ <tr>
678
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Name</p></td>
679
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Type</p></td>
680
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Description</p></td>
681
+ </tr>
682
+ <tr>
683
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>key</code></p></td>
684
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlKey.html">ControlKey</a></code></p></td>
685
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The virtual key to monitor.</p></td>
686
+ </tr>
687
+ <tr>
688
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>type</code></p></td>
689
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlEventType.html">ControlEventType</a></code></p></td>
690
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The type of trigger.</p></td>
691
+ </tr>
692
+ <tr>
693
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>callback</code></p></td>
694
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../types/ControlCallback.html">ControlCallback</a></code></p></td>
695
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The function to execute.</p></td>
696
+ </tr>
697
+ </tbody>
698
+ </table>
699
+ <hr>
700
+ </div>
701
+ <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>
703
+ <div class="paragraph">
704
+ <p>Removes an existing Game Over Screen subscription.</p>
705
+ </div>
706
+ <hr>
707
+ </div>
708
+ <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>
710
+ <div class="paragraph">
711
+ <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
+ </div>
713
+ <hr>
714
+ </div>
715
+ <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>
717
+ <div class="paragraph">
718
+ <p>Removes an existing Playing Screen subscription.</p>
719
+ </div>
720
+ <hr>
721
+ </div>
722
+ <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>
724
+ <div class="paragraph">
725
+ <p>Registers a callback for a specific input event ONLY when the game is in a Paused state.</p>
726
+ </div>
727
+ <div class="paragraph">
728
+ <p><strong>Parameters</strong></p>
729
+ </div>
730
+ <table class="tableblock frame-all grid-all stretch">
731
+ <colgroup>
732
+ <col style="width: 20%;">
733
+ <col style="width: 20%;">
734
+ <col style="width: 60%;">
735
+ </colgroup>
736
+ <tbody>
737
+ <tr>
738
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Name</p></td>
739
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Type</p></td>
740
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Description</p></td>
741
+ </tr>
742
+ <tr>
743
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>key</code></p></td>
744
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlKey.html">ControlKey</a></code></p></td>
745
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The virtual key to monitor.</p></td>
746
+ </tr>
747
+ <tr>
748
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>type</code></p></td>
749
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/ControlEventType.html">ControlEventType</a></code></p></td>
750
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The type of trigger.</p></td>
751
+ </tr>
752
+ <tr>
753
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>callback</code></p></td>
754
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../types/ControlCallback.html">ControlCallback</a></code></p></td>
755
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The function to execute.</p></td>
756
+ </tr>
757
+ </tbody>
758
+ </table>
759
+ <hr>
760
+ </div>
761
+ <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>
763
+ <div class="paragraph">
764
+ <p>Removes an existing Paused Screen subscription.</p>
604
765
  </div>
605
766
  <hr>
606
767
  </div>
607
768
  <div class="sect2">
608
- <h3 id="bindcontrols-void"><a class="link" href="#bindcontrols-void">2.3. <code>bindControls(): void</code></a></h3>
769
+ <h3 id="bindcontrols-void"><a class="link" href="#bindcontrols-void">2.11. <code>bindControls(): void</code></a></h3>
609
770
  <div class="paragraph">
610
771
  <p>Attaches low-level event listeners to the environment.</p>
611
772
  </div>
@@ -618,7 +779,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
618
779
  <hr>
619
780
  </div>
620
781
  <div class="sect2">
621
- <h3 id="unbindcontrols-void"><a class="link" href="#unbindcontrols-void">2.4. <code>unbindControls(): void</code></a></h3>
782
+ <h3 id="unbindcontrols-void"><a class="link" href="#unbindcontrols-void">2.12. <code>unbindControls(): void</code></a></h3>
622
783
  <div class="paragraph">
623
784
  <p>Detaches all input listeners and clears subscriptions.</p>
624
785
  </div>
@@ -631,7 +792,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
631
792
  <hr>
632
793
  </div>
633
794
  <div class="sect2">
634
- <h3 id="notifykey-controlkey-type-controleventtype-void"><a class="link" href="#notifykey-controlkey-type-controleventtype-void">2.5. <code>notify(key: ControlKey, type: ControlEventType): void</code></a></h3>
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>
635
796
  <div class="paragraph">
636
797
  <p>Manually triggers an input event.</p>
637
798
  </div>
@@ -687,7 +848,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
687
848
  <hr>
688
849
  </div>
689
850
  <div class="sect2">
690
- <h3 id="getdebugdata-recordstring-string-number-boolean"><a class="link" href="#getdebugdata-recordstring-string-number-boolean">2.6. <code>getDebugData(): Record&lt;string, string | number | boolean&gt;</code></a></h3>
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>
691
852
  <div class="paragraph">
692
853
  <p>Returns metadata for the real-time debugger.</p>
693
854
  </div>