brick-engine-js 1.0.17 → 1.0.19

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 (46) hide show
  1. package/README.adoc +6 -1
  2. package/dist/docs/index.html +16 -0
  3. package/dist/docs/reference/context/RendererContext.html +584 -0
  4. package/dist/docs/reference/enums/EventSuffix.html +513 -0
  5. package/dist/docs/reference/helpers/CoordinateHelper.html +10 -35
  6. package/dist/docs/reference/helpers/RelativeValuesHelper.html +4 -14
  7. package/dist/docs/reference/interfaces/GameModules.html +14 -9
  8. package/dist/docs/reference/interfaces/StateContext.html +517 -0
  9. package/dist/docs/reference/modules/EventEmitter.html +624 -0
  10. package/dist/docs/reference/modules/Game.html +4 -4
  11. package/dist/docs/reference/modules/GameControl.html +170 -9
  12. package/dist/docs/reference/modules/GameEventRegistry.html +605 -0
  13. package/dist/docs/reference/modules/GameState.html +119 -6
  14. package/dist/docs/reference/modules/InitialStateSnapshot.html +5 -2
  15. package/dist/docs/reference/view/GameView.html +606 -0
  16. package/dist/game.bundle.js +1 -1
  17. package/dist/types/bootstrap.d.ts +1 -1
  18. package/dist/types/core/Game.d.ts +16 -5
  19. package/dist/types/core/context/RendererContext.d.ts +25 -0
  20. package/dist/types/core/context/RendererContext.test.d.ts +1 -0
  21. package/dist/types/core/event/EventEmitter.d.ts +71 -0
  22. package/dist/types/core/event/EventEmitter.test.d.ts +1 -0
  23. package/dist/types/core/event/GameEventRegistry.d.ts +28 -0
  24. package/dist/types/core/event/GameEventRegistry.test.d.ts +1 -0
  25. package/dist/types/core/helpers/CoordinateHelper.d.ts +5 -11
  26. package/dist/types/core/helpers/RelativeValuesHelper.d.ts +2 -5
  27. package/dist/types/core/module/control/GameControl.d.ts +11 -15
  28. package/dist/types/core/module/renderer/DisplayRenderer.d.ts +0 -8
  29. package/dist/types/core/module/renderer/GameRenderer.d.ts +0 -8
  30. package/dist/types/core/module/renderer/HudRenderer.d.ts +0 -8
  31. package/dist/types/core/module/session/GameSession.d.ts +4 -2
  32. package/dist/types/core/module/state/GameState.d.ts +12 -16
  33. package/dist/types/core/module/text/GameText.d.ts +0 -9
  34. package/dist/types/core/types/modules.d.ts +77 -6
  35. package/dist/types/index.d.ts +2 -0
  36. package/dist/types/view/Debugger.d.ts +1 -3
  37. package/dist/types/view/GameView.d.ts +1 -2
  38. package/dist/types/view/SessionModal.d.ts +1 -3
  39. package/dist/types/view/components/layout/ButtonLayout.d.ts +1 -1
  40. package/dist/types/view/components/layout/ContainerLayout.d.ts +1 -1
  41. package/dist/types/view/components/layout/FrameLayout.d.ts +1 -1
  42. package/dist/types/view/components/ui/BigButton.d.ts +1 -1
  43. package/dist/types/view/components/ui/Button.d.ts +1 -1
  44. package/dist/types/view/components/ui/Canvas.d.ts +1 -1
  45. package/dist/types/view/components/ui/SmallButton.d.ts +1 -1
  46. package/package.json +1 -1
@@ -457,7 +457,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
457
457
  </ul>
458
458
  </li>
459
459
  <li><a href="#session-management">3. Session Management</a></li>
460
- <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>
461
461
  <li><a href="#automated-system-controls">5. Automated System Controls</a></li>
462
462
  </ul>
463
463
  </div>
@@ -719,16 +719,16 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
719
719
  </div>
720
720
  </div>
721
721
  <div class="sect1">
722
- <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>
723
723
  <div class="sectionbody">
724
724
  <div class="paragraph">
725
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>
726
726
  </div>
727
727
  <div class="paragraph">
728
- <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>
729
729
  </div>
730
730
  <div class="paragraph">
731
- <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>
732
732
  </div>
733
733
  </div>
734
734
  </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>