@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
@@ -19,8 +19,8 @@ export const RENDER_TEXTURE = 9;
19
19
 
20
20
  export class Cache {
21
21
  /**
22
- * TBD.
23
- * @param {import('./game.js').Game} game - TBD.
22
+ * Creates a new Cache instance.
23
+ * @param {import('./game.js').Game} game - The game instance.
24
24
  */
25
25
  constructor(game) {
26
26
  this.game = game;
@@ -57,7 +57,7 @@ export class Cache {
57
57
  }
58
58
 
59
59
  /**
60
- * TBD.
60
+ * Adds the default image to the cache.
61
61
  */
62
62
  addDefaultImage() {
63
63
  const img = new Image();
@@ -69,7 +69,7 @@ export class Cache {
69
69
  }
70
70
 
71
71
  /**
72
- * TBD.
72
+ * Adds the missing image to the cache.
73
73
  */
74
74
  addMissingImage() {
75
75
  const img = new Image();
@@ -80,11 +80,11 @@ export class Cache {
80
80
  }
81
81
 
82
82
  /**
83
- * TBD.
84
- * @param {string} key - TBD.
85
- * @param {string} url - TBD.
86
- * @param {HTMLImageElement} data - TBD.
87
- * @returns {object} TBD.
83
+ * Adds an image to the cache.
84
+ * @param {string} key - The unique key for this cache entry.
85
+ * @param {string} url - The URL the image was loaded from.
86
+ * @param {HTMLImageElement} data - The image data to cache.
87
+ * @returns {object} The cached image object.
88
88
  */
89
89
  addImage(key, url, data) {
90
90
  if (this.checkImageKey(key)) {
@@ -108,11 +108,11 @@ export class Cache {
108
108
  }
109
109
 
110
110
  /**
111
- * TBD.
112
- * @param {string} key - TBD.
113
- * @param {string} url - TBD.
114
- * @param {HTMLCanvasElement} data - TBD.
115
- * @param {object} atlasData - TBD.
111
+ * Adds a texture atlas to the cache.
112
+ * @param {string} key - The unique key for this cache entry.
113
+ * @param {string} url - The URL the atlas was loaded from.
114
+ * @param {HTMLCanvasElement} data - The canvas data for the atlas.
115
+ * @param {object} atlasData - The atlas data to cache.
116
116
  */
117
117
  addTextureAtlas(key, url, data, atlasData) {
118
118
  const obj = {
@@ -127,10 +127,10 @@ export class Cache {
127
127
  }
128
128
 
129
129
  /**
130
- * TBD.
131
- * @param {string} key - TBD.
132
- * @param {string} url - TBD.
133
- * @param {object} data - TBD.
130
+ * Adds sound data to the cache.
131
+ * @param {string} key - The unique key for this cache entry.
132
+ * @param {string} url - The URL the sound was loaded from.
133
+ * @param {object} data - The sound data to cache.
134
134
  */
135
135
  addSound(key, url, data) {
136
136
  this._cache.sound[key] = {
@@ -143,10 +143,10 @@ export class Cache {
143
143
  }
144
144
 
145
145
  /**
146
- * TBD.
147
- * @param {string} key - TBD.
148
- * @param {string} url - TBD.
149
- * @param {string} data - TBD.
146
+ * Adds text data to the cache.
147
+ * @param {string} key - The unique key for this cache entry.
148
+ * @param {string} url - The URL the text was loaded from.
149
+ * @param {string} data - The text data to cache.
150
150
  */
151
151
  addText(key, url, data) {
152
152
  this._cache.text[key] = { url, data };
@@ -154,14 +154,14 @@ export class Cache {
154
154
  }
155
155
 
156
156
  /**
157
- * TBD.
158
- * @param {string} key - TBD.
159
- * @param {string} url - TBD.
160
- * @param {HTMLCanvasElement} data - TBD.
161
- * @param {object} atlasData - TBD.
162
- * @param {string} atlasType - TBD.
163
- * @param {number} xSpacing - TBD.
164
- * @param {number} ySpacing - TBD.
157
+ * Adds a bitmap font to the cache.
158
+ * @param {string} key - The unique key for this cache entry.
159
+ * @param {string} url - The URL the bitmap font was loaded from.
160
+ * @param {HTMLCanvasElement} data - The canvas data for the font.
161
+ * @param {object} atlasData - The bitmap font atlas data to cache.
162
+ * @param {string} atlasType - The type of the atlas data ('json' or 'xml').
163
+ * @param {number} xSpacing - Horizontal spacing between characters.
164
+ * @param {number} ySpacing - Vertical spacing between characters.
165
165
  */
166
166
  addBitmapFont(key, url, data, atlasData, atlasType, xSpacing = 0, ySpacing = 0) {
167
167
  const obj = {
@@ -180,10 +180,10 @@ export class Cache {
180
180
  }
181
181
 
182
182
  /**
183
- * TBD.
184
- * @param {string} key - TBD.
185
- * @param {string} url - TBD.
186
- * @param {object} data - TBD.
183
+ * Adds JSON data to the cache.
184
+ * @param {string} key - The unique key for this cache entry.
185
+ * @param {string} url - The URL the JSON was loaded from.
186
+ * @param {object} data - The JSON data to cache.
187
187
  */
188
188
  addJSON(key, url, data) {
189
189
  this._cache.json[key] = { url, data };
@@ -191,10 +191,10 @@ export class Cache {
191
191
  }
192
192
 
193
193
  /**
194
- * TBD.
195
- * @param {string} key - TBD.
196
- * @param {string} url - TBD.
197
- * @param {XMLDocument} data - TBD.
194
+ * Adds XML data to the cache.
195
+ * @param {string} key - The unique key for this cache entry.
196
+ * @param {string} url - The URL the XML was loaded from.
197
+ * @param {XMLDocument} data - The XML data to cache.
198
198
  */
199
199
  addXML(key, url, data) {
200
200
  this._cache.xml[key] = { url, data };
@@ -204,10 +204,10 @@ export class Cache {
204
204
  // SOUND
205
205
 
206
206
  /**
207
- * TBD.
208
- * @param {string} key - TBD.
209
- * @param {string} property - TBD.
210
- * @param {any} value - TBD.
207
+ * Updates a sound property in the cache.
208
+ * @param {string} key - The unique key for the cached sound.
209
+ * @param {string} property - The property to update.
210
+ * @param {any} value - The new value for the property.
211
211
  */
212
212
  updateSound(key, property, value) {
213
213
  const sound = this.getSound(key);
@@ -217,9 +217,9 @@ export class Cache {
217
217
  }
218
218
 
219
219
  /**
220
- * TBD.
221
- * @param {string} key - TBD.
222
- * @param {AudioBuffer} data - TBD.
220
+ * Marks a sound as decoded in the cache.
221
+ * @param {string} key - The unique key for the cached sound.
222
+ * @param {AudioBuffer} data - The decoded audio buffer.
223
223
  */
224
224
  decodedSound(key, data) {
225
225
  const sound = this.getSound(key);
@@ -229,9 +229,9 @@ export class Cache {
229
229
  }
230
230
 
231
231
  /**
232
- * TBD.
233
- * @param {string} key - TBD.
234
- * @returns {boolean} TBD.
232
+ * Checks if a sound has been decoded in the cache.
233
+ * @param {string} key - The unique key for the cached sound.
234
+ * @returns {boolean} True if the sound is decoded, false otherwise.
235
235
  */
236
236
  isSoundDecoded(key) {
237
237
  const sound = this.getItem(key, SOUND, 'isSoundDecoded');
@@ -242,9 +242,9 @@ export class Cache {
242
242
  }
243
243
 
244
244
  /**
245
- * TBD.
246
- * @param {string} key - TBD.
247
- * @returns {boolean} TBD.
245
+ * Checks if a sound is ready to play (decoded and not locked).
246
+ * @param {string} key - The unique key for the cached sound.
247
+ * @returns {boolean} True if the sound is ready, false otherwise.
248
248
  */
249
249
  isSoundReady(key) {
250
250
  const sound = this.getItem(key, SOUND, 'isSoundDecoded');
@@ -257,10 +257,10 @@ export class Cache {
257
257
  // CHECK
258
258
 
259
259
  /**
260
- * TBD.
261
- * @param {number} cache - TBD.
262
- * @param {string} key - TBD.
263
- * @returns {boolean} TBD.
260
+ * Checks if a cache entry exists.
261
+ * @param {number} cache - The cache type (CANVAS, IMAGE, etc.).
262
+ * @param {string} key - The unique key for the cache entry.
263
+ * @returns {boolean} True if the entry exists, false otherwise.
264
264
  */
265
265
  checkKey(cache, key) {
266
266
  if (this._cacheMap[cache][key]) {
@@ -270,9 +270,9 @@ export class Cache {
270
270
  }
271
271
 
272
272
  /**
273
- * TBD.
274
- * @param {string} url - TBD.
275
- * @returns {boolean} TBD.
273
+ * Checks if a URL has been resolved and cached.
274
+ * @param {string} url - The URL to check.
275
+ * @returns {boolean} True if the URL has been resolved and cached, false otherwise.
276
276
  */
277
277
  checkURL(url) {
278
278
  if (this._urlMap[this._resolveURL(url)]) {
@@ -282,81 +282,81 @@ export class Cache {
282
282
  }
283
283
 
284
284
  /**
285
- * TBD.
286
- * @param {string} key - TBD.
287
- * @returns {boolean} TBD.
285
+ * Checks if a canvas cache entry exists.
286
+ * @param {string} key - The unique key for the cache entry.
287
+ * @returns {boolean} True if the entry exists, false otherwise.
288
288
  */
289
289
  checkCanvasKey(key) {
290
290
  return this.checkKey(CANVAS, key);
291
291
  }
292
292
 
293
293
  /**
294
- * TBD.
295
- * @param {string} key - TBD.
296
- * @returns {boolean} TBD.
294
+ * Checks if an image cache entry exists.
295
+ * @param {string} key - The unique key for the cache entry.
296
+ * @returns {boolean} True if the entry exists, false otherwise.
297
297
  */
298
298
  checkImageKey(key) {
299
299
  return this.checkKey(IMAGE, key);
300
300
  }
301
301
 
302
302
  /**
303
- * TBD.
304
- * @param {string} key - TBD.
305
- * @returns {boolean} TBD.
303
+ * Checks if a texture cache entry exists.
304
+ * @param {string} key - The unique key for the cache entry.
305
+ * @returns {boolean} True if the entry exists, false otherwise.
306
306
  */
307
307
  checkTextureKey(key) {
308
308
  return this.checkKey(TEXTURE, key);
309
309
  }
310
310
 
311
311
  /**
312
- * TBD.
313
- * @param {string} key - TBD.
314
- * @returns {boolean} TBD.
312
+ * Checks if a sound cache entry exists.
313
+ * @param {string} key - The unique key for the cache entry.
314
+ * @returns {boolean} True if the entry exists, false otherwise.
315
315
  */
316
316
  checkSoundKey(key) {
317
317
  return this.checkKey(SOUND, key);
318
318
  }
319
319
 
320
320
  /**
321
- * TBD.
322
- * @param {string} key - TBD.
323
- * @returns {boolean} TBD.
321
+ * Checks if a text cache entry exists.
322
+ * @param {string} key - The unique key for the cache entry.
323
+ * @returns {boolean} True if the entry exists, false otherwise.
324
324
  */
325
325
  checkTextKey(key) {
326
326
  return this.checkKey(TEXT, key);
327
327
  }
328
328
 
329
329
  /**
330
- * TBD.
331
- * @param {string} key - TBD.
332
- * @returns {boolean} TBD.
330
+ * Checks if a bitmap data cache entry exists.
331
+ * @param {string} key - The unique key for the cache entry.
332
+ * @returns {boolean} True if the entry exists, false otherwise.
333
333
  */
334
334
  checkBitmapDataKey(key) {
335
335
  return this.checkKey(BITMAPDATA, key);
336
336
  }
337
337
 
338
338
  /**
339
- * TBD.
340
- * @param {string} key - TBD.
341
- * @returns {boolean} TBD.
339
+ * Checks if a bitmap font cache entry exists.
340
+ * @param {string} key - The unique key for the cache entry.
341
+ * @returns {boolean} True if the entry exists, false otherwise.
342
342
  */
343
343
  checkBitmapFontKey(key) {
344
344
  return this.checkKey(BITMAPFONT, key);
345
345
  }
346
346
 
347
347
  /**
348
- * TBD.
349
- * @param {string} key - TBD.
350
- * @returns {boolean} TBD.
348
+ * Checks if a JSON cache entry exists.
349
+ * @param {string} key - The unique key for the cache entry.
350
+ * @returns {boolean} True if the entry exists, false otherwise.
351
351
  */
352
352
  checkJSONKey(key) {
353
353
  return this.checkKey(JSONDATA, key);
354
354
  }
355
355
 
356
356
  /**
357
- * TBD.
358
- * @param {string} key - TBD.
359
- * @returns {boolean} TBD.
357
+ * Checks if an XML cache entry exists.
358
+ * @param {string} key - The unique key for the cache entry.
359
+ * @returns {boolean} True if the entry exists, false otherwise.
360
360
  */
361
361
  checkXMLKey(key) {
362
362
  return this.checkKey(XML, key);
@@ -494,30 +494,30 @@ export class Cache {
494
494
  // FRAME
495
495
 
496
496
  /**
497
- * TBD.
498
- * @param {string} key - TBD.
499
- * @param {number} cache - TBD.
500
- * @returns {BaseTexture} TBD.
497
+ * Gets the base texture of a cache entry.
498
+ * @param {string} key - The unique key for the cache entry.
499
+ * @param {number} cache - The cache type (CANVAS, IMAGE, etc.).
500
+ * @returns {BaseTexture} The base texture.
501
501
  */
502
502
  getBaseTexture(key, cache = IMAGE) {
503
503
  return this.getItem(key, cache, 'getBaseTexture', 'base');
504
504
  }
505
505
 
506
506
  /**
507
- * TBD.
508
- * @param {string} key - TBD.
509
- * @param {number} cache - TBD.
510
- * @returns {Frame} TBD.
507
+ * Gets a frame from the cache.
508
+ * @param {string} key - The unique key for the cache entry.
509
+ * @param {number} cache - The cache type (CANVAS, IMAGE, etc.).
510
+ * @returns {Frame} The frame.
511
511
  */
512
512
  getFrame(key, cache = IMAGE) {
513
513
  return this.getItem(key, cache, 'getFrame', 'frame');
514
514
  }
515
515
 
516
516
  /**
517
- * TBD.
518
- * @param {string} key - TBD.
519
- * @param {number} cache - TBD.
520
- * @returns {number} TBD.
517
+ * Gets the frame count of a cache entry.
518
+ * @param {string} key - The unique key for the cache entry.
519
+ * @param {number} cache - The cache type (CANVAS, IMAGE, etc.).
520
+ * @returns {number} The number of frames.
521
521
  */
522
522
  getFrameCount(key, cache = IMAGE) {
523
523
  const data = this.getFrameData(key, cache);
@@ -528,30 +528,30 @@ export class Cache {
528
528
  }
529
529
 
530
530
  /**
531
- * TBD.
532
- * @param {string} key - TBD.
533
- * @param {number} cache - TBD.
534
- * @returns {FrameData} TBD.
531
+ * Gets the frame data of a cache entry.
532
+ * @param {string} key - The unique key for the cache entry.
533
+ * @param {number} cache - The cache type (CANVAS, IMAGE, etc.).
534
+ * @returns {FrameData} The frame data.
535
535
  */
536
536
  getFrameData(key, cache = IMAGE) {
537
537
  return this.getItem(key, cache, 'getFrameData', 'frameData');
538
538
  }
539
539
 
540
540
  /**
541
- * TBD.
542
- * @param {string} key - TBD.
543
- * @param {number} cache - TBD.
544
- * @returns {boolean} TBD.
541
+ * Checks if a cache entry has frame data.
542
+ * @param {string} key - The unique key for the cache entry.
543
+ * @param {number} cache - The cache type (CANVAS, IMAGE, etc.).
544
+ * @returns {boolean} True if the entry has frame data, false otherwise.
545
545
  */
546
546
  hasFrameData(key, cache = IMAGE) {
547
547
  return this.getItem(key, cache, '', 'frameData') !== null;
548
548
  }
549
549
 
550
550
  /**
551
- * TBD.
552
- * @param {string} key - TBD.
553
- * @param {FrameData} frameData - TBD.
554
- * @param {number} cache - TBD.
551
+ * Updates the frame data of a cache entry.
552
+ * @param {string} key - The unique key for the cache entry.
553
+ * @param {FrameData} frameData - The new frame data.
554
+ * @param {number} cache - The cache type (CANVAS, IMAGE, etc.).
555
555
  */
556
556
  updateFrameData(key, frameData, cache = IMAGE) {
557
557
  if (this._cacheMap[cache][key]) {
@@ -560,11 +560,11 @@ export class Cache {
560
560
  }
561
561
 
562
562
  /**
563
- * TBD.
564
- * @param {string} key - TBD.
565
- * @param {number} index - TBD.
566
- * @param {number} cache - TBD.
567
- * @returns {Frame} TBD.
563
+ * Gets a frame by index from the cache.
564
+ * @param {string} key - The unique key for the cache entry.
565
+ * @param {number} index - The index of the frame to get.
566
+ * @param {number} cache - The cache type (CANVAS, IMAGE, etc.).
567
+ * @returns {Frame} The frame at the specified index.
568
568
  */
569
569
  getFrameByIndex(key, index, cache = IMAGE) {
570
570
  const data = this.getFrameData(key, cache);
@@ -575,11 +575,11 @@ export class Cache {
575
575
  }
576
576
 
577
577
  /**
578
- * TBD.
579
- * @param {string} key - TBD.
580
- * @param {string} name - TBD.
581
- * @param {number} cache - TBD.
582
- * @returns {Frame} TBD.
578
+ * Gets a frame by name from the cache.
579
+ * @param {string} key - The unique key for the cache entry.
580
+ * @param {string} name - The name of the frame to get.
581
+ * @param {number} cache - The cache type (CANVAS, IMAGE, etc.).
582
+ * @returns {Frame} The frame with the specified name.
583
583
  */
584
584
  getFrameByName(key, name, cache = IMAGE) {
585
585
  const data = this.getFrameData(key, cache);
@@ -590,9 +590,9 @@ export class Cache {
590
590
  }
591
591
 
592
592
  /**
593
- * TBD.
594
- * @param {string} url - TBD.
595
- * @returns {string} TBD.
593
+ * Gets the resolved URL from cache.
594
+ * @param {string} url - The original URL to resolve.
595
+ * @returns {string} The resolved URL or null if not found.
596
596
  */
597
597
  getURL(url) {
598
598
  const resolvedURL = this._resolveURL(url);
@@ -604,9 +604,9 @@ export class Cache {
604
604
  }
605
605
 
606
606
  /**
607
- * TBD.
608
- * @param {object} cache - TBD.
609
- * @returns {string[]} TBD.
607
+ * Gets all keys from a cache type.
608
+ * @param {object} cache - The cache type (CANVAS, IMAGE, etc.).
609
+ * @returns {string[]} An array of cache keys.
610
610
  */
611
611
  getKeys(cache = IMAGE) {
612
612
  const result = [];
@@ -625,17 +625,17 @@ export class Cache {
625
625
  // REMOVE
626
626
 
627
627
  /**
628
- * TBD.
629
- * @param {string} key - TBD.
628
+ * Removes a canvas cache entry.
629
+ * @param {string} key - The unique key for the cache entry to remove.
630
630
  */
631
631
  removeCanvas(key) {
632
632
  delete this._cache.canvas[key];
633
633
  }
634
634
 
635
635
  /**
636
- * TBD.
637
- * @param {string} key - TBD.
638
- * @param {boolean} destroyBaseTexture - TBD.
636
+ * Removes an image cache entry.
637
+ * @param {string} key - The unique key for the cache entry to remove.
638
+ * @param {boolean} destroyBaseTexture - Whether to destroy the base texture (default: true).
639
639
  */
640
640
  removeImage(key, destroyBaseTexture = true) {
641
641
  const img = this.getImage(key, true);
@@ -646,79 +646,79 @@ export class Cache {
646
646
  }
647
647
 
648
648
  /**
649
- * TBD.
650
- * @param {string} key - TBD.
649
+ * Removes a sound cache entry.
650
+ * @param {string} key - The unique key for the cache entry to remove.
651
651
  */
652
652
  removeSound(key) {
653
653
  delete this._cache.sound[key];
654
654
  }
655
655
 
656
656
  /**
657
- * TBD.
658
- * @param {string} key - TBD.
657
+ * Removes a text cache entry.
658
+ * @param {string} key - The unique key for the cache entry to remove.
659
659
  */
660
660
  removeText(key) {
661
661
  delete this._cache.text[key];
662
662
  }
663
663
 
664
664
  /**
665
- * TBD.
666
- * @param {string} key - TBD.
665
+ * Removes a bitmap data cache entry.
666
+ * @param {string} key - The unique key for the cache entry to remove.
667
667
  */
668
668
  removeBitmapData(key) {
669
669
  delete this._cache.bitmapData[key];
670
670
  }
671
671
 
672
672
  /**
673
- * TBD.
674
- * @param {string} key - TBD.
673
+ * Removes a bitmap font cache entry.
674
+ * @param {string} key - The unique key for the cache entry to remove.
675
675
  */
676
676
  removeBitmapFont(key) {
677
677
  delete this._cache.bitmapFont[key];
678
678
  }
679
679
 
680
680
  /**
681
- * TBD.
682
- * @param {string} key - TBD.
681
+ * Removes a JSON cache entry.
682
+ * @param {string} key - The unique key for the cache entry to remove.
683
683
  */
684
684
  removeJSON(key) {
685
685
  delete this._cache.json[key];
686
686
  }
687
687
 
688
688
  /**
689
- * TBD.
690
- * @param {string} key - TBD.
689
+ * Removes an XML cache entry.
690
+ * @param {string} key - The unique key for the cache entry to remove.
691
691
  */
692
692
  removeXML(key) {
693
693
  delete this._cache.xml[key];
694
694
  }
695
695
 
696
696
  /**
697
- * TBD.
698
- * @param {string} key - TBD.
697
+ * Removes a render texture cache entry.
698
+ * @param {string} key - The unique key for the cache entry to remove.
699
699
  */
700
700
  removeRenderTexture(key) {
701
701
  delete this._cache.renderTexture[key];
702
702
  }
703
703
 
704
704
  /**
705
- * TBD.
706
- * @param {string} key - TBD.
705
+ * Removes a sprite sheet cache entry.
706
+ * @param {string} key - The unique key for the cache entry to remove.
707
707
  */
708
708
  removeSpriteSheet(key) {
709
709
  delete this._cache.spriteSheet[key];
710
710
  }
711
711
 
712
712
  /**
713
- * TBD.
714
- * @param {string} key - TBD.
713
+ * Removes a texture atlas cache entry.
714
+ * @param {string} key - The unique key for the cache entry to remove.
715
715
  */
716
716
  removeTextureAtlas(key) {
717
717
  delete this._cache.atlas[key];
718
718
  }
719
719
 
720
720
  /**
721
- * TBD.
721
+ * Clears all GL textures from the cache.
722
722
  */
723
723
  clearGLTextures() {
724
724
  const keys = Object.keys(this._cache.image);
@@ -729,10 +729,10 @@ export class Cache {
729
729
  }
730
730
 
731
731
  /**
732
- * TBD.
733
- * @param {string} url - TBD.
734
- * @param {object} data - TBD.
735
- * @returns {string} TBD.
732
+ * Resolves a URL and stores it in the cache.
733
+ * @param {string} url - The URL to resolve.
734
+ * @param {object} data - The data to associate with the resolved URL.
735
+ * @returns {string} The resolved URL or null if not enabled.
736
736
  */
737
737
  _resolveURL(url, data) {
738
738
  if (!this.autoResolveURL) {
@@ -750,7 +750,7 @@ export class Cache {
750
750
  }
751
751
 
752
752
  /**
753
- * TBD.
753
+ * Destroys the cache and cleans up resources.
754
754
  */
755
755
  destroy() {
756
756
  for (let i = 0; i < this._cacheMap.length; i += 1) {
@@ -1,6 +1,7 @@
1
1
  export class Device {
2
2
  /**
3
- * TBD.
3
+ * Creates a new Device instance.
4
+ * This class provides information about the current device and browser capabilities.
4
5
  */
5
6
  constructor() {
6
7
  /**