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