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,24 +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="#properties">1. Properties</a></li>
447
- <li><a href="#methods">2. Methods</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="#methods">3. Methods</a>
448
449
  <ul class="sectlevel2">
449
- <li><a href="#updatedeltatime-number-void">2.1. <code>update(deltaTime: number): void</code></a></li>
450
- <li><a href="#shouldtick-boolean">2.2. <code>shouldTick(): boolean</code></a></li>
451
- <li><a href="#reset-void">2.3. <code>reset(): void</code></a></li>
452
- <li><a href="#incrementtickintervalamount-number-void">2.4. <code>incrementTickInterval(amount: number): void</code></a></li>
453
- <li><a href="#decrementtickintervalamount-number-void">2.5. <code>decrementTickInterval(amount: number): void</code></a></li>
454
- <li><a href="#settickintervalinterval-number-void">2.6. <code>setTickInterval(interval: number): void</code></a></li>
455
- <li><a href="#setmintickintervalinterval-number-void">2.7. <code>setMinTickInterval(interval: number): void</code></a></li>
450
+ <li><a href="#updatedeltatime-number-void">3.1. <code>update(deltaTime: number): void</code></a></li>
451
+ <li><a href="#shouldtick-boolean">3.2. <code>shouldTick(): boolean</code></a></li>
452
+ <li><a href="#reset-void">3.3. <code>reset(): void</code></a></li>
453
+ <li><a href="#istickeveryinterval-number-boolean">3.4. <code>isTickEvery(interval: number): boolean</code></a></li>
454
+ <li><a href="#incrementtickintervalamount-number-void">3.5. <code>incrementTickInterval(amount: number): void</code></a></li>
455
+ <li><a href="#decrementtickintervalamount-number-void">3.6. <code>decrementTickInterval(amount: number): void</code></a></li>
456
+ <li><a href="#settickintervalinterval-number-void">3.7. <code>setTickInterval(interval: number): void</code></a></li>
457
+ <li><a href="#setmintickintervalinterval-number-void">3.8. <code>setMinTickInterval(interval: number): void</code></a></li>
458
+ <li><a href="#captureinitialstate-void">3.9. <code>captureInitialState(): void</code></a></li>
456
459
  </ul>
457
460
  </li>
458
- <li><a href="#general-usage">3. General Usage</a></li>
461
+ <li><a href="#general-usage">4. General Usage</a></li>
459
462
  </ul>
460
463
  </div>
461
464
  </div>
462
465
  <div id="content">
463
- <div id="preamble">
466
+ <div class="sect1">
467
+ <h2 id="architectural-purpose"><a class="link" href="#architectural-purpose">1. Architectural Purpose</a></h2>
464
468
  <div class="sectionbody">
465
469
  <div class="paragraph">
466
470
  <p>Interface for managing the game&#8217;s logical clock and update frequency.</p>
@@ -468,7 +472,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
468
472
  </div>
469
473
  </div>
470
474
  <div class="sect1">
471
- <h2 id="properties"><a class="link" href="#properties">1. Properties</a></h2>
475
+ <h2 id="properties"><a class="link" href="#properties">2. Properties</a></h2>
472
476
  <div class="sectionbody">
473
477
  <table class="tableblock frame-all grid-all stretch">
474
478
  <colgroup>
@@ -487,17 +491,27 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
487
491
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>number</code></p></td>
488
492
  <td class="tableblock halign-left valign-top"><p class="tableblock">The duration in milliseconds between logic updates.</p></td>
489
493
  </tr>
494
+ <tr>
495
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>totalTicks</code></p></td>
496
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>number</code></p></td>
497
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The total number of logic ticks that have occurred since the game started.</p></td>
498
+ </tr>
499
+ <tr>
500
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>elapsedTime</code></p></td>
501
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>number</code></p></td>
502
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The total time in milliseconds elapsed since the game started.</p></td>
503
+ </tr>
490
504
  </tbody>
491
505
  </table>
492
506
  </div>
493
507
  </div>
494
508
  <div class="sect1">
495
- <h2 id="methods"><a class="link" href="#methods">2. Methods</a></h2>
509
+ <h2 id="methods"><a class="link" href="#methods">3. Methods</a></h2>
496
510
  <div class="sectionbody">
497
511
  <div class="sect2">
498
- <h3 id="updatedeltatime-number-void"><a class="link" href="#updatedeltatime-number-void">2.1. <code>update(deltaTime: number): void</code></a></h3>
512
+ <h3 id="updatedeltatime-number-void"><a class="link" href="#updatedeltatime-number-void">3.1. <code>update(deltaTime: number): void</code></a></h3>
499
513
  <div class="paragraph">
500
- <p>Adds elapsed time to the internal accumulator. Called every frame.</p>
514
+ <p>Adds elapsed time to the internal tick accumulator. Called every frame.</p>
501
515
  </div>
502
516
  <div class="paragraph">
503
517
  <p><strong>Parameters</strong></p>
@@ -524,9 +538,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
524
538
  <hr>
525
539
  </div>
526
540
  <div class="sect2">
527
- <h3 id="shouldtick-boolean"><a class="link" href="#shouldtick-boolean">2.2. <code>shouldTick(): boolean</code></a></h3>
541
+ <h3 id="shouldtick-boolean"><a class="link" href="#shouldtick-boolean">3.2. <code>shouldTick(): boolean</code></a></h3>
528
542
  <div class="paragraph">
529
- <p>Returns <code>true</code> if the accumulator has exceeded the <code>tickInterval</code>, indicating a logic update is due.</p>
543
+ <p>Returns <code>true</code> if the tick accumulator has exceeded the <code>tickInterval</code>, indicating a logic update is due.</p>
530
544
  </div>
531
545
  <div class="paragraph">
532
546
  <p><strong>Returns</strong></p>
@@ -537,14 +551,49 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
537
551
  <hr>
538
552
  </div>
539
553
  <div class="sect2">
540
- <h3 id="reset-void"><a class="link" href="#reset-void">2.3. <code>reset(): void</code></a></h3>
554
+ <h3 id="reset-void"><a class="link" href="#reset-void">3.3. <code>reset(): void</code></a></h3>
541
555
  <div class="paragraph">
542
- <p>Clears the time accumulator. Useful during game restarts.</p>
556
+ <p>Clears the tick accumulator and resets global time counters. Useful during game restarts.</p>
543
557
  </div>
544
558
  <hr>
545
559
  </div>
546
560
  <div class="sect2">
547
- <h3 id="incrementtickintervalamount-number-void"><a class="link" href="#incrementtickintervalamount-number-void">2.4. <code>incrementTickInterval(amount: number): void</code></a></h3>
561
+ <h3 id="istickeveryinterval-number-boolean"><a class="link" href="#istickeveryinterval-number-boolean">3.4. <code>isTickEvery(interval: number): boolean</code></a></h3>
562
+ <div class="paragraph">
563
+ <p>Returns <code>true</code> if the <code>totalTicks</code> is a multiple of the specified <code>interval</code>. Useful for scheduling recurring game events.</p>
564
+ </div>
565
+ <div class="paragraph">
566
+ <p><strong>Parameters</strong></p>
567
+ </div>
568
+ <table class="tableblock frame-all grid-all stretch">
569
+ <colgroup>
570
+ <col style="width: 20%;">
571
+ <col style="width: 20%;">
572
+ <col style="width: 60%;">
573
+ </colgroup>
574
+ <tbody>
575
+ <tr>
576
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Name</p></td>
577
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Type</p></td>
578
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Description</p></td>
579
+ </tr>
580
+ <tr>
581
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>interval</code></p></td>
582
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><code>number</code></p></td>
583
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The tick frequency to check.</p></td>
584
+ </tr>
585
+ </tbody>
586
+ </table>
587
+ <div class="paragraph">
588
+ <p><strong>Returns</strong></p>
589
+ </div>
590
+ <div class="paragraph">
591
+ <p><code>boolean</code> - <code>true</code> if the current tick is a multiple of the interval (and greater than 0).</p>
592
+ </div>
593
+ <hr>
594
+ </div>
595
+ <div class="sect2">
596
+ <h3 id="incrementtickintervalamount-number-void"><a class="link" href="#incrementtickintervalamount-number-void">3.5. <code>incrementTickInterval(amount: number): void</code></a></h3>
548
597
  <div class="paragraph">
549
598
  <p>Slows down the game by increasing the time between ticks.</p>
550
599
  </div>
@@ -573,7 +622,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
573
622
  <hr>
574
623
  </div>
575
624
  <div class="sect2">
576
- <h3 id="decrementtickintervalamount-number-void"><a class="link" href="#decrementtickintervalamount-number-void">2.5. <code>decrementTickInterval(amount: number): void</code></a></h3>
625
+ <h3 id="decrementtickintervalamount-number-void"><a class="link" href="#decrementtickintervalamount-number-void">3.6. <code>decrementTickInterval(amount: number): void</code></a></h3>
577
626
  <div class="paragraph">
578
627
  <p>Speeds up the game by decreasing the time between ticks.</p>
579
628
  </div>
@@ -602,7 +651,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
602
651
  <hr>
603
652
  </div>
604
653
  <div class="sect2">
605
- <h3 id="settickintervalinterval-number-void"><a class="link" href="#settickintervalinterval-number-void">2.6. <code>setTickInterval(interval: number): void</code></a></h3>
654
+ <h3 id="settickintervalinterval-number-void"><a class="link" href="#settickintervalinterval-number-void">3.7. <code>setTickInterval(interval: number): void</code></a></h3>
606
655
  <div class="paragraph">
607
656
  <p>Sets the tick interval exactly to the specified value.</p>
608
657
  </div>
@@ -631,7 +680,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
631
680
  <hr>
632
681
  </div>
633
682
  <div class="sect2">
634
- <h3 id="setmintickintervalinterval-number-void"><a class="link" href="#setmintickintervalinterval-number-void">2.7. <code>setMinTickInterval(interval: number): void</code></a></h3>
683
+ <h3 id="setmintickintervalinterval-number-void"><a class="link" href="#setmintickintervalinterval-number-void">3.8. <code>setMinTickInterval(interval: number): void</code></a></h3>
635
684
  <div class="paragraph">
636
685
  <p>Sets the minimum limit for the tick interval, preventing the game from speeding up beyond this point.</p>
637
686
  </div>
@@ -657,11 +706,18 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
657
706
  </tr>
658
707
  </tbody>
659
708
  </table>
709
+ <hr>
710
+ </div>
711
+ <div class="sect2">
712
+ <h3 id="captureinitialstate-void"><a class="link" href="#captureinitialstate-void">3.9. <code>captureInitialState(): void</code></a></h3>
713
+ <div class="paragraph">
714
+ <p>Captures the current <code>tickInterval</code> as the initial state. This should be called after a game has performed its specific initialization to ensure that future resets restore the correct starting speed.</p>
715
+ </div>
660
716
  </div>
661
717
  </div>
662
718
  </div>
663
719
  <div class="sect1">
664
- <h2 id="general-usage"><a class="link" href="#general-usage">3. General Usage</a></h2>
720
+ <h2 id="general-usage"><a class="link" href="#general-usage">4. General Usage</a></h2>
665
721
  <div class="sectionbody">
666
722
  <div class="paragraph">
667
723
  <p>Implemented by <code><a href="../../modules/GameTime.html">GameTime</a></code>. This module ensures that game logic (like falling pieces) runs at a consistent speed regardless of the render frame rate.</p>
@@ -443,31 +443,33 @@ 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="#api-reference">1. API Reference</a>
446
+ <li><a href="#architectural-purpose">1. Architectural Purpose</a></li>
447
+ <li><a href="#api-reference">2. API Reference</a>
447
448
  <ul class="sectlevel2">
448
- <li><a href="#setup-void">1.1. <code>setup(): void</code></a></li>
449
- <li><a href="#setgamemodulesgamemodules-gamemodules-void">1.2. <code>setGameModules(gameModules: GameModules): void</code></a></li>
450
- <li><a href="#update-promisevoid">1.3. <code>update(): Promise&lt;void&gt;</code></a></li>
449
+ <li><a href="#setup-void">2.1. <code>setup(): void</code></a></li>
450
+ <li><a href="#setgamemodulesgamemodules-gamemodules-void">2.2. <code>setGameModules(gameModules: GameModules): void</code></a></li>
451
+ <li><a href="#update-promisevoid">2.3. <code>update(): Promise&lt;void&gt;</code></a></li>
451
452
  </ul>
452
453
  </li>
453
- <li><a href="#configuration">2. Configuration</a></li>
454
- <li><a href="#implementation">3. Implementation</a></li>
454
+ <li><a href="#configuration">3. Configuration</a></li>
455
+ <li><a href="#implementation">4. Implementation</a></li>
455
456
  </ul>
456
457
  </div>
457
458
  </div>
458
459
  <div id="content">
459
- <div id="preamble">
460
+ <div class="sect1">
461
+ <h2 id="architectural-purpose"><a class="link" href="#architectural-purpose">1. Architectural Purpose</a></h2>
460
462
  <div class="sectionbody">
461
463
  <div class="paragraph">
462
- <p>The <code>Debugger</code> class provides a real-time, HTML-based overlay for monitoring the state of all engine modules. It automatically identifies and extracts data from any module that implements the <code><a href="../interfaces/Debuggable.html">Debuggable</a></code> interface.</p>
464
+ <p>The <code>Debugger</code> module establishes an isolated inspection perimeter generating <code>&lt;details&gt;</code> tags mirroring runtime property values. Its architecture separates text-rendering diagnostics strictly from the hardware-accelerated Canvas loop allowing it to freely display un-optimized dynamic string representations of data models (<code><a href="../interfaces/Debuggable.html">Debuggable</a></code>) without plummeting framerates dragging continuous geometric translations.</p>
463
465
  </div>
464
466
  </div>
465
467
  </div>
466
468
  <div class="sect1">
467
- <h2 id="api-reference"><a class="link" href="#api-reference">1. API Reference</a></h2>
469
+ <h2 id="api-reference"><a class="link" href="#api-reference">2. API Reference</a></h2>
468
470
  <div class="sectionbody">
469
471
  <div class="sect2">
470
- <h3 id="setup-void"><a class="link" href="#setup-void">1.1. <code>setup(): void</code></a></h3>
472
+ <h3 id="setup-void"><a class="link" href="#setup-void">2.1. <code>setup(): void</code></a></h3>
471
473
  <div class="paragraph">
472
474
  <p>Initializes the debugger&#8217;s DOM structure.</p>
473
475
  </div>
@@ -480,7 +482,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
480
482
  <hr>
481
483
  </div>
482
484
  <div class="sect2">
483
- <h3 id="setgamemodulesgamemodules-gamemodules-void"><a class="link" href="#setgamemodulesgamemodules-gamemodules-void">1.2. <code>setGameModules(gameModules: GameModules): void</code></a></h3>
485
+ <h3 id="setgamemodulesgamemodules-gamemodules-void"><a class="link" href="#setgamemodulesgamemodules-gamemodules-void">2.2. <code>setGameModules(gameModules: GameModules): void</code></a></h3>
484
486
  <div class="paragraph">
485
487
  <p>Updates the active game modules being monitored by the debugger.</p>
486
488
  </div>
@@ -517,7 +519,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
517
519
  <hr>
518
520
  </div>
519
521
  <div class="sect2">
520
- <h3 id="update-promisevoid"><a class="link" href="#update-promisevoid">1.3. <code>update(): Promise&lt;void&gt;</code></a></h3>
522
+ <h3 id="update-promisevoid"><a class="link" href="#update-promisevoid">2.3. <code>update(): Promise&lt;void&gt;</code></a></h3>
521
523
  <div class="paragraph">
522
524
  <p>Refreshes the overlay with new data from the modules.</p>
523
525
  </div>
@@ -531,7 +533,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
531
533
  </div>
532
534
  </div>
533
535
  <div class="sect1">
534
- <h2 id="configuration"><a class="link" href="#configuration">2. Configuration</a></h2>
536
+ <h2 id="configuration"><a class="link" href="#configuration">3. Configuration</a></h2>
535
537
  <div class="sectionbody">
536
538
  <div class="paragraph">
537
539
  <p>The debugger behavior is controlled via the main <code>configs.ts</code> file:</p>
@@ -549,7 +551,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
549
551
  </div>
550
552
  </div>
551
553
  <div class="sect1">
552
- <h2 id="implementation"><a class="link" href="#implementation">3. Implementation</a></h2>
554
+ <h2 id="implementation"><a class="link" href="#implementation">4. Implementation</a></h2>
553
555
  <div class="sectionbody">
554
556
  <div class="paragraph">
555
557
  <p>Modules wishing to appear in the debugger must implement the <code>Debuggable</code> interface:</p>
@@ -443,28 +443,30 @@ 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="#api-reference">1. API Reference</a>
446
+ <li><a href="#architectural-purpose">1. Architectural Purpose</a></li>
447
+ <li><a href="#api-reference">2. API Reference</a>
447
448
  <ul class="sectlevel2">
448
- <li><a href="#setuprenderermetrics-renderermetrics-void">1.1. <code>setup(rendererMetrics: RendererMetrics): void</code></a></li>
449
- <li><a href="#rendergrid-cell-void">1.2. <code>render(grid: Cell[][]): void</code></a></li>
449
+ <li><a href="#setuprenderermetrics-renderermetrics-void">2.1. <code>setup(rendererMetrics: RendererMetrics): void</code></a></li>
450
+ <li><a href="#rendergrid-cell-void">2.2. <code>render(grid: Cell[][]): void</code></a></li>
450
451
  </ul>
451
452
  </li>
452
453
  </ul>
453
454
  </div>
454
455
  </div>
455
456
  <div id="content">
456
- <div id="preamble">
457
+ <div class="sect1">
458
+ <h2 id="architectural-purpose"><a class="link" href="#architectural-purpose">1. Architectural Purpose</a></h2>
457
459
  <div class="sectionbody">
458
460
  <div class="paragraph">
459
- <p>The <code>DisplayRenderer</code> is responsible for drawing the main game grid and the active bricks. It implements the standard <code><a href="../interfaces/modules/Renderer.html">Renderer</a></code> interface and is managed by the <code><a href="GameRenderer.html">GameRenderer</a></code>.</p>
461
+ <p>The <code>DisplayRenderer</code> is a dedicated visual presentation component completely isolated from gameplay logic. It translates logical cell matrix data directly into pixel payloads, leveraging hardware-accelerated drawing contexts. By pre-building a static background image buffer, it guarantees the volatile foreground update loop exclusively processes the minimum amount of dynamic rectangles required, aggressively reducing power consumption.</p>
460
462
  </div>
461
463
  </div>
462
464
  </div>
463
465
  <div class="sect1">
464
- <h2 id="api-reference"><a class="link" href="#api-reference">1. API Reference</a></h2>
466
+ <h2 id="api-reference"><a class="link" href="#api-reference">2. API Reference</a></h2>
465
467
  <div class="sectionbody">
466
468
  <div class="sect2">
467
- <h3 id="setuprenderermetrics-renderermetrics-void"><a class="link" href="#setuprenderermetrics-renderermetrics-void">1.1. <code>setup(rendererMetrics: RendererMetrics): void</code></a></h3>
469
+ <h3 id="setuprenderermetrics-renderermetrics-void"><a class="link" href="#setuprenderermetrics-renderermetrics-void">2.1. <code>setup(rendererMetrics: RendererMetrics): void</code></a></h3>
468
470
  <div class="paragraph">
469
471
  <p>Initializes the renderer and pre-calculates the static scene.</p>
470
472
  </div>
@@ -499,7 +501,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
499
501
  <hr>
500
502
  </div>
501
503
  <div class="sect2">
502
- <h3 id="rendergrid-cell-void"><a class="link" href="#rendergrid-cell-void">1.2. <code>render(grid: Cell[][]): void</code></a></h3>
504
+ <h3 id="rendergrid-cell-void"><a class="link" href="#rendergrid-cell-void">2.2. <code>render(grid: Cell[][]): void</code></a></h3>
503
505
  <div class="paragraph">
504
506
  <p>Executes the main display drawing logic.</p>
505
507
  </div>
@@ -443,29 +443,31 @@ 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="#contextual-notification-system">1. Contextual Notification System</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="#contextual-notification-system">2. Contextual Notification System</a></li>
448
+ <li><a href="#api-reference">3. API Reference</a>
448
449
  <ul class="sectlevel2">
449
- <li><a href="#subscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void">2.1. <code>subscribe(eventName: string, callback: EventCallback&lt;T&gt;, suffix?: EventSuffix): void</code></a></li>
450
- <li><a href="#unsubscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void">2.2. <code>unsubscribe(eventName: string, callback: EventCallback&lt;T&gt;, suffix?: EventSuffix): void</code></a></li>
451
- <li><a href="#notifyeventname-string-payload-t-void">2.3. <code>notify(eventName: string, payload: T): void</code></a></li>
452
- <li><a href="#notifycontextualeventname-string-payload-t-context-statecontext-void">2.4. <code>notifyContextual(eventName: string, payload: T, context: StateContext): void</code></a></li>
450
+ <li><a href="#subscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void">3.1. <code>subscribe(eventName: string, callback: EventCallback&lt;T&gt;, suffix?: EventSuffix): void</code></a></li>
451
+ <li><a href="#unsubscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void">3.2. <code>unsubscribe(eventName: string, callback: EventCallback&lt;T&gt;, suffix?: EventSuffix): void</code></a></li>
452
+ <li><a href="#notifyeventname-string-payload-t-void">3.3. <code>notify(eventName: string, payload: T): void</code></a></li>
453
+ <li><a href="#notifycontextualeventname-string-payload-t-context-statecontext-void">3.4. <code>notifyContextual(eventName: string, payload: T, context: StateContext): void</code></a></li>
453
454
  </ul>
454
455
  </li>
455
- <li><a href="#internal-name-formatting">3. Internal Name Formatting</a></li>
456
+ <li><a href="#internal-name-formatting">4. Internal Name Formatting</a></li>
456
457
  </ul>
457
458
  </div>
458
459
  </div>
459
460
  <div id="content">
460
- <div id="preamble">
461
+ <div class="sect1">
462
+ <h2 id="architectural-purpose"><a class="link" href="#architectural-purpose">1. Architectural Purpose</a></h2>
461
463
  <div class="sectionbody">
462
464
  <div class="paragraph">
463
- <p>The <code>EventEmitter</code> is the backbone of the engine&#8217;s reactive architecture. It allows modules to communicate without direct dependencies and supports <strong>Contextual Notifications</strong> that automatically target specific game states (e.g., Playing vs. Paused).</p>
465
+ <p>The <code>EventEmitter</code> acts as the centralized communication backbone of the engine reactor. It allows entirely decoupled modules to hook into each other&#8217;s lifecycles without direct direct method calls. By supporting <strong>Contextual Notifications</strong>, it prevents tight coupling and enables dynamic routing where events can automatically target specific game active states (e.g., Playing vs. Paused).</p>
464
466
  </div>
465
467
  </div>
466
468
  </div>
467
469
  <div class="sect1">
468
- <h2 id="contextual-notification-system"><a class="link" href="#contextual-notification-system">1. Contextual Notification System</a></h2>
470
+ <h2 id="contextual-notification-system"><a class="link" href="#contextual-notification-system">2. Contextual Notification System</a></h2>
469
471
  <div class="sectionbody">
470
472
  <div class="paragraph">
471
473
  <p>The <code>EventEmitter</code> extends simple pub/sub by supporting event suffixes. When a module notifies a "contextual" event, the emitter propagates the signal to:
@@ -479,12 +481,12 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
479
481
  </div>
480
482
  </div>
481
483
  <div class="sect1">
482
- <h2 id="api-reference"><a class="link" href="#api-reference">2. API Reference</a></h2>
484
+ <h2 id="api-reference"><a class="link" href="#api-reference">3. API Reference</a></h2>
483
485
  <div class="sectionbody">
484
486
  <div class="sect2">
485
- <h3 id="subscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void"><a class="link" href="#subscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void">2.1. <code>subscribe(eventName: string, callback: EventCallback&lt;T&gt;, suffix?: EventSuffix): void</code></a></h3>
487
+ <h3 id="subscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void"><a class="link" href="#subscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void">3.1. <code>subscribe(eventName: string, callback: EventCallback&lt;T&gt;, suffix?: EventSuffix): void</code></a></h3>
486
488
  <div class="paragraph">
487
- <p>Registers a listener for a specific event.</p>
489
+ <p>Registers a listener callback to be executed whenever the specified event is emitted. If a <code>EventSuffix</code> is provided, it subscribes to the contextual sub-channel (e.g. <code>UP:playing</code>) instead of the base channel.</p>
488
490
  </div>
489
491
  <div class="paragraph">
490
492
  <p><strong>Parameters</strong></p>
@@ -504,40 +506,46 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
504
506
  <tr>
505
507
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>eventName</code></p></td>
506
508
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>string</code></p></td>
507
- <td class="tableblock halign-left valign-top"><p class="tableblock">The base name of the event.</p></td>
509
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The base string identifier of the event to listen for.</p></td>
508
510
  </tr>
509
511
  <tr>
510
512
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>callback</code></p></td>
511
513
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>Function</code></p></td>
512
- <td class="tableblock halign-left valign-top"><p class="tableblock">The function to execute.</p></td>
514
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The function to execute when the event triggers. Receives the payload if applicable.</p></td>
513
515
  </tr>
514
516
  <tr>
515
517
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>suffix</code></p></td>
516
518
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../enums/EventSuffix.html">EventSuffix</a></code></p></td>
517
- <td class="tableblock halign-left valign-top"><p class="tableblock">(Optional) The context suffix (e.g., <code>EventSuffix.PAUSED</code>).</p></td>
519
+ <td class="tableblock halign-left valign-top"><p class="tableblock">(Optional) The context restricted modifier to listen only on specific lifecycle states.</p></td>
518
520
  </tr>
519
521
  </tbody>
520
522
  </table>
521
523
  <hr>
522
524
  </div>
523
525
  <div class="sect2">
524
- <h3 id="unsubscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void"><a class="link" href="#unsubscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void">2.2. <code>unsubscribe(eventName: string, callback: EventCallback&lt;T&gt;, suffix?: EventSuffix): void</code></a></h3>
526
+ <h3 id="unsubscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void"><a class="link" href="#unsubscribeeventname-string-callback-eventcallbackt-suffix-eventsuffix-void">3.2. <code>unsubscribe(eventName: string, callback: EventCallback&lt;T&gt;, suffix?: EventSuffix): void</code></a></h3>
525
527
  <div class="paragraph">
526
- <p>Removes a registration. The suffix must match the one used during subscription.</p>
528
+ <p>Safely removes the provided callback from the notification queue. The exact function reference must be used. If the event was subscribed with a suffix, the same suffix must be provided here to target the correct sub-channel.</p>
527
529
  </div>
528
530
  <hr>
529
531
  </div>
530
532
  <div class="sect2">
531
- <h3 id="notifyeventname-string-payload-t-void"><a class="link" href="#notifyeventname-string-payload-t-void">2.3. <code>notify(eventName: string, payload: T): void</code></a></h3>
533
+ <h3 id="notifyeventname-string-payload-t-void"><a class="link" href="#notifyeventname-string-payload-t-void">3.3. <code>notify(eventName: string, payload: T): void</code></a></h3>
534
+ <div class="paragraph">
535
+ <p><strong>Behavior</strong></p>
536
+ </div>
532
537
  <div class="paragraph">
533
- <p>Dispatches an event to the base channel.</p>
538
+ <p>Iterates over all callbacks associated with the given channel key and invokes them sequentially with the provided payload. This acts strictly on the base channel without evaluating current game states.</p>
534
539
  </div>
535
540
  <hr>
536
541
  </div>
537
542
  <div class="sect2">
538
- <h3 id="notifycontextualeventname-string-payload-t-context-statecontext-void"><a class="link" href="#notifycontextualeventname-string-payload-t-context-statecontext-void">2.4. <code>notifyContextual(eventName: string, payload: T, context: StateContext): void</code></a></h3>
543
+ <h3 id="notifycontextualeventname-string-payload-t-context-statecontext-void"><a class="link" href="#notifycontextualeventname-string-payload-t-context-statecontext-void">3.4. <code>notifyContextual(eventName: string, payload: T, context: StateContext): void</code></a></h3>
544
+ <div class="paragraph">
545
+ <p><strong>Behavior</strong></p>
546
+ </div>
539
547
  <div class="paragraph">
540
- <p>Dispatches an event to the base channel AND an appropriate state-specific channel.</p>
548
+ <p>Performs a standard notify on the base <code>eventName</code>, and then evaluates the provided <code><a href="../interfaces/StateContext.html">StateContext</a></code> to decide which secondary <code><a href="../enums/EventSuffix.html">EventSuffix</a></code> channel should also receive the payload. This enables multi-cast signals where listeners can opt into receiving only under certain states.</p>
541
549
  </div>
542
550
  <div class="paragraph">
543
551
  <p><strong>Parameters</strong></p>
@@ -557,17 +565,17 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
557
565
  <tr>
558
566
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>eventName</code></p></td>
559
567
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>string</code></p></td>
560
- <td class="tableblock halign-left valign-top"><p class="tableblock">The base name.</p></td>
568
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The core string identifier of the event broadcast.</p></td>
561
569
  </tr>
562
570
  <tr>
563
571
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>payload</code></p></td>
564
572
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>any</code></p></td>
565
- <td class="tableblock halign-left valign-top"><p class="tableblock">The data to pass.</p></td>
573
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The required event data to be passed to callbacks in both base and context channels.</p></td>
566
574
  </tr>
567
575
  <tr>
568
576
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code>context</code></p></td>
569
577
  <td class="tableblock halign-left valign-top"><p class="tableblock"><code><a href="../interfaces/StateContext.html">StateContext</a></code></p></td>
570
- <td class="tableblock halign-left valign-top"><p class="tableblock">The current engine context.</p></td>
578
+ <td class="tableblock halign-left valign-top"><p class="tableblock">The engine state provider used to determine applicable conditions (Playing, Paused, Title, Gameover).</p></td>
571
579
  </tr>
572
580
  </tbody>
573
581
  </table>
@@ -595,7 +603,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
595
603
  </div>
596
604
  </div>
597
605
  <div class="sect1">
598
- <h2 id="internal-name-formatting"><a class="link" href="#internal-name-formatting">3. Internal Name Formatting</a></h2>
606
+ <h2 id="internal-name-formatting"><a class="link" href="#internal-name-formatting">4. Internal Name Formatting</a></h2>
599
607
  <div class="sectionbody">
600
608
  <div class="paragraph">
601
609
  <p>The <code>EventEmitter</code> encapsulates its naming convention within a private <code>_formatName</code> method. The current standard uses a colon separator:</p>