brick-engine-js 1.0.16 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.adoc CHANGED
@@ -56,7 +56,7 @@ The engine is organized into the following core modules:
56
56
  | Module | Description
57
57
 
58
58
  | xref:docs/reference/modules/Game.adoc[Game (Core)]
59
- | The central orchestrator. It manages the main loop (ticks and frames), and coordinates dynamic game loading and transitions via an instance-based switch handler.
59
+ | The central orchestrator. It manages the main loop (ticks and frames) and maintains the lifecycle of all engine modules.
60
60
 
61
61
  | xref:docs/reference/modules/GameGrid.adoc[GameGrid]
62
62
  | Manages the 2D grid data structure. Handles cell values, colors, row/column operations, and collision detection. Includes `GameHudGrid` for custom HUD content.
@@ -634,7 +634,7 @@ export default class MyGame extends Game {
634
634
  </div>
635
635
  <div id="footer">
636
636
  <div id="footer-text">
637
- Last updated 2026-02-23 16:20:59 -0300
637
+ Last updated 2026-02-24 23:24:58 -0300
638
638
  </div>
639
639
  </div>
640
640
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
@@ -539,7 +539,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
539
539
  <tbody>
540
540
  <tr>
541
541
  <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="reference/modules/Game.html">Game (Core)</a></p></td>
542
- <td class="tableblock halign-left valign-top"><p class="tableblock">The central orchestrator. It manages the main loop (ticks and frames), and coordinates dynamic game loading and transitions via an instance-based switch handler.</p></td>
542
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The central orchestrator. It manages the main loop (ticks and frames) and maintains the lifecycle of all engine modules.</p></td>
543
543
  </tr>
544
544
  <tr>
545
545
  <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="reference/modules/GameGrid.html">GameGrid</a></p></td>
@@ -559,7 +559,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
559
559
  </div>
560
560
  <div id="footer">
561
561
  <div id="footer-text">
562
- Last updated 2026-02-23 16:10:29 -0300
562
+ Last updated 2026-02-24 23:18:56 -0300
563
563
  </div>
564
564
  </div>
565
565
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
@@ -451,7 +451,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
451
451
  <li><a href="#getformattedscoredigits-number-string">2.3. <code>getFormattedScore(digits?: number): string</code></a></li>
452
452
  <li><a href="#increaselevelamount-number-void">2.4. <code>increaseLevel(amount: number): void</code></a></li>
453
453
  <li><a href="#resetlevel-void">2.5. <code>resetLevel(): void</code></a></li>
454
- <li><a href="#setstatestate-state-void">2.6. <code>setState(state: State): void</code></a></li>
454
+ <li><a href="#setupgamehighscoreid-string-void">2.6. <code>setupGameHighScore(id: string): void</code></a></li>
455
455
  </ul>
456
456
  </li>
457
457
  <li><a href="#general-usage">3. General Usage</a></li>
@@ -616,9 +616,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
616
616
  <hr>
617
617
  </div>
618
618
  <div class="sect2">
619
- <h3 id="setstatestate-state-void"><a class="link" href="#setstatestate-state-void">2.6. <code>setState(state: <a href="State.html">State</a>): void</code></a></h3>
619
+ <h3 id="setupgamehighscoreid-string-void"><a class="link" href="#setupgamehighscoreid-string-void">2.6. <code>setupGameHighScore(id: string): void</code></a></h3>
620
620
  <div class="paragraph">
621
- <p>Internal setup method to link the score module with high-score persistence logic.</p>
621
+ <p>Initializes the high score for a specific game, loading it from namespaced storage.</p>
622
622
  </div>
623
623
  <div class="paragraph">
624
624
  <p><strong>Parameters</strong></p>
@@ -636,9 +636,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
636
636
  <td class="tableblock halign-left valign-top"><p class="tableblock">Description</p></td>
637
637
  </tr>
638
638
  <tr>
639
- <td class="tableblock halign-left valign-top"><p class="tableblock"><code>state</code></p></td>
640
- <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="State.html">State</a></code></p></td>
641
- <td class="tableblock halign-left valign-top"><p class="tableblock">The global state manager.</p></td>
639
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>id</code></p></td>
640
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>string</code></p></td>
641
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The unique identifier of the game (e.g., from <code><a href="../modules/Game.html">Game.gameId</a></code>).</p></td>
642
642
  </tr>
643
643
  </tbody>
644
644
  </table>
@@ -449,6 +449,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
449
449
  <li><a href="#_savesession_void">2.2. <code>saveSession(): void</code></a></li>
450
450
  <li><a href="#_clearsession_void">2.3. <code>clearSession(): void</code></a></li>
451
451
  <li><a href="#_setshowmodalfunctionshowmodal_onconfirm_void_oncancel_void_void_void">2.4. <code>setShowModalFunction(showModal: (onConfirm: () &#8658; void, onCancel: () &#8658; void) &#8658; void): void</code></a></li>
452
+ <li><a href="#_setsessionenabledenabled_boolean_void">2.5. <code>setSessionEnabled(enabled: boolean): void</code></a></li>
452
453
  </ul>
453
454
  </li>
454
455
  <li><a href="#_general_usage">3. General Usage</a></li>
@@ -564,6 +565,35 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
564
565
  </tr>
565
566
  </tbody>
566
567
  </table>
568
+ <hr>
569
+ </div>
570
+ <div class="sect2">
571
+ <h3 id="_setsessionenabledenabled_boolean_void"><a class="link" href="#_setsessionenabledenabled_boolean_void">2.5. <code>setSessionEnabled(enabled: boolean): void</code></a></h3>
572
+ <div class="paragraph">
573
+ <p>Enables or disables the session recovery mechanism for the current game instance.</p>
574
+ </div>
575
+ <div class="paragraph">
576
+ <p><strong>Parameters</strong></p>
577
+ </div>
578
+ <table class="tableblock frame-all grid-all stretch">
579
+ <colgroup>
580
+ <col style="width: 20%;">
581
+ <col style="width: 20%;">
582
+ <col style="width: 60%;">
583
+ </colgroup>
584
+ <tbody>
585
+ <tr>
586
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Name</p></td>
587
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Type</p></td>
588
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Description</p></td>
589
+ </tr>
590
+ <tr>
591
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>enabled</code></p></td>
592
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>boolean</code></p></td>
593
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Whether the session recovery should be enabled.</p></td>
594
+ </tr>
595
+ </tbody>
596
+ </table>
567
597
  </div>
568
598
  </div>
569
599
  </div>
@@ -578,7 +608,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
578
608
  </div>
579
609
  <div id="footer">
580
610
  <div id="footer-text">
581
- Last updated 2026-02-23 16:03:34 -0300
611
+ Last updated 2026-02-24 23:17:40 -0300
582
612
  </div>
583
613
  </div>
584
614
  </body>
@@ -448,15 +448,12 @@ 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>
@@ -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>
@@ -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>
@@ -453,10 +453,11 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
453
453
  <li><a href="#resetscore-void">1.6. <code>resetScore(): void</code></a></li>
454
454
  <li><a href="#increaselevelamount-number-void">1.7. <code>increaseLevel(amount: number): void</code></a></li>
455
455
  <li><a href="#resetlevel-void">1.8. <code>resetLevel(): void</code></a></li>
456
- <li><a href="#getformattedscoredigits-number-string">1.9. <code>getFormattedScore(digits: number): string</code></a></li>
457
- <li><a href="#serialize-string">1.10. <code>serialize(): string</code></a></li>
458
- <li><a href="#deserializedata-string-void">1.11. <code>deserialize(data: string): void</code></a></li>
459
- <li><a href="#getdebugdata-recordstring-string-number-boolean">1.12. <code>getDebugData(): Record&lt;string, string | number | boolean&gt;</code></a></li>
456
+ <li><a href="#setupgamehighscoreid-string-void">1.9. <code>setupGameHighScore(id: string): void</code></a></li>
457
+ <li><a href="#getformattedscoredigits-number-string">1.10. <code>getFormattedScore(digits: number): string</code></a></li>
458
+ <li><a href="#serialize-string">1.11. <code>serialize(): string</code></a></li>
459
+ <li><a href="#deserializedata-string-void">1.12. <code>deserialize(data: string): void</code></a></li>
460
+ <li><a href="#getdebugdata-recordstring-string-number-boolean">1.13. <code>getDebugData(): Record&lt;string, string | number | boolean&gt;</code></a></li>
460
461
  </ul>
461
462
  </li>
462
463
  </ul>
@@ -503,7 +504,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
503
504
  <p><strong>Behavior</strong></p>
504
505
  </div>
505
506
  <div class="paragraph">
506
- <p>When set, it automatically persists the value directly to <code>LocalStorage</code> under the <code>highScore</code> key. It does not use <code>GameState</code> for this persistence.</p>
507
+ <p>When set, it automatically persists the value directly to <code>LocalStorage</code> under the namespaced key <code>${gameId}::highScore</code>. This ensures that different games do not overwrite each other&#8217;s records.</p>
507
508
  </div>
508
509
  <hr>
509
510
  </div>
@@ -581,12 +582,41 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
581
582
  <div class="sect2">
582
583
  <h3 id="resetlevel-void"><a class="link" href="#resetlevel-void">1.8. <code>resetLevel(): void</code></a></h3>
583
584
  <div class="paragraph">
584
- <p>Resets the level counter to 1.</p>
585
+ <p>Resets the level counter to 1.
586
+ '''</p>
585
587
  </div>
588
+ </div>
589
+ <div class="sect2">
590
+ <h3 id="setupgamehighscoreid-string-void"><a class="link" href="#setupgamehighscoreid-string-void">1.9. <code>setupGameHighScore(id: string): void</code></a></h3>
591
+ <div class="paragraph">
592
+ <p>Initializes the module with the specific game ID and loads the corresponding high score.</p>
593
+ </div>
594
+ <div class="paragraph">
595
+ <p><strong>Parameters</strong></p>
596
+ </div>
597
+ <table class="tableblock frame-all grid-all stretch">
598
+ <colgroup>
599
+ <col style="width: 20%;">
600
+ <col style="width: 20%;">
601
+ <col style="width: 60%;">
602
+ </colgroup>
603
+ <tbody>
604
+ <tr>
605
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Name</p></td>
606
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Type</p></td>
607
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Description</p></td>
608
+ </tr>
609
+ <tr>
610
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>id</code></p></td>
611
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>string</code></p></td>
612
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The unique game identifier used as a prefix for LocalStorage.</p></td>
613
+ </tr>
614
+ </tbody>
615
+ </table>
586
616
  <hr>
587
617
  </div>
588
618
  <div class="sect2">
589
- <h3 id="getformattedscoredigits-number-string"><a class="link" href="#getformattedscoredigits-number-string">1.9. <code>getFormattedScore(digits: number): string</code></a></h3>
619
+ <h3 id="getformattedscoredigits-number-string"><a class="link" href="#getformattedscoredigits-number-string">1.10. <code>getFormattedScore(digits: number): string</code></a></h3>
590
620
  <div class="paragraph">
591
621
  <p>Returns the score as a padded string suitable for HUD display.</p>
592
622
  </div>
@@ -621,7 +651,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
621
651
  <hr>
622
652
  </div>
623
653
  <div class="sect2">
624
- <h3 id="serialize-string"><a class="link" href="#serialize-string">1.10. <code>serialize(): string</code></a></h3>
654
+ <h3 id="serialize-string"><a class="link" href="#serialize-string">1.11. <code>serialize(): string</code></a></h3>
625
655
  <div class="paragraph">
626
656
  <p><strong>Behavior</strong></p>
627
657
  </div>
@@ -631,7 +661,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
631
661
  <hr>
632
662
  </div>
633
663
  <div class="sect2">
634
- <h3 id="deserializedata-string-void"><a class="link" href="#deserializedata-string-void">1.11. <code>deserialize(data: string): void</code></a></h3>
664
+ <h3 id="deserializedata-string-void"><a class="link" href="#deserializedata-string-void">1.12. <code>deserialize(data: string): void</code></a></h3>
635
665
  <div class="paragraph">
636
666
  <p><strong>Behavior</strong></p>
637
667
  </div>
@@ -641,7 +671,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
641
671
  <hr>
642
672
  </div>
643
673
  <div class="sect2">
644
- <h3 id="getdebugdata-recordstring-string-number-boolean"><a class="link" href="#getdebugdata-recordstring-string-number-boolean">1.12. <code>getDebugData(): Record&lt;string, string | number | boolean&gt;</code></a></h3>
674
+ <h3 id="getdebugdata-recordstring-string-number-boolean"><a class="link" href="#getdebugdata-recordstring-string-number-boolean">1.13. <code>getDebugData(): Record&lt;string, string | number | boolean&gt;</code></a></h3>
645
675
  <div class="paragraph">
646
676
  <p>Returns metadata for the real-time debugger.</p>
647
677
  </div>
@@ -445,8 +445,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
445
445
  <li><a href="#_session_management">1. Session Management</a>
446
446
  <ul class="sectlevel2">
447
447
  <li><a href="#_savesession_void">1.1. <code>saveSession(): void</code></a></li>
448
- <li><a href="#_clearsession_void">1.2. <code>clearSession(): void</code></a></li>
449
- <li><a href="#_syncstatestate_state_void">1.3. <code>syncState(state: State): void</code></a></li>
448
+ <li><a href="#_setsessionenabledenabled_boolean_void">1.2. <code>setSessionEnabled(enabled: boolean): void</code></a></li>
449
+ <li><a href="#_clearsession_void">1.3. <code>clearSession(): void</code></a></li>
450
+ <li><a href="#_syncstatestate_state_void">1.4. <code>syncState(state: State): void</code></a></li>
450
451
  </ul>
451
452
  </li>
452
453
  <li><a href="#_internals">2. Internals</a></li>
@@ -467,17 +468,46 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
467
468
  <div class="sect2">
468
469
  <h3 id="_savesession_void"><a class="link" href="#_savesession_void">1.1. <code>saveSession(): void</code></a></h3>
469
470
  <div class="paragraph">
470
- <p>Creates or updates the session. Early returns if the <code>GameID</code> belongs to the main menu (<code>game-menu</code>) or if the <code>SessionModal</code> (if existing) has not been confirmed/rejected yet.</p>
471
+ <p>Creates or updates the session. Early returns if the session is disabled (via <code>setSessionEnabled</code>) or if the <code>SessionModal</code> (if existing) has not been confirmed/rejected yet.</p>
471
472
  </div>
473
+ <hr>
472
474
  </div>
473
475
  <div class="sect2">
474
- <h3 id="_clearsession_void"><a class="link" href="#_clearsession_void">1.2. <code>clearSession(): void</code></a></h3>
476
+ <h3 id="_setsessionenabledenabled_boolean_void"><a class="link" href="#_setsessionenabledenabled_boolean_void">1.2. <code>setSessionEnabled(enabled: boolean): void</code></a></h3>
477
+ <div class="paragraph">
478
+ <p>Enables or disables the session recovery mechanism. When disabled, the engine will neither show the session recovery modal nor save the session.</p>
479
+ </div>
480
+ <div class="paragraph">
481
+ <p><strong>Parameters</strong></p>
482
+ </div>
483
+ <table class="tableblock frame-all grid-all stretch">
484
+ <colgroup>
485
+ <col style="width: 20%;">
486
+ <col style="width: 20%;">
487
+ <col style="width: 60%;">
488
+ </colgroup>
489
+ <tbody>
490
+ <tr>
491
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Name</p></td>
492
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Type</p></td>
493
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Description</p></td>
494
+ </tr>
495
+ <tr>
496
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>enabled</code></p></td>
497
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>boolean</code></p></td>
498
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Whether the session should be enabled.</p></td>
499
+ </tr>
500
+ </tbody>
501
+ </table>
502
+ </div>
503
+ <div class="sect2">
504
+ <h3 id="_clearsession_void"><a class="link" href="#_clearsession_void">1.3. <code>clearSession(): void</code></a></h3>
475
505
  <div class="paragraph">
476
506
  <p>Removes the saved instances from <code>localStorage</code>.</p>
477
507
  </div>
478
508
  </div>
479
509
  <div class="sect2">
480
- <h3 id="_syncstatestate_state_void"><a class="link" href="#_syncstatestate_state_void">1.3. <code>syncState(state: State): void</code></a></h3>
510
+ <h3 id="_syncstatestate_state_void"><a class="link" href="#_syncstatestate_state_void">1.4. <code>syncState(state: State): void</code></a></h3>
481
511
  <div class="paragraph">
482
512
  <p>Subscribes to <code><a href="GameState.html">GameState</a></code> interactions.</p>
483
513
  </div>
@@ -508,7 +538,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
508
538
  </div>
509
539
  <div class="paragraph">
510
540
  <p>Reacts to:
511
- - <code>PLAYING</code>: If a session for the current <code>gameId</code> exists, is NOT the game menu, and the modal hasn&#8217;t been closed, it invokes the modal via <code>_showSessionModal</code>. If accepted, calls deserialize on all registered targets. If canceled or if no previous session exists, proceeds normally. The modal state is tracked to prevent re-triggering during the same power cycle.
541
+ - <code>PLAYING</code>: If a session for the current <code>gameId</code> exists, session is enabled, and the modal hasn&#8217;t been closed, it invokes the modal via <code>_showSessionModal</code>. If accepted, calls deserialize on all registered targets. If canceled or if no previous session exists, proceeds normally. The modal state is tracked to prevent re-triggering during the same power cycle.
512
542
  - <code>ON</code> (when false): Resets the modal state tracking closure, allowing the session modal to appear again after the device is powered back on.
513
543
  - <code>GAME_OVER</code>: Clears active session entirely.</p>
514
544
  </div>
@@ -526,7 +556,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
526
556
  </div>
527
557
  <div id="footer">
528
558
  <div id="footer-text">
529
- Last updated 2026-02-22 22:09:51 -0300
559
+ Last updated 2026-02-24 23:17:20 -0300
530
560
  </div>
531
561
  </div>
532
562
  </body>