@vpmedia/phaser 1.94.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 (205) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/package.json +11 -11
  3. package/src/phaser/core/animation.js +79 -56
  4. package/src/phaser/core/animation_manager.js +55 -55
  5. package/src/phaser/core/animation_parser.js +2 -2
  6. package/src/phaser/core/cache.js +154 -154
  7. package/src/phaser/core/device.js +2 -1
  8. package/src/phaser/core/device_util.js +27 -27
  9. package/src/phaser/core/dom.js +43 -43
  10. package/src/phaser/core/event_manager.js +63 -63
  11. package/src/phaser/core/factory.js +47 -47
  12. package/src/phaser/core/frame.js +30 -30
  13. package/src/phaser/core/frame_data.js +30 -28
  14. package/src/phaser/core/frame_util.js +8 -8
  15. package/src/phaser/core/game.js +35 -19
  16. package/src/phaser/core/input_pointer.js +18 -0
  17. package/src/phaser/core/loader.js +171 -171
  18. package/src/phaser/core/loader_parser.js +22 -22
  19. package/src/phaser/core/raf.js +1 -1
  20. package/src/phaser/core/scale_manager.js +3 -2
  21. package/src/phaser/core/scene.js +16 -10
  22. package/src/phaser/core/scene_manager.js +51 -43
  23. package/src/phaser/core/signal.js +56 -52
  24. package/src/phaser/core/sound.js +54 -54
  25. package/src/phaser/core/sound_manager.js +49 -49
  26. package/src/phaser/core/stage.js +16 -16
  27. package/src/phaser/core/time.js +54 -30
  28. package/src/phaser/core/timer.js +82 -64
  29. package/src/phaser/core/timer_event.js +9 -9
  30. package/src/phaser/core/tween.js +106 -90
  31. package/src/phaser/core/tween_data.js +30 -30
  32. package/src/phaser/core/tween_manager.js +32 -24
  33. package/src/phaser/core/world.js +4 -3
  34. package/src/phaser/display/bitmap_text.js +72 -54
  35. package/src/phaser/display/button.js +48 -47
  36. package/src/phaser/display/canvas/buffer.js +8 -8
  37. package/src/phaser/display/canvas/graphics.js +8 -8
  38. package/src/phaser/display/canvas/masker.js +5 -5
  39. package/src/phaser/display/canvas/pool.js +18 -18
  40. package/src/phaser/display/canvas/renderer.js +17 -16
  41. package/src/phaser/display/canvas/tinter.js +22 -22
  42. package/src/phaser/display/canvas/util.js +42 -42
  43. package/src/phaser/display/display_object.js +119 -108
  44. package/src/phaser/display/graphics.js +129 -112
  45. package/src/phaser/display/graphics_data.js +10 -10
  46. package/src/phaser/display/graphics_data_util.js +3 -3
  47. package/src/phaser/display/group.js +63 -50
  48. package/src/phaser/display/image.js +68 -50
  49. package/src/phaser/display/sprite_batch.js +2 -2
  50. package/src/phaser/display/sprite_util.js +19 -19
  51. package/src/phaser/display/text.js +217 -187
  52. package/src/phaser/display/webgl/abstract_filter.js +4 -4
  53. package/src/phaser/display/webgl/base_texture.js +9 -9
  54. package/src/phaser/display/webgl/blend_manager.js +7 -7
  55. package/src/phaser/display/webgl/earcut.js +95 -95
  56. package/src/phaser/display/webgl/earcut_node.js +4 -4
  57. package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
  58. package/src/phaser/display/webgl/filter_manager.js +9 -9
  59. package/src/phaser/display/webgl/filter_texture.js +10 -10
  60. package/src/phaser/display/webgl/graphics.js +37 -37
  61. package/src/phaser/display/webgl/graphics_data.js +4 -4
  62. package/src/phaser/display/webgl/mask_manager.js +6 -6
  63. package/src/phaser/display/webgl/render_texture.js +16 -16
  64. package/src/phaser/display/webgl/renderer.js +21 -20
  65. package/src/phaser/display/webgl/shader/complex.js +4 -4
  66. package/src/phaser/display/webgl/shader/fast.js +4 -4
  67. package/src/phaser/display/webgl/shader/normal.js +8 -8
  68. package/src/phaser/display/webgl/shader/primitive.js +4 -4
  69. package/src/phaser/display/webgl/shader/strip.js +4 -4
  70. package/src/phaser/display/webgl/shader_manager.js +9 -9
  71. package/src/phaser/display/webgl/sprite_batch.js +18 -18
  72. package/src/phaser/display/webgl/stencil_manager.js +16 -16
  73. package/src/phaser/display/webgl/texture.js +13 -13
  74. package/src/phaser/display/webgl/texture_util.js +8 -8
  75. package/src/phaser/display/webgl/util.js +25 -25
  76. package/src/phaser/geom/circle.js +74 -69
  77. package/src/phaser/geom/ellipse.js +33 -28
  78. package/src/phaser/geom/line.js +96 -93
  79. package/src/phaser/geom/matrix.js +61 -54
  80. package/src/phaser/geom/point.js +99 -96
  81. package/src/phaser/geom/polygon.js +27 -22
  82. package/src/phaser/geom/rectangle.js +137 -132
  83. package/src/phaser/geom/rounded_rectangle.js +12 -12
  84. package/src/phaser/geom/util/circle.js +33 -33
  85. package/src/phaser/geom/util/ellipse.js +5 -5
  86. package/src/phaser/geom/util/line.js +26 -26
  87. package/src/phaser/geom/util/matrix.js +8 -8
  88. package/src/phaser/geom/util/point.js +97 -97
  89. package/src/phaser/geom/util/polygon.js +4 -4
  90. package/src/phaser/geom/util/rectangle.js +74 -74
  91. package/src/phaser/geom/util/rounded_rectangle.js +4 -4
  92. package/src/phaser/util/math.js +81 -81
  93. package/types/phaser/core/animation.d.ts +79 -56
  94. package/types/phaser/core/animation.d.ts.map +1 -1
  95. package/types/phaser/core/animation_manager.d.ts +55 -55
  96. package/types/phaser/core/animation_parser.d.ts +3 -2
  97. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  98. package/types/phaser/core/cache.d.ts +154 -154
  99. package/types/phaser/core/device.d.ts.map +1 -1
  100. package/types/phaser/core/dom.d.ts +51 -44
  101. package/types/phaser/core/dom.d.ts.map +1 -1
  102. package/types/phaser/core/event_manager.d.ts +63 -63
  103. package/types/phaser/core/factory.d.ts +47 -47
  104. package/types/phaser/core/frame.d.ts +30 -30
  105. package/types/phaser/core/frame_data.d.ts +28 -27
  106. package/types/phaser/core/frame_data.d.ts.map +1 -1
  107. package/types/phaser/core/game.d.ts +54 -21
  108. package/types/phaser/core/game.d.ts.map +1 -1
  109. package/types/phaser/core/input_pointer.d.ts +18 -0
  110. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  111. package/types/phaser/core/loader.d.ts +175 -172
  112. package/types/phaser/core/loader.d.ts.map +1 -1
  113. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  114. package/types/phaser/core/raf.d.ts +1 -1
  115. package/types/phaser/core/scale_manager.d.ts +6 -5
  116. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  117. package/types/phaser/core/scene.d.ts +15 -9
  118. package/types/phaser/core/scene.d.ts.map +1 -1
  119. package/types/phaser/core/scene_manager.d.ts +51 -43
  120. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  121. package/types/phaser/core/signal.d.ts +54 -51
  122. package/types/phaser/core/signal.d.ts.map +1 -1
  123. package/types/phaser/core/sound.d.ts +54 -54
  124. package/types/phaser/core/sound_manager.d.ts +49 -49
  125. package/types/phaser/core/stage.d.ts +10 -10
  126. package/types/phaser/core/time.d.ts +54 -30
  127. package/types/phaser/core/time.d.ts.map +1 -1
  128. package/types/phaser/core/timer.d.ts +82 -64
  129. package/types/phaser/core/timer.d.ts.map +1 -1
  130. package/types/phaser/core/timer_event.d.ts +9 -9
  131. package/types/phaser/core/tween.d.ts +106 -90
  132. package/types/phaser/core/tween.d.ts.map +1 -1
  133. package/types/phaser/core/tween_data.d.ts +30 -30
  134. package/types/phaser/core/tween_manager.d.ts +35 -67
  135. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  136. package/types/phaser/core/world.d.ts +4 -3
  137. package/types/phaser/core/world.d.ts.map +1 -1
  138. package/types/phaser/display/bitmap_text.d.ts +76 -53
  139. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  140. package/types/phaser/display/button.d.ts +47 -46
  141. package/types/phaser/display/button.d.ts.map +1 -1
  142. package/types/phaser/display/canvas/buffer.d.ts +8 -8
  143. package/types/phaser/display/canvas/graphics.d.ts +3 -3
  144. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  145. package/types/phaser/display/canvas/pool.d.ts +6 -3
  146. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  147. package/types/phaser/display/canvas/renderer.d.ts +18 -17
  148. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  149. package/types/phaser/display/canvas/util.d.ts +6 -6
  150. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  151. package/types/phaser/display/display_object.d.ts +119 -108
  152. package/types/phaser/display/display_object.d.ts.map +1 -1
  153. package/types/phaser/display/graphics.d.ts +118 -102
  154. package/types/phaser/display/graphics.d.ts.map +1 -1
  155. package/types/phaser/display/graphics_data.d.ts +10 -10
  156. package/types/phaser/display/group.d.ts +59 -47
  157. package/types/phaser/display/group.d.ts.map +1 -1
  158. package/types/phaser/display/image.d.ts +58 -45
  159. package/types/phaser/display/image.d.ts.map +1 -1
  160. package/types/phaser/display/text.d.ts +237 -188
  161. package/types/phaser/display/text.d.ts.map +1 -1
  162. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  163. package/types/phaser/display/webgl/base_texture.d.ts +10 -10
  164. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  165. package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
  166. package/types/phaser/display/webgl/earcut.d.ts +95 -95
  167. package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
  168. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
  169. package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
  170. package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
  171. package/types/phaser/display/webgl/graphics.d.ts +2 -2
  172. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  173. package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
  174. package/types/phaser/display/webgl/render_texture.d.ts +16 -16
  175. package/types/phaser/display/webgl/renderer.d.ts +21 -20
  176. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  177. package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
  178. package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
  179. package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
  180. package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
  181. package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
  182. package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
  183. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
  184. package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
  185. package/types/phaser/display/webgl/texture.d.ts +12 -12
  186. package/types/phaser/display/webgl/texture_util.d.ts +4 -2
  187. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  188. package/types/phaser/geom/circle.d.ts +74 -69
  189. package/types/phaser/geom/circle.d.ts.map +1 -1
  190. package/types/phaser/geom/ellipse.d.ts +33 -28
  191. package/types/phaser/geom/ellipse.d.ts.map +1 -1
  192. package/types/phaser/geom/line.d.ts +96 -93
  193. package/types/phaser/geom/line.d.ts.map +1 -1
  194. package/types/phaser/geom/matrix.d.ts +61 -54
  195. package/types/phaser/geom/matrix.d.ts.map +1 -1
  196. package/types/phaser/geom/point.d.ts +99 -96
  197. package/types/phaser/geom/point.d.ts.map +1 -1
  198. package/types/phaser/geom/polygon.d.ts +29 -23
  199. package/types/phaser/geom/polygon.d.ts.map +1 -1
  200. package/types/phaser/geom/rectangle.d.ts +137 -132
  201. package/types/phaser/geom/rectangle.d.ts.map +1 -1
  202. package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
  203. package/types/phaser/geom/util/point.d.ts +1 -1
  204. package/types/phaser/geom/util/point.d.ts.map +1 -1
  205. package/pnpm-workspace.yaml +0 -4
@@ -7,8 +7,8 @@ const TEXTURE_ATLAS_JSON_HASH = 1;
7
7
 
8
8
  export class Loader {
9
9
  /**
10
- * TBD.
11
- * @param {import('./game.js').Game} game - TBD.
10
+ * Creates a new Loader instance.
11
+ * @param {import('./game.js').Game} game - Reference to the Phaser Game instance.
12
12
  */
13
13
  constructor(game) {
14
14
  this.game = game;
@@ -46,9 +46,9 @@ export class Loader {
46
46
  }
47
47
 
48
48
  /**
49
- * TBD.
50
- * @param {import('../display/image.js').Image} sprite - TBD.
51
- * @param {number} direction - TBD.
49
+ * Sets the preload sprite for displaying loading progress.
50
+ * @param {import('../display/image.js').Image} sprite - The image to use as the preload sprite.
51
+ * @param {number} direction - The direction of the progress (0 = horizontal, 1 = vertical).
52
52
  */
53
53
  setPreloadSprite(sprite, direction = 0) {
54
54
  this.preloadSprite = {
@@ -70,7 +70,7 @@ export class Loader {
70
70
  }
71
71
 
72
72
  /**
73
- * TBD.
73
+ * Resizes the preload sprite when the window is resized.
74
74
  */
75
75
  resize() {
76
76
  if (this.preloadSprite && this.preloadSprite.height !== this.preloadSprite.sprite.height) {
@@ -79,20 +79,20 @@ export class Loader {
79
79
  }
80
80
 
81
81
  /**
82
- * TBD.
83
- * @param {string} type - TBD.
84
- * @param {string} key - TBD.
85
- * @returns {boolean} TBD.
82
+ * Checks if a file with the given type and key already exists in the file list.
83
+ * @param {string} type - The type of file to check for.
84
+ * @param {string} key - The key of the file to check for.
85
+ * @returns {boolean} True if the file exists, false otherwise.
86
86
  */
87
87
  checkKeyExists(type, key) {
88
88
  return this.getAssetIndex(type, key) > -1;
89
89
  }
90
90
 
91
91
  /**
92
- * TBD.
93
- * @param {string} type - TBD.
94
- * @param {string} key - TBD.
95
- * @returns {number} TBD.
92
+ * Gets the index of a file in the file list by type and key.
93
+ * @param {string} type - The type of file to find.
94
+ * @param {string} key - The key of the file to find.
95
+ * @returns {number} The index of the file in the list, or -1 if not found.
96
96
  */
97
97
  getAssetIndex(type, key) {
98
98
  let bestFound = -1;
@@ -111,10 +111,10 @@ export class Loader {
111
111
  }
112
112
 
113
113
  /**
114
- * TBD.
115
- * @param {string} type - TBD.
116
- * @param {string} key - TBD.
117
- * @returns {object} TBD.
114
+ * Gets a file from the file list by type and key.
115
+ * @param {string} type - The type of file to get.
116
+ * @param {string} key - The key of the file to get.
117
+ * @returns {{index: number, file: object} | null} The file and its index, or null if not found.
118
118
  */
119
119
  getAsset(type, key) {
120
120
  const fileIndex = this.getAssetIndex(type, key);
@@ -125,9 +125,9 @@ export class Loader {
125
125
  }
126
126
 
127
127
  /**
128
- * TBD.
129
- * @param {boolean} hard - TBD.
130
- * @param {boolean} clearEvents - TBD.
128
+ * Resets the loader state, optionally clearing event listeners.
129
+ * @param {boolean} hard - Whether to perform a hard reset (clears preload sprite).
130
+ * @param {boolean} clearEvents - Whether to clear event listeners.
131
131
  */
132
132
  reset(hard = false, clearEvents = false) {
133
133
  if (hard) {
@@ -153,14 +153,14 @@ export class Loader {
153
153
  }
154
154
 
155
155
  /**
156
- * TBD.
157
- * @param {string} type - TBD.
158
- * @param {string} key - TBD.
159
- * @param {string} url - TBD.
160
- * @param {object} properties - TBD.
161
- * @param {boolean} overwrite - TBD.
162
- * @param {string} extension - TBD.
163
- * @returns {Loader} TBD.
156
+ * Adds a file to the file list for loading.
157
+ * @param {string} type - The type of file to add.
158
+ * @param {string} key - The key to identify the file.
159
+ * @param {string} url - The URL of the file to load.
160
+ * @param {object} properties - Additional properties for the file.
161
+ * @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
162
+ * @param {string} extension - The file extension to use if URL is not provided.
163
+ * @returns {Loader} This Loader instance for chaining.
164
164
  */
165
165
  addToFileList(type, key = '', url = null, properties = null, overwrite = false, extension = null) {
166
166
  if (key === undefined || key === '') {
@@ -210,24 +210,24 @@ export class Loader {
210
210
  }
211
211
 
212
212
  /**
213
- * TBD.
214
- * @param {string} type - TBD.
215
- * @param {string} key - TBD.
216
- * @param {string} url - TBD.
217
- * @param {object} properties - TBD.
218
- * @returns {Loader} TBD.
213
+ * Replaces a file in the file list with new properties.
214
+ * @param {string} type - The type of file to replace.
215
+ * @param {string} key - The key of the file to replace.
216
+ * @param {string} url - The new URL for the file.
217
+ * @param {object} properties - The new properties for the file.
218
+ * @returns {Loader} This Loader instance for chaining.
219
219
  */
220
220
  replaceInFileList(type, key, url, properties) {
221
221
  return this.addToFileList(type, key, url, properties, true);
222
222
  }
223
223
 
224
224
  /**
225
- * TBD.
226
- * @param {string} key - TBD.
227
- * @param {string} url - TBD.
228
- * @param {object} data - TBD.
229
- * @param {object} callbackContext - TBD.
230
- * @returns {Loader} TBD.
225
+ * Adds a pack file to the file list.
226
+ * @param {string} key - The key to identify the pack file.
227
+ * @param {string} url - The URL of the pack file to load.
228
+ * @param {object} data - The parsed pack data.
229
+ * @param {object} callbackContext - The context in which to call the callback.
230
+ * @returns {Loader} This Loader instance for chaining.
231
231
  */
232
232
  pack(key, url, data, callbackContext) {
233
233
  const pack = {
@@ -261,21 +261,21 @@ export class Loader {
261
261
  }
262
262
 
263
263
  /**
264
- * TBD.
265
- * @param {string} key - TBD.
266
- * @param {string} url - TBD.
267
- * @param {boolean} overwrite - TBD.
268
- * @returns {Loader} TBD.
264
+ * Adds an image file to the file list.
265
+ * @param {string} key - The key to identify the image file.
266
+ * @param {string} url - The URL of the image file to load.
267
+ * @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
268
+ * @returns {Loader} This Loader instance for chaining.
269
269
  */
270
270
  image(key, url, overwrite = false) {
271
271
  return this.addToFileList('image', key, url, undefined, overwrite, '.png');
272
272
  }
273
273
 
274
274
  /**
275
- * TBD.
276
- * @param {string[]} keys - TBD.
277
- * @param {string[]} urls - TBD.
278
- * @returns {Loader} TBD.
275
+ * Adds multiple image files to the file list.
276
+ * @param {string[]} keys - The keys to identify the image files.
277
+ * @param {string[]} urls - The URLs of the image files to load.
278
+ * @returns {Loader} This Loader instance for chaining.
279
279
  */
280
280
  images(keys, urls) {
281
281
  if (Array.isArray(urls)) {
@@ -291,48 +291,48 @@ export class Loader {
291
291
  }
292
292
 
293
293
  /**
294
- * TBD.
295
- * @param {string} key - TBD.
296
- * @param {string} url - TBD.
297
- * @param {boolean} overwrite - TBD.
298
- * @returns {Loader} TBD.
294
+ * Adds a text file to the file list.
295
+ * @param {string} key - The key to identify the text file.
296
+ * @param {string} url - The URL of the text file to load.
297
+ * @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
298
+ * @returns {Loader} This Loader instance for chaining.
299
299
  */
300
300
  text(key, url, overwrite = false) {
301
301
  return this.addToFileList('text', key, url, undefined, overwrite, '.txt');
302
302
  }
303
303
 
304
304
  /**
305
- * TBD.
306
- * @param {string} key - TBD.
307
- * @param {string} url - TBD.
308
- * @param {boolean} overwrite - TBD.
309
- * @returns {Loader} TBD.
305
+ * Adds a JSON file to the file list.
306
+ * @param {string} key - The key to identify the JSON file.
307
+ * @param {string} url - The URL of the JSON file to load.
308
+ * @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
309
+ * @returns {Loader} This Loader instance for chaining.
310
310
  */
311
311
  json(key, url, overwrite = false) {
312
312
  return this.addToFileList('json', key, url, undefined, overwrite, '.json');
313
313
  }
314
314
 
315
315
  /**
316
- * TBD.
317
- * @param {string} key - TBD.
318
- * @param {string} url - TBD.
319
- * @param {boolean} overwrite - TBD.
320
- * @returns {Loader} TBD.
316
+ * Adds an XML file to the file list.
317
+ * @param {string} key - The key to identify the XML file.
318
+ * @param {string} url - The URL of the XML file to load.
319
+ * @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
320
+ * @returns {Loader} This Loader instance for chaining.
321
321
  */
322
322
  xml(key, url, overwrite = false) {
323
323
  return this.addToFileList('xml', key, url, undefined, overwrite, '.xml');
324
324
  }
325
325
 
326
326
  /**
327
- * TBD.
328
- * @param {string} key - TBD.
329
- * @param {string} url - TBD.
330
- * @param {number} frameWidth - TBD.
331
- * @param {number} frameHeight - TBD.
332
- * @param {number} frameMax - TBD.
333
- * @param {number} margin - TBD.
334
- * @param {number} spacing - TBD.
335
- * @returns {Loader} TBD.
327
+ * Adds a spritesheet file to the file list.
328
+ * @param {string} key - The key to identify the spritesheet file.
329
+ * @param {string} url - The URL of the spritesheet file to load.
330
+ * @param {number} frameWidth - The width of each frame in the spritesheet.
331
+ * @param {number} frameHeight - The height of each frame in the spritesheet.
332
+ * @param {number} frameMax - The maximum number of frames to load (-1 for all).
333
+ * @param {number} margin - The margin around each frame in pixels.
334
+ * @param {number} spacing - The spacing between frames in pixels.
335
+ * @returns {Loader} This Loader instance for chaining.
336
336
  */
337
337
  spritesheet(key, url, frameWidth, frameHeight, frameMax = -1, margin = 0, spacing = 0) {
338
338
  return this.addToFileList(
@@ -346,11 +346,11 @@ export class Loader {
346
346
  }
347
347
 
348
348
  /**
349
- * TBD.
350
- * @param {string} key - TBD.
351
- * @param {string[]} urls - TBD.
352
- * @param {boolean} autoDecode - TBD.
353
- * @returns {Loader} TBD.
349
+ * Adds an audio file to the file list.
350
+ * @param {string} key - The key to identify the audio file.
351
+ * @param {string[]} urls - The URLs of the audio files to load.
352
+ * @param {boolean} autoDecode - Whether to automatically decode the audio file.
353
+ * @returns {Loader} This Loader instance for chaining.
354
354
  */
355
355
  audio(key, urls, autoDecode = true) {
356
356
  if (this.game.sound.noAudio || this.game.device.noAudioFormat) {
@@ -363,13 +363,13 @@ export class Loader {
363
363
  }
364
364
 
365
365
  /**
366
- * TBD.
367
- * @param {string} key - TBD.
368
- * @param {string} urls - TBD.
369
- * @param {string} jsonURL - TBD.
370
- * @param {object} jsonData - TBD.
371
- * @param {boolean} autoDecode - TBD.
372
- * @returns {Loader} TBD.
366
+ * Adds an audio sprite file to the file list.
367
+ * @param {string} key - The key to identify the audio sprite file.
368
+ * @param {string} urls - The URLs of the audio files to load.
369
+ * @param {string} jsonURL - The URL of the JSON file containing audio sprite data.
370
+ * @param {object} jsonData - The parsed JSON data containing audio sprite data.
371
+ * @param {boolean} autoDecode - Whether to automatically decode the audio file.
372
+ * @returns {Loader} This Loader instance for chaining.
373
373
  */
374
374
  audioSprite(key, urls, jsonURL, jsonData, autoDecode = true) {
375
375
  if (this.game.sound.noAudio || this.game.device.noAudioFormat) {
@@ -388,15 +388,15 @@ export class Loader {
388
388
  }
389
389
 
390
390
  /**
391
- * TBD.
392
- * @param {string} key - TBD.
393
- * @param {string} textureURL - TBD.
394
- * @param {string} atlasURL - TBD.
395
- * @param {object} atlasData - TBD.
396
- * @param {number} xSpacing - TBD.
397
- * @param {number} ySpacing - TBD.
398
- * @returns {Loader} TBD.
399
- * @throws {Error}
391
+ * Adds a bitmap font file to the file list.
392
+ * @param {string} key - The key to identify the bitmap font file.
393
+ * @param {string} textureURL - The URL of the font texture image.
394
+ * @param {string} atlasURL - The URL of the XML or JSON file containing font data.
395
+ * @param {object} atlasData - The parsed data containing font information.
396
+ * @param {number} xSpacing - The horizontal spacing between characters in pixels.
397
+ * @param {number} ySpacing - The vertical spacing between characters in pixels.
398
+ * @returns {Loader} This Loader instance for chaining.
399
+ * @throws {Error} If the bitmap font atlas data is invalid.
400
400
  */
401
401
  bitmapFont(key, textureURL = null, atlasURL = null, atlasData = null, xSpacing = 0, ySpacing = 0) {
402
402
  if (textureURL === undefined || textureURL === null) {
@@ -432,13 +432,13 @@ export class Loader {
432
432
  }
433
433
 
434
434
  /**
435
- * TBD.
436
- * @param {string} key - TBD.
437
- * @param {string} textureURL - TBD.
438
- * @param {string} atlasURL - TBD.
439
- * @param {object} atlasData - TBD.
440
- * @param {number} format - TBD.
441
- * @returns {Loader} TBD.
435
+ * Adds a texture atlas file to the file list.
436
+ * @param {string} key - The key to identify the texture atlas file.
437
+ * @param {string} textureURL - The URL of the texture image file.
438
+ * @param {string} atlasURL - The URL of the JSON or XML file containing atlas data.
439
+ * @param {object} atlasData - The parsed data containing atlas information.
440
+ * @param {number} format - The format of the atlas file (JSON or XML).
441
+ * @returns {Loader} This Loader instance for chaining.
442
442
  */
443
443
  atlas(key, textureURL, atlasURL = null, atlasData = null, format = TEXTURE_ATLAS_JSON_HASH) {
444
444
  if (textureURL === undefined || textureURL === null) {
@@ -457,10 +457,10 @@ export class Loader {
457
457
  }
458
458
 
459
459
  /**
460
- * TBD.
461
- * @param {Function} callback - TBD.
462
- * @param {object} callbackContext - TBD.
463
- * @returns {Loader} TBD.
460
+ * Creates a sync point for loading files, ensuring all files in the block are loaded before continuing.
461
+ * @param {Function} callback - The callback function to execute within the sync point.
462
+ * @param {object} callbackContext - The context in which to call the callback.
463
+ * @returns {Loader} This Loader instance for chaining.
464
464
  */
465
465
  withSyncPoint(callback, callbackContext) {
466
466
  this._withSyncPointDepth += 1;
@@ -473,10 +473,10 @@ export class Loader {
473
473
  }
474
474
 
475
475
  /**
476
- * TBD.
477
- * @param {string} type - TBD.
478
- * @param {string} key - TBD.
479
- * @returns {Loader} TBD.
476
+ * Adds a sync point to a specific file, preventing other files from loading until this one is processed.
477
+ * @param {string} type - The type of file to add a sync point to.
478
+ * @param {string} key - The key of the file to add a sync point to.
479
+ * @returns {Loader} This Loader instance for chaining.
480
480
  */
481
481
  addSyncPoint(type, key) {
482
482
  const asset = this.getAsset(type, key);
@@ -487,9 +487,9 @@ export class Loader {
487
487
  }
488
488
 
489
489
  /**
490
- * TBD.
491
- * @param {string} type - TBD.
492
- * @param {string} key - TBD.
490
+ * Removes a file from the file list if it's not currently loading or loaded.
491
+ * @param {string} type - The type of file to remove.
492
+ * @param {string} key - The key of the file to remove.
493
493
  */
494
494
  removeFile(type, key) {
495
495
  const asset = this.getAsset(type, key);
@@ -501,7 +501,7 @@ export class Loader {
501
501
  }
502
502
 
503
503
  /**
504
- * TBD.
504
+ * Removes all files from the file list.
505
505
  */
506
506
  removeAll() {
507
507
  this._fileList.length = 0;
@@ -509,7 +509,7 @@ export class Loader {
509
509
  }
510
510
 
511
511
  /**
512
- * TBD.
512
+ * Starts the loading process for all queued files.
513
513
  */
514
514
  start() {
515
515
  if (this.isLoading) {
@@ -522,7 +522,7 @@ export class Loader {
522
522
  }
523
523
 
524
524
  /**
525
- * TBD.
525
+ * Processes the loading queue, loading files as appropriate.
526
526
  */
527
527
  processLoadQueue() {
528
528
  if (!this.isLoading) {
@@ -620,10 +620,10 @@ export class Loader {
620
620
  }
621
621
 
622
622
  /**
623
- * TBD.
624
- * @param {boolean} abnormal - TBD.
623
+ * Finishes the loading process, optionally reporting an abnormal termination.
624
+ * @param {boolean} abnormal - Whether the loading was terminated abnormally.
625
625
  */
626
- finishedLoading(abnormal) {
626
+ finishedLoading(abnormal = false) {
627
627
  if (this.hasLoaded) {
628
628
  return;
629
629
  }
@@ -643,9 +643,9 @@ export class Loader {
643
643
  }
644
644
 
645
645
  /**
646
- * TBD.
647
- * @param {object} file - TBD.
648
- * @param {string} errorMessage - TBD.
646
+ * Marks a file as complete or failed, updating the loading state.
647
+ * @param {object} file - The file to complete or mark as failed.
648
+ * @param {string} errorMessage - An error message if the file failed to load.
649
649
  */
650
650
  asyncComplete(file, errorMessage = '') {
651
651
  file.loaded = true;
@@ -659,8 +659,8 @@ export class Loader {
659
659
  }
660
660
 
661
661
  /**
662
- * TBD.
663
- * @param {object} pack - TBD.
662
+ * Processes a pack file, adding its contained files to the loader.
663
+ * @param {object} pack - The pack file object to process.
664
664
  */
665
665
  processPack(pack) {
666
666
  const packData = pack.data[pack.key];
@@ -722,10 +722,10 @@ export class Loader {
722
722
  }
723
723
 
724
724
  /**
725
- * TBD.
726
- * @param {string} url - TBD.
727
- * @param {object} file - TBD.
728
- * @returns {string} TBD.
725
+ * Transforms a URL by adding the base URL and path prefix if needed.
726
+ * @param {string} url - The original URL to transform.
727
+ * @param {object} file - The file object containing path information.
728
+ * @returns {string} The transformed URL.
729
729
  */
730
730
  transformUrl(url, file) {
731
731
  if (!url) {
@@ -738,8 +738,8 @@ export class Loader {
738
738
  }
739
739
 
740
740
  /**
741
- * TBD.
742
- * @param {object} file - TBD.
741
+ * Loads a file using XMLHttpRequest, handling image files specially.
742
+ * @param {object} file - The file object to load.
743
743
  */
744
744
  loadFile(file) {
745
745
  switch (file.type) {
@@ -780,8 +780,8 @@ export class Loader {
780
780
  }
781
781
 
782
782
  /**
783
- * TBD.
784
- * @param {object} file - TBD.
783
+ * Loads an image file using the Image DOM element.
784
+ * @param {object} file - The file object to load.
785
785
  */
786
786
  loadImageTag(file) {
787
787
  this.log('loadImageTag', file);
@@ -814,12 +814,12 @@ export class Loader {
814
814
  }
815
815
 
816
816
  /**
817
- * TBD.
818
- * @param {object} file - TBD.
819
- * @param {string} url - TBD.
820
- * @param {string} type - TBD.
821
- * @param {Function} onload - TBD.
822
- * @param {Function} onerror - TBD.
817
+ * Loads a file using XMLHttpRequest with the specified parameters.
818
+ * @param {object} file - The file object to load.
819
+ * @param {string} url - The URL of the file to load.
820
+ * @param {string} type - The expected response type (e.g., 'text', 'arraybuffer').
821
+ * @param {Function} onload - The function to call when the file loads successfully.
822
+ * @param {Function} onerror - The function to call if the file fails to load.
823
823
  */
824
824
  xhrLoad(file, url, type, onload, onerror = null) {
825
825
  this.log('xhrLoad', file);
@@ -887,7 +887,7 @@ export class Loader {
887
887
  }
888
888
 
889
889
  /**
890
- * TBD.
890
+ * Placeholder for XDomainRequest loading (not implemented).
891
891
  */
892
892
  xhrLoadWithXDR() {
893
893
  // TODO
@@ -895,9 +895,9 @@ export class Loader {
895
895
  }
896
896
 
897
897
  /**
898
- * TBD.
899
- * @param {object[]} urls - TBD.
900
- * @returns {string} TBD.
898
+ * Gets the first supported audio URL from a list of URLs.
899
+ * @param {object[]} urls - The array of URLs to check for supported audio formats.
900
+ * @returns {string} The first URL with a supported audio format, or null if none found.
901
901
  */
902
902
  getAudioURL(urls) {
903
903
  if (this.game.sound.noAudio || this.game.device.noAudioFormat) {
@@ -935,10 +935,10 @@ export class Loader {
935
935
  }
936
936
 
937
937
  /**
938
- * TBD.
939
- * @param {object} file - TBD.
940
- * @param {XMLHttpRequest} xhr - TBD.
941
- * @param {number | string} reason - TBD.
938
+ * Handles file loading errors, optionally retrying or marking the file as failed.
939
+ * @param {object} file - The file object that failed to load.
940
+ * @param {XMLHttpRequest} xhr - The XMLHttpRequest object that failed.
941
+ * @param {number | string} reason - The error code or message explaining the failure.
942
942
  */
943
943
  fileError(file, xhr = null, reason = 0) {
944
944
  // const url = file.requestUrl || this.transformUrl(file.url, file);
@@ -1042,9 +1042,9 @@ export class Loader {
1042
1042
  }
1043
1043
 
1044
1044
  /**
1045
- * TBD.
1046
- * @param {object} file - TBD.
1047
- * @param {XMLHttpRequest} xhr - TBD.
1045
+ * Handles successful file loading, processing the file content appropriately.
1046
+ * @param {object} file - The file object that was loaded successfully.
1047
+ * @param {XMLHttpRequest} xhr - The XMLHttpRequest object containing the file data.
1048
1048
  */
1049
1049
  jsonLoadComplete(file, xhr) {
1050
1050
  const data = JSON.parse(xhr.responseText);
@@ -1067,9 +1067,9 @@ export class Loader {
1067
1067
  }
1068
1068
 
1069
1069
  /**
1070
- * TBD.
1071
- * @param {object} file - TBD.
1072
- * @param {XMLHttpRequest} xhr - TBD.
1070
+ * Processes JSON file data after loading.
1071
+ * @param {object} file - The file object containing the JSON data.
1072
+ * @param {XMLHttpRequest} xhr - The XMLHttpRequest object containing the file data.
1073
1073
  */
1074
1074
  xmlLoadComplete(file, xhr) {
1075
1075
  // Always try parsing the content as XML, regardless of actually response type
@@ -1092,9 +1092,9 @@ export class Loader {
1092
1092
  }
1093
1093
 
1094
1094
  /**
1095
- * TBD.
1096
- * @param {object} data - TBD.
1097
- * @returns {Document} TBD.
1095
+ * Parses XML string data into a DOM Document object.
1096
+ * @param {object} data - The XML string data to parse.
1097
+ * @returns {Document} The parsed DOM Document, or null if parsing failed.
1098
1098
  */
1099
1099
  parseXml(data) {
1100
1100
  let xml = null;
@@ -1118,7 +1118,7 @@ export class Loader {
1118
1118
  }
1119
1119
 
1120
1120
  /**
1121
- * TBD.
1121
+ * Updates the preload sprite's progress indicator.
1122
1122
  */
1123
1123
  updateProgress() {
1124
1124
  if (this.preloadSprite) {
@@ -1137,9 +1137,9 @@ export class Loader {
1137
1137
  }
1138
1138
 
1139
1139
  /**
1140
- * TBD.
1141
- * @param {string} message - TBD.
1142
- * @param {string|object} data - TBD.
1140
+ * Logs a message to the console if logging is enabled.
1141
+ * @param {string} message - The message to log.
1142
+ * @param {string|object} data - Additional data to log with the message.
1143
1143
  */
1144
1144
  log(message, data = '') {
1145
1145
  if (!this.isUseLog) {
@@ -1149,40 +1149,40 @@ export class Loader {
1149
1149
  }
1150
1150
 
1151
1151
  /**
1152
- * TBD.
1153
- * @returns {number} TBD.
1152
+ * Gets the number of files that have been loaded.
1153
+ * @returns {number} The total number of loaded files.
1154
1154
  */
1155
1155
  totalLoadedFiles() {
1156
1156
  return this._loadedFileCount;
1157
1157
  }
1158
1158
 
1159
1159
  /**
1160
- * TBD.
1161
- * @returns {number} TBD.
1160
+ * Gets the number of files that are still queued for loading.
1161
+ * @returns {number} The total number of queued files.
1162
1162
  */
1163
1163
  totalQueuedFiles() {
1164
1164
  return this._totalFileCount - this._loadedFileCount;
1165
1165
  }
1166
1166
 
1167
1167
  /**
1168
- * TBD.
1169
- * @returns {number} TBD.
1168
+ * Gets the number of pack files that have been loaded.
1169
+ * @returns {number} The total number of loaded pack files.
1170
1170
  */
1171
1171
  totalLoadedPacks() {
1172
1172
  return this._totalPackCount;
1173
1173
  }
1174
1174
 
1175
1175
  /**
1176
- * TBD.
1177
- * @returns {number} TBD.
1176
+ * Gets the number of pack files that are still queued for loading.
1177
+ * @returns {number} The total number of queued pack files.
1178
1178
  */
1179
1179
  totalQueuedPacks() {
1180
1180
  return this._totalPackCount - this._loadedPackCount;
1181
1181
  }
1182
1182
 
1183
1183
  /**
1184
- * TBD.
1185
- * @returns {number} TBD.
1184
+ * Gets the loading progress as a percentage (0-100).
1185
+ * @returns {number} The current loading progress as a percentage.
1186
1186
  */
1187
1187
  get progressFloat() {
1188
1188
  const progress = (this._loadedFileCount / this._totalFileCount) * 100;
@@ -1190,8 +1190,8 @@ export class Loader {
1190
1190
  }
1191
1191
 
1192
1192
  /**
1193
- * TBD.
1194
- * @returns {number} TBD.
1193
+ * Gets the loading progress as a rounded percentage (0-100).
1194
+ * @returns {number} The current loading progress as a rounded percentage.
1195
1195
  */
1196
1196
  get progress() {
1197
1197
  return Math.round(this.progressFloat);