brick-engine-js 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.adoc +7 -2
- package/dist/docs/getting-started.html +1 -1
- package/dist/docs/index.html +17 -1
- package/dist/docs/publishing.html +1 -1
- package/dist/docs/reference/context/RendererContext.html +584 -0
- package/dist/docs/reference/{types/GameEntry.html → enums/EventSuffix.html} +21 -22
- package/dist/docs/reference/helpers/CoordinateHelper.html +10 -35
- package/dist/docs/reference/helpers/RelativeValuesHelper.html +4 -14
- package/dist/docs/reference/interfaces/GameModules.html +14 -9
- package/dist/docs/reference/{modules/GameMenu.html → interfaces/StateContext.html} +50 -71
- package/dist/docs/reference/interfaces/modules/Score.html +6 -6
- package/dist/docs/reference/interfaces/modules/Session.html +31 -1
- package/dist/docs/reference/modules/EventEmitter.html +624 -0
- package/dist/docs/reference/modules/Game.html +18 -136
- package/dist/docs/reference/modules/GameControl.html +170 -9
- package/dist/docs/reference/modules/GameEventRegistry.html +605 -0
- package/dist/docs/reference/modules/GameScore.html +40 -10
- package/dist/docs/reference/modules/GameSession.html +37 -7
- package/dist/docs/reference/modules/GameState.html +119 -6
- package/dist/docs/reference/modules/InitialStateSnapshot.html +5 -2
- package/dist/docs/reference/view/GameView.html +606 -0
- package/dist/game.bundle.js +1 -1
- package/dist/types/bootstrap.d.ts +1 -1
- package/dist/types/core/Game.d.ts +16 -5
- package/dist/types/core/context/RendererContext.d.ts +25 -0
- package/dist/types/core/context/RendererContext.test.d.ts +1 -0
- package/dist/types/core/event/EventEmitter.d.ts +71 -0
- package/dist/types/core/event/EventEmitter.test.d.ts +1 -0
- package/dist/types/core/event/GameEventRegistry.d.ts +28 -0
- package/dist/types/core/event/GameEventRegistry.test.d.ts +1 -0
- package/dist/types/core/helpers/CoordinateHelper.d.ts +5 -11
- package/dist/types/core/helpers/RelativeValuesHelper.d.ts +2 -5
- package/dist/types/core/module/control/GameControl.d.ts +11 -15
- package/dist/types/core/module/renderer/DisplayRenderer.d.ts +0 -8
- package/dist/types/core/module/renderer/GameRenderer.d.ts +0 -8
- package/dist/types/core/module/renderer/HudRenderer.d.ts +0 -8
- package/dist/types/core/module/score/GameScore.d.ts +5 -3
- package/dist/types/core/module/session/GameSession.d.ts +0 -1
- package/dist/types/core/module/state/GameState.d.ts +12 -16
- package/dist/types/core/module/text/GameText.d.ts +0 -9
- package/dist/types/core/types/modules.d.ts +77 -7
- package/dist/types/index.d.ts +2 -0
- package/dist/types/view/Debugger.d.ts +1 -3
- package/dist/types/view/GameView.d.ts +1 -2
- package/dist/types/view/SessionModal.d.ts +1 -3
- package/dist/types/view/components/layout/ButtonLayout.d.ts +1 -1
- package/dist/types/view/components/layout/ContainerLayout.d.ts +1 -1
- package/dist/types/view/components/layout/FrameLayout.d.ts +1 -1
- package/dist/types/view/components/ui/BigButton.d.ts +1 -1
- package/dist/types/view/components/ui/Button.d.ts +1 -1
- package/dist/types/view/components/ui/Canvas.d.ts +1 -1
- package/dist/types/view/components/ui/SmallButton.d.ts +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import { ControlCallback, ControlEventType, GameModules } from '../../types/Type
|
|
|
9
9
|
export default class GameControl implements Control, Debuggable {
|
|
10
10
|
private _modules;
|
|
11
11
|
private _keyBinding;
|
|
12
|
-
private
|
|
12
|
+
private _activeListeners;
|
|
13
13
|
/**
|
|
14
14
|
* Initializes the control system.
|
|
15
15
|
* Sets up key bindings and prepares the input handler.
|
|
@@ -29,22 +29,18 @@ export default class GameControl implements Control, Debuggable {
|
|
|
29
29
|
* @param {GameModules} modules - The collected game modules.
|
|
30
30
|
*/
|
|
31
31
|
setModules(modules: GameModules): void;
|
|
32
|
-
/**
|
|
33
|
-
* Subscribes a callback to a specific control event.
|
|
34
|
-
*
|
|
35
|
-
* @param {ControlKey} key - The key to listen for.
|
|
36
|
-
* @param {ControlEventType} type - The event type (pressed/held).
|
|
37
|
-
* @param {ControlCallback} callback - The function to execute.
|
|
38
|
-
*/
|
|
39
32
|
subscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
40
|
-
/**
|
|
41
|
-
* Unsubscribes a callback from a control event.
|
|
42
|
-
*
|
|
43
|
-
* @param {ControlKey} key - The key to stop listening for.
|
|
44
|
-
* @param {ControlEventType} type - The event type.
|
|
45
|
-
* @param {ControlCallback} callback - The function to remove.
|
|
46
|
-
*/
|
|
47
33
|
unsubscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
34
|
+
subscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
35
|
+
unsubscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
36
|
+
subscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
37
|
+
unsubscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
38
|
+
subscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
39
|
+
unsubscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
40
|
+
subscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
41
|
+
unsubscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
42
|
+
private _subscribe;
|
|
43
|
+
private _unsubscribe;
|
|
48
44
|
/**
|
|
49
45
|
* Notifies subscribers of a control event.
|
|
50
46
|
*
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import p5 from 'p5';
|
|
2
1
|
import { Cell, GameModules, RendererMetrics } from '../../types/Types';
|
|
3
2
|
import { Renderer, State } from '../../types/modules';
|
|
4
3
|
/**
|
|
@@ -6,16 +5,9 @@ import { Renderer, State } from '../../types/modules';
|
|
|
6
5
|
* Handles cell rendering, background drawing, and optimizes static elements using an off-screen buffer.
|
|
7
6
|
*/
|
|
8
7
|
export default class DisplayRenderer implements Renderer {
|
|
9
|
-
private _p;
|
|
10
8
|
private _rendererMetrics;
|
|
11
9
|
private _cellPreCalculatedGeometry;
|
|
12
10
|
private _staticGraphics;
|
|
13
|
-
/**
|
|
14
|
-
* Creates an instance of the DisplayRenderer.
|
|
15
|
-
*
|
|
16
|
-
* @param {p5} p - The p5 instance.
|
|
17
|
-
*/
|
|
18
|
-
constructor(p: p5);
|
|
19
11
|
/**
|
|
20
12
|
* Initializes the renderer with the calculated metrics.
|
|
21
13
|
* Pre-calculates cell geometry for faster rendering.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import p5 from 'p5';
|
|
2
1
|
import { Cell, GameModules, RendererMetrics } from '../../types/Types';
|
|
3
2
|
import { Debuggable } from '../../types/Interfaces';
|
|
4
3
|
import { Renderer } from '../../types/modules';
|
|
@@ -9,17 +8,10 @@ import { RendererComposite } from '../../types/modules';
|
|
|
9
8
|
* Handles the calculation of shared rendering metrics (sizes, positions) to ensure consistency.
|
|
10
9
|
*/
|
|
11
10
|
export default class GameRenderer implements RendererComposite, Debuggable {
|
|
12
|
-
private _p;
|
|
13
11
|
private _renderers;
|
|
14
12
|
private _displayRenderer;
|
|
15
13
|
private _hudRenderer;
|
|
16
14
|
private _rendererMetrics;
|
|
17
|
-
/**
|
|
18
|
-
* Creates an instance of GameRenderer.
|
|
19
|
-
*
|
|
20
|
-
* @param {p5} p - The p5 instance.
|
|
21
|
-
*/
|
|
22
|
-
constructor(p: p5);
|
|
23
15
|
/**
|
|
24
16
|
* Adds a sub-renderer to the composition.
|
|
25
17
|
*
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { Renderer } from '../../types/modules';
|
|
2
2
|
import { Cell, GameModules, RendererMetrics } from '../../types/Types';
|
|
3
|
-
import p5 from 'p5';
|
|
4
3
|
/**
|
|
5
4
|
* Responsible for rendering the Heads-Up Display (HUD).
|
|
6
5
|
* Displays game information like Score, High Score, Level, and the Next Piece Preview.
|
|
7
6
|
*/
|
|
8
7
|
export default class HudRenderer implements Renderer {
|
|
9
|
-
private _p;
|
|
10
8
|
private _gridOrigin;
|
|
11
9
|
private _cellSize;
|
|
12
10
|
private _hudBorderRect;
|
|
13
|
-
/**
|
|
14
|
-
* Creates an instance of HudRenderer.
|
|
15
|
-
*
|
|
16
|
-
* @param {p5} p - The p5 instance.
|
|
17
|
-
*/
|
|
18
|
-
constructor(p: p5);
|
|
19
11
|
/**
|
|
20
12
|
* Initializes the HUD with calculated metrics.
|
|
21
13
|
* Sets up the grid origin and border rectangle for the "next piece" preview area.
|
|
@@ -12,12 +12,14 @@ export default class GameScore implements Score, Debuggable, Serializable {
|
|
|
12
12
|
private _level;
|
|
13
13
|
private _maxLevel;
|
|
14
14
|
private _highScore;
|
|
15
|
+
private _gameId;
|
|
15
16
|
serialId: string;
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
18
|
+
* Sets up the game high score.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} id - The game ID.
|
|
19
21
|
*/
|
|
20
|
-
|
|
22
|
+
setupGameHighScore(id: string): void;
|
|
21
23
|
/**
|
|
22
24
|
* Increases the score by the given amount, applying the current multiplier.
|
|
23
25
|
* Automatically checks for high score updates.
|
|
@@ -14,7 +14,6 @@ export default class GameSession implements Session {
|
|
|
14
14
|
setSessionEnabled(enabled: boolean): void;
|
|
15
15
|
private _hasSession;
|
|
16
16
|
private _loadSession;
|
|
17
|
-
private _destroySession;
|
|
18
17
|
syncState(state: State): void;
|
|
19
18
|
getDebugData(): Record<string, string | number | boolean>;
|
|
20
19
|
private _key;
|
|
@@ -15,8 +15,6 @@ import { StateProperty } from '../../types/Types';
|
|
|
15
15
|
*/
|
|
16
16
|
export default class GameState implements State, Debuggable {
|
|
17
17
|
private _state;
|
|
18
|
-
/** Map to store property names and their associated subscription callbacks. */
|
|
19
|
-
private _subscribers;
|
|
20
18
|
/**
|
|
21
19
|
* Initializes the state module.
|
|
22
20
|
* Sets default values for all state properties and loads persisted data.
|
|
@@ -35,11 +33,11 @@ export default class GameState implements State, Debuggable {
|
|
|
35
33
|
private _set;
|
|
36
34
|
/**
|
|
37
35
|
* Notifies all subscribers of a property change.
|
|
36
|
+
* Dispatches to the base property channel and state-specific context channels.
|
|
38
37
|
*
|
|
39
38
|
* @param {StateProperty} property - The property that changed.
|
|
40
|
-
* @param {boolean | number} value - The new value of the property.
|
|
41
39
|
*/
|
|
42
|
-
|
|
40
|
+
notify(property: StateProperty): void;
|
|
43
41
|
/**
|
|
44
42
|
* Checks if the game machine is powered on.
|
|
45
43
|
*
|
|
@@ -149,20 +147,18 @@ export default class GameState implements State, Debuggable {
|
|
|
149
147
|
* Toggles the muted state.
|
|
150
148
|
*/
|
|
151
149
|
toggleMuted(): void;
|
|
152
|
-
/**
|
|
153
|
-
* Subscribes to changes in specific state properties.
|
|
154
|
-
*
|
|
155
|
-
* @param {StateProperty} property - The state property to monitor.
|
|
156
|
-
* @param {function(boolean | number): void} callback - The function to execute when the property changes.
|
|
157
|
-
*/
|
|
158
150
|
subscribe(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
159
|
-
/**
|
|
160
|
-
* Unsubscribes from changes in specific state properties.
|
|
161
|
-
*
|
|
162
|
-
* @param {StateProperty} property - The state property to monitor.
|
|
163
|
-
* @param {function(boolean | number): void} callback - The function to remove.
|
|
164
|
-
*/
|
|
165
151
|
unsubscribe(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
152
|
+
subscribeForTitleScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
153
|
+
unsubscribeForTitleScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
154
|
+
subscribeForGameOverScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
155
|
+
unsubscribeForGameOverScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
156
|
+
subscribeForPlayingScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
157
|
+
unsubscribeForPlayingScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
158
|
+
subscribeForPausedScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
159
|
+
unsubscribeForPausedScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
160
|
+
private _subscribe;
|
|
161
|
+
private _unsubscribe;
|
|
166
162
|
/**
|
|
167
163
|
* Retrieves debug information about the game state.
|
|
168
164
|
*
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import p5 from 'p5';
|
|
2
1
|
import { FontSize, FontAlign, FontVerticalAlign } from '../../types/enums';
|
|
3
2
|
import { Coordinate, RendererMetrics } from '../../types/Types';
|
|
4
3
|
import { Debuggable } from '../../types/Interfaces';
|
|
@@ -16,14 +15,6 @@ export default class GameText implements Text, Debuggable {
|
|
|
16
15
|
private fontSizes;
|
|
17
16
|
/** Stores the current display metrics for relative positioning. */
|
|
18
17
|
private _rendererMetrics;
|
|
19
|
-
/** The p5 instance used for rendering. */
|
|
20
|
-
private _p;
|
|
21
|
-
/**
|
|
22
|
-
* Creates an instance of GameText.
|
|
23
|
-
*
|
|
24
|
-
* @param {p5} p - The p5 instance.
|
|
25
|
-
*/
|
|
26
|
-
constructor(p: p5);
|
|
27
18
|
/**
|
|
28
19
|
* Setup the font and pre-calculates relative font sizes.
|
|
29
20
|
*
|
|
@@ -486,6 +486,38 @@ export interface State extends Initializable {
|
|
|
486
486
|
* @param {function(boolean | number): void} callback - The callback reference to remove.
|
|
487
487
|
*/
|
|
488
488
|
unsubscribe(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
489
|
+
/**
|
|
490
|
+
* Registers a callback for a specific state change ONLY during the title screen.
|
|
491
|
+
*/
|
|
492
|
+
subscribeForTitleScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
493
|
+
/**
|
|
494
|
+
* Removes an existing title screen subscription.
|
|
495
|
+
*/
|
|
496
|
+
unsubscribeForTitleScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
497
|
+
/**
|
|
498
|
+
* Registers a callback for a specific state change ONLY during the game over screen.
|
|
499
|
+
*/
|
|
500
|
+
subscribeForGameOverScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
501
|
+
/**
|
|
502
|
+
* Removes an existing game over screen subscription.
|
|
503
|
+
*/
|
|
504
|
+
unsubscribeForGameOverScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
505
|
+
/**
|
|
506
|
+
* Registers a callback for a specific state change ONLY during active gameplay.
|
|
507
|
+
*/
|
|
508
|
+
subscribeForPlayingScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
509
|
+
/**
|
|
510
|
+
* Removes an existing playing screen subscription.
|
|
511
|
+
*/
|
|
512
|
+
unsubscribeForPlayingScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
513
|
+
/**
|
|
514
|
+
* Registers a callback for a specific state change ONLY during the paused screen.
|
|
515
|
+
*/
|
|
516
|
+
subscribeForPausedScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
517
|
+
/**
|
|
518
|
+
* Removes an existing paused screen subscription.
|
|
519
|
+
*/
|
|
520
|
+
unsubscribeForPausedScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
489
521
|
/** Turn the game system on. */
|
|
490
522
|
turnOn(): void;
|
|
491
523
|
/** Turn the game system off. */
|
|
@@ -523,12 +555,6 @@ export interface Control extends Initializable {
|
|
|
523
555
|
* @param {ControlEventType} type - The type of event (press/hold).
|
|
524
556
|
*/
|
|
525
557
|
notify(key: ControlKey, type: ControlEventType): void;
|
|
526
|
-
/**
|
|
527
|
-
* Injects the module references required for populating the event context.
|
|
528
|
-
*
|
|
529
|
-
* @param {GameModules} modules - The collection of system modules.
|
|
530
|
-
*/
|
|
531
|
-
setModules(modules: GameModules): void;
|
|
532
558
|
/**
|
|
533
559
|
* Registers a callback for a specific control event.
|
|
534
560
|
*
|
|
@@ -545,6 +571,44 @@ export interface Control extends Initializable {
|
|
|
545
571
|
* @param {ControlCallback} callback - The function reference to remove.
|
|
546
572
|
*/
|
|
547
573
|
unsubscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
574
|
+
/**
|
|
575
|
+
* Registers a callback for a specific control event ONLY during the title screen.
|
|
576
|
+
*/
|
|
577
|
+
subscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
578
|
+
/**
|
|
579
|
+
* Removes an existing title screen subscription.
|
|
580
|
+
*/
|
|
581
|
+
unsubscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
582
|
+
/**
|
|
583
|
+
* Registers a callback for a specific control event ONLY during the game over screen.
|
|
584
|
+
*/
|
|
585
|
+
subscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
586
|
+
/**
|
|
587
|
+
* Removes an existing game over screen subscription.
|
|
588
|
+
*/
|
|
589
|
+
unsubscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
590
|
+
/**
|
|
591
|
+
* Registers a callback for a specific control event ONLY during active gameplay.
|
|
592
|
+
*/
|
|
593
|
+
subscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
594
|
+
/**
|
|
595
|
+
* Removes an existing playing screen subscription.
|
|
596
|
+
*/
|
|
597
|
+
unsubscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
598
|
+
/**
|
|
599
|
+
* Registers a callback for a specific control event ONLY during the paused screen.
|
|
600
|
+
*/
|
|
601
|
+
subscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
602
|
+
/**
|
|
603
|
+
* Removes an existing paused screen subscription.
|
|
604
|
+
*/
|
|
605
|
+
unsubscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
606
|
+
/**
|
|
607
|
+
* Injects the module references required for populating the event context.
|
|
608
|
+
*
|
|
609
|
+
* @param {GameModules} modules - The collection of system modules.
|
|
610
|
+
*/
|
|
611
|
+
setModules(modules: GameModules): void;
|
|
548
612
|
/**
|
|
549
613
|
* Detaches all hardware/DOM event listeners.
|
|
550
614
|
*/
|
|
@@ -660,7 +724,7 @@ export interface TimePerformanceMonitor {
|
|
|
660
724
|
/**
|
|
661
725
|
* Interface for the score and progression module.
|
|
662
726
|
*/
|
|
663
|
-
export interface Score
|
|
727
|
+
export interface Score {
|
|
664
728
|
/** Current session score points. */
|
|
665
729
|
score: number;
|
|
666
730
|
/** Current high score. */
|
|
@@ -698,6 +762,12 @@ export interface Score extends Initializable {
|
|
|
698
762
|
* Resets the level to the starting value (1).
|
|
699
763
|
*/
|
|
700
764
|
resetLevel(): void;
|
|
765
|
+
/**
|
|
766
|
+
* Sets up the game high score.
|
|
767
|
+
*
|
|
768
|
+
* @param {string} id - The game ID.
|
|
769
|
+
*/
|
|
770
|
+
setupGameHighScore(id: string): void;
|
|
701
771
|
}
|
|
702
772
|
export interface Session extends StateSyncable, Debuggable {
|
|
703
773
|
gameId: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,5 +5,7 @@ export * from './core/types/modules';
|
|
|
5
5
|
export * from './core/types/Types';
|
|
6
6
|
export { default as Game } from './core/Game';
|
|
7
7
|
export { default as GameView } from './view/GameView';
|
|
8
|
+
export { default as RendererContext } from './core/context/RendererContext';
|
|
9
|
+
export { default as EventEmitter } from './core/event/EventEmitter';
|
|
8
10
|
export { default as configs } from './config/configs';
|
|
9
11
|
export { bootstrap, setActiveGame } from './bootstrap';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import p5 from 'p5';
|
|
2
1
|
import { Initializable } from '../core/types/Interfaces';
|
|
3
2
|
import { GameModules } from '../core/types/Types';
|
|
4
3
|
export default class NewDebugger implements Initializable {
|
|
5
|
-
private _p;
|
|
6
4
|
private _gameModules;
|
|
7
5
|
private _moduleElements;
|
|
8
|
-
constructor(gameModules: GameModules
|
|
6
|
+
constructor(gameModules: GameModules);
|
|
9
7
|
setup(): void;
|
|
10
8
|
setGameModules(gameModules: GameModules): void;
|
|
11
9
|
update(): void;
|
|
@@ -22,7 +22,6 @@ export default class GameView {
|
|
|
22
22
|
private _leftBtn;
|
|
23
23
|
private _actionBtn;
|
|
24
24
|
private _parent;
|
|
25
|
-
private _p;
|
|
26
25
|
private _inputHandler;
|
|
27
26
|
private _cachedCanvas;
|
|
28
27
|
private _debugger;
|
|
@@ -33,7 +32,7 @@ export default class GameView {
|
|
|
33
32
|
* @param p - The p5 instance used for rendering and event handling.
|
|
34
33
|
* @param parent - The DOM element where the game view will be attached.
|
|
35
34
|
*/
|
|
36
|
-
constructor(
|
|
35
|
+
constructor(parent: HTMLElement);
|
|
37
36
|
/**
|
|
38
37
|
* Checks if the game body has been built.
|
|
39
38
|
* @returns True if the game body has been built, false otherwise.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Initializable } from '../core/types/Interfaces';
|
|
2
|
-
import p5 from 'p5';
|
|
3
2
|
export default class SessionModal implements Initializable {
|
|
4
|
-
private _p;
|
|
5
3
|
private _container;
|
|
6
4
|
private _confirmButton;
|
|
7
5
|
private _cancelButton;
|
|
8
|
-
constructor(
|
|
6
|
+
constructor();
|
|
9
7
|
setup(): void;
|
|
10
8
|
show(onConfirm: () => void, onCancel: () => void): void;
|
|
11
9
|
private _hide;
|
|
@@ -21,5 +21,5 @@ interface ButtonLayoutResponse {
|
|
|
21
21
|
* - directionVerticalContainer: For Up/Down buttons.
|
|
22
22
|
* - directionHorizontalContainer: For Left/Right buttons.
|
|
23
23
|
*/
|
|
24
|
-
export default function ButtonLayout(
|
|
24
|
+
export default function ButtonLayout(container: p5.Element): ButtonLayoutResponse;
|
|
25
25
|
export {};
|
|
@@ -19,5 +19,5 @@ interface ContainerResponse {
|
|
|
19
19
|
* @param {HTMLElement} parent - The DOM element where the container will be appended.
|
|
20
20
|
* @returns {ContainerResponse} Object containing the container element and its calculated width/height.
|
|
21
21
|
*/
|
|
22
|
-
export default function ContainerLayout(
|
|
22
|
+
export default function ContainerLayout(parent: HTMLElement): ContainerResponse;
|
|
23
23
|
export {};
|
|
@@ -8,4 +8,4 @@ import p5 from 'p5';
|
|
|
8
8
|
* @param container - The parent container element.
|
|
9
9
|
* @returns The created frame element.
|
|
10
10
|
*/
|
|
11
|
-
export default function FrameLayout(
|
|
11
|
+
export default function FrameLayout(container: p5.Element): p5.Element;
|
|
@@ -10,4 +10,4 @@ import p5 from 'p5';
|
|
|
10
10
|
* @param label - The text label for the button (currently used for aria-label or internal logic as visual label is commented out).
|
|
11
11
|
* @returns The created button element.
|
|
12
12
|
*/
|
|
13
|
-
export default function BigButton(
|
|
13
|
+
export default function BigButton(container: p5.Element, label: string): p5.Element;
|
|
@@ -9,4 +9,4 @@ import p5 from 'p5';
|
|
|
9
9
|
* @param label - The text label for the button.
|
|
10
10
|
* @returns The created button element.
|
|
11
11
|
*/
|
|
12
|
-
export default function Button(
|
|
12
|
+
export default function Button(container: p5.Element, label: string): p5.Element;
|
|
@@ -18,5 +18,5 @@ interface CanvasResponse {
|
|
|
18
18
|
* @param {number} width - The width of the outer container, used to calculate canvas dimensions with `configs.viewLayout.canvas.widthRatio`.
|
|
19
19
|
* @returns {CanvasResponse} Object containing the canvas element and its calculated dimensions.
|
|
20
20
|
*/
|
|
21
|
-
export default function Canvas(
|
|
21
|
+
export default function Canvas(container: p5.Element, width: number): CanvasResponse;
|
|
22
22
|
export {};
|
|
@@ -10,4 +10,4 @@ import p5 from 'p5';
|
|
|
10
10
|
* @param {boolean} top - Determines position/styling nuance (e.g. if it belongs to the top row of small buttons).
|
|
11
11
|
* @returns {p5.Element} The created button element.
|
|
12
12
|
*/
|
|
13
|
-
export default function SmallButton(
|
|
13
|
+
export default function SmallButton(container: p5.Element, label: string, top: boolean): p5.Element;
|