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.
- package/README.adoc +2 -2
- package/dist/docs/index.html +3 -3
- package/dist/docs/jsdoc_standard.html +30 -13
- package/dist/docs/reference/bootstrap.html +556 -0
- package/dist/docs/reference/context/RendererContext.html +19 -9
- package/dist/docs/reference/enums/Color.html +11 -5
- package/dist/docs/reference/enums/ControlEventType.html +7 -5
- package/dist/docs/reference/enums/ControlKey.html +7 -5
- package/dist/docs/reference/enums/EventSuffix.html +7 -5
- package/dist/docs/reference/enums/FontAlignment.html +9 -7
- package/dist/docs/reference/enums/FontSize.html +7 -5
- package/dist/docs/reference/enums/Sound.html +7 -5
- package/dist/docs/reference/enums/StateProperty.html +7 -5
- package/dist/docs/reference/helpers/CellHelper.html +6 -2
- package/dist/docs/reference/helpers/ControlInputHandlerHelper.html +9 -5
- package/dist/docs/reference/helpers/CoordinateHelper.html +14 -10
- package/dist/docs/reference/helpers/RelativeValuesHelper.html +7 -3
- package/dist/docs/reference/interfaces/Debuggable.html +9 -7
- package/dist/docs/reference/interfaces/GameModules.html +7 -5
- package/dist/docs/reference/interfaces/Initializable.html +9 -7
- package/dist/docs/reference/interfaces/RendererInitializable.html +9 -7
- package/dist/docs/reference/interfaces/StateContext.html +7 -5
- package/dist/docs/reference/interfaces/StateSyncable.html +11 -9
- package/dist/docs/reference/interfaces/modules/Control.html +19 -17
- package/dist/docs/reference/interfaces/modules/Grid.html +77 -55
- package/dist/docs/reference/interfaces/modules/Renderer.html +9 -7
- package/dist/docs/reference/interfaces/modules/RendererComposite.html +13 -11
- package/dist/docs/reference/interfaces/modules/Score.html +21 -19
- package/dist/docs/reference/interfaces/modules/Session.html +64 -18
- package/dist/docs/reference/interfaces/modules/State.html +59 -57
- package/dist/docs/reference/interfaces/modules/Text.html +21 -19
- package/dist/docs/reference/interfaces/modules/Time.html +80 -24
- package/dist/docs/reference/modules/Debugger.html +16 -14
- package/dist/docs/reference/modules/DisplayRenderer.html +10 -8
- package/dist/docs/reference/modules/EventEmitter.html +34 -26
- package/dist/docs/reference/modules/Game.html +55 -30
- package/dist/docs/reference/modules/GameControl.html +49 -44
- package/dist/docs/reference/modules/GameEventRegistry.html +17 -34
- package/dist/docs/reference/modules/GameGrid.html +174 -116
- package/dist/docs/reference/modules/GameHudGrid.html +10 -8
- package/dist/docs/reference/modules/GameRenderer.html +14 -12
- package/dist/docs/reference/modules/GameScore.html +36 -34
- package/dist/docs/reference/modules/GameSession.html +37 -19
- package/dist/docs/reference/modules/GameSound.html +20 -18
- package/dist/docs/reference/modules/GameState.html +70 -68
- package/dist/docs/reference/modules/GameText.html +29 -27
- package/dist/docs/reference/modules/GameTime.html +98 -30
- package/dist/docs/reference/modules/HudRenderer.html +10 -8
- package/dist/docs/reference/modules/InitialStateSnapshot.html +13 -11
- package/dist/docs/reference/modules/SessionModal.html +11 -9
- package/dist/docs/reference/types/Axis.html +7 -5
- package/dist/docs/reference/types/Cell.html +7 -5
- package/dist/docs/reference/types/ControlCallback.html +7 -5
- package/dist/docs/reference/types/Coordinate.html +7 -5
- package/dist/docs/reference/types/GameEvent.html +7 -5
- package/dist/docs/reference/types/Piece.html +7 -5
- package/dist/docs/reference/types/RendererMetrics.html +7 -5
- package/dist/docs/reference/types/Vector.html +7 -5
- package/dist/docs/reference/view/GameView.html +29 -21
- package/dist/docs/testing_best_practices.html +2 -2
- package/dist/game.bundle.js +1 -1
- package/dist/types/bootstrap.d.ts +12 -11
- package/dist/types/core/Game.d.ts +46 -39
- package/dist/types/core/InitialStateSnapshot.d.ts +18 -6
- package/dist/types/core/context/RendererContext.d.ts +32 -10
- package/dist/types/core/event/EventEmitter.d.ts +64 -21
- package/dist/types/core/event/GameEventRegistry.d.ts +17 -3
- package/dist/types/core/helpers/CellHelper.d.ts +11 -4
- package/dist/types/core/helpers/ControlInputHandlerHelper.d.ts +20 -11
- package/dist/types/core/helpers/CoordinateHelper.d.ts +28 -23
- package/dist/types/core/helpers/InterfaceIdentifierHelper.d.ts +34 -0
- package/dist/types/core/helpers/RelativeValuesHelper.d.ts +10 -8
- package/dist/types/core/module/control/GameControl.d.ts +26 -14
- package/dist/types/core/module/grid/GameGrid.d.ts +92 -53
- package/dist/types/core/module/grid/GameHudGrid.d.ts +9 -7
- package/dist/types/core/module/grid/engines/GridAnalysisEngine.d.ts +25 -6
- package/dist/types/core/module/grid/engines/GridLineEngine.d.ts +51 -13
- package/dist/types/core/module/grid/engines/GridMovementEngine.d.ts +97 -13
- package/dist/types/core/module/grid/engines/GridRegionEngine.d.ts +24 -5
- package/dist/types/core/module/grid/engines/GridTransformEngine.d.ts +21 -5
- package/dist/types/core/module/renderer/DisplayRenderer.d.ts +27 -15
- package/dist/types/core/module/renderer/GameRenderer.d.ts +20 -13
- package/dist/types/core/module/renderer/HudRenderer.d.ts +27 -19
- package/dist/types/core/module/score/GameScore.d.ts +29 -18
- package/dist/types/core/module/session/GameSession.d.ts +56 -0
- package/dist/types/core/module/sound/GameSound.d.ts +39 -23
- package/dist/types/core/module/state/GameState.d.ts +38 -14
- package/dist/types/core/module/text/GameText.d.ts +40 -25
- package/dist/types/core/module/time/GameTime.d.ts +52 -18
- package/dist/types/core/types/Interfaces.d.ts +15 -0
- package/dist/types/core/types/Types.d.ts +1 -0
- package/dist/types/core/types/enums.d.ts +2 -1
- package/dist/types/core/types/modules.d.ts +214 -45
- package/dist/types/view/Debugger.d.ts +23 -0
- package/dist/types/view/GameView.d.ts +44 -27
- package/dist/types/view/SessionModal.d.ts +24 -0
- package/package.json +1 -1
- package/dist/CNAME +0 -1
package/README.adoc
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
:idprefix:
|
|
13
13
|
:idseparator: -
|
|
14
14
|
|
|
15
|
-
==
|
|
15
|
+
== Architectural Purpose
|
|
16
16
|
|
|
17
|
-
The **Brick Engine** is a modular, TypeScript-based game engine designed for creating retro grid-based games (like Tetris, Snake, Breakout) that run in a browser. It leverages **P5.js** for rendering and simulates the experience of a classic handheld gaming device,
|
|
17
|
+
The **Brick Engine** is a modular, TypeScript-based game engine designed for creating retro grid-based games (like Tetris, Snake, Breakout) that run in a browser. It leverages **P5.js** for rendering and simulates the experience of a physical, classic handheld gaming device. By isolating mathematical states from actual Canvas execution, it guarantees completely deterministic and highly scalable retro physics. It is composed of a dot-matrix style display, a specialized HUD (Head-Up Display), and explicitly bound event-driven physical controls.
|
|
18
18
|
|
|
19
19
|
== Key Features
|
|
20
20
|
|
package/dist/docs/index.html
CHANGED
|
@@ -443,7 +443,7 @@ 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="#
|
|
446
|
+
<li><a href="#architectural-purpose">1. Architectural Purpose</a></li>
|
|
447
447
|
<li><a href="#key-features">2. Key Features</a></li>
|
|
448
448
|
<li><a href="#getting-started">3. Getting Started</a></li>
|
|
449
449
|
<li><a href="#publishing-your-game">4. Publishing Your Game</a></li>
|
|
@@ -454,10 +454,10 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
|
|
|
454
454
|
</div>
|
|
455
455
|
<div id="content">
|
|
456
456
|
<div class="sect1">
|
|
457
|
-
<h2 id="
|
|
457
|
+
<h2 id="architectural-purpose"><a class="link" href="#architectural-purpose">1. Architectural Purpose</a></h2>
|
|
458
458
|
<div class="sectionbody">
|
|
459
459
|
<div class="paragraph">
|
|
460
|
-
<p>The <strong>Brick Engine</strong> is a modular, TypeScript-based game engine designed for creating retro grid-based games (like Tetris, Snake, Breakout) that run in a browser. It leverages <strong>P5.js</strong> for rendering and simulates the experience of a classic handheld gaming device,
|
|
460
|
+
<p>The <strong>Brick Engine</strong> is a modular, TypeScript-based game engine designed for creating retro grid-based games (like Tetris, Snake, Breakout) that run in a browser. It leverages <strong>P5.js</strong> for rendering and simulates the experience of a physical, classic handheld gaming device. By isolating mathematical states from actual Canvas execution, it guarantees completely deterministic and highly scalable retro physics. It is composed of a dot-matrix style display, a specialized HUD (Head-Up Display), and explicitly bound event-driven physical controls.</p>
|
|
461
461
|
</div>
|
|
462
462
|
</div>
|
|
463
463
|
</div>
|
|
@@ -458,7 +458,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
|
|
|
458
458
|
<li><a href="#_example_2">Example</a></li>
|
|
459
459
|
</ul>
|
|
460
460
|
</li>
|
|
461
|
-
<li><a href="#
|
|
461
|
+
<li><a href="#_interfaces_types_and_enums">Interfaces, Types, and Enums</a>
|
|
462
462
|
<ul class="sectlevel2">
|
|
463
463
|
<li><a href="#_example_3">Example</a></li>
|
|
464
464
|
</ul>
|
|
@@ -520,7 +520,7 @@ Strict typing is <strong>mandatory</strong> for all methods and functions docume
|
|
|
520
520
|
<h2 id="_classes">Classes</h2>
|
|
521
521
|
<div class="sectionbody">
|
|
522
522
|
<div class="paragraph">
|
|
523
|
-
<p>Classes must
|
|
523
|
+
<p>Classes must include a detailed description that explains their architectural purpose, responsibility, and the core problem they solve. This context is essential for understanding why the class exists and how it fits into the broader architecture, without needing repetitive phrasing like "The motivation for this class is…​".</p>
|
|
524
524
|
</div>
|
|
525
525
|
<div class="admonitionblock warning">
|
|
526
526
|
<table>
|
|
@@ -541,7 +541,10 @@ All class public properties must be documented, explaining what they store.
|
|
|
541
541
|
<pre class="highlightjs highlight"><code class="language-typescript hljs" data-lang="typescript">/**
|
|
542
542
|
* Manages the game view layer and user interactions.
|
|
543
543
|
*
|
|
544
|
-
*
|
|
544
|
+
* Designed to decouple the rendering logic from the core game state and
|
|
545
|
+
* input processing. It orchestrates the rendering of sub-components and
|
|
546
|
+
* binds DOM events to game logic, ensuring that visual updates happen
|
|
547
|
+
* consistently in the render loop.
|
|
545
548
|
*/
|
|
546
549
|
export default class GameView {
|
|
547
550
|
private p: P5;
|
|
@@ -581,13 +584,19 @@ export default class GameView {
|
|
|
581
584
|
<p><strong>Short Description</strong>: One-line summary.</p>
|
|
582
585
|
</li>
|
|
583
586
|
<li>
|
|
584
|
-
<p><strong>Detailed Description</strong>:
|
|
587
|
+
<p><strong>Detailed Description</strong>: Provide a detailed base description to make its objective, context, and side-effects completely clear.</p>
|
|
585
588
|
</li>
|
|
586
589
|
<li>
|
|
587
|
-
<p><strong
|
|
590
|
+
<p><strong>Cross-Referencing</strong>: Use inline links (e.g., <code>{@link EntityName}</code>) to reference other related entities when useful.</p>
|
|
588
591
|
</li>
|
|
589
592
|
<li>
|
|
590
|
-
<p><strong>@
|
|
593
|
+
<p><strong>@param</strong>: One for each argument, including the type and a detailed description of its usage and constraints.</p>
|
|
594
|
+
</li>
|
|
595
|
+
<li>
|
|
596
|
+
<p><strong>@throws</strong>: Document the exceptions thrown in a detailed way, explaining the exception type and the conditions that trigger it.</p>
|
|
597
|
+
</li>
|
|
598
|
+
<li>
|
|
599
|
+
<p><strong>@returns</strong>: The return type and a detailed description of exactly what is returned.</p>
|
|
591
600
|
</li>
|
|
592
601
|
</ol>
|
|
593
602
|
</div>
|
|
@@ -600,11 +609,14 @@ export default class GameView {
|
|
|
600
609
|
* Calculates the optimal dimensions for the game container.
|
|
601
610
|
*
|
|
602
611
|
* It ensures the container maintains the aspect ratio defined by constants
|
|
603
|
-
* while fitting within the parent element's bounds.
|
|
612
|
+
* while fitting within the parent element's bounds. This is crucial for
|
|
613
|
+
* supporting multiple screen sizes without distorting the game canvas.
|
|
614
|
+
* For more details on the layout behavior, see {@link FrameLayout}.
|
|
604
615
|
*
|
|
605
|
-
* @param {number} availableWidth - The maximum available width in pixels.
|
|
606
|
-
* @param {number} availableHeight - The maximum available height in pixels.
|
|
607
|
-
* @
|
|
616
|
+
* @param {number} availableWidth - The maximum available width in pixels provided by the parent container. Must be greater than zero.
|
|
617
|
+
* @param {number} availableHeight - The maximum available height in pixels provided by the parent container. Must be greater than zero.
|
|
618
|
+
* @throws {Error} If `availableWidth` or `availableHeight` are less than or equal to zero.
|
|
619
|
+
* @returns {Dimensions} An object containing the calculated optimal `width` and `height`, guaranteed to preserve the aspect ratio.
|
|
608
620
|
*/
|
|
609
621
|
function calculateDimensions(availableWidth: number, availableHeight: number): Dimensions {
|
|
610
622
|
// ...
|
|
@@ -615,10 +627,10 @@ function calculateDimensions(availableWidth: number, availableHeight: number): D
|
|
|
615
627
|
</div>
|
|
616
628
|
</div>
|
|
617
629
|
<div class="sect1">
|
|
618
|
-
<h2 id="
|
|
630
|
+
<h2 id="_interfaces_types_and_enums">Interfaces, Types, and Enums</h2>
|
|
619
631
|
<div class="sectionbody">
|
|
620
632
|
<div class="paragraph">
|
|
621
|
-
<p>Interfaces must
|
|
633
|
+
<p>Interfaces, types, and enums must include a detailed description explaining their purpose and architectural context. It should be clear why this specific data structure, type constraint, or set of values was created and how it is meant to be used. They must also document each of their properties or members.</p>
|
|
622
634
|
</div>
|
|
623
635
|
<div class="sect2">
|
|
624
636
|
<h3 id="_example_3">Example</h3>
|
|
@@ -626,6 +638,11 @@ function calculateDimensions(availableWidth: number, availableHeight: number): D
|
|
|
626
638
|
<div class="content">
|
|
627
639
|
<pre class="highlightjs highlight"><code class="language-typescript hljs" data-lang="typescript">/**
|
|
628
640
|
* Represents the layout response containing container references.
|
|
641
|
+
*
|
|
642
|
+
* Provides a standardized structure for UI components when they allocate
|
|
643
|
+
* space on the screen. By returning this structured response, the parent
|
|
644
|
+
* view can easily align other elements relatively without needing to know
|
|
645
|
+
* the implementation details.
|
|
629
646
|
*/
|
|
630
647
|
interface ButtonLayoutResponse {
|
|
631
648
|
/** The container for small system buttons (e.g., Reset, Power). */
|
|
@@ -642,7 +659,7 @@ interface ButtonLayoutResponse {
|
|
|
642
659
|
</div>
|
|
643
660
|
<div id="footer">
|
|
644
661
|
<div id="footer-text">
|
|
645
|
-
Last updated 2026-02-
|
|
662
|
+
Last updated 2026-02-27 21:30:24 -0300
|
|
646
663
|
</div>
|
|
647
664
|
</div>
|
|
648
665
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
|