@vpmedia/phaser 1.95.0 → 1.97.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 (184) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/package.json +10 -10
  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 +68 -52
  21. package/src/phaser/core/signal.test.js +37 -0
  22. package/src/phaser/core/sound.js +54 -54
  23. package/src/phaser/core/sound_manager.js +49 -49
  24. package/src/phaser/core/stage.js +16 -16
  25. package/src/phaser/core/time.js +30 -30
  26. package/src/phaser/core/timer.js +79 -64
  27. package/src/phaser/core/timer_event.js +9 -9
  28. package/src/phaser/core/tween.js +90 -90
  29. package/src/phaser/core/tween_data.js +30 -30
  30. package/src/phaser/core/tween_manager.js +29 -24
  31. package/src/phaser/core/world.js +4 -3
  32. package/src/phaser/display/bitmap_text.js +61 -54
  33. package/src/phaser/display/button.js +48 -47
  34. package/src/phaser/display/canvas/buffer.js +8 -8
  35. package/src/phaser/display/canvas/graphics.js +8 -8
  36. package/src/phaser/display/canvas/masker.js +5 -5
  37. package/src/phaser/display/canvas/pool.js +18 -18
  38. package/src/phaser/display/canvas/renderer.js +16 -16
  39. package/src/phaser/display/canvas/tinter.js +22 -22
  40. package/src/phaser/display/canvas/util.js +42 -42
  41. package/src/phaser/display/display_object.js +119 -108
  42. package/src/phaser/display/graphics.js +112 -112
  43. package/src/phaser/display/graphics_data.js +10 -10
  44. package/src/phaser/display/graphics_data_util.js +3 -3
  45. package/src/phaser/display/group.js +50 -50
  46. package/src/phaser/display/image.js +54 -50
  47. package/src/phaser/display/sprite_batch.js +2 -2
  48. package/src/phaser/display/sprite_util.js +19 -19
  49. package/src/phaser/display/text.js +212 -187
  50. package/src/phaser/display/webgl/abstract_filter.js +4 -4
  51. package/src/phaser/display/webgl/base_texture.js +9 -9
  52. package/src/phaser/display/webgl/blend_manager.js +7 -7
  53. package/src/phaser/display/webgl/earcut.js +95 -95
  54. package/src/phaser/display/webgl/earcut_node.js +4 -4
  55. package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
  56. package/src/phaser/display/webgl/filter_manager.js +9 -9
  57. package/src/phaser/display/webgl/filter_texture.js +10 -10
  58. package/src/phaser/display/webgl/graphics.js +37 -37
  59. package/src/phaser/display/webgl/graphics_data.js +4 -4
  60. package/src/phaser/display/webgl/mask_manager.js +6 -6
  61. package/src/phaser/display/webgl/render_texture.js +16 -16
  62. package/src/phaser/display/webgl/renderer.js +20 -20
  63. package/src/phaser/display/webgl/shader/complex.js +4 -4
  64. package/src/phaser/display/webgl/shader/fast.js +4 -4
  65. package/src/phaser/display/webgl/shader/normal.js +8 -8
  66. package/src/phaser/display/webgl/shader/primitive.js +4 -4
  67. package/src/phaser/display/webgl/shader/strip.js +4 -4
  68. package/src/phaser/display/webgl/shader_manager.js +9 -9
  69. package/src/phaser/display/webgl/sprite_batch.js +18 -18
  70. package/src/phaser/display/webgl/stencil_manager.js +16 -16
  71. package/src/phaser/display/webgl/texture.js +13 -13
  72. package/src/phaser/display/webgl/texture_util.js +8 -8
  73. package/src/phaser/display/webgl/util.js +25 -25
  74. package/src/phaser/geom/circle.js +69 -69
  75. package/src/phaser/geom/circle.test.js +1 -0
  76. package/src/phaser/geom/ellipse.js +28 -28
  77. package/src/phaser/geom/ellipse.test.js +1 -0
  78. package/src/phaser/geom/line.js +93 -93
  79. package/src/phaser/geom/line.test.js +1 -0
  80. package/src/phaser/geom/matrix.js +54 -54
  81. package/src/phaser/geom/matrix.test.js +1 -0
  82. package/src/phaser/geom/point.js +96 -96
  83. package/src/phaser/geom/point.test.js +1 -0
  84. package/src/phaser/geom/polygon.js +22 -22
  85. package/src/phaser/geom/rectangle.js +132 -132
  86. package/src/phaser/geom/rectangle.test.js +1 -0
  87. package/src/phaser/geom/rounded_rectangle.js +12 -12
  88. package/src/phaser/geom/rounded_rectangle.test.js +1 -0
  89. package/src/phaser/geom/util/circle.js +33 -33
  90. package/src/phaser/geom/util/circle.test.js +1 -0
  91. package/src/phaser/geom/util/ellipse.js +5 -5
  92. package/src/phaser/geom/util/ellipse.test.js +1 -0
  93. package/src/phaser/geom/util/line.js +26 -26
  94. package/src/phaser/geom/util/line.test.js +1 -0
  95. package/src/phaser/geom/util/matrix.js +8 -8
  96. package/src/phaser/geom/util/matrix.test.js +1 -0
  97. package/src/phaser/geom/util/point.js +97 -97
  98. package/src/phaser/geom/util/point.test.js +1 -0
  99. package/src/phaser/geom/util/polygon.js +4 -4
  100. package/src/phaser/geom/util/polygon.test.js +1 -0
  101. package/src/phaser/geom/util/rectangle.js +74 -74
  102. package/src/phaser/geom/util/rectangle.test.js +1 -0
  103. package/src/phaser/geom/util/rounded_rectangle.js +4 -4
  104. package/src/phaser/geom/util/rounded_rectangle.test.js +1 -0
  105. package/src/phaser/util/math.js +81 -81
  106. package/src/phaser/util/math.test.js +1 -0
  107. package/types/phaser/core/animation.d.ts +61 -56
  108. package/types/phaser/core/animation.d.ts.map +1 -1
  109. package/types/phaser/core/animation_manager.d.ts +55 -55
  110. package/types/phaser/core/cache.d.ts +154 -154
  111. package/types/phaser/core/device.d.ts.map +1 -1
  112. package/types/phaser/core/dom.d.ts +43 -43
  113. package/types/phaser/core/event_manager.d.ts +63 -63
  114. package/types/phaser/core/factory.d.ts +47 -47
  115. package/types/phaser/core/frame.d.ts +30 -30
  116. package/types/phaser/core/frame_data.d.ts +28 -27
  117. package/types/phaser/core/frame_data.d.ts.map +1 -1
  118. package/types/phaser/core/game.d.ts +52 -19
  119. package/types/phaser/core/game.d.ts.map +1 -1
  120. package/types/phaser/core/loader.d.ts +170 -170
  121. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  122. package/types/phaser/core/raf.d.ts +1 -1
  123. package/types/phaser/core/scene.d.ts +15 -9
  124. package/types/phaser/core/scene.d.ts.map +1 -1
  125. package/types/phaser/core/scene_manager.d.ts +51 -43
  126. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  127. package/types/phaser/core/signal.d.ts +54 -51
  128. package/types/phaser/core/signal.d.ts.map +1 -1
  129. package/types/phaser/core/sound.d.ts +54 -54
  130. package/types/phaser/core/sound_manager.d.ts +49 -49
  131. package/types/phaser/core/stage.d.ts +10 -10
  132. package/types/phaser/core/time.d.ts +30 -30
  133. package/types/phaser/core/timer.d.ts +64 -64
  134. package/types/phaser/core/timer_event.d.ts +9 -9
  135. package/types/phaser/core/tween.d.ts +90 -90
  136. package/types/phaser/core/tween_data.d.ts +30 -30
  137. package/types/phaser/core/tween_manager.d.ts +29 -24
  138. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  139. package/types/phaser/core/world.d.ts +4 -3
  140. package/types/phaser/core/world.d.ts.map +1 -1
  141. package/types/phaser/display/bitmap_text.d.ts +59 -52
  142. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  143. package/types/phaser/display/button.d.ts +47 -46
  144. package/types/phaser/display/button.d.ts.map +1 -1
  145. package/types/phaser/display/canvas/buffer.d.ts +8 -8
  146. package/types/phaser/display/canvas/renderer.d.ts +16 -16
  147. package/types/phaser/display/display_object.d.ts +119 -108
  148. package/types/phaser/display/display_object.d.ts.map +1 -1
  149. package/types/phaser/display/graphics.d.ts +101 -101
  150. package/types/phaser/display/graphics_data.d.ts +10 -10
  151. package/types/phaser/display/group.d.ts +47 -47
  152. package/types/phaser/display/image.d.ts +42 -40
  153. package/types/phaser/display/image.d.ts.map +1 -1
  154. package/types/phaser/display/text.d.ts +207 -184
  155. package/types/phaser/display/text.d.ts.map +1 -1
  156. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  157. package/types/phaser/display/webgl/base_texture.d.ts +9 -9
  158. package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
  159. package/types/phaser/display/webgl/earcut.d.ts +95 -95
  160. package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
  161. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
  162. package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
  163. package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
  164. package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
  165. package/types/phaser/display/webgl/render_texture.d.ts +16 -16
  166. package/types/phaser/display/webgl/renderer.d.ts +20 -20
  167. package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
  168. package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
  169. package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
  170. package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
  171. package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
  172. package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
  173. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
  174. package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
  175. package/types/phaser/display/webgl/texture.d.ts +12 -12
  176. package/types/phaser/geom/circle.d.ts +69 -69
  177. package/types/phaser/geom/ellipse.d.ts +28 -28
  178. package/types/phaser/geom/line.d.ts +93 -93
  179. package/types/phaser/geom/matrix.d.ts +54 -54
  180. package/types/phaser/geom/point.d.ts +96 -96
  181. package/types/phaser/geom/polygon.d.ts +22 -22
  182. package/types/phaser/geom/rectangle.d.ts +132 -132
  183. package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
  184. package/pnpm-workspace.yaml +0 -4
@@ -8,11 +8,11 @@ export const SORT_DESCENDING = 1;
8
8
 
9
9
  export class Group extends DisplayObject {
10
10
  /**
11
- * TBD.
12
- * @param {import('../core/game.js').Game} game - TBD.
13
- * @param {DisplayObject} parent - TBD.
14
- * @param {string} name - TBD.
15
- * @param {boolean} addToStage - TBD.
11
+ * Creates a new Group object.
12
+ * @param {import('../core/game.js').Game} game - The game instance this group belongs to.
13
+ * @param {DisplayObject} parent - The parent display object.
14
+ * @param {string} name - The name of this group.
15
+ * @param {boolean} addToStage - Whether to add this group to the stage.
16
16
  */
17
17
  constructor(game, parent = null, name = null, addToStage = false) {
18
18
  super(game);
@@ -57,9 +57,9 @@ export class Group extends DisplayObject {
57
57
  }
58
58
 
59
59
  /**
60
- * TBD.
61
- * @param {boolean} destroyChildren - TBD.
62
- * @param {boolean} soft - TBD.
60
+ * Destroys this group and cleans up resources.
61
+ * @param {boolean} destroyChildren - Whether to destroy children as well.
62
+ * @param {boolean} soft - Whether to perform a soft destroy (leaving the group in the parent's children list).
63
63
  */
64
64
  destroy(destroyChildren = true, soft = false) {
65
65
  if (this.game === null || this.ignoreDestroy) {
@@ -80,11 +80,11 @@ export class Group extends DisplayObject {
80
80
  }
81
81
 
82
82
  /**
83
- * TBD.
84
- * @param {DisplayObject} child - TBD.
85
- * @param {boolean} silent - TBD.
86
- * @param {number} index - TBD.
87
- * @returns {DisplayObject} TBD.
83
+ * Adds a child to this group.
84
+ * @param {DisplayObject} child - The child to add.
85
+ * @param {boolean} silent - Whether to dispatch events.
86
+ * @param {number} index - The index to add the child at.
87
+ * @returns {DisplayObject} The added child.
88
88
  */
89
89
  add(child, silent = false, index = -1) {
90
90
  if (child.parent === this) {
@@ -110,19 +110,19 @@ export class Group extends DisplayObject {
110
110
  }
111
111
 
112
112
  /**
113
- * TBD.
114
- * @param {DisplayObject} child - TBD.
115
- * @param {number} index - TBD.
116
- * @param {boolean} silent - TBD.
113
+ * Adds a child to this group at a specific index.
114
+ * @param {DisplayObject} child - The child to add.
115
+ * @param {number} index - The index to add the child at.
116
+ * @param {boolean} silent - Whether to dispatch events.
117
117
  */
118
118
  addAt(child, index, silent) {
119
119
  this.add(child, silent, index);
120
120
  }
121
121
 
122
122
  /**
123
- * TBD.
124
- * @param {number} index - TBD.
125
- * @returns {DisplayObject} TBD.
123
+ * Gets a child at the specified index.
124
+ * @param {number} index - The index of the child to get.
125
+ * @returns {DisplayObject} The child at the specified index, or -1 if not found.
126
126
  */
127
127
  getAt(index) {
128
128
  if (index < 0 || index >= this.children.length) {
@@ -132,7 +132,7 @@ export class Group extends DisplayObject {
132
132
  }
133
133
 
134
134
  /**
135
- * TBD.
135
+ * Updates the Z indices of all children in this group.
136
136
  */
137
137
  updateZ() {
138
138
  let i = this.children.length;
@@ -143,8 +143,8 @@ export class Group extends DisplayObject {
143
143
  }
144
144
 
145
145
  /**
146
- * TBD.
147
- * @returns {DisplayObject} TBD.
146
+ * Gets the next child in this group (with circular wrapping).
147
+ * @returns {DisplayObject} The next child, or null if no children exist.
148
148
  */
149
149
  next() {
150
150
  if (this.cursor) {
@@ -161,8 +161,8 @@ export class Group extends DisplayObject {
161
161
  }
162
162
 
163
163
  /**
164
- * TBD.
165
- * @returns {DisplayObject} TBD.
164
+ * Gets the previous child in this group (with circular wrapping).
165
+ * @returns {DisplayObject} The previous child, or null if no children exist.
166
166
  */
167
167
  previous() {
168
168
  if (this.cursor) {
@@ -179,9 +179,9 @@ export class Group extends DisplayObject {
179
179
  }
180
180
 
181
181
  /**
182
- * TBD.
183
- * @param {DisplayObject} child1 - TBD.
184
- * @param {DisplayObject} child2 - TBD.
182
+ * Swaps the positions of two children in this group.
183
+ * @param {DisplayObject} child1 - The first child to swap.
184
+ * @param {DisplayObject} child2 - The second child to swap.
185
185
  */
186
186
  swap(child1, child2) {
187
187
  this.swapChildren(child1, child2);
@@ -189,9 +189,9 @@ export class Group extends DisplayObject {
189
189
  }
190
190
 
191
191
  /**
192
- * TBD.
193
- * @param {DisplayObject} child - TBD.
194
- * @returns {DisplayObject} TBD.
192
+ * Brings a child to the top of this group.
193
+ * @param {DisplayObject} child - The child to bring to the top.
194
+ * @returns {DisplayObject} The child that was brought to the top.
195
195
  */
196
196
  bringToTop(child) {
197
197
  if (child.parent === this && this.getIndex(child) < this.children.length) {
@@ -202,9 +202,9 @@ export class Group extends DisplayObject {
202
202
  }
203
203
 
204
204
  /**
205
- * TBD.
206
- * @param {DisplayObject} child - TBD.
207
- * @returns {DisplayObject} TBD.
205
+ * Sends a child to the back of this group.
206
+ * @param {DisplayObject} child - The child to send to the back.
207
+ * @returns {DisplayObject} The child that was sent to the back.
208
208
  */
209
209
  sendToBack(child) {
210
210
  if (child.parent === this && this.getIndex(child) > 0) {
@@ -215,7 +215,7 @@ export class Group extends DisplayObject {
215
215
  }
216
216
 
217
217
  /**
218
- * TBD.
218
+ * Reverses the order of children in this group.
219
219
  */
220
220
  reverse() {
221
221
  this.children.reverse();
@@ -223,16 +223,16 @@ export class Group extends DisplayObject {
223
223
  }
224
224
 
225
225
  /**
226
- * TBD.
227
- * @param {DisplayObject} child - TBD.
228
- * @returns {number} TBD.
226
+ * Gets the index of a child in this group.
227
+ * @param {DisplayObject} child - The child to get the index of.
228
+ * @returns {number} The index of the child, or -1 if not found.
229
229
  */
230
230
  getIndex(child) {
231
231
  return this.children.indexOf(child);
232
232
  }
233
233
 
234
234
  /**
235
- * TBD.
235
+ * Updates the Z indices of all children in this group before the update cycle.
236
236
  */
237
237
  preUpdate() {
238
238
  if (this.pendingDestroy) {
@@ -249,7 +249,7 @@ export class Group extends DisplayObject {
249
249
  }
250
250
 
251
251
  /**
252
- * TBD.
252
+ * Updates all children in this group during the update cycle.
253
253
  */
254
254
  update() {
255
255
  let i = this.children.length;
@@ -260,7 +260,7 @@ export class Group extends DisplayObject {
260
260
  }
261
261
 
262
262
  /**
263
- * TBD.
263
+ * Updates all children in this group after the update cycle.
264
264
  */
265
265
  postUpdate() {
266
266
  for (let i = 0; i < this.children.length; i += 1) {
@@ -269,11 +269,11 @@ export class Group extends DisplayObject {
269
269
  }
270
270
 
271
271
  /**
272
- * TBD.
273
- * @param {DisplayObject} child - TBD.
274
- * @param {boolean} destroy - TBD.
275
- * @param {boolean} silent - TBD.
276
- * @returns {boolean} TBD.
272
+ * Removes a child from this group.
273
+ * @param {DisplayObject} child - The child to remove.
274
+ * @param {boolean} destroy - Whether to destroy the child after removing it.
275
+ * @param {boolean} silent - Whether to dispatch events.
276
+ * @returns {boolean} True if the child was removed, false otherwise.
277
277
  */
278
278
  remove(child, destroy = true, silent = false) {
279
279
  if (this.children.length === 0 || this.children.indexOf(child) === -1) {
@@ -294,10 +294,10 @@ export class Group extends DisplayObject {
294
294
  }
295
295
 
296
296
  /**
297
- * TBD.
298
- * @param {boolean} destroy - TBD.
299
- * @param {boolean} silent - TBD.
300
- * @param {boolean} destroyTexture - TBD.
297
+ * Removes all children from this group.
298
+ * @param {boolean} destroy - Whether to destroy children as well.
299
+ * @param {boolean} silent - Whether to dispatch events.
300
+ * @param {boolean} destroyTexture - Whether to destroy textures as well.
301
301
  */
302
302
  removeAll(destroy = true, silent = false, destroyTexture = false) {
303
303
  if (this.children.length === 0) {
@@ -9,12 +9,12 @@ import { Texture } from './webgl/texture.js';
9
9
 
10
10
  export class Image extends DisplayObject {
11
11
  /**
12
- * TBD.
13
- * @param {import('../core/game.js').Game} game - TBD.
14
- * @param {number} x - TBD.
15
- * @param {number} y - TBD.
16
- * @param {string | number | Texture} key - TBD.
17
- * @param {string | number} frame - TBD.
12
+ * Creates a new Image instance.
13
+ * @param {import('../core/game.js').Game} game - The game instance this image belongs to.
14
+ * @param {number} x - The x position of the image.
15
+ * @param {number} y - The y position of the image.
16
+ * @param {string | number | Texture} key - The texture key or texture to use.
17
+ * @param {string | number} frame - The frame identifier (name or index) to use.
18
18
  */
19
19
  constructor(game, x, y, key, frame = 0) {
20
20
  super(game);
@@ -57,7 +57,7 @@ export class Image extends DisplayObject {
57
57
  }
58
58
 
59
59
  /**
60
- * TBD.
60
+ * Destroys this image and cleans up resources.
61
61
  */
62
62
  destroy() {
63
63
  this.game = null;
@@ -81,7 +81,7 @@ export class Image extends DisplayObject {
81
81
  }
82
82
 
83
83
  /**
84
- * TBD.
84
+ * Called before the update cycle for this image.
85
85
  */
86
86
  preUpdate() {
87
87
  if (this.pendingDestroy) {
@@ -107,10 +107,10 @@ export class Image extends DisplayObject {
107
107
  // LoadTexture
108
108
 
109
109
  /**
110
- * TBD.
111
- * @param {string | number | Texture} key - TBD.
112
- * @param {string | number | null | undefined} frame - TBD.
113
- * @param {boolean} stopAnimation - TBD.
110
+ * Loads a texture for this image.
111
+ * @param {string | number | Texture} key - The texture key or texture to use.
112
+ * @param {string | number | null | undefined} frame - The frame identifier (name or index) to use.
113
+ * @param {boolean} stopAnimation - Whether to stop the animation when changing textures.
114
114
  */
115
115
  loadTexture(key, frame = 0, stopAnimation = true) {
116
116
  if (key === PENDING_ATLAS) {
@@ -151,8 +151,8 @@ export class Image extends DisplayObject {
151
151
  }
152
152
 
153
153
  /**
154
- * TBD.
155
- * @param {import('../core/frame.js').Frame} frame - TBD.
154
+ * Sets the current frame of this image.
155
+ * @param {import('../core/frame.js').Frame} frame - The frame to set.
156
156
  */
157
157
  setFrame(frame) {
158
158
  this._frame = frame;
@@ -196,10 +196,10 @@ export class Image extends DisplayObject {
196
196
  }
197
197
 
198
198
  /**
199
- * TBD.
200
- * @param {DisplayObject} parent - TBD.
201
- * @param {number} width - TBD.
202
- * @param {number} height - TBD.
199
+ * Resizes the frame of this image.
200
+ * @param {DisplayObject} parent - The parent display object.
201
+ * @param {number} width - The new width of the frame.
202
+ * @param {number} height - The new height of the frame.
203
203
  */
204
204
  resizeFrame(parent, width, height) {
205
205
  this.texture.frame.resize(width, height);
@@ -207,7 +207,7 @@ export class Image extends DisplayObject {
207
207
  }
208
208
 
209
209
  /**
210
- * TBD.
210
+ * Resets the frame of this image to its original frame.
211
211
  */
212
212
  resetFrame() {
213
213
  if (this._frame) {
@@ -216,30 +216,32 @@ export class Image extends DisplayObject {
216
216
  }
217
217
 
218
218
  /**
219
- * TBD.
220
- * @returns {number} TBD.
219
+ * Gets the current frame index of this image.
220
+ * @returns {number} The current frame index.
221
221
  */
222
222
  get frame() {
223
223
  return this.animations.frame;
224
224
  }
225
225
 
226
226
  /**
227
- * TBD.
227
+ * Sets the current frame index of this image.
228
+ * @param {number} value - The new frame index to set.
228
229
  */
229
230
  set frame(value) {
230
231
  this.animations.frame = value;
231
232
  }
232
233
 
233
234
  /**
234
- * TBD.
235
- * @returns {string} TBD.
235
+ * Gets the current frame name of this image.
236
+ * @returns {string} The current frame name.
236
237
  */
237
238
  get frameName() {
238
239
  return this.animations.frameName;
239
240
  }
240
241
 
241
242
  /**
242
- * TBD.
243
+ * Sets the current frame name of this image.
244
+ * @param {string} value - The new frame name to set.
243
245
  */
244
246
  set frameName(value) {
245
247
  this.animations.frameName = value;
@@ -248,9 +250,9 @@ export class Image extends DisplayObject {
248
250
  // Crop
249
251
 
250
252
  /**
251
- * TBD.
252
- * @param {Rectangle} rect - TBD.
253
- * @param {boolean} copy - TBD.
253
+ * Crops the texture of this image.
254
+ * @param {Rectangle} rect - The rectangle to crop to.
255
+ * @param {boolean} copy - Whether to copy the rect or use it directly.
254
256
  */
255
257
  crop(rect, copy = false) {
256
258
  if (rect) {
@@ -270,7 +272,7 @@ export class Image extends DisplayObject {
270
272
  }
271
273
 
272
274
  /**
273
- * TBD.
275
+ * Updates the crop rectangle of this image.
274
276
  */
275
277
  updateCrop() {
276
278
  if (!this.cropRect) {
@@ -302,15 +304,16 @@ export class Image extends DisplayObject {
302
304
  }
303
305
 
304
306
  /**
305
- * TBD.
306
- * @returns {number} TBD.
307
+ * Gets the width of this image.
308
+ * @returns {number} The width in pixels.
307
309
  */
308
310
  get width() {
309
311
  return this.scale.x * this.texture.frame.width;
310
312
  }
311
313
 
312
314
  /**
313
- * TBD.
315
+ * Sets the width of this image.
316
+ * @param {number} value - The new width in pixels.
314
317
  */
315
318
  set width(value) {
316
319
  this.scale.x = value / this.texture.frame.width;
@@ -318,15 +321,16 @@ export class Image extends DisplayObject {
318
321
  }
319
322
 
320
323
  /**
321
- * TBD.
322
- * @returns {number} TBD.
324
+ * Gets the height of this image.
325
+ * @returns {number} The height in pixels.
323
326
  */
324
327
  get height() {
325
328
  return this.scale.y * this.texture.frame.height;
326
329
  }
327
330
 
328
331
  /**
329
- * TBD.
332
+ * Sets the height of this image.
333
+ * @param {number} value - The new height in pixels.
330
334
  */
331
335
  set height(value) {
332
336
  this.scale.y = value / this.texture.frame.height;
@@ -334,7 +338,7 @@ export class Image extends DisplayObject {
334
338
  }
335
339
 
336
340
  /**
337
- * TBD.
341
+ * Called when the texture of this image is updated.
338
342
  */
339
343
  onTextureUpdate() {
340
344
  // so if _width is 0 then width was not set..
@@ -347,44 +351,44 @@ export class Image extends DisplayObject {
347
351
  }
348
352
 
349
353
  /**
350
- * TBD.
351
- * @param {Texture} texture - TBD.
352
- * @param {boolean} destroyBase - TBD.
354
+ * Sets the texture for this image.
355
+ * @param {Texture} texture - The new texture to set.
356
+ * @param {boolean} destroyBase - Whether to destroy the base texture.
353
357
  */
354
358
  setTexture(texture, destroyBase = false) {
355
359
  setTexture(this, texture, destroyBase);
356
360
  }
357
361
 
358
362
  /**
359
- * TBD.
360
- * @param {import('../geom/matrix.js').Matrix} matrix - TBD.
361
- * @returns {Rectangle} TBD.
363
+ * Gets the bounds of this image.
364
+ * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
365
+ * @returns {Rectangle} The bounds rectangle of this image.
362
366
  */
363
367
  getBounds(matrix = null) {
364
368
  return getBounds(this, matrix);
365
369
  }
366
370
 
367
371
  /**
368
- * TBD.
369
- * @returns {Rectangle} TBD.
372
+ * Gets the local bounds of this image.
373
+ * @returns {Rectangle} The local bounds rectangle of this image.
370
374
  */
371
375
  getLocalBounds() {
372
376
  return getLocalBounds(this);
373
377
  }
374
378
 
375
379
  /**
376
- * TBD.
377
- * @param {object} renderSession - TBD.
378
- * @param {import('../geom/matrix.js').Matrix} matrix - TBD.
380
+ * Renders this image using WebGL.
381
+ * @param {object} renderSession - The WebGL rendering session.
382
+ * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
379
383
  */
380
384
  renderWebGL(renderSession, matrix = null) {
381
385
  renderWebGL(this, renderSession, matrix);
382
386
  }
383
387
 
384
388
  /**
385
- * TBD.
386
- * @param {object} renderSession - TBD.
387
- * @param {import('../geom/matrix.js').Matrix} matrix - TBD.
389
+ * Renders this image using Canvas.
390
+ * @param {object} renderSession - The Canvas rendering session.
391
+ * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
388
392
  */
389
393
  renderCanvas(renderSession, matrix = null) {
390
394
  renderCanvas(this, renderSession, matrix);
@@ -2,8 +2,8 @@ import { DisplayObject } from './display_object.js';
2
2
 
3
3
  export class SpriteBatch extends DisplayObject {
4
4
  /**
5
- * TBD.
6
- * @param {import('../core/game.js').Game} game - TBD.
5
+ * Creates a new SpriteBatch object.
6
+ * @param {import('../core/game.js').Game} game - The game instance.
7
7
  */
8
8
  constructor(game) {
9
9
  super(game);
@@ -3,10 +3,10 @@ import { getIdentityMatrix } from '../geom/util/matrix.js';
3
3
  import { getTintedTexture } from './canvas/tinter.js';
4
4
 
5
5
  /**
6
- * TBD.
7
- * @param {import('./image.js').Image} target - TBD.
8
- * @param {import('./webgl/texture.js').Texture} texture - TBD.
9
- * @param {boolean} destroyBase - TBD.
6
+ * Sets the texture of a sprite.
7
+ * @param {import('./image.js').Image} target - The target image to set the texture on.
8
+ * @param {import('./webgl/texture.js').Texture} texture - The new texture to set.
9
+ * @param {boolean} destroyBase - Whether to destroy the base texture.
10
10
  */
11
11
  export const setTexture = (target, texture, destroyBase = false) => {
12
12
  if (destroyBase) {
@@ -19,10 +19,10 @@ export const setTexture = (target, texture, destroyBase = false) => {
19
19
  };
20
20
 
21
21
  /**
22
- * TBD.
23
- * @param {import('./image.js').Image} target - TBD.
24
- * @param {object} matrix - TBD.
25
- * @returns {import('../geom/rectangle.js').Rectangle} TBD.
22
+ * Gets the bounds of a sprite.
23
+ * @param {import('./image.js').Image} target - The target image to get bounds for.
24
+ * @param {object} matrix - The transformation matrix.
25
+ * @returns {import('../geom/rectangle.js').Rectangle} The bounds rectangle.
26
26
  */
27
27
  export const getBounds = (target, matrix = null) => {
28
28
  // TODO verify
@@ -102,9 +102,9 @@ export const getBounds = (target, matrix = null) => {
102
102
  };
103
103
 
104
104
  /**
105
- * TBD.
106
- * @param {import('./image.js').Image} target - TBD.
107
- * @returns {import('../geom/rectangle.js').Rectangle} TBD.
105
+ * Gets the local bounds of a sprite.
106
+ * @param {import('./image.js').Image} target - The target image to get local bounds for.
107
+ * @returns {import('../geom/rectangle.js').Rectangle} The local bounds rectangle.
108
108
  */
109
109
  export const getLocalBounds = (target) => {
110
110
  const matrixCache = target.worldTransform;
@@ -122,10 +122,10 @@ export const getLocalBounds = (target) => {
122
122
  };
123
123
 
124
124
  /**
125
- * TBD.
126
- * @param {import('./image.js').Image} target - TBD.
127
- * @param {object} renderSession - TBD.
128
- * @param {import('../geom/matrix.js').Matrix | null | undefined} matrix - TBD.
125
+ * Renders a sprite using WebGL.
126
+ * @param {import('./image.js').Image} target - The target image to render.
127
+ * @param {object} renderSession - The render session object.
128
+ * @param {import('../geom/matrix.js').Matrix | null | undefined} matrix - The transformation matrix.
129
129
  */
130
130
  export const renderWebGL = (target, renderSession, matrix = null) => {
131
131
  // if the sprite is not visible or the alpha is 0 then no need to render this element
@@ -171,10 +171,10 @@ export const renderWebGL = (target, renderSession, matrix = null) => {
171
171
  };
172
172
 
173
173
  /**
174
- * TBD.
175
- * @param {import('./image.js').Image} target - TBD.
176
- * @param {object} renderSession - TBD.
177
- * @param {import('../geom/matrix.js').Matrix | null | undefined} matrix - TBD.
174
+ * Renders a sprite using Canvas.
175
+ * @param {import('./image.js').Image} target - The target image to render.
176
+ * @param {object} renderSession - The render session object.
177
+ * @param {import('../geom/matrix.js').Matrix | null | undefined} matrix - The transformation matrix.
178
178
  */
179
179
  export const renderCanvas = (target, renderSession, matrix = null) => {
180
180
  // If the sprite is not visible or the alpha is 0 then no need to render this element