@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
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## [1.96.0] - 2025-12-17
2
+
3
+ ### 💼 Other
4
+
5
+ - *(deps)* Bump dependency versions
6
+
7
+ ### 📚 Documentation
8
+
9
+ - Improve jsdocs
10
+ - Improve jsdoc comments
11
+ - Improve jsdoc comments
12
+ - Improve jsdoc comments
13
+ - Improve jsdoc comments
14
+ - Improve jsdoc comments
15
+ - Improve jsdoc comments
16
+ - Improve jsdoc comments
17
+ - Regenerated types
18
+ - Improve jsdoc comments
19
+ - Improve jsdoc comments
20
+ - Improved jsdoc comments
21
+ - Improve jsdoc comments
22
+ - Improve jsdoc comments
23
+ - Improve jsdoc comments
24
+ - Improve jsdoc comments
25
+
26
+ ### ⚙️ Miscellaneous Tasks
27
+
28
+ - Release
29
+ - *(release)* V1.96.0
1
30
  ## [1.95.0] - 2025-12-16
2
31
 
3
32
  ### 💼 Other
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.95.0",
3
+ "version": "1.96.0",
4
4
  "description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -23,27 +23,27 @@
23
23
  "types": "./types/index.d.ts",
24
24
  "type": "module",
25
25
  "dependencies": {
26
- "@vpmedia/simplify": "^1.46.0",
26
+ "@vpmedia/simplify": "^1.52.0",
27
27
  "uuid": "^13.0.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@commitlint/cli": "^20.2.0",
31
31
  "@commitlint/config-conventional": "^20.2.0",
32
32
  "@eslint/js": "^9.39.2",
33
- "@types/node": "^25.0.2",
34
- "@vitest/coverage-v8": "^4.0.15",
33
+ "@types/node": "^25.0.3",
34
+ "@vitest/coverage-v8": "^4.0.16",
35
35
  "eslint": "^9.39.2",
36
36
  "eslint-plugin-jsdoc": "^61.5.0",
37
- "eslint-plugin-oxlint": "^1.32.0",
37
+ "eslint-plugin-oxlint": "^1.33.0",
38
38
  "eslint-plugin-unicorn": "^62.0.0",
39
39
  "globals": "^16.5.0",
40
40
  "jsdom": "^27.3.0",
41
- "oxlint": "^1.32.0",
42
- "oxlint-tsgolint": "^0.8.6",
41
+ "oxlint": "^1.33.0",
42
+ "oxlint-tsgolint": "^0.9.1",
43
43
  "prettier": "^3.7.4",
44
44
  "typescript": "^5.9.3",
45
- "typescript-eslint": "^8.49.0",
46
- "vitest": "^4.0.15"
45
+ "typescript-eslint": "^8.50.0",
46
+ "vitest": "^4.0.16"
47
47
  },
48
48
  "browserslist": [
49
49
  "> 0.5%",
@@ -2,14 +2,14 @@ import { Signal } from './signal.js';
2
2
 
3
3
  export class Animation {
4
4
  /**
5
- * TBD.
6
- * @param {import('./game.js').Game} game - TBD.
7
- * @param {import('../display/image.js').Image} parent - TBD.
8
- * @param {string} name - TBD.
9
- * @param {import('./frame_data.js').FrameData} frameData - TBD.
10
- * @param {string[]|number[]} frames - TBD.
11
- * @param {number} frameRate - TBD.
12
- * @param {boolean} loop - TBD.
5
+ * Creates a new Animation instance.
6
+ * @param {import('./game.js').Game} game - The game instance this animation belongs to.
7
+ * @param {import('../display/image.js').Image} parent - The Image object that owns this animation.
8
+ * @param {string} name - The unique name of this animation.
9
+ * @param {import('./frame_data.js').FrameData} frameData - The FrameData object that contains the frames for this animation.
10
+ * @param {string[]|number[]} frames - An array of frame identifiers (names or indices) to use in this animation.
11
+ * @param {number} frameRate - The frame rate at which this animation should play (frames per second).
12
+ * @param {boolean} loop - Whether the animation should loop when it completes.
13
13
  */
14
14
  constructor(game, parent, name, frameData, frames, frameRate, loop = false) {
15
15
  /** @type {import('./game.js').Game} */
@@ -58,10 +58,10 @@ export class Animation {
58
58
  }
59
59
 
60
60
  /**
61
- * TBD.
62
- * @param {number} frameRate - TBD.
63
- * @param {boolean} loop - TBD.
64
- * @returns {Animation} TBD.
61
+ * Plays this animation.
62
+ * @param {number} frameRate - The new frame rate to use for this animation (if null, uses the original frame rate).
63
+ * @param {boolean} loop - Whether to loop this animation (if null, uses the original loop setting).
64
+ * @returns {Animation} This Animation instance for chaining.
65
65
  */
66
66
  play(frameRate = null, loop = null) {
67
67
  if (typeof frameRate === 'number') {
@@ -88,7 +88,7 @@ export class Animation {
88
88
  }
89
89
 
90
90
  /**
91
- * TBD.
91
+ * Restarts this animation from the beginning.
92
92
  */
93
93
  restart() {
94
94
  this.isPlaying = true;
@@ -106,8 +106,8 @@ export class Animation {
106
106
  }
107
107
 
108
108
  /**
109
- * TBD.
110
- * @returns {Animation} TBD.
109
+ * Reverses the direction of this animation.
110
+ * @returns {Animation} This Animation instance for chaining.
111
111
  */
112
112
  reverse() {
113
113
  this.reversed = !this.reversed;
@@ -115,8 +115,8 @@ export class Animation {
115
115
  }
116
116
 
117
117
  /**
118
- * TBD.
119
- * @returns {Animation} TBD.
118
+ * Reverses the animation direction once, then returns to normal direction.
119
+ * @returns {Animation} This Animation instance for chaining.
120
120
  */
121
121
  reverseOnce() {
122
122
  this.onComplete.addOnce(this.reverse, this);
@@ -124,9 +124,9 @@ export class Animation {
124
124
  }
125
125
 
126
126
  /**
127
- * TBD.
128
- * @param {string|number} frameId - TBD.
129
- * @param {boolean} useLocalFrameIndex - TBD.
127
+ * Sets the current frame of this animation.
128
+ * @param {string|number} frameId - The identifier (name or index) of the frame to set.
129
+ * @param {boolean} useLocalFrameIndex - If true, treats frameId as an index into the local frames array.
130
130
  */
131
131
  setFrame(frameId, useLocalFrameIndex = false) {
132
132
  let frameIndex;
@@ -158,9 +158,9 @@ export class Animation {
158
158
  }
159
159
 
160
160
  /**
161
- * TBD.
162
- * @param {boolean} resetFrame - TBD.
163
- * @param {boolean} dispatchComplete - TBD.
161
+ * Stops this animation.
162
+ * @param {boolean} resetFrame - If true, resets to the first frame.
163
+ * @param {boolean} dispatchComplete - If true, dispatches the onComplete signal.
164
164
  */
165
165
  stop(resetFrame = false, dispatchComplete = false) {
166
166
  this.isPlaying = false;
@@ -179,7 +179,7 @@ export class Animation {
179
179
  }
180
180
 
181
181
  /**
182
- * TBD.
182
+ * Called when the game is paused.
183
183
  */
184
184
  onPause() {
185
185
  if (this.isPlaying) {
@@ -188,7 +188,7 @@ export class Animation {
188
188
  }
189
189
 
190
190
  /**
191
- * TBD.
191
+ * Called when the game is resumed.
192
192
  */
193
193
  onResume() {
194
194
  if (this.isPlaying) {
@@ -197,8 +197,8 @@ export class Animation {
197
197
  }
198
198
 
199
199
  /**
200
- * TBD.
201
- * @returns {boolean} TBD.
200
+ * Updates this animation.
201
+ * @returns {boolean} True if the animation was updated, false otherwise.
202
202
  */
203
203
  update() {
204
204
  if (this.isPaused) {
@@ -256,10 +256,10 @@ export class Animation {
256
256
  }
257
257
 
258
258
  /**
259
- * TBD.
260
- * @param {boolean} signalUpdate - TBD.
261
- * @param {boolean} fromPlay - TBD.
262
- * @returns {boolean} TBD.
259
+ * Updates the current frame of this animation.
260
+ * @param {boolean} signalUpdate - Whether to signal the update event.
261
+ * @param {boolean} fromPlay - Whether this call is from play().
262
+ * @returns {boolean} True if the frame was updated, false otherwise.
263
263
  */
264
264
  updateCurrentFrame(signalUpdate, fromPlay = false) {
265
265
  if (!this._frameData || !this.currentFrame) {
@@ -281,8 +281,8 @@ export class Animation {
281
281
  }
282
282
 
283
283
  /**
284
- * TBD.
285
- * @param {number} quantity - TBD.
284
+ * Advances the animation to the next frame(s).
285
+ * @param {number} quantity - The number of frames to advance by.
286
286
  */
287
287
  next(quantity = 1) {
288
288
  let frame = this._frameIndex + quantity;
@@ -300,8 +300,8 @@ export class Animation {
300
300
  }
301
301
 
302
302
  /**
303
- * TBD.
304
- * @param {number} quantity - TBD.
303
+ * Moves the animation to the previous frame(s).
304
+ * @param {number} quantity - The number of frames to move back by.
305
305
  */
306
306
  previous(quantity = 1) {
307
307
  let frame = this._frameIndex - quantity;
@@ -319,8 +319,8 @@ export class Animation {
319
319
  }
320
320
 
321
321
  /**
322
- * TBD.
323
- * @param {import('./frame_data.js').FrameData} frameData - TBD.
322
+ * Updates the frame data used by this animation.
323
+ * @param {import('./frame_data.js').FrameData} frameData - The new FrameData object to use.
324
324
  */
325
325
  updateFrameData(frameData) {
326
326
  this._frameData = frameData;
@@ -330,7 +330,7 @@ export class Animation {
330
330
  }
331
331
 
332
332
  /**
333
- * TBD.
333
+ * Destroys this animation and cleans up resources.
334
334
  */
335
335
  destroy() {
336
336
  if (!this._frameData) {
@@ -354,7 +354,7 @@ export class Animation {
354
354
  }
355
355
 
356
356
  /**
357
- * TBD.
357
+ * Completes this animation, setting it to the final frame.
358
358
  */
359
359
  complete() {
360
360
  this._frameIndex = this._frames.length - 1;
@@ -367,15 +367,16 @@ export class Animation {
367
367
  }
368
368
 
369
369
  /**
370
- * TBD.
371
- * @returns {boolean} TBD.
370
+ * Gets whether this animation is currently paused.
371
+ * @returns {boolean} True if the animation is paused, false otherwise.
372
372
  */
373
373
  get paused() {
374
374
  return this.isPaused;
375
375
  }
376
376
 
377
377
  /**
378
- * TBD.
378
+ * Sets whether this animation is currently paused.
379
+ * @param {boolean} value - True to pause the animation, false to resume it.
379
380
  */
380
381
  set paused(value) {
381
382
  this.isPaused = value;
@@ -387,31 +388,32 @@ export class Animation {
387
388
  }
388
389
 
389
390
  /**
390
- * TBD.
391
- * @returns {boolean} TBD.
391
+ * Gets whether this animation is currently reversed.
392
+ * @returns {boolean} True if the animation is reversed, false otherwise.
392
393
  */
393
394
  get reversed() {
394
395
  return this.isReversed;
395
396
  }
396
397
 
397
398
  /**
398
- * TBD.
399
+ * Sets whether this animation is currently reversed.
400
+ * @param {boolean} value - True to reverse the animation, false to normal direction.
399
401
  */
400
402
  set reversed(value) {
401
403
  this.isReversed = value;
402
404
  }
403
405
 
404
406
  /**
405
- * TBD.
406
- * @returns {number} TBD.
407
+ * Gets the total number of frames in this animation.
408
+ * @returns {number} The total number of frames.
407
409
  */
408
410
  get frameTotal() {
409
411
  return this._frames.length;
410
412
  }
411
413
 
412
414
  /**
413
- * TBD.
414
- * @returns {number} TBD.
415
+ * Gets the current frame index.
416
+ * @returns {number} The current frame index.
415
417
  */
416
418
  get frame() {
417
419
  if (this.currentFrame !== null) {
@@ -421,7 +423,8 @@ export class Animation {
421
423
  }
422
424
 
423
425
  /**
424
- * TBD.
426
+ * Sets the current frame index.
427
+ * @param {number} value - The new frame index to set.
425
428
  */
426
429
  set frame(value) {
427
430
  this.currentFrame = this._frameData.getFrame(this._frames[value]);
@@ -435,15 +438,16 @@ export class Animation {
435
438
  }
436
439
 
437
440
  /**
438
- * TBD.
439
- * @returns {number} TBD.
441
+ * Gets the current animation speed (frame rate).
442
+ * @returns {number} The frame rate in frames per second.
440
443
  */
441
444
  get speed() {
442
445
  return 1000 / this.delay;
443
446
  }
444
447
 
445
448
  /**
446
- * TBD.
449
+ * Sets the animation speed (frame rate).
450
+ * @param {number} value - The new frame rate in frames per second.
447
451
  */
448
452
  set speed(value) {
449
453
  if (value > 0) {
@@ -452,15 +456,16 @@ export class Animation {
452
456
  }
453
457
 
454
458
  /**
455
- * TBD.
456
- * @returns {boolean} TBD.
459
+ * Gets whether the update signal is enabled.
460
+ * @returns {boolean} True if the update signal is enabled, false otherwise.
457
461
  */
458
462
  get enableUpdate() {
459
463
  return this.onUpdate !== null;
460
464
  }
461
465
 
462
466
  /**
463
- * TBD.
467
+ * Sets whether the update signal is enabled.
468
+ * @param {boolean} value - True to enable the update signal, false to disable it.
464
469
  */
465
470
  set enableUpdate(value) {
466
471
  if (value && this.onUpdate === null) {
@@ -3,8 +3,8 @@ import { ENGINE_ERROR_CANNOT_SET_FRAME, ENGINE_ERROR_CANNOT_SET_FRAME_NAME } fro
3
3
 
4
4
  export class AnimationManager {
5
5
  /**
6
- * TBD.
7
- * @param {import('../display/image.js').Image} sprite - TBD.
6
+ * Creates a new AnimationManager instance.
7
+ * @param {import('../display/image.js').Image} sprite - Reference to the parent Sprite.
8
8
  */
9
9
  constructor(sprite) {
10
10
  this.sprite = sprite;
@@ -24,7 +24,7 @@ export class AnimationManager {
24
24
  }
25
25
 
26
26
  /**
27
- * TBD.
27
+ * Destroys the AnimationManager and cleans up resources.
28
28
  */
29
29
  destroy() {
30
30
  const keys = Object.keys(this._anims);
@@ -41,10 +41,10 @@ export class AnimationManager {
41
41
  }
42
42
 
43
43
  /**
44
- * TBD.
45
- * @param {import('./frame_data.js').FrameData} frameData - TBD.
46
- * @param {string|number} frame - TBD.
47
- * @returns {boolean} TBD.
44
+ * Loads frame data into the AnimationManager.
45
+ * @param {import('./frame_data.js').FrameData} frameData - The FrameData to load.
46
+ * @param {string|number} frame - The frame index or name to set as current.
47
+ * @returns {boolean} True if the frame data was loaded successfully, false otherwise.
48
48
  */
49
49
  loadFrameData(frameData, frame) {
50
50
  if (!frameData) {
@@ -71,10 +71,10 @@ export class AnimationManager {
71
71
  }
72
72
 
73
73
  /**
74
- * TBD.
75
- * @param {import('./frame_data.js').FrameData} frameData - TBD.
76
- * @param {string|number} frame - TBD.
77
- * @returns {boolean} TBD.
74
+ * Copies frame data into the AnimationManager.
75
+ * @param {import('./frame_data.js').FrameData} frameData - The FrameData to copy.
76
+ * @param {string|number} frame - The frame index or name to set as current.
77
+ * @returns {boolean} True if the frame data was copied successfully, false otherwise.
78
78
  */
79
79
  copyFrameData(frameData, frame) {
80
80
  this._frameData = frameData.clone();
@@ -98,13 +98,13 @@ export class AnimationManager {
98
98
  }
99
99
 
100
100
  /**
101
- * TBD.
102
- * @param {string} name - TBD.
103
- * @param {number[] | string[] | null | undefined} frameList - TBD.
104
- * @param {number} frameRate - TBD.
105
- * @param {boolean} loop - TBD.
106
- * @param {boolean | undefined} useNumericIndex - TBD.
107
- * @returns {Animation} TBD.
101
+ * Adds a new animation to the AnimationManager.
102
+ * @param {string} name - The name of the animation.
103
+ * @param {number[] | string[] | null | undefined} frameList - The list of frames to include in the animation.
104
+ * @param {number} frameRate - The frame rate of the animation (frames per second).
105
+ * @param {boolean} loop - Whether the animation should loop.
106
+ * @param {boolean | undefined} useNumericIndex - Whether to treat frameList as numeric indices.
107
+ * @returns {Animation} The created Animation object.
108
108
  */
109
109
  add(name, frameList, frameRate = 60, loop = false, useNumericIndex = undefined) {
110
110
  const frames = frameList || [];
@@ -135,10 +135,10 @@ export class AnimationManager {
135
135
  }
136
136
 
137
137
  /**
138
- * TBD.
139
- * @param {string[] | number[]} frames - TBD.
140
- * @param {boolean} useNumericIndex - TBD.
141
- * @returns {boolean} TBD.
138
+ * Validates a list of frames against the current frame data.
139
+ * @param {string[] | number[]} frames - The list of frames to validate.
140
+ * @param {boolean} useNumericIndex - Whether to treat frameList as numeric indices.
141
+ * @returns {boolean} True if all frames are valid, false otherwise.
142
142
  */
143
143
  validateFrames(frames, useNumericIndex = false) {
144
144
  for (let i = 0; i < frames.length; i += 1) {
@@ -154,11 +154,11 @@ export class AnimationManager {
154
154
  }
155
155
 
156
156
  /**
157
- * TBD.
158
- * @param {string} name - TBD.
159
- * @param {number} frameRate - TBD.
160
- * @param {boolean} loop - TBD.
161
- * @returns {Animation} TBD.
157
+ * Plays an animation by name.
158
+ * @param {string} name - The name of the animation to play.
159
+ * @param {number} frameRate - The frame rate (frames per second) to play at, or null to use the animation's default.
160
+ * @param {boolean} loop - Whether the animation should loop, or null to use the animation's default.
161
+ * @returns {Animation} The Animation object that was played, or null if not found.
162
162
  */
163
163
  play(name, frameRate = null, loop = null) {
164
164
  if (this._anims[name]) {
@@ -181,9 +181,9 @@ export class AnimationManager {
181
181
  }
182
182
 
183
183
  /**
184
- * TBD.
185
- * @param {string} name - TBD.
186
- * @param {boolean} resetFrame - TBD.
184
+ * Stops an animation by name.
185
+ * @param {string} name - The name of the animation to stop, or null to stop the current animation.
186
+ * @param {boolean} resetFrame - Whether to reset the frame to the first frame of the animation.
187
187
  */
188
188
  stop(name = null, resetFrame = false) {
189
189
  if (this.currentAnim && (typeof name !== 'string' || name === this.currentAnim.name)) {
@@ -192,8 +192,8 @@ export class AnimationManager {
192
192
  }
193
193
 
194
194
  /**
195
- * TBD.
196
- * @returns {boolean} TBD.
195
+ * Updates the animation manager state.
196
+ * @returns {boolean} True if an animation was updated, false otherwise.
197
197
  */
198
198
  update() {
199
199
  if (this.updateIfVisible && !this.sprite.visible) {
@@ -207,8 +207,8 @@ export class AnimationManager {
207
207
  }
208
208
 
209
209
  /**
210
- * TBD.
211
- * @param {number} quantity - TBD.
210
+ * Advances the current animation by a specified number of frames.
211
+ * @param {number} quantity - The number of frames to advance by.
212
212
  */
213
213
  next(quantity) {
214
214
  if (this.currentAnim) {
@@ -218,8 +218,8 @@ export class AnimationManager {
218
218
  }
219
219
 
220
220
  /**
221
- * TBD.
222
- * @param {number} quantity - TBD.
221
+ * Moves the current animation back by a specified number of frames.
222
+ * @param {number} quantity - The number of frames to move back by.
223
223
  */
224
224
  previous(quantity) {
225
225
  if (this.currentAnim) {
@@ -229,9 +229,9 @@ export class AnimationManager {
229
229
  }
230
230
 
231
231
  /**
232
- * TBD.
233
- * @param {string} name - TBD.
234
- * @returns {Animation} TBD.
232
+ * Gets an animation by name.
233
+ * @param {string} name - The name of the animation to retrieve.
234
+ * @returns {Animation} The Animation object, or null if not found.
235
235
  */
236
236
  getAnimation(name) {
237
237
  if (name && this._anims[name]) {
@@ -241,7 +241,7 @@ export class AnimationManager {
241
241
  }
242
242
 
243
243
  /**
244
- * TBD.
244
+ * Refreshes the current frame texture (not implemented).
245
245
  */
246
246
  refreshFrame() {
247
247
  // TODO
@@ -250,39 +250,39 @@ export class AnimationManager {
250
250
  }
251
251
 
252
252
  /**
253
- * TBD.
254
- * @returns {import('./frame_data.js').FrameData} TBD.
253
+ * Gets the frame data used by this AnimationManager.
254
+ * @returns {import('./frame_data.js').FrameData} The FrameData object.
255
255
  */
256
256
  get frameData() {
257
257
  return this._frameData;
258
258
  }
259
259
 
260
260
  /**
261
- * TBD.
262
- * @returns {number} TBD.
261
+ * Gets the total number of frames in the frame data.
262
+ * @returns {number} The total number of frames.
263
263
  */
264
264
  get frameTotal() {
265
265
  return this._frameData.total;
266
266
  }
267
267
 
268
268
  /**
269
- * TBD.
270
- * @returns {boolean} TBD.
269
+ * Gets the paused state of the current animation.
270
+ * @returns {boolean} True if the current animation is paused, false otherwise.
271
271
  */
272
272
  get paused() {
273
273
  return this.currentAnim.isPaused;
274
274
  }
275
275
 
276
276
  /**
277
- * TBD.
277
+ * Sets the paused state of the current animation.
278
278
  */
279
279
  set paused(value) {
280
280
  this.currentAnim.paused = value;
281
281
  }
282
282
 
283
283
  /**
284
- * TBD.
285
- * @returns {string} TBD.
284
+ * Gets the name of the current animation.
285
+ * @returns {string} The name of the current animation, or null if no animation is active.
286
286
  */
287
287
  get name() {
288
288
  if (this.currentAnim) {
@@ -292,8 +292,8 @@ export class AnimationManager {
292
292
  }
293
293
 
294
294
  /**
295
- * TBD.
296
- * @returns {number} TBD.
295
+ * Gets the current frame index.
296
+ * @returns {number} The current frame index.
297
297
  */
298
298
  get frame() {
299
299
  if (this.currentFrame) {
@@ -303,7 +303,7 @@ export class AnimationManager {
303
303
  }
304
304
 
305
305
  /**
306
- * TBD.
306
+ * Sets the current frame index.
307
307
  */
308
308
  set frame(value) {
309
309
  if (typeof value === 'number' && this._frameData && this._frameData.getFrame(value) !== null) {
@@ -319,8 +319,8 @@ export class AnimationManager {
319
319
  }
320
320
 
321
321
  /**
322
- * TBD.
323
- * @returns {string} TBD.
322
+ * Gets the current frame name.
323
+ * @returns {string} The current frame name, or null if no frame is set.
324
324
  */
325
325
  get frameName() {
326
326
  if (this.currentFrame) {
@@ -330,7 +330,7 @@ export class AnimationManager {
330
330
  }
331
331
 
332
332
  /**
333
- * TBD.
333
+ * Sets the current frame by name.
334
334
  */
335
335
  set frameName(value) {
336
336
  if (typeof value === 'string' && this._frameData && this._frameData.getFrameByName(value) !== null) {