@vpmedia/phaser 1.95.0 → 1.96.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/package.json +9 -9
  3. package/src/phaser/core/animation.js +61 -56
  4. package/src/phaser/core/animation_manager.js +55 -55
  5. package/src/phaser/core/cache.js +154 -154
  6. package/src/phaser/core/device.js +2 -1
  7. package/src/phaser/core/device_util.js +27 -27
  8. package/src/phaser/core/dom.js +43 -43
  9. package/src/phaser/core/event_manager.js +63 -63
  10. package/src/phaser/core/factory.js +47 -47
  11. package/src/phaser/core/frame.js +30 -30
  12. package/src/phaser/core/frame_data.js +30 -28
  13. package/src/phaser/core/frame_util.js +8 -8
  14. package/src/phaser/core/game.js +34 -18
  15. package/src/phaser/core/loader.js +170 -170
  16. package/src/phaser/core/loader_parser.js +22 -22
  17. package/src/phaser/core/raf.js +1 -1
  18. package/src/phaser/core/scene.js +16 -10
  19. package/src/phaser/core/scene_manager.js +51 -43
  20. package/src/phaser/core/signal.js +56 -52
  21. package/src/phaser/core/sound.js +54 -54
  22. package/src/phaser/core/sound_manager.js +49 -49
  23. package/src/phaser/core/stage.js +16 -16
  24. package/src/phaser/core/time.js +30 -30
  25. package/src/phaser/core/timer.js +64 -64
  26. package/src/phaser/core/timer_event.js +9 -9
  27. package/src/phaser/core/tween.js +90 -90
  28. package/src/phaser/core/tween_data.js +30 -30
  29. package/src/phaser/core/tween_manager.js +29 -24
  30. package/src/phaser/core/world.js +4 -3
  31. package/src/phaser/display/bitmap_text.js +61 -54
  32. package/src/phaser/display/button.js +48 -47
  33. package/src/phaser/display/canvas/buffer.js +8 -8
  34. package/src/phaser/display/canvas/graphics.js +8 -8
  35. package/src/phaser/display/canvas/masker.js +5 -5
  36. package/src/phaser/display/canvas/pool.js +18 -18
  37. package/src/phaser/display/canvas/renderer.js +16 -16
  38. package/src/phaser/display/canvas/tinter.js +22 -22
  39. package/src/phaser/display/canvas/util.js +42 -42
  40. package/src/phaser/display/display_object.js +119 -108
  41. package/src/phaser/display/graphics.js +112 -112
  42. package/src/phaser/display/graphics_data.js +10 -10
  43. package/src/phaser/display/graphics_data_util.js +3 -3
  44. package/src/phaser/display/group.js +50 -50
  45. package/src/phaser/display/image.js +54 -50
  46. package/src/phaser/display/sprite_batch.js +2 -2
  47. package/src/phaser/display/sprite_util.js +19 -19
  48. package/src/phaser/display/text.js +212 -187
  49. package/src/phaser/display/webgl/abstract_filter.js +4 -4
  50. package/src/phaser/display/webgl/base_texture.js +9 -9
  51. package/src/phaser/display/webgl/blend_manager.js +7 -7
  52. package/src/phaser/display/webgl/earcut.js +95 -95
  53. package/src/phaser/display/webgl/earcut_node.js +4 -4
  54. package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
  55. package/src/phaser/display/webgl/filter_manager.js +9 -9
  56. package/src/phaser/display/webgl/filter_texture.js +10 -10
  57. package/src/phaser/display/webgl/graphics.js +37 -37
  58. package/src/phaser/display/webgl/graphics_data.js +4 -4
  59. package/src/phaser/display/webgl/mask_manager.js +6 -6
  60. package/src/phaser/display/webgl/render_texture.js +16 -16
  61. package/src/phaser/display/webgl/renderer.js +20 -20
  62. package/src/phaser/display/webgl/shader/complex.js +4 -4
  63. package/src/phaser/display/webgl/shader/fast.js +4 -4
  64. package/src/phaser/display/webgl/shader/normal.js +8 -8
  65. package/src/phaser/display/webgl/shader/primitive.js +4 -4
  66. package/src/phaser/display/webgl/shader/strip.js +4 -4
  67. package/src/phaser/display/webgl/shader_manager.js +9 -9
  68. package/src/phaser/display/webgl/sprite_batch.js +18 -18
  69. package/src/phaser/display/webgl/stencil_manager.js +16 -16
  70. package/src/phaser/display/webgl/texture.js +13 -13
  71. package/src/phaser/display/webgl/texture_util.js +8 -8
  72. package/src/phaser/display/webgl/util.js +25 -25
  73. package/src/phaser/geom/circle.js +69 -69
  74. package/src/phaser/geom/ellipse.js +28 -28
  75. package/src/phaser/geom/line.js +93 -93
  76. package/src/phaser/geom/matrix.js +54 -54
  77. package/src/phaser/geom/point.js +96 -96
  78. package/src/phaser/geom/polygon.js +22 -22
  79. package/src/phaser/geom/rectangle.js +132 -132
  80. package/src/phaser/geom/rounded_rectangle.js +12 -12
  81. package/src/phaser/geom/util/circle.js +33 -33
  82. package/src/phaser/geom/util/ellipse.js +5 -5
  83. package/src/phaser/geom/util/line.js +26 -26
  84. package/src/phaser/geom/util/matrix.js +8 -8
  85. package/src/phaser/geom/util/point.js +97 -97
  86. package/src/phaser/geom/util/polygon.js +4 -4
  87. package/src/phaser/geom/util/rectangle.js +74 -74
  88. package/src/phaser/geom/util/rounded_rectangle.js +4 -4
  89. package/src/phaser/util/math.js +81 -81
  90. package/types/phaser/core/animation.d.ts +61 -56
  91. package/types/phaser/core/animation.d.ts.map +1 -1
  92. package/types/phaser/core/animation_manager.d.ts +55 -55
  93. package/types/phaser/core/cache.d.ts +154 -154
  94. package/types/phaser/core/device.d.ts.map +1 -1
  95. package/types/phaser/core/dom.d.ts +43 -43
  96. package/types/phaser/core/event_manager.d.ts +63 -63
  97. package/types/phaser/core/factory.d.ts +47 -47
  98. package/types/phaser/core/frame.d.ts +30 -30
  99. package/types/phaser/core/frame_data.d.ts +28 -27
  100. package/types/phaser/core/frame_data.d.ts.map +1 -1
  101. package/types/phaser/core/game.d.ts +52 -19
  102. package/types/phaser/core/game.d.ts.map +1 -1
  103. package/types/phaser/core/loader.d.ts +170 -170
  104. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  105. package/types/phaser/core/raf.d.ts +1 -1
  106. package/types/phaser/core/scene.d.ts +15 -9
  107. package/types/phaser/core/scene.d.ts.map +1 -1
  108. package/types/phaser/core/scene_manager.d.ts +51 -43
  109. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  110. package/types/phaser/core/signal.d.ts +54 -51
  111. package/types/phaser/core/signal.d.ts.map +1 -1
  112. package/types/phaser/core/sound.d.ts +54 -54
  113. package/types/phaser/core/sound_manager.d.ts +49 -49
  114. package/types/phaser/core/stage.d.ts +10 -10
  115. package/types/phaser/core/time.d.ts +30 -30
  116. package/types/phaser/core/timer.d.ts +64 -64
  117. package/types/phaser/core/timer_event.d.ts +9 -9
  118. package/types/phaser/core/tween.d.ts +90 -90
  119. package/types/phaser/core/tween_data.d.ts +30 -30
  120. package/types/phaser/core/tween_manager.d.ts +29 -24
  121. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  122. package/types/phaser/core/world.d.ts +4 -3
  123. package/types/phaser/core/world.d.ts.map +1 -1
  124. package/types/phaser/display/bitmap_text.d.ts +59 -52
  125. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  126. package/types/phaser/display/button.d.ts +47 -46
  127. package/types/phaser/display/button.d.ts.map +1 -1
  128. package/types/phaser/display/canvas/buffer.d.ts +8 -8
  129. package/types/phaser/display/canvas/renderer.d.ts +16 -16
  130. package/types/phaser/display/display_object.d.ts +119 -108
  131. package/types/phaser/display/display_object.d.ts.map +1 -1
  132. package/types/phaser/display/graphics.d.ts +101 -101
  133. package/types/phaser/display/graphics_data.d.ts +10 -10
  134. package/types/phaser/display/group.d.ts +47 -47
  135. package/types/phaser/display/image.d.ts +42 -40
  136. package/types/phaser/display/image.d.ts.map +1 -1
  137. package/types/phaser/display/text.d.ts +207 -184
  138. package/types/phaser/display/text.d.ts.map +1 -1
  139. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  140. package/types/phaser/display/webgl/base_texture.d.ts +9 -9
  141. package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
  142. package/types/phaser/display/webgl/earcut.d.ts +95 -95
  143. package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
  144. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
  145. package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
  146. package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
  147. package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
  148. package/types/phaser/display/webgl/render_texture.d.ts +16 -16
  149. package/types/phaser/display/webgl/renderer.d.ts +20 -20
  150. package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
  151. package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
  152. package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
  153. package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
  154. package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
  155. package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
  156. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
  157. package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
  158. package/types/phaser/display/webgl/texture.d.ts +12 -12
  159. package/types/phaser/geom/circle.d.ts +69 -69
  160. package/types/phaser/geom/ellipse.d.ts +28 -28
  161. package/types/phaser/geom/line.d.ts +93 -93
  162. package/types/phaser/geom/matrix.d.ts +54 -54
  163. package/types/phaser/geom/point.d.ts +96 -96
  164. package/types/phaser/geom/polygon.d.ts +22 -22
  165. package/types/phaser/geom/rectangle.d.ts +132 -132
  166. package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
  167. package/pnpm-workspace.yaml +0 -4
@@ -2,12 +2,12 @@ import { Signal } from './signal.js';
2
2
 
3
3
  export class Sound {
4
4
  /**
5
- * TBD.
6
- * @param {import('./game.js').Game} game - TBD.
7
- * @param {string} key - TBD.
8
- * @param {number} volume - TBD.
9
- * @param {boolean} loop - TBD.
10
- * @param {boolean} connect - TBD.
5
+ * Creates a new Sound instance.
6
+ * @param {import('./game.js').Game} game - Reference to the Phaser Game instance.
7
+ * @param {string} key - The key of the sound to play.
8
+ * @param {number} volume - The initial volume level (0.0 to 1.0).
9
+ * @param {boolean} loop - Whether the sound should loop.
10
+ * @param {boolean} connect - Whether to connect to the master gain node.
11
11
  */
12
12
  constructor(game, key, volume = 1, loop = false, connect = null) {
13
13
  // TODO
@@ -81,8 +81,8 @@ export class Sound {
81
81
  }
82
82
 
83
83
  /**
84
- * TBD.
85
- * @param {string} key - TBD.
84
+ * Callback when a sound has been unlocked.
85
+ * @param {string} key - The key of the sound that was unlocked.
86
86
  */
87
87
  soundHasUnlocked(key) {
88
88
  if (key === this.key) {
@@ -92,12 +92,12 @@ export class Sound {
92
92
  }
93
93
 
94
94
  /**
95
- * TBD.
96
- * @param {string} name - TBD.
97
- * @param {number} start - TBD.
98
- * @param {number} duration - TBD.
99
- * @param {number} volume - TBD.
100
- * @param {boolean} loop - TBD.
95
+ * Adds a marker to the sound.
96
+ * @param {string} name - The name of the marker.
97
+ * @param {number} start - The start time (in seconds) of the marker.
98
+ * @param {number} duration - The duration (in seconds) of the marker.
99
+ * @param {number} volume - The volume level (0.0 to 1.0) of the marker.
100
+ * @param {boolean} loop - Whether the marker should loop.
101
101
  */
102
102
  addMarker(name, start, duration = 1, volume = 1, loop = false) {
103
103
  this.markers[name] = {
@@ -112,15 +112,15 @@ export class Sound {
112
112
  }
113
113
 
114
114
  /**
115
- * TBD.
116
- * @param {string} name - TBD.
115
+ * Removes a marker from the sound.
116
+ * @param {string} name - The name of the marker to remove.
117
117
  */
118
118
  removeMarker(name) {
119
119
  delete this.markers[name];
120
120
  }
121
121
 
122
122
  /**
123
- * TBD.
123
+ * Handler for when the sound ends.
124
124
  */
125
125
  onEndedHandler() {
126
126
  this._sound.onended = null;
@@ -154,7 +154,7 @@ export class Sound {
154
154
  }
155
155
 
156
156
  /**
157
- * TBD.
157
+ * Updates the sound state.
158
158
  */
159
159
  update() {
160
160
  if (!this.game.cache.checkSoundKey(this.key)) {
@@ -191,22 +191,22 @@ export class Sound {
191
191
  }
192
192
 
193
193
  /**
194
- * TBD.
195
- * @param {number} volume - TBD.
196
- * @returns {Sound} TBD.
194
+ * Plays the sound at full volume in a loop.
195
+ * @param {number} volume - The volume level (0.0 to 1.0) to play at.
196
+ * @returns {Sound} This Sound instance for chaining.
197
197
  */
198
198
  loopFull(volume) {
199
199
  return this.play(null, 0, volume, true);
200
200
  }
201
201
 
202
202
  /**
203
- * TBD.
204
- * @param {string} marker - TBD.
205
- * @param {number} position - TBD.
206
- * @param {number} volume - TBD.
207
- * @param {boolean} loop - TBD.
208
- * @param {boolean} forceRestart - TBD.
209
- * @returns {Sound} TBD.
203
+ * Plays the sound, optionally using a marker.
204
+ * @param {string} marker - The name of the marker to play, or null/undefined to play the entire sound.
205
+ * @param {number} position - The position (in seconds) to start playing from.
206
+ * @param {number} volume - The volume level (0.0 to 1.0) to play at.
207
+ * @param {boolean} loop - Whether the sound should loop.
208
+ * @param {boolean} forceRestart - Whether to force restarting the sound even if it's already playing.
209
+ * @returns {Sound} This Sound instance for chaining.
210
210
  */
211
211
  play(marker, position, volume, loop, forceRestart = true) {
212
212
  if (marker === undefined || marker === false || marker === null) {
@@ -323,18 +323,18 @@ export class Sound {
323
323
  }
324
324
 
325
325
  /**
326
- * TBD.
327
- * @param {string} marker - TBD.
328
- * @param {number} position - TBD.
329
- * @param {number} volume - TBD.
330
- * @param {boolean} loop - TBD.
326
+ * Restarts the sound, optionally using a marker.
327
+ * @param {string} marker - The name of the marker to play, or empty string to play the entire sound.
328
+ * @param {number} position - The position (in seconds) to start playing from.
329
+ * @param {number} volume - The volume level (0.0 to 1.0) to play at.
330
+ * @param {boolean} loop - Whether the sound should loop.
331
331
  */
332
332
  restart(marker = '', position = 0, volume = 1, loop = false) {
333
333
  this.play(marker, position, volume, loop, true);
334
334
  }
335
335
 
336
336
  /**
337
- * TBD.
337
+ * Pauses the sound.
338
338
  */
339
339
  pause() {
340
340
  if (this.isPlaying && this._sound) {
@@ -348,7 +348,7 @@ export class Sound {
348
348
  }
349
349
 
350
350
  /**
351
- * TBD.
351
+ * Resumes the sound.
352
352
  */
353
353
  resume() {
354
354
  if (this.paused && this._sound) {
@@ -380,7 +380,7 @@ export class Sound {
380
380
  }
381
381
 
382
382
  /**
383
- * TBD.
383
+ * Stops the sound.
384
384
  */
385
385
  stop() {
386
386
  if (this.isPlaying && this._sound) {
@@ -411,10 +411,10 @@ export class Sound {
411
411
  }
412
412
 
413
413
  /**
414
- * TBD.
415
- * @param {number} duration - TBD.
416
- * @param {boolean} loop - TBD.
417
- * @param {string} marker - TBD.
414
+ * Fades in the sound to full volume.
415
+ * @param {number} duration - The fade-in duration (in milliseconds).
416
+ * @param {boolean} loop - Whether the sound should loop.
417
+ * @param {string} marker - The name of the marker to fade in, or empty string to use current marker.
418
418
  */
419
419
  fadeIn(duration, loop = false, marker = this.currentMarker) {
420
420
  if (this.paused) {
@@ -425,17 +425,17 @@ export class Sound {
425
425
  }
426
426
 
427
427
  /**
428
- * TBD.
429
- * @param {number} duration - TBD.
428
+ * Fades out the sound to silence.
429
+ * @param {number} duration - The fade-out duration (in milliseconds).
430
430
  */
431
431
  fadeOut(duration) {
432
432
  this.fadeTo(duration, 0);
433
433
  }
434
434
 
435
435
  /**
436
- * TBD.
437
- * @param {number} duration - TBD.
438
- * @param {number} volume - TBD.
436
+ * Fades the sound to a specific volume level.
437
+ * @param {number} duration - The fade duration (in milliseconds).
438
+ * @param {number} volume - The target volume level (0.0 to 1.0).
439
439
  */
440
440
  fadeTo(duration = 100, volume = 0) {
441
441
  if (!this.isPlaying || this.paused || volume === this.volume) {
@@ -446,7 +446,7 @@ export class Sound {
446
446
  }
447
447
 
448
448
  /**
449
- * TBD.
449
+ * Callback when fade completes.
450
450
  */
451
451
  fadeComplete() {
452
452
  this.onFadeComplete.dispatch(this, this.volume);
@@ -456,8 +456,8 @@ export class Sound {
456
456
  }
457
457
 
458
458
  /**
459
- * TBD.
460
- * @param {boolean} remove - TBD.
459
+ * Destroys the sound and cleans up resources.
460
+ * @param {boolean} remove - Whether to remove the sound from the SoundManager.
461
461
  */
462
462
  destroy(remove = true) {
463
463
  this._markedToDelete = true;
@@ -482,15 +482,15 @@ export class Sound {
482
482
  }
483
483
 
484
484
  /**
485
- * TBD.
486
- * @returns {boolean} TBD.
485
+ * Gets the muted state of the sound.
486
+ * @returns {boolean} True if the sound is muted, false otherwise.
487
487
  */
488
488
  get mute() {
489
489
  return this._muted || this.game.sound.mute;
490
490
  }
491
491
 
492
492
  /**
493
- * TBD.
493
+ * Sets the muted state of the sound.
494
494
  */
495
495
  set mute(value) {
496
496
  value = value || false;
@@ -509,15 +509,15 @@ export class Sound {
509
509
  }
510
510
 
511
511
  /**
512
- * TBD.
513
- * @returns {number} TBD.
512
+ * Gets the volume of the sound.
513
+ * @returns {number} The volume level (0.0 to 1.0).
514
514
  */
515
515
  get volume() {
516
516
  return this._volume;
517
517
  }
518
518
 
519
519
  /**
520
- * TBD.
520
+ * Sets the volume of the sound.
521
521
  */
522
522
  set volume(value) {
523
523
  if (this._muted) {
@@ -13,8 +13,8 @@ import { SoundSprite } from './sound_sprite.js';
13
13
 
14
14
  export class SoundManager {
15
15
  /**
16
- * TBD.
17
- * @param {import('./game.js').Game} game - TBD.
16
+ * Creates a new SoundManager instance.
17
+ * @param {import('./game.js').Game} game - Reference to the Phaser Game instance.
18
18
  */
19
19
  constructor(game) {
20
20
  this.game = game;
@@ -40,7 +40,7 @@ export class SoundManager {
40
40
  }
41
41
 
42
42
  /**
43
- * TBD.
43
+ * Initializes the sound manager and sets up audio context.
44
44
  */
45
45
  boot() {
46
46
  const setAudioDisabledState = () => {
@@ -98,7 +98,7 @@ export class SoundManager {
98
98
  }
99
99
 
100
100
  /**
101
- * TBD.
101
+ * Handles page lifecycle changes for audio management.
102
102
  */
103
103
  onPageLifecycleChange = () => {
104
104
  if (!document.hidden) {
@@ -107,7 +107,7 @@ export class SoundManager {
107
107
  };
108
108
 
109
109
  /**
110
- * TBD.
110
+ * Handles audio context state changes.
111
111
  */
112
112
  onContextStateChange = () => {
113
113
  this.game.logger.info('onContextStateChange', {
@@ -118,7 +118,7 @@ export class SoundManager {
118
118
  };
119
119
 
120
120
  /**
121
- * TBD.
121
+ * Checks if audio unlock handlers need to be added or removed.
122
122
  */
123
123
  checkUnlockHandlers = () => {
124
124
  this.game.logger.info('checkUnlockHandlers', {
@@ -133,7 +133,7 @@ export class SoundManager {
133
133
  };
134
134
 
135
135
  /**
136
- * TBD.
136
+ * Adds event listeners to unlock audio context.
137
137
  */
138
138
  addUnlockHandlers = () => {
139
139
  this.isLocked = true;
@@ -147,7 +147,7 @@ export class SoundManager {
147
147
  };
148
148
 
149
149
  /**
150
- * TBD.
150
+ * Removes event listeners that unlock audio context.
151
151
  */
152
152
  removeUnlockHandlers = () => {
153
153
  this.isLocked = false;
@@ -161,8 +161,8 @@ export class SoundManager {
161
161
  };
162
162
 
163
163
  /**
164
- * TBD.
165
- * @param {Event} event - TBD.
164
+ * Handles unlock events to resume audio context.
165
+ * @param {Event} event - The DOM event that triggered the unlock.
166
166
  */
167
167
  onUnlockEvent = (event) => {
168
168
  const initialState = this.context.state;
@@ -205,7 +205,7 @@ export class SoundManager {
205
205
  };
206
206
 
207
207
  /**
208
- * TBD.
208
+ * Stops all sounds in the manager.
209
209
  */
210
210
  stopAll() {
211
211
  if (this.noAudio) {
@@ -219,7 +219,7 @@ export class SoundManager {
219
219
  }
220
220
 
221
221
  /**
222
- * TBD.
222
+ * Pauses all sounds in the manager.
223
223
  */
224
224
  pauseAll() {
225
225
  if (this.noAudio) {
@@ -233,7 +233,7 @@ export class SoundManager {
233
233
  }
234
234
 
235
235
  /**
236
- * TBD.
236
+ * Resumes all sounds in the manager.
237
237
  */
238
238
  resumeAll() {
239
239
  if (this.noAudio) {
@@ -247,8 +247,8 @@ export class SoundManager {
247
247
  }
248
248
 
249
249
  /**
250
- * TBD.
251
- * @param {string} key - TBD.
250
+ * Decodes an audio file for playback.
251
+ * @param {string} key - The key of the sound to decode.
252
252
  */
253
253
  decode(key) {
254
254
  const soundData = this.game.cache.getSoundData(key);
@@ -274,10 +274,10 @@ export class SoundManager {
274
274
  }
275
275
 
276
276
  /**
277
- * TBD.
278
- * @param {Sound[]|string[]} files - TBD.
279
- * @param {Function} callback - TBD.
280
- * @param {object} callbackContext - TBD.
277
+ * Sets up a callback to be called when audio files are decoded.
278
+ * @param {Sound[]|string[]} files - The sound files or keys to wait for.
279
+ * @param {Function} callback - The callback function to call when all files are decoded.
280
+ * @param {object} callbackContext - The context in which to call the callback.
281
281
  */
282
282
  setDecodedCallback(files, callback, callbackContext) {
283
283
  if (typeof files === 'string') {
@@ -306,7 +306,7 @@ export class SoundManager {
306
306
  }
307
307
 
308
308
  /**
309
- * TBD.
309
+ * Updates the sound manager state.
310
310
  */
311
311
  update() {
312
312
  if (this.noAudio) {
@@ -332,12 +332,12 @@ export class SoundManager {
332
332
  }
333
333
 
334
334
  /**
335
- * TBD.
336
- * @param {string} key - TBD.
337
- * @param {number} volume - TBD.
338
- * @param {boolean} loop - TBD.
339
- * @param {boolean} connect - TBD.
340
- * @returns {Sound} TBD.
335
+ * Adds a new sound to the manager.
336
+ * @param {string} key - The key of the sound to add.
337
+ * @param {number} volume - The initial volume level (0.0 to 1.0).
338
+ * @param {boolean} loop - Whether the sound should loop.
339
+ * @param {boolean} connect - Whether to connect to the master gain node.
340
+ * @returns {Sound} The created Sound object.
341
341
  */
342
342
  add(key, volume = 1, loop = false, connect = this.connectToMaster) {
343
343
  const sound = new Sound(this.game, key, volume, loop, connect);
@@ -346,18 +346,18 @@ export class SoundManager {
346
346
  }
347
347
 
348
348
  /**
349
- * TBD.
350
- * @param {string} key - TBD.
351
- * @returns {SoundSprite} TBD.
349
+ * Adds a new sound sprite to the manager.
350
+ * @param {string} key - The key of the sound sprite to add.
351
+ * @returns {SoundSprite} The created SoundSprite object.
352
352
  */
353
353
  addSprite(key) {
354
354
  return new SoundSprite(this.game, key);
355
355
  }
356
356
 
357
357
  /**
358
- * TBD.
359
- * @param {Sound | null | undefined} sound - TBD.
360
- * @returns {boolean} TBD.
358
+ * Removes a sound from the manager.
359
+ * @param {Sound | null | undefined} sound - The sound object to remove.
360
+ * @returns {boolean} True if the sound was removed, false otherwise.
361
361
  */
362
362
  remove(sound) {
363
363
  let i = this._sounds.length;
@@ -373,9 +373,9 @@ export class SoundManager {
373
373
  }
374
374
 
375
375
  /**
376
- * TBD.
377
- * @param {string} key - TBD.
378
- * @returns {number} TBD.
376
+ * Removes all sounds with a specific key from the manager.
377
+ * @param {string} key - The key of sounds to remove.
378
+ * @returns {number} The number of sounds removed.
379
379
  */
380
380
  removeByKey(key) {
381
381
  let i = this._sounds.length;
@@ -392,11 +392,11 @@ export class SoundManager {
392
392
  }
393
393
 
394
394
  /**
395
- * TBD.
396
- * @param {string} key - TBD.
397
- * @param {number} volume - TBD.
398
- * @param {boolean} loop - TBD.
399
- * @returns {Sound} TBD.
395
+ * Plays a sound by key.
396
+ * @param {string} key - The key of the sound to play.
397
+ * @param {number} volume - The volume level (0.0 to 1.0).
398
+ * @param {boolean} loop - Whether the sound should loop.
399
+ * @returns {Sound} The created Sound object, or null if audio is disabled.
400
400
  */
401
401
  play(key, volume = 1, loop = false) {
402
402
  if (this.noAudio) {
@@ -408,7 +408,7 @@ export class SoundManager {
408
408
  }
409
409
 
410
410
  /**
411
- * TBD.
411
+ * Mutes all sounds in the manager.
412
412
  */
413
413
  setMute() {
414
414
  if (this._muted) {
@@ -423,7 +423,7 @@ export class SoundManager {
423
423
  }
424
424
 
425
425
  /**
426
- * TBD.
426
+ * Unmutes all sounds in the manager.
427
427
  */
428
428
  unsetMute() {
429
429
  if (!this._muted || this._codeMuted) {
@@ -437,7 +437,7 @@ export class SoundManager {
437
437
  }
438
438
 
439
439
  /**
440
- * TBD.
440
+ * Destroys the sound manager and cleans up resources.
441
441
  */
442
442
  destroy() {
443
443
  this.stopAll();
@@ -454,15 +454,15 @@ export class SoundManager {
454
454
  }
455
455
 
456
456
  /**
457
- * TBD.
458
- * @returns {boolean} TBD.
457
+ * Gets the muted state of the sound manager.
458
+ * @returns {boolean} True if the manager is muted, false otherwise.
459
459
  */
460
460
  get mute() {
461
461
  return this._muted;
462
462
  }
463
463
 
464
464
  /**
465
- * TBD.
465
+ * Sets the muted state of the sound manager.
466
466
  */
467
467
  set mute(value) {
468
468
  if (value || false) {
@@ -481,15 +481,15 @@ export class SoundManager {
481
481
  }
482
482
 
483
483
  /**
484
- * TBD.
485
- * @returns {number} TBD.
484
+ * Gets the volume level of the sound manager.
485
+ * @returns {number} The volume level (0.0 to 1.0).
486
486
  */
487
487
  get volume() {
488
488
  return this._volume;
489
489
  }
490
490
 
491
491
  /**
492
- * TBD.
492
+ * Sets the volume level of the sound manager.
493
493
  */
494
494
  set volume(value) {
495
495
  if (value < 0) {
@@ -6,8 +6,8 @@ import { SCALE_LINEAR, SCALE_NEAREST } from './const.js';
6
6
 
7
7
  export class Stage extends DisplayObject {
8
8
  /**
9
- * TBD.
10
- * @param {import('./game.js').Game} game - TBD.
9
+ * Creates a new Stage instance.
10
+ * @param {import('./game.js').Game} game - The game instance.
11
11
  */
12
12
  constructor(game) {
13
13
  super(game);
@@ -32,8 +32,8 @@ export class Stage extends DisplayObject {
32
32
  }
33
33
 
34
34
  /**
35
- * TBD.
36
- * @param {number} color - TBD.
35
+ * Sets the background color of the stage.
36
+ * @param {number} color - The color to set as the background.
37
37
  */
38
38
  setBackgroundColor(color) {
39
39
  if (this.game.config.transparent) {
@@ -48,7 +48,7 @@ export class Stage extends DisplayObject {
48
48
  }
49
49
 
50
50
  /**
51
- * TBD.
51
+ * Initializes the stage after game creation.
52
52
  */
53
53
  boot() {
54
54
  setUserSelect(this.game.canvas, 'none');
@@ -56,7 +56,7 @@ export class Stage extends DisplayObject {
56
56
  }
57
57
 
58
58
  /**
59
- * TBD.
59
+ * Pre-updates the stage and its children.
60
60
  */
61
61
  preUpdate() {
62
62
  this.currentRenderOrderID = 0;
@@ -67,7 +67,7 @@ export class Stage extends DisplayObject {
67
67
  }
68
68
 
69
69
  /**
70
- * TBD.
70
+ * Updates the stage and its children.
71
71
  */
72
72
  update() {
73
73
  let i = this.children.length;
@@ -78,7 +78,7 @@ export class Stage extends DisplayObject {
78
78
  }
79
79
 
80
80
  /**
81
- * TBD.
81
+ * Post-updates the stage and its children.
82
82
  */
83
83
  postUpdate() {
84
84
  for (let i = 0; i < this.children.length; i += 1) {
@@ -88,7 +88,7 @@ export class Stage extends DisplayObject {
88
88
  }
89
89
 
90
90
  /**
91
- * TBD.
91
+ * Updates the stage's transformation matrix.
92
92
  */
93
93
  updateTransform() {
94
94
  this.worldAlpha = 1;
@@ -98,7 +98,7 @@ export class Stage extends DisplayObject {
98
98
  }
99
99
 
100
100
  /**
101
- * TBD.
101
+ * Destroys the stage and cleans up resources.
102
102
  */
103
103
  destroy() {
104
104
  this.exists = false;
@@ -108,30 +108,30 @@ export class Stage extends DisplayObject {
108
108
  }
109
109
 
110
110
  /**
111
- * TBD.
112
- * @returns {number} TBD.
111
+ * Gets the background color of the stage.
112
+ * @returns {number} The background color.
113
113
  */
114
114
  get backgroundColor() {
115
115
  return this._bgColor.color;
116
116
  }
117
117
 
118
118
  /**
119
- * TBD.
119
+ * Sets the background color of the stage.
120
120
  */
121
121
  set backgroundColor(value) {
122
122
  this.setBackgroundColor(value);
123
123
  }
124
124
 
125
125
  /**
126
- * TBD.
127
- * @returns {boolean} TBD.
126
+ * Gets whether texture smoothing is enabled.
127
+ * @returns {boolean} True if texture smoothing is enabled, false otherwise.
128
128
  */
129
129
  get smoothed() {
130
130
  return window.PhaserRegistry.TEXTURE_SCALE_MODE === SCALE_LINEAR;
131
131
  }
132
132
 
133
133
  /**
134
- * TBD.
134
+ * Sets whether texture smoothing is enabled.
135
135
  */
136
136
  set smoothed(value) {
137
137
  window.PhaserRegistry.TEXTURE_SCALE_MODE = value ? SCALE_LINEAR : SCALE_NEAREST;