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
|
@@ -12,6 +12,7 @@ export interface Renderer extends RendererInitializable {
|
|
|
12
12
|
*
|
|
13
13
|
* @param {Cell[][]} grid - The current state of the game grid.
|
|
14
14
|
* @param {GameModules} modules - Access to other engine modules for context (e.g., Score, State).
|
|
15
|
+
* @returns {void} Returns nothing.
|
|
15
16
|
*/
|
|
16
17
|
render(grid: Cell[][], modules: GameModules): void;
|
|
17
18
|
}
|
|
@@ -23,6 +24,7 @@ export interface RendererComposite {
|
|
|
23
24
|
* Registers a new renderer layer to the composite system.
|
|
24
25
|
*
|
|
25
26
|
* @param {Renderer} renderer - The renderer instance to add.
|
|
27
|
+
* @returns {void} Returns nothing.
|
|
26
28
|
*/
|
|
27
29
|
addRenderer(renderer: Renderer): void;
|
|
28
30
|
/**
|
|
@@ -30,6 +32,7 @@ export interface RendererComposite {
|
|
|
30
32
|
*
|
|
31
33
|
* @param {Cell[][]} grid - The current state of the game grid.
|
|
32
34
|
* @param {GameModules} modules - Access to other engine modules.
|
|
35
|
+
* @returns {void} Returns nothing.
|
|
33
36
|
*/
|
|
34
37
|
render(grid: Cell[][], modules: GameModules): void;
|
|
35
38
|
/**
|
|
@@ -46,20 +49,26 @@ export interface Text extends Initializable {
|
|
|
46
49
|
* Sets the display metrics used for coordinate calculations.
|
|
47
50
|
*
|
|
48
51
|
* @param {RendererMetrics} rendererMetrics - The calculated layout metrics.
|
|
52
|
+
* @returns {void} Returns nothing.
|
|
49
53
|
*/
|
|
50
54
|
setRendererMetrics(rendererMetrics: RendererMetrics): void;
|
|
51
55
|
/**
|
|
52
56
|
* Sets the text color to the "active" theme color.
|
|
57
|
+
*
|
|
58
|
+
* @returns {void} Returns nothing.
|
|
53
59
|
*/
|
|
54
60
|
setActiveText(): void;
|
|
55
61
|
/**
|
|
56
62
|
* Sets the text color to the "inactive" theme color.
|
|
63
|
+
*
|
|
64
|
+
* @returns {void} Returns nothing.
|
|
57
65
|
*/
|
|
58
66
|
setInactiveText(): void;
|
|
59
67
|
/**
|
|
60
68
|
* Sets the current font size.
|
|
61
69
|
*
|
|
62
70
|
* @param {FontSize} fontSize - The desired size enum value.
|
|
71
|
+
* @returns {void} Returns nothing.
|
|
63
72
|
*/
|
|
64
73
|
setTextSize(fontSize: FontSize): void;
|
|
65
74
|
/**
|
|
@@ -67,6 +76,7 @@ export interface Text extends Initializable {
|
|
|
67
76
|
*
|
|
68
77
|
* @param {FontAlign} fontAlign - The horizontal alignment.
|
|
69
78
|
* @param {FontVerticalAlign} fontVerticalAlign - The vertical alignment.
|
|
79
|
+
* @returns {void} Returns nothing.
|
|
70
80
|
*/
|
|
71
81
|
setTextAlign(fontAlign: FontAlign, fontVerticalAlign: FontVerticalAlign): void;
|
|
72
82
|
/**
|
|
@@ -74,6 +84,7 @@ export interface Text extends Initializable {
|
|
|
74
84
|
*
|
|
75
85
|
* @param {string} text - The string content to display.
|
|
76
86
|
* @param {Coordinate} coordinate - The normalized position (0.0 to 1.0) within the HUD.
|
|
87
|
+
* @returns {void} Returns nothing.
|
|
77
88
|
*/
|
|
78
89
|
textOnHud(text: string, coordinate: Coordinate): void;
|
|
79
90
|
/**
|
|
@@ -81,6 +92,7 @@ export interface Text extends Initializable {
|
|
|
81
92
|
*
|
|
82
93
|
* @param {string} text - The string content to display.
|
|
83
94
|
* @param {Coordinate} coordinate - The normalized position (0.0 to 1.0) within the Display.
|
|
95
|
+
* @returns {void} Returns nothing.
|
|
84
96
|
*/
|
|
85
97
|
textOnDisplay(text: string, coordinate: Coordinate): void;
|
|
86
98
|
}
|
|
@@ -96,17 +108,28 @@ export interface Grid extends Initializable {
|
|
|
96
108
|
*/
|
|
97
109
|
getGrid(): Cell[][];
|
|
98
110
|
/** The number of columns in the grid. */
|
|
99
|
-
width: number;
|
|
111
|
+
readonly width: number;
|
|
100
112
|
/** The number of rows in the grid. */
|
|
101
|
-
height: number;
|
|
113
|
+
readonly height: number;
|
|
114
|
+
/** The index of the top-most row (always 0). */
|
|
115
|
+
readonly topRow: number;
|
|
116
|
+
/** The index of the bottom-most row. */
|
|
117
|
+
readonly bottomRow: number;
|
|
118
|
+
/** The index of the left-most column (always 0). */
|
|
119
|
+
readonly leftColumn: number;
|
|
120
|
+
/** The index of the right-most column. */
|
|
121
|
+
readonly rightColumn: number;
|
|
102
122
|
/**
|
|
103
123
|
* Resets the entire grid to its empty state.
|
|
124
|
+
*
|
|
125
|
+
* @returns {void} Returns nothing.
|
|
104
126
|
*/
|
|
105
127
|
resetGrid(): void;
|
|
106
128
|
/**
|
|
107
129
|
* Iterates over every cell in the grid.
|
|
108
130
|
*
|
|
109
131
|
* @param {function(Cell): void} callback - The function to execute for each cell.
|
|
132
|
+
* @returns {void} Returns nothing.
|
|
110
133
|
*/
|
|
111
134
|
forEach(callback: (cell: Cell) => void): void;
|
|
112
135
|
/**
|
|
@@ -128,6 +151,7 @@ export interface Grid extends Initializable {
|
|
|
128
151
|
*
|
|
129
152
|
* @param {Coordinate} coordinate - The target location.
|
|
130
153
|
* @param {number} value - The new value (0 for empty).
|
|
154
|
+
* @returns {void} Returns nothing.
|
|
131
155
|
*/
|
|
132
156
|
setCellValue(coordinate: Coordinate, value: number): void;
|
|
133
157
|
/**
|
|
@@ -135,22 +159,23 @@ export interface Grid extends Initializable {
|
|
|
135
159
|
*
|
|
136
160
|
* @param {Coordinate} coordinate - The target location.
|
|
137
161
|
* @param {Color} color - The new color.
|
|
162
|
+
* @returns {void} Returns nothing.
|
|
138
163
|
*/
|
|
139
164
|
setCellColor(coordinate: Coordinate, color: Color): void;
|
|
140
165
|
/**
|
|
141
166
|
* Checks if a cell is occupied (value > 0).
|
|
142
167
|
*
|
|
143
|
-
* @param {
|
|
168
|
+
* @param {Cell} cell - The cell to check.
|
|
144
169
|
* @returns {boolean} `true` if active.
|
|
145
170
|
*/
|
|
146
|
-
isCellActive(
|
|
171
|
+
isCellActive(cell: Cell): boolean;
|
|
147
172
|
/**
|
|
148
173
|
* Checks if a cell is empty (value == 0).
|
|
149
174
|
*
|
|
150
|
-
* @param {
|
|
175
|
+
* @param {Cell} cell - The cell to check.
|
|
151
176
|
* @returns {boolean} `true` if inactive.
|
|
152
177
|
*/
|
|
153
|
-
isCellInactive(
|
|
178
|
+
isCellInactive(cell: Cell): boolean;
|
|
154
179
|
/**
|
|
155
180
|
* Checks if a specific row is completely full.
|
|
156
181
|
*
|
|
@@ -169,18 +194,21 @@ export interface Grid extends Initializable {
|
|
|
169
194
|
* Clears all cells in a specific row.
|
|
170
195
|
*
|
|
171
196
|
* @param {number} y - The row index.
|
|
197
|
+
* @returns {void} Returns nothing.
|
|
172
198
|
*/
|
|
173
199
|
clearRow(y: number): void;
|
|
174
200
|
/**
|
|
175
201
|
* Shifts all rows above the specified index down by one.
|
|
176
202
|
*
|
|
177
203
|
* @param {number} fromY - The row index to start from.
|
|
204
|
+
* @returns {void} Returns nothing.
|
|
178
205
|
*/
|
|
179
206
|
shiftRowsDown(fromY: number): void;
|
|
180
207
|
/**
|
|
181
208
|
* Shifts all rows below the specified index up by one.
|
|
182
209
|
*
|
|
183
210
|
* @param {number} fromY - The row index to start from.
|
|
211
|
+
* @returns {void} Returns nothing.
|
|
184
212
|
*/
|
|
185
213
|
shiftRowsUp(fromY: number): void;
|
|
186
214
|
/**
|
|
@@ -207,18 +235,21 @@ export interface Grid extends Initializable {
|
|
|
207
235
|
* Clears all cells in a specific column.
|
|
208
236
|
*
|
|
209
237
|
* @param {number} x - The column index.
|
|
238
|
+
* @returns {void} Returns nothing.
|
|
210
239
|
*/
|
|
211
240
|
clearColumn(x: number): void;
|
|
212
241
|
/**
|
|
213
242
|
* Shifts all columns to the right of the specified index.
|
|
214
243
|
*
|
|
215
244
|
* @param {number} fromX - The column index to start from.
|
|
245
|
+
* @returns {void} Returns nothing.
|
|
216
246
|
*/
|
|
217
247
|
shiftColumnsRight(fromX: number): void;
|
|
218
248
|
/**
|
|
219
249
|
* Shifts all columns to the left of the specified index.
|
|
220
250
|
*
|
|
221
251
|
* @param {number} fromX - The column index to start from.
|
|
252
|
+
* @returns {void} Returns nothing.
|
|
222
253
|
*/
|
|
223
254
|
shiftColumnsLeft(fromX: number): void;
|
|
224
255
|
/**
|
|
@@ -241,101 +272,104 @@ export interface Grid extends Initializable {
|
|
|
241
272
|
* @param {Coordinate} end - Bottom-right coordinate.
|
|
242
273
|
* @param {number} value - The value to fill.
|
|
243
274
|
* @param {Color} color - The color to fill.
|
|
275
|
+
* @returns {void} Returns nothing.
|
|
244
276
|
*/
|
|
245
277
|
fillArea(start: Coordinate, end: Coordinate, value: number, color: Color): void;
|
|
246
278
|
/**
|
|
247
279
|
* Updates multiple coordinates simultaneously with their specific values and colors.
|
|
248
280
|
*
|
|
249
|
-
* @param {Piece}
|
|
281
|
+
* @param {Piece | Cell[]} cells - The collection of cells to stamp.
|
|
282
|
+
* @returns {void} Returns nothing.
|
|
250
283
|
*/
|
|
251
|
-
stampPiece(
|
|
284
|
+
stampPiece(cells: Piece | Cell[]): void;
|
|
252
285
|
/**
|
|
253
286
|
* Updates a single coordinate with a specific value and color from a Cell.
|
|
254
287
|
*
|
|
255
288
|
* @param {Cell} cell - The cell containing coordinate, value and color.
|
|
289
|
+
* @returns {void} Returns nothing.
|
|
256
290
|
*/
|
|
257
291
|
stampCell(cell: Cell): void;
|
|
258
292
|
/**
|
|
259
293
|
* Attempts to move a piece in a given direction.
|
|
260
294
|
*
|
|
261
|
-
* @param {Piece}
|
|
295
|
+
* @param {Piece | Cell[]} cells - The current piece coordinates.
|
|
262
296
|
* @param {Vector} direction - The movement vector.
|
|
263
|
-
* @returns {Piece
|
|
297
|
+
* @returns {Piece} The new piece.
|
|
264
298
|
*/
|
|
265
|
-
movePiece(
|
|
299
|
+
movePiece(cells: Piece | Cell[], direction: Vector): Piece;
|
|
266
300
|
/**
|
|
267
301
|
* Attempts to move a piece one unit to the left.
|
|
268
302
|
*
|
|
269
|
-
* @param {Piece}
|
|
270
|
-
* @returns {Piece
|
|
303
|
+
* @param {Piece | Cell[]} cells - The current piece coordinates.
|
|
304
|
+
* @returns {Piece} The new piece.
|
|
271
305
|
*/
|
|
272
|
-
movePieceLeft(
|
|
306
|
+
movePieceLeft(cells: Piece | Cell[]): Piece;
|
|
273
307
|
/**
|
|
274
308
|
* Attempts to move a piece one unit to the right.
|
|
275
309
|
*
|
|
276
|
-
* @param {Piece}
|
|
277
|
-
* @returns {Piece
|
|
310
|
+
* @param {Piece | Cell[]} cells - The current piece coordinates.
|
|
311
|
+
* @returns {Piece} The new piece.
|
|
278
312
|
*/
|
|
279
|
-
movePieceRight(
|
|
313
|
+
movePieceRight(cells: Piece | Cell[]): Piece;
|
|
280
314
|
/**
|
|
281
315
|
* Attempts to move a piece one unit up.
|
|
282
316
|
*
|
|
283
|
-
* @param {Piece}
|
|
284
|
-
* @returns {Piece
|
|
317
|
+
* @param {Piece | Cell[]} cells - The current piece coordinates.
|
|
318
|
+
* @returns {Piece} The new piece.
|
|
285
319
|
*/
|
|
286
|
-
movePieceUp(
|
|
320
|
+
movePieceUp(cells: Piece | Cell[]): Piece;
|
|
287
321
|
/**
|
|
288
322
|
* Attempts to move a piece one unit down.
|
|
289
323
|
*
|
|
290
|
-
* @param {Piece}
|
|
291
|
-
* @returns {Piece
|
|
324
|
+
* @param {Piece | Cell[]} cells - The current piece coordinates.
|
|
325
|
+
* @returns {Piece} The new piece.
|
|
292
326
|
*/
|
|
293
|
-
movePieceDown(
|
|
327
|
+
movePieceDown(cells: Piece | Cell[]): Piece;
|
|
294
328
|
/**
|
|
295
329
|
* Attempts to move a single coordinate in a given direction.
|
|
296
330
|
*
|
|
297
331
|
* @param {Cell} cell - The current cell.
|
|
298
332
|
* @param {Vector} direction - The movement vector.
|
|
299
|
-
* @returns {Cell
|
|
333
|
+
* @returns {Cell} The new cell.
|
|
300
334
|
*/
|
|
301
|
-
moveCell(cell: Cell, direction: Vector): Cell
|
|
335
|
+
moveCell(cell: Cell, direction: Vector): Cell;
|
|
302
336
|
/**
|
|
303
337
|
* Attempts to move a single coordinate one unit to the left.
|
|
304
338
|
*
|
|
305
339
|
* @param {Cell} cell - The current cell.
|
|
306
|
-
* @returns {Cell
|
|
340
|
+
* @returns {Cell} The new cell.
|
|
307
341
|
*/
|
|
308
|
-
moveCellLeft(cell: Cell): Cell
|
|
342
|
+
moveCellLeft(cell: Cell): Cell;
|
|
309
343
|
/**
|
|
310
344
|
* Attempts to move a single coordinate one unit to the right.
|
|
311
345
|
*
|
|
312
346
|
* @param {Cell} cell - The current cell.
|
|
313
|
-
* @returns {Cell
|
|
347
|
+
* @returns {Cell} The new cell.
|
|
314
348
|
*/
|
|
315
|
-
moveCellRight(cell: Cell): Cell
|
|
349
|
+
moveCellRight(cell: Cell): Cell;
|
|
316
350
|
/**
|
|
317
351
|
* Attempts to move a single coordinate one unit up.
|
|
318
352
|
*
|
|
319
353
|
* @param {Cell} cell - The current cell.
|
|
320
|
-
* @returns {Cell
|
|
354
|
+
* @returns {Cell} The new cell.
|
|
321
355
|
*/
|
|
322
|
-
moveCellUp(cell: Cell): Cell
|
|
356
|
+
moveCellUp(cell: Cell): Cell;
|
|
323
357
|
/**
|
|
324
358
|
* Attempts to move a single coordinate one unit down.
|
|
325
359
|
*
|
|
326
360
|
* @param {Cell} cell - The current cell.
|
|
327
|
-
* @returns {Cell
|
|
361
|
+
* @returns {Cell} The new cell.
|
|
328
362
|
*/
|
|
329
|
-
moveCellDown(cell: Cell): Cell
|
|
363
|
+
moveCellDown(cell: Cell): Cell;
|
|
330
364
|
/**
|
|
331
365
|
* Attempts to rotate a piece 90 degrees around a specific origin.
|
|
332
366
|
*
|
|
333
367
|
* @param {Piece} piece - The current piece.
|
|
334
368
|
* @param {Coordinate} origin - The center of rotation.
|
|
335
369
|
* @param {boolean} [clockwise=true] - Direction of rotation.
|
|
336
|
-
* @returns {Piece
|
|
370
|
+
* @returns {Piece} The new piece.
|
|
337
371
|
*/
|
|
338
|
-
rotatePiece(piece: Piece, origin: Coordinate, clockwise?: boolean): Piece
|
|
372
|
+
rotatePiece(piece: Piece, origin: Coordinate, clockwise?: boolean): Piece;
|
|
339
373
|
/**
|
|
340
374
|
* Identifies all rows that are completely filled with active cells.
|
|
341
375
|
*
|
|
@@ -404,6 +438,7 @@ export interface Grid extends Initializable {
|
|
|
404
438
|
*
|
|
405
439
|
* @param {Coordinate} a - First coordinate.
|
|
406
440
|
* @param {Coordinate} b - Second coordinate.
|
|
441
|
+
* @returns {void} Returns nothing.
|
|
407
442
|
*/
|
|
408
443
|
swapCells(a: Coordinate, b: Coordinate): void;
|
|
409
444
|
}
|
|
@@ -458,6 +493,7 @@ export interface State extends Initializable {
|
|
|
458
493
|
* Sets the color rendering preference.
|
|
459
494
|
*
|
|
460
495
|
* @param {boolean} value - The new state.
|
|
496
|
+
* @returns {void} Returns nothing.
|
|
461
497
|
*/
|
|
462
498
|
setColorEnabled(value: boolean): void;
|
|
463
499
|
/**
|
|
@@ -470,6 +506,7 @@ export interface State extends Initializable {
|
|
|
470
506
|
* Sets the master mute state.
|
|
471
507
|
*
|
|
472
508
|
* @param {boolean} value - The new mute state.
|
|
509
|
+
* @returns {void} Returns nothing.
|
|
473
510
|
*/
|
|
474
511
|
setMuted(value: boolean): void;
|
|
475
512
|
/**
|
|
@@ -477,6 +514,7 @@ export interface State extends Initializable {
|
|
|
477
514
|
*
|
|
478
515
|
* @param {StateProperty} property - The state property to monitor.
|
|
479
516
|
* @param {function(boolean | number): void} callback - The function to execute when the property changes.
|
|
517
|
+
* @returns {void} Returns nothing.
|
|
480
518
|
*/
|
|
481
519
|
subscribe(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
482
520
|
/**
|
|
@@ -484,62 +522,118 @@ export interface State extends Initializable {
|
|
|
484
522
|
*
|
|
485
523
|
* @param {StateProperty} property - The state property being monitored.
|
|
486
524
|
* @param {function(boolean | number): void} callback - The callback reference to remove.
|
|
525
|
+
* @returns {void} Returns nothing.
|
|
487
526
|
*/
|
|
488
527
|
unsubscribe(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
489
528
|
/**
|
|
490
529
|
* Registers a callback for a specific state change ONLY during the title screen.
|
|
530
|
+
* @param {StateProperty} property - The state property to monitor.
|
|
531
|
+
* @param {function(boolean | number): void} callback - The function to execute when the property changes.
|
|
532
|
+
* @returns {void} Returns nothing.
|
|
491
533
|
*/
|
|
492
534
|
subscribeForTitleScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
493
535
|
/**
|
|
494
536
|
* Removes an existing title screen subscription.
|
|
537
|
+
* @param {StateProperty} property - The state property to monitor.
|
|
538
|
+
* @param {function(boolean | number): void} callback - The function to execute when the property changes.
|
|
539
|
+
* @returns {void} Returns nothing.
|
|
495
540
|
*/
|
|
496
541
|
unsubscribeForTitleScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
497
542
|
/**
|
|
498
543
|
* Registers a callback for a specific state change ONLY during the game over screen.
|
|
544
|
+
* @param {StateProperty} property - The state property to monitor.
|
|
545
|
+
* @param {function(boolean | number): void} callback - The function to execute when the property changes.
|
|
546
|
+
* @returns {void} Returns nothing.
|
|
499
547
|
*/
|
|
500
548
|
subscribeForGameOverScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
501
549
|
/**
|
|
502
550
|
* Removes an existing game over screen subscription.
|
|
551
|
+
* @param {StateProperty} property - The state property to monitor.
|
|
552
|
+
* @param {function(boolean | number): void} callback - The function to execute when the property changes.
|
|
553
|
+
* @returns {void} Returns nothing.
|
|
503
554
|
*/
|
|
504
555
|
unsubscribeForGameOverScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
505
556
|
/**
|
|
506
557
|
* Registers a callback for a specific state change ONLY during active gameplay.
|
|
558
|
+
* @param {StateProperty} property - The state property to monitor.
|
|
559
|
+
* @param {function(boolean | number): void} callback - The function to execute when the property changes.
|
|
560
|
+
* @returns {void} Returns nothing.
|
|
507
561
|
*/
|
|
508
562
|
subscribeForPlayingScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
509
563
|
/**
|
|
510
564
|
* Removes an existing playing screen subscription.
|
|
565
|
+
* @param {StateProperty} property - The state property to monitor.
|
|
566
|
+
* @param {function(boolean | number): void} callback - The function to execute when the property changes.
|
|
567
|
+
* @returns {void} Returns nothing.
|
|
511
568
|
*/
|
|
512
569
|
unsubscribeForPlayingScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
513
570
|
/**
|
|
514
571
|
* Registers a callback for a specific state change ONLY during the paused screen.
|
|
572
|
+
* @param {StateProperty} property - The state property to monitor.
|
|
573
|
+
* @param {function(boolean | number): void} callback - The function to execute when the property changes.
|
|
574
|
+
* @returns {void} Returns nothing.
|
|
515
575
|
*/
|
|
516
576
|
subscribeForPausedScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
517
577
|
/**
|
|
518
578
|
* Removes an existing paused screen subscription.
|
|
579
|
+
* @param {StateProperty} property - The state property to monitor.
|
|
580
|
+
* @param {function(boolean | number): void} callback - The function to execute when the property changes.
|
|
581
|
+
* @returns {void} Returns nothing.
|
|
519
582
|
*/
|
|
520
583
|
unsubscribeForPausedScreen(property: StateProperty, callback: (value: boolean | number) => void): void;
|
|
521
|
-
/**
|
|
584
|
+
/**
|
|
585
|
+
* Turn the game system on.
|
|
586
|
+
* @returns {void} Returns nothing.
|
|
587
|
+
*/
|
|
522
588
|
turnOn(): void;
|
|
523
|
-
/**
|
|
589
|
+
/**
|
|
590
|
+
* Turn the game system off.
|
|
591
|
+
* @returns {void} Returns nothing.
|
|
592
|
+
*/
|
|
524
593
|
turnOff(): void;
|
|
525
|
-
/**
|
|
594
|
+
/**
|
|
595
|
+
* Initiate a new game (transition from Title Screen to Gameplay).
|
|
596
|
+
* @returns {void} Returns nothing.
|
|
597
|
+
*/
|
|
526
598
|
startGame(): void;
|
|
527
|
-
/**
|
|
599
|
+
/**
|
|
600
|
+
* Exit the current game session (transition to Title Screen).
|
|
601
|
+
* @returns {void} Returns nothing.
|
|
602
|
+
*/
|
|
528
603
|
exitGame(): void;
|
|
529
|
-
/**
|
|
604
|
+
/**
|
|
605
|
+
* Pause the current game logic.
|
|
606
|
+
* @returns {void} Returns nothing.
|
|
607
|
+
*/
|
|
530
608
|
pause(): void;
|
|
531
|
-
/**
|
|
609
|
+
/**
|
|
610
|
+
* Resume the game logic from a paused state.
|
|
611
|
+
* @returns {void} Returns nothing.
|
|
612
|
+
*/
|
|
532
613
|
resume(): void;
|
|
533
|
-
/**
|
|
614
|
+
/**
|
|
615
|
+
* Trigger a game over state.
|
|
616
|
+
* @returns {void} Returns nothing.
|
|
617
|
+
*/
|
|
534
618
|
triggerGameOver(): void;
|
|
535
|
-
/**
|
|
619
|
+
/**
|
|
620
|
+
* Reset the game state flags for a new round (post-Game Over).
|
|
621
|
+
* @returns {void} Returns nothing.
|
|
622
|
+
*/
|
|
536
623
|
resetGame(): void;
|
|
537
|
-
/**
|
|
624
|
+
/**
|
|
625
|
+
* Toggles the {@link StateProperty.COLOR_ENABLED} state.
|
|
626
|
+
* @returns {void} Returns nothing.
|
|
627
|
+
*/
|
|
538
628
|
toggleColorEnabled(): void;
|
|
539
|
-
/**
|
|
629
|
+
/**
|
|
630
|
+
* Toggles the {@link StateProperty.MUTED} state.
|
|
631
|
+
* @returns {void} Returns nothing.
|
|
632
|
+
*/
|
|
540
633
|
toggleMuted(): void;
|
|
541
634
|
/**
|
|
542
635
|
* Resets the game over state and starts the game again.
|
|
636
|
+
* @returns {void} Returns nothing.
|
|
543
637
|
*/
|
|
544
638
|
resetGameOver(): void;
|
|
545
639
|
}
|
|
@@ -553,6 +647,7 @@ export interface Control extends Initializable {
|
|
|
553
647
|
*
|
|
554
648
|
* @param {ControlKey} key - The key identity.
|
|
555
649
|
* @param {ControlEventType} type - The type of event (press/hold).
|
|
650
|
+
* @returns {void} Returns nothing.
|
|
556
651
|
*/
|
|
557
652
|
notify(key: ControlKey, type: ControlEventType): void;
|
|
558
653
|
/**
|
|
@@ -561,6 +656,7 @@ export interface Control extends Initializable {
|
|
|
561
656
|
* @param {ControlKey} key - The key to listen for.
|
|
562
657
|
* @param {ControlEventType} type - The event trigger type.
|
|
563
658
|
* @param {ControlCallback} callback - The function to execute.
|
|
659
|
+
* @returns {void} Returns nothing.
|
|
564
660
|
*/
|
|
565
661
|
subscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
566
662
|
/**
|
|
@@ -569,52 +665,90 @@ export interface Control extends Initializable {
|
|
|
569
665
|
* @param {ControlKey} key - The key to stop listening for.
|
|
570
666
|
* @param {ControlEventType} type - The event trigger type.
|
|
571
667
|
* @param {ControlCallback} callback - The function reference to remove.
|
|
668
|
+
* @returns {void} Returns nothing.
|
|
572
669
|
*/
|
|
573
670
|
unsubscribe(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
574
671
|
/**
|
|
575
672
|
* Registers a callback for a specific control event ONLY during the title screen.
|
|
673
|
+
* @param {ControlKey} key - The key to listen for.
|
|
674
|
+
* @param {ControlEventType} type - The event trigger type.
|
|
675
|
+
* @param {ControlCallback} callback - The function reference to remove.
|
|
676
|
+
* @returns {void} Returns nothing.
|
|
576
677
|
*/
|
|
577
678
|
subscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
578
679
|
/**
|
|
579
680
|
* Removes an existing title screen subscription.
|
|
681
|
+
* @param {ControlKey} key - The key to stop listening for.
|
|
682
|
+
* @param {ControlEventType} type - The event trigger type.
|
|
683
|
+
* @param {ControlCallback} callback - The function reference to remove.
|
|
684
|
+
* @returns {void} Returns nothing.
|
|
580
685
|
*/
|
|
581
686
|
unsubscribeForTitleScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
582
687
|
/**
|
|
583
688
|
* Registers a callback for a specific control event ONLY during the game over screen.
|
|
689
|
+
* @param {ControlKey} key - The key to listen for.
|
|
690
|
+
* @param {ControlEventType} type - The event trigger type.
|
|
691
|
+
* @param {ControlCallback} callback - The function to execute.
|
|
692
|
+
* @returns {void} Returns nothing.
|
|
584
693
|
*/
|
|
585
694
|
subscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
586
695
|
/**
|
|
587
696
|
* Removes an existing game over screen subscription.
|
|
697
|
+
* @param {ControlKey} key - The key to stop listening for.
|
|
698
|
+
* @param {ControlEventType} type - The event trigger type.
|
|
699
|
+
* @param {ControlCallback} callback - The function reference to remove.
|
|
700
|
+
* @returns {void} Returns nothing.
|
|
588
701
|
*/
|
|
589
702
|
unsubscribeForGameOverScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
590
703
|
/**
|
|
591
704
|
* Registers a callback for a specific control event ONLY during active gameplay.
|
|
705
|
+
* @param {ControlKey} key - The key to listen for.
|
|
706
|
+
* @param {ControlEventType} type - The event trigger type.
|
|
707
|
+
* @param {ControlCallback} callback - The function to execute.
|
|
708
|
+
* @returns {void} Returns nothing.
|
|
592
709
|
*/
|
|
593
710
|
subscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
594
711
|
/**
|
|
595
712
|
* Removes an existing playing screen subscription.
|
|
713
|
+
* @param {ControlKey} key - The key to stop listening for.
|
|
714
|
+
* @param {ControlEventType} type - The event trigger type.
|
|
715
|
+
* @param {ControlCallback} callback - The function reference to remove.
|
|
716
|
+
* @returns {void} Returns nothing.
|
|
596
717
|
*/
|
|
597
718
|
unsubscribeForPlayingScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
598
719
|
/**
|
|
599
720
|
* Registers a callback for a specific control event ONLY during the paused screen.
|
|
721
|
+
* @param {ControlKey} key - The key to listen for.
|
|
722
|
+
* @param {ControlEventType} type - The event trigger type.
|
|
723
|
+
* @param {ControlCallback} callback - The function to execute.
|
|
724
|
+
* @returns {void} Returns nothing.
|
|
600
725
|
*/
|
|
601
726
|
subscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
602
727
|
/**
|
|
603
728
|
* Removes an existing paused screen subscription.
|
|
729
|
+
* @param {ControlKey} key - The key to stop listening for.
|
|
730
|
+
* @param {ControlEventType} type - The event trigger type.
|
|
731
|
+
* @param {ControlCallback} callback - The function reference to remove.
|
|
732
|
+
* @returns {void} Returns nothing.
|
|
604
733
|
*/
|
|
605
734
|
unsubscribeForPausedScreen(key: ControlKey, type: ControlEventType, callback: ControlCallback): void;
|
|
606
735
|
/**
|
|
607
736
|
* Injects the module references required for populating the event context.
|
|
608
737
|
*
|
|
609
738
|
* @param {GameModules} modules - The collection of system modules.
|
|
739
|
+
* @returns {void} Returns nothing.
|
|
610
740
|
*/
|
|
611
741
|
setModules(modules: GameModules): void;
|
|
612
742
|
/**
|
|
613
743
|
* Detaches all hardware/DOM event listeners.
|
|
744
|
+
*
|
|
745
|
+
* @returns {void} Returns nothing.
|
|
614
746
|
*/
|
|
615
747
|
unbindControls(): void;
|
|
616
748
|
/**
|
|
617
749
|
* Attaches all hardware/DOM event listeners.
|
|
750
|
+
*
|
|
751
|
+
* @returns {void} Returns nothing.
|
|
618
752
|
*/
|
|
619
753
|
bindControls(): void;
|
|
620
754
|
}
|
|
@@ -625,10 +759,22 @@ export interface Control extends Initializable {
|
|
|
625
759
|
export interface Time extends Initializable {
|
|
626
760
|
/** The interval between logic ticks in milliseconds. */
|
|
627
761
|
tickInterval: number;
|
|
762
|
+
/** The total number of ticks since the game started. */
|
|
763
|
+
readonly totalTicks: number;
|
|
764
|
+
/** Total elapsed time in milliseconds since the game started. */
|
|
765
|
+
readonly elapsedTime: number;
|
|
766
|
+
/**
|
|
767
|
+
* Checks if enough time has passed for a game tick based on a specific interval.
|
|
768
|
+
*
|
|
769
|
+
* @param {number} interval - The tick interval to check.
|
|
770
|
+
* @returns {boolean} `true` if the current tick is a multiple of the interval.
|
|
771
|
+
*/
|
|
772
|
+
isTickEvery(interval: number): boolean;
|
|
628
773
|
/**
|
|
629
774
|
* Accumulates passed time and calculates FPS/TPS.
|
|
630
775
|
*
|
|
631
776
|
* @param {number} deltaTime - Time elapsed since last frame in milliseconds.
|
|
777
|
+
* @returns {void} Returns nothing.
|
|
632
778
|
*/
|
|
633
779
|
update(deltaTime: number): void;
|
|
634
780
|
/**
|
|
@@ -639,35 +785,43 @@ export interface Time extends Initializable {
|
|
|
639
785
|
shouldTick(): boolean;
|
|
640
786
|
/**
|
|
641
787
|
* Resets internal time accumulators and counters.
|
|
788
|
+
*
|
|
789
|
+
* @returns {void} Returns nothing.
|
|
642
790
|
*/
|
|
643
791
|
reset(): void;
|
|
644
792
|
/**
|
|
645
793
|
* Increases the tick interval (slowing down the game logic).
|
|
646
794
|
*
|
|
647
795
|
* @param {number} amount - Milliseconds to add.
|
|
796
|
+
* @returns {void} Returns nothing.
|
|
648
797
|
*/
|
|
649
798
|
incrementTickInterval(amount: number): void;
|
|
650
799
|
/**
|
|
651
800
|
* Decreases the tick interval (speeding up the game logic).
|
|
652
801
|
*
|
|
653
802
|
* @param {number} amount - Milliseconds to subtract.
|
|
803
|
+
* @returns {void} Returns nothing.
|
|
654
804
|
*/
|
|
655
805
|
decrementTickInterval(amount: number): void;
|
|
656
806
|
/**
|
|
657
807
|
* Sets the tick interval.
|
|
658
808
|
*
|
|
659
809
|
* @param {number} interval - The new tick interval in milliseconds.
|
|
810
|
+
* @returns {void} Returns nothing.
|
|
660
811
|
*/
|
|
661
812
|
setTickInterval(interval: number): void;
|
|
662
813
|
/**
|
|
663
814
|
* Sets the minimum tick interval.
|
|
664
815
|
*
|
|
665
816
|
* @param {number} interval - The new minimum tick interval in milliseconds.
|
|
817
|
+
* @returns {void} Returns nothing.
|
|
666
818
|
*/
|
|
667
819
|
setMinTickInterval(interval: number): void;
|
|
668
820
|
/**
|
|
669
821
|
* Captures the current tick interval as the initial state.
|
|
670
822
|
* Use this after games have set their starting speed.
|
|
823
|
+
*
|
|
824
|
+
* @returns {void} Returns nothing.
|
|
671
825
|
*/
|
|
672
826
|
captureInitialState(): void;
|
|
673
827
|
}
|
|
@@ -697,6 +851,7 @@ export interface SoundModule extends Initializable {
|
|
|
697
851
|
stopAll(): Promise<void>;
|
|
698
852
|
/**
|
|
699
853
|
* Toggles the master mute setting.
|
|
854
|
+
* @returns {void} Returns nothing.
|
|
700
855
|
*/
|
|
701
856
|
toggleMute(): void;
|
|
702
857
|
/** Current master mute state. */
|
|
@@ -712,10 +867,12 @@ export interface TimePerformanceMonitor {
|
|
|
712
867
|
* Updates performance calculations.
|
|
713
868
|
*
|
|
714
869
|
* @param {number} deltaTime - Time elapsed since last frame.
|
|
870
|
+
* @returns {void} Returns nothing.
|
|
715
871
|
*/
|
|
716
872
|
update(deltaTime: number): void;
|
|
717
873
|
/**
|
|
718
874
|
* Records a logic tick occurrence for TPS calculation.
|
|
875
|
+
* @returns {void} Returns nothing.
|
|
719
876
|
*/
|
|
720
877
|
logTick(): void;
|
|
721
878
|
/**
|
|
@@ -723,6 +880,7 @@ export interface TimePerformanceMonitor {
|
|
|
723
880
|
*
|
|
724
881
|
* @param {p5} p - The P5 instance to draw on.
|
|
725
882
|
* @param {number} tickInterval - The expected tick interval.
|
|
883
|
+
* @returns {void} Returns nothing.
|
|
726
884
|
*/
|
|
727
885
|
render(p: p5, tickInterval: number): void;
|
|
728
886
|
}
|
|
@@ -738,10 +896,12 @@ export interface Score {
|
|
|
738
896
|
* Adds points to the score, applying the current multiplier.
|
|
739
897
|
*
|
|
740
898
|
* @param {number} amount - Base points to add.
|
|
899
|
+
* @returns {void} Returns nothing.
|
|
741
900
|
*/
|
|
742
901
|
increaseScore(amount: number): void;
|
|
743
902
|
/**
|
|
744
903
|
* Resets the score to zero.
|
|
904
|
+
* @returns {void} Returns nothing.
|
|
745
905
|
*/
|
|
746
906
|
resetScore(): void;
|
|
747
907
|
/**
|
|
@@ -761,16 +921,19 @@ export interface Score {
|
|
|
761
921
|
* Increases the difficulty level.
|
|
762
922
|
*
|
|
763
923
|
* @param {number} amount - Levels to advance.
|
|
924
|
+
* @returns {void} Returns nothing.
|
|
764
925
|
*/
|
|
765
926
|
increaseLevel(amount: number): void;
|
|
766
927
|
/**
|
|
767
928
|
* Resets the level to the starting value (1).
|
|
929
|
+
* @returns {void} Returns nothing.
|
|
768
930
|
*/
|
|
769
931
|
resetLevel(): void;
|
|
770
932
|
/**
|
|
771
933
|
* Sets up the game high score.
|
|
772
934
|
*
|
|
773
935
|
* @param {string} id - The game ID.
|
|
936
|
+
* @returns {void} Returns nothing.
|
|
774
937
|
*/
|
|
775
938
|
setupGameHighScore(id: string): void;
|
|
776
939
|
}
|
|
@@ -780,19 +943,23 @@ export interface Session extends StateSyncable, Debuggable {
|
|
|
780
943
|
* Registers a serializable object to be saved in the session.
|
|
781
944
|
*
|
|
782
945
|
* @param {Serializable} serializable - The object to register.
|
|
946
|
+
* @returns {void} Returns nothing.
|
|
783
947
|
*/
|
|
784
948
|
register(serializable: Serializable): void;
|
|
785
949
|
/**
|
|
786
950
|
* Creates or updates the current session.
|
|
951
|
+
* @returns {void} Returns nothing.
|
|
787
952
|
*/
|
|
788
953
|
saveSession(): void;
|
|
789
954
|
/**
|
|
790
955
|
* Clears the current session.
|
|
956
|
+
* @returns {void} Returns nothing.
|
|
791
957
|
*/
|
|
792
958
|
clearSession(): void;
|
|
793
959
|
/**
|
|
794
960
|
* Sets whether the session is enabled.
|
|
795
961
|
* @param {boolean} enabled - Whether the session should be enabled.
|
|
962
|
+
* @returns {void} Returns nothing.
|
|
796
963
|
*/
|
|
797
964
|
setSessionEnabled(enabled: boolean): void;
|
|
798
965
|
/**
|
|
@@ -805,11 +972,13 @@ export interface Session extends StateSyncable, Debuggable {
|
|
|
805
972
|
/**
|
|
806
973
|
* Sets the function to be called when the session modal should be shown.
|
|
807
974
|
* @param {function} showModal - The function to be called.
|
|
975
|
+
* @returns {void} Returns nothing.
|
|
808
976
|
*/
|
|
809
977
|
setShowModalFunction(showModal: (onConfirm: () => void, onCancel: () => void) => void): void;
|
|
810
978
|
/**
|
|
811
979
|
* Sets the function to be called when the session is canceled/cleared to reset the game.
|
|
812
980
|
* @param {function} resetFn - The function to be called.
|
|
981
|
+
* @returns {void} Returns nothing.
|
|
813
982
|
*/
|
|
814
983
|
setResetFunction(resetFn: () => void): void;
|
|
815
984
|
}
|