@vpmedia/phaser 1.115.0 → 1.117.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 (193) hide show
  1. package/dist/index.js +56 -96
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation.d.ts.map +1 -1
  4. package/dist/phaser/core/animation_manager.d.ts +15 -14
  5. package/dist/phaser/core/animation_manager.d.ts.map +1 -1
  6. package/dist/phaser/core/animation_parser.d.ts.map +1 -1
  7. package/dist/phaser/core/array_set.d.ts.map +1 -1
  8. package/dist/phaser/core/cache.d.ts +10 -9
  9. package/dist/phaser/core/cache.d.ts.map +1 -1
  10. package/dist/phaser/core/device_util.d.ts.map +1 -1
  11. package/dist/phaser/core/dom.d.ts.map +1 -1
  12. package/dist/phaser/core/factory.d.ts.map +1 -1
  13. package/dist/phaser/core/game.d.ts.map +1 -1
  14. package/dist/phaser/core/input.d.ts +20 -20
  15. package/dist/phaser/core/input.d.ts.map +1 -1
  16. package/dist/phaser/core/input_handler.d.ts +11 -13
  17. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  18. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  19. package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
  20. package/dist/phaser/core/input_pointer.d.ts +19 -8
  21. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  22. package/dist/phaser/core/input_touch.d.ts.map +1 -1
  23. package/dist/phaser/core/loader.d.ts.map +1 -1
  24. package/dist/phaser/core/raf.d.ts.map +1 -1
  25. package/dist/phaser/core/scale_manager.d.ts +38 -13
  26. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  27. package/dist/phaser/core/scene.d.ts.map +1 -1
  28. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  29. package/dist/phaser/core/signal.d.ts.map +1 -1
  30. package/dist/phaser/core/signal_binding.d.ts.map +1 -1
  31. package/dist/phaser/core/sound.d.ts +2 -2
  32. package/dist/phaser/core/sound.d.ts.map +1 -1
  33. package/dist/phaser/core/sound_manager.d.ts +24 -22
  34. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  35. package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
  36. package/dist/phaser/core/stage.d.ts.map +1 -1
  37. package/dist/phaser/core/time.d.ts.map +1 -1
  38. package/dist/phaser/core/timer.d.ts +1 -1
  39. package/dist/phaser/core/timer.d.ts.map +1 -1
  40. package/dist/phaser/core/tween.d.ts.map +1 -1
  41. package/dist/phaser/core/tween_data.d.ts +26 -26
  42. package/dist/phaser/core/tween_data.d.ts.map +1 -1
  43. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  44. package/dist/phaser/core/world.d.ts.map +1 -1
  45. package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
  46. package/dist/phaser/display/button.d.ts.map +1 -1
  47. package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
  48. package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
  49. package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
  50. package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
  51. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  52. package/dist/phaser/display/canvas/tinter.d.ts +3 -2
  53. package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
  54. package/dist/phaser/display/canvas/util.d.ts.map +1 -1
  55. package/dist/phaser/display/display_object.d.ts.map +1 -1
  56. package/dist/phaser/display/graphics.d.ts.map +1 -1
  57. package/dist/phaser/display/graphics_data.d.ts.map +1 -1
  58. package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
  59. package/dist/phaser/display/group.d.ts.map +1 -1
  60. package/dist/phaser/display/image.d.ts +2 -2
  61. package/dist/phaser/display/image.d.ts.map +1 -1
  62. package/dist/phaser/display/sprite_util.d.ts.map +1 -1
  63. package/dist/phaser/display/text.d.ts.map +1 -1
  64. package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  65. package/dist/phaser/display/webgl/base_texture.d.ts +12 -10
  66. package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
  67. package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  68. package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
  69. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +13 -12
  70. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  71. package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  72. package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  73. package/dist/phaser/display/webgl/graphics.d.ts +9 -7
  74. package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
  75. package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  76. package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  77. package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
  78. package/dist/phaser/display/webgl/renderer.d.ts +12 -10
  79. package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
  80. package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  81. package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  82. package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  83. package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  84. package/dist/phaser/display/webgl/texture.d.ts +18 -33
  85. package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
  86. package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
  87. package/dist/phaser/display/webgl/util.d.ts.map +1 -1
  88. package/dist/phaser/geom/circle.d.ts.map +1 -1
  89. package/dist/phaser/geom/ellipse.d.ts.map +1 -1
  90. package/dist/phaser/geom/line.d.ts.map +1 -1
  91. package/dist/phaser/geom/matrix.d.ts +1 -1
  92. package/dist/phaser/geom/matrix.d.ts.map +1 -1
  93. package/dist/phaser/geom/point.d.ts.map +1 -1
  94. package/dist/phaser/geom/polygon.d.ts.map +1 -1
  95. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  96. package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  97. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  98. package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
  99. package/dist/phaser/geom/util/line.d.ts +5 -4
  100. package/dist/phaser/geom/util/line.d.ts.map +1 -1
  101. package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
  102. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  103. package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
  104. package/dist/phaser/geom/util/rectangle.d.ts +10 -1
  105. package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
  106. package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  107. package/package.json +1 -1
  108. package/src/phaser/core/animation.ts +20 -20
  109. package/src/phaser/core/animation_manager.ts +27 -24
  110. package/src/phaser/core/animation_parser.ts +2 -2
  111. package/src/phaser/core/array_set.ts +7 -7
  112. package/src/phaser/core/cache.ts +55 -51
  113. package/src/phaser/core/callback_context.test.ts +70 -0
  114. package/src/phaser/core/device_util.ts +13 -13
  115. package/src/phaser/core/dom.ts +26 -22
  116. package/src/phaser/core/factory.ts +6 -6
  117. package/src/phaser/core/game.ts +10 -10
  118. package/src/phaser/core/input.ts +37 -39
  119. package/src/phaser/core/input_handler.ts +90 -93
  120. package/src/phaser/core/input_mouse.ts +19 -19
  121. package/src/phaser/core/input_mspointer.ts +15 -15
  122. package/src/phaser/core/input_pointer.ts +37 -28
  123. package/src/phaser/core/input_touch.ts +17 -17
  124. package/src/phaser/core/loader.ts +52 -52
  125. package/src/phaser/core/loader_parser.ts +3 -3
  126. package/src/phaser/core/raf.ts +3 -3
  127. package/src/phaser/core/scale_manager.ts +86 -67
  128. package/src/phaser/core/scene.ts +7 -7
  129. package/src/phaser/core/scene_manager.ts +16 -16
  130. package/src/phaser/core/signal.ts +29 -19
  131. package/src/phaser/core/signal_binding.ts +4 -4
  132. package/src/phaser/core/sound.ts +17 -17
  133. package/src/phaser/core/sound_manager.ts +71 -72
  134. package/src/phaser/core/sound_sprite.ts +1 -1
  135. package/src/phaser/core/stage.ts +7 -7
  136. package/src/phaser/core/time.ts +16 -16
  137. package/src/phaser/core/timer.ts +36 -26
  138. package/src/phaser/core/tween.ts +23 -23
  139. package/src/phaser/core/tween_data.ts +41 -37
  140. package/src/phaser/core/tween_manager.ts +11 -11
  141. package/src/phaser/core/world.ts +1 -1
  142. package/src/phaser/display/bitmap_text.ts +13 -13
  143. package/src/phaser/display/button.ts +13 -13
  144. package/src/phaser/display/canvas/buffer.ts +3 -3
  145. package/src/phaser/display/canvas/graphics.ts +3 -3
  146. package/src/phaser/display/canvas/masker.ts +2 -2
  147. package/src/phaser/display/canvas/pool.ts +6 -6
  148. package/src/phaser/display/canvas/renderer.ts +6 -6
  149. package/src/phaser/display/canvas/tinter.ts +39 -8
  150. package/src/phaser/display/canvas/util.ts +15 -9
  151. package/src/phaser/display/display_object.ts +38 -38
  152. package/src/phaser/display/graphics.ts +30 -30
  153. package/src/phaser/display/graphics_data.ts +1 -1
  154. package/src/phaser/display/graphics_data_util.ts +1 -1
  155. package/src/phaser/display/group.ts +16 -16
  156. package/src/phaser/display/image.ts +30 -26
  157. package/src/phaser/display/sprite_util.ts +12 -4
  158. package/src/phaser/display/text.ts +55 -55
  159. package/src/phaser/display/webgl/abstract_filter.ts +1 -1
  160. package/src/phaser/display/webgl/base_texture.ts +22 -18
  161. package/src/phaser/display/webgl/blend_manager.ts +3 -3
  162. package/src/phaser/display/webgl/earcut.ts +3 -3
  163. package/src/phaser/display/webgl/fast_sprite_batch.ts +26 -24
  164. package/src/phaser/display/webgl/filter_manager.ts +7 -7
  165. package/src/phaser/display/webgl/filter_texture.ts +3 -3
  166. package/src/phaser/display/webgl/graphics.ts +43 -41
  167. package/src/phaser/display/webgl/graphics_data.ts +2 -2
  168. package/src/phaser/display/webgl/mask_manager.ts +2 -2
  169. package/src/phaser/display/webgl/render_texture.ts +6 -6
  170. package/src/phaser/display/webgl/renderer.ts +20 -25
  171. package/src/phaser/display/webgl/shader/normal.ts +3 -3
  172. package/src/phaser/display/webgl/shader_manager.ts +2 -2
  173. package/src/phaser/display/webgl/sprite_batch.ts +9 -9
  174. package/src/phaser/display/webgl/stencil_manager.ts +4 -4
  175. package/src/phaser/display/webgl/texture.ts +23 -42
  176. package/src/phaser/display/webgl/texture_util.ts +2 -2
  177. package/src/phaser/display/webgl/util.ts +11 -7
  178. package/src/phaser/geom/circle.ts +21 -21
  179. package/src/phaser/geom/ellipse.ts +7 -7
  180. package/src/phaser/geom/line.ts +29 -29
  181. package/src/phaser/geom/matrix.ts +13 -13
  182. package/src/phaser/geom/point.ts +36 -30
  183. package/src/phaser/geom/polygon.ts +6 -6
  184. package/src/phaser/geom/rectangle.ts +42 -42
  185. package/src/phaser/geom/rounded_rectangle.ts +2 -2
  186. package/src/phaser/geom/util/circle.ts +7 -7
  187. package/src/phaser/geom/util/ellipse.ts +1 -1
  188. package/src/phaser/geom/util/line.ts +13 -5
  189. package/src/phaser/geom/util/matrix.ts +3 -3
  190. package/src/phaser/geom/util/point.ts +20 -20
  191. package/src/phaser/geom/util/polygon.ts +1 -1
  192. package/src/phaser/geom/util/rectangle.ts +34 -17
  193. package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
@@ -124,7 +124,7 @@ export class Loader {
124
124
  * @param {Image} sprite - The image to use as the preload sprite.
125
125
  * @param {number} direction - The direction of the progress (0 = horizontal, 1 = vertical).
126
126
  */
127
- public setPreloadSprite(sprite: Image, direction = 0) {
127
+ public setPreloadSprite(sprite: Image, direction = 0): void {
128
128
  this.preloadSprite = {
129
129
  sprite,
130
130
  direction,
@@ -146,7 +146,7 @@ export class Loader {
146
146
  /**
147
147
  * Resizes the preload sprite when the window is resized.
148
148
  */
149
- public resize() {
149
+ public resize(): void {
150
150
  if (this.preloadSprite && this.preloadSprite.height !== this.preloadSprite.sprite.height) {
151
151
  this.preloadSprite.rect.height = this.preloadSprite.sprite.height;
152
152
  }
@@ -158,7 +158,7 @@ export class Loader {
158
158
  * @param {string} key - The key of the file to check for.
159
159
  * @returns {boolean} True if the file exists, false otherwise.
160
160
  */
161
- public checkKeyExists(type: string, key: string) {
161
+ public checkKeyExists(type: string, key: string): boolean {
162
162
  return this.getAssetIndex(type, key) > -1;
163
163
  }
164
164
 
@@ -168,7 +168,7 @@ export class Loader {
168
168
  * @param {string} key - The key of the file to find.
169
169
  * @returns {number} The index of the file in the list, or -1 if not found.
170
170
  */
171
- public getAssetIndex(type: string, key: string) {
171
+ public getAssetIndex(type: string, key: string): number {
172
172
  let bestFound = -1;
173
173
  for (let i = 0; i < this._fileList.length; i += 1) {
174
174
  const file = this._fileList[i]!;
@@ -203,7 +203,7 @@ export class Loader {
203
203
  * @param {boolean} hard - Whether to perform a hard reset (clears preload sprite).
204
204
  * @param {boolean} clearEvents - Whether to clear event listeners.
205
205
  */
206
- public reset(hard = false, clearEvents = false) {
206
+ public reset(hard = false, clearEvents = false): void {
207
207
  if (hard) {
208
208
  this.preloadSprite = null;
209
209
  }
@@ -243,7 +243,7 @@ export class Loader {
243
243
  properties: Partial<LoaderFile> | null = null,
244
244
  overwrite = false,
245
245
  extension: string | null = null
246
- ) {
246
+ ): this {
247
247
  if (key === undefined || key === '') {
248
248
  this.game.logger.warn(`Loader: Invalid or no key given of type ${type}`);
249
249
  return this;
@@ -292,7 +292,7 @@ export class Loader {
292
292
  * @param {object} properties - The new properties for the file.
293
293
  * @returns {Loader} This Loader instance for chaining.
294
294
  */
295
- public replaceInFileList(type: string, key: string, url: string, properties: Partial<LoaderFile>) {
295
+ public replaceInFileList(type: string, key: string, url: string, properties: Partial<LoaderFile>): this {
296
296
  return this.addToFileList(type, key, url, properties, true);
297
297
  }
298
298
 
@@ -304,7 +304,7 @@ export class Loader {
304
304
  * @param {object} callbackContext - The context in which to call the callback.
305
305
  * @returns {Loader} This Loader instance for chaining.
306
306
  */
307
- public pack(key: string, url: string, data: unknown, callbackContext: unknown) {
307
+ public pack(key: string, url: string, data: unknown, callbackContext: unknown): this {
308
308
  const pack = {
309
309
  type: 'packfile',
310
310
  key,
@@ -342,7 +342,7 @@ export class Loader {
342
342
  * @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
343
343
  * @returns {Loader} This Loader instance for chaining.
344
344
  */
345
- public image(key: string, url?: string, overwrite = false) {
345
+ public image(key: string, url?: string, overwrite = false): this {
346
346
  return this.addToFileList('image', key, url, undefined, overwrite, '.png');
347
347
  }
348
348
 
@@ -352,7 +352,7 @@ export class Loader {
352
352
  * @param {string[]} urls - The URLs of the image files to load.
353
353
  * @returns {Loader} This Loader instance for chaining.
354
354
  */
355
- public images(keys: string[], urls: string[]) {
355
+ public images(keys: string[], urls: string[]): this {
356
356
  if (Array.isArray(urls)) {
357
357
  for (let i = 0; i < keys.length; i += 1) {
358
358
  this.image(keys[i]!, urls[i]);
@@ -372,7 +372,7 @@ export class Loader {
372
372
  * @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
373
373
  * @returns {Loader} This Loader instance for chaining.
374
374
  */
375
- public text(key: string, url: string, overwrite = false) {
375
+ public text(key: string, url: string, overwrite = false): this {
376
376
  return this.addToFileList('text', key, url, undefined, overwrite, '.txt');
377
377
  }
378
378
 
@@ -383,7 +383,7 @@ export class Loader {
383
383
  * @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
384
384
  * @returns {Loader} This Loader instance for chaining.
385
385
  */
386
- public json(key: string, url: string, overwrite = false) {
386
+ public json(key: string, url: string, overwrite = false): this {
387
387
  return this.addToFileList('json', key, url, undefined, overwrite, '.json');
388
388
  }
389
389
 
@@ -394,7 +394,7 @@ export class Loader {
394
394
  * @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
395
395
  * @returns {Loader} This Loader instance for chaining.
396
396
  */
397
- public xml(key: string, url: string, overwrite = false) {
397
+ public xml(key: string, url: string, overwrite = false): this {
398
398
  return this.addToFileList('xml', key, url, undefined, overwrite, '.xml');
399
399
  }
400
400
 
@@ -417,7 +417,7 @@ export class Loader {
417
417
  frameMax = -1,
418
418
  margin = 0,
419
419
  spacing = 0
420
- ) {
420
+ ): this {
421
421
  return this.addToFileList(
422
422
  'spritesheet',
423
423
  key,
@@ -435,7 +435,7 @@ export class Loader {
435
435
  * @param {boolean} autoDecode - Whether to automatically decode the audio file.
436
436
  * @returns {Loader} This Loader instance for chaining.
437
437
  */
438
- public audio(key: string, urls: string | string[], autoDecode = true) {
438
+ public audio(key: string, urls: string | string[], autoDecode = true): this {
439
439
  if (this.game.sound.noAudio || this.game.device.noAudioFormat) {
440
440
  return this;
441
441
  }
@@ -454,7 +454,7 @@ export class Loader {
454
454
  * @param {boolean} autoDecode - Whether to automatically decode the audio file.
455
455
  * @returns {Loader} This Loader instance for chaining.
456
456
  */
457
- public audioSprite(key: string, urls: string, jsonURL: string, jsonData: unknown, autoDecode = true) {
457
+ public audioSprite(key: string, urls: string, jsonURL: string, jsonData: unknown, autoDecode = true): this {
458
458
  if (this.game.sound.noAudio || this.game.device.noAudioFormat) {
459
459
  return this;
460
460
  }
@@ -488,7 +488,7 @@ export class Loader {
488
488
  atlasData: unknown = null,
489
489
  xSpacing = 0,
490
490
  ySpacing = 0
491
- ) {
491
+ ): this {
492
492
  textureURL ??= `${key}.png`;
493
493
  if (atlasURL === null && atlasData === null) {
494
494
  atlasURL = `${key}.xml`;
@@ -534,7 +534,7 @@ export class Loader {
534
534
  atlasURL: string | null = null,
535
535
  atlasData: unknown = null,
536
536
  format: number = TEXTURE_ATLAS_JSON_HASH
537
- ) {
537
+ ): this {
538
538
  textureURL ??= `${key}.png`;
539
539
  if (!atlasURL && !atlasData) {
540
540
  atlasURL = `${key}.json`;
@@ -554,7 +554,7 @@ export class Loader {
554
554
  * @param {object} callbackContext - The context in which to call the callback.
555
555
  * @returns {Loader} This Loader instance for chaining.
556
556
  */
557
- public withSyncPoint(callback: Function, callbackContext: unknown) {
557
+ public withSyncPoint(callback: Function, callbackContext: unknown): this {
558
558
  this._withSyncPointDepth += 1;
559
559
  try {
560
560
  callback.call(callbackContext ?? this, this);
@@ -570,7 +570,7 @@ export class Loader {
570
570
  * @param {string} key - The key of the file to add a sync point to.
571
571
  * @returns {Loader} This Loader instance for chaining.
572
572
  */
573
- public addSyncPoint(type: string, key: string) {
573
+ public addSyncPoint(type: string, key: string): this {
574
574
  const asset = this.getAsset(type, key);
575
575
  if (asset) {
576
576
  asset.file.syncPoint = true;
@@ -583,7 +583,7 @@ export class Loader {
583
583
  * @param {string} type - The type of file to remove.
584
584
  * @param {string} key - The key of the file to remove.
585
585
  */
586
- public removeFile(type: string, key: string) {
586
+ public removeFile(type: string, key: string): void {
587
587
  const asset = this.getAsset(type, key);
588
588
  if (asset) {
589
589
  if (!asset.file.loaded && !asset.file.loading) {
@@ -595,7 +595,7 @@ export class Loader {
595
595
  /**
596
596
  * Removes all files from the file list.
597
597
  */
598
- public removeAll() {
598
+ public removeAll(): void {
599
599
  this._fileList.length = 0;
600
600
  this._flightQueue.length = 0;
601
601
  }
@@ -603,7 +603,7 @@ export class Loader {
603
603
  /**
604
604
  * Starts the loading process for all queued files.
605
605
  */
606
- public start() {
606
+ public start(): void {
607
607
  if (this.isLoading) {
608
608
  return;
609
609
  }
@@ -616,7 +616,7 @@ export class Loader {
616
616
  /**
617
617
  * Processes the loading queue, loading files as appropriate.
618
618
  */
619
- public processLoadQueue() {
619
+ public processLoadQueue(): void {
620
620
  if (!this.isLoading) {
621
621
  this.game.logger.warn('Active loading canceled / reset');
622
622
  this.finishedLoading(true);
@@ -705,7 +705,7 @@ export class Loader {
705
705
  // This indicates a critical internal error with no known recovery.
706
706
  this.game.logger.warn('Aborting: processing queue empty, loading may have stalled');
707
707
  const scope = this;
708
- setTimeout(() => {
708
+ setTimeout((): void => {
709
709
  scope.finishedLoading(true);
710
710
  }, 2000);
711
711
  }
@@ -715,7 +715,7 @@ export class Loader {
715
715
  * Finishes the loading process, optionally reporting an abnormal termination.
716
716
  * @param {boolean} abnormal - Whether the loading was terminated abnormally.
717
717
  */
718
- public finishedLoading(abnormal = false) {
718
+ public finishedLoading(abnormal = false): void {
719
719
  if (this.hasLoaded) {
720
720
  return;
721
721
  }
@@ -739,7 +739,7 @@ export class Loader {
739
739
  * @param {object} file - The file to complete or mark as failed.
740
740
  * @param {string} errorMessage - An error message if the file failed to load.
741
741
  */
742
- public asyncComplete(file: LoaderFile, errorMessage = '') {
742
+ public asyncComplete(file: LoaderFile, errorMessage = ''): void {
743
743
  file.loaded = true;
744
744
  file.error = Boolean(errorMessage);
745
745
  if (file.error) {
@@ -754,7 +754,7 @@ export class Loader {
754
754
  * Processes a pack file, adding its contained files to the loader.
755
755
  * @param {object} pack - The pack file object to process.
756
756
  */
757
- public processPack(pack: LoaderFile) {
757
+ public processPack(pack: LoaderFile): void {
758
758
  const packData = pack.data[pack.key];
759
759
  if (!packData) {
760
760
  this.game.logger.warn('Missing loader pack key', { key: pack.key });
@@ -845,7 +845,7 @@ export class Loader {
845
845
  * Loads a file using XMLHttpRequest, handling image files specially.
846
846
  * @param {object} file - The file object to load.
847
847
  */
848
- public loadFile(file: LoaderFile) {
848
+ public loadFile(file: LoaderFile): void {
849
849
  switch (file.type) {
850
850
  case 'packfile': {
851
851
  this.xhrLoad(file, this.transformUrl(file.url, file), 'text', this.fileComplete);
@@ -895,7 +895,7 @@ export class Loader {
895
895
  * Loads an image file using the Image DOM element.
896
896
  * @param {object} file - The file object to load.
897
897
  */
898
- public loadImageTag(file: LoaderFile) {
898
+ public loadImageTag(file: LoaderFile): void {
899
899
  this.log('loadImageTag', file);
900
900
  const scope = this;
901
901
  file.data = new globalThis.Image();
@@ -903,16 +903,16 @@ export class Loader {
903
903
  if (this.crossOrigin) {
904
904
  file.data.crossOrigin = this.crossOrigin;
905
905
  }
906
- file.data.onload = () => {
906
+ file.data.onload = (): void => {
907
907
  if (file.data.onload) {
908
908
  file.data.onload = null;
909
909
  file.data.onerror = null;
910
910
  scope.fileComplete(file);
911
911
  }
912
912
  };
913
- file.data.onerror = () => {
913
+ file.data.onerror = (): void => {
914
914
  if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
915
- setTimeout(() => {
915
+ setTimeout((): void => {
916
916
  file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
917
917
  scope.loadImageTag(file);
918
918
  }, 1000);
@@ -939,7 +939,7 @@ export class Loader {
939
939
  type: XMLHttpRequestResponseType,
940
940
  onload: Function,
941
941
  onerror: Function | null = null
942
- ) {
942
+ ): void {
943
943
  if (url === false) {
944
944
  this.fileError(file, null, 'Could not resolve the file URL');
945
945
  return;
@@ -963,7 +963,7 @@ export class Loader {
963
963
  if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) {
964
964
  // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
965
965
  if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
966
- setTimeout(() => {
966
+ setTimeout((): void => {
967
967
  file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
968
968
  scope.xhrLoad(file, url, type, onload, onerror);
969
969
  }, 1000);
@@ -986,7 +986,7 @@ export class Loader {
986
986
  };
987
987
  xhr.onerror = () => {
988
988
  if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
989
- setTimeout(() => {
989
+ setTimeout((): void => {
990
990
  file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
991
991
  scope.xhrLoad(file, url, type, onload, onerror);
992
992
  }, 1000);
@@ -1012,7 +1012,7 @@ export class Loader {
1012
1012
  /**
1013
1013
  * Placeholder for XDomainRequest loading (not implemented).
1014
1014
  */
1015
- public xhrLoadWithXDR() {
1015
+ public xhrLoadWithXDR(): void {
1016
1016
  // TODO
1017
1017
  this.game.logger.warn('loader.xhrLoadWithXDR() is not implemented');
1018
1018
  }
@@ -1022,7 +1022,7 @@ export class Loader {
1022
1022
  * @param {object[]} urls - The array of URLs to check for supported audio formats.
1023
1023
  * @returns {string} The first URL with a supported audio format, or null if none found.
1024
1024
  */
1025
- public getAudioURL(urls: string | AudioSource[]) {
1025
+ public getAudioURL(urls: string | AudioSource[]): string | null {
1026
1026
  if (this.game.sound.noAudio || this.game.device.noAudioFormat) {
1027
1027
  return null;
1028
1028
  }
@@ -1064,7 +1064,7 @@ export class Loader {
1064
1064
  * @param {XMLHttpRequest} xhr - The XMLHttpRequest object that failed.
1065
1065
  * @param {number | string} reason - The error code or message explaining the failure.
1066
1066
  */
1067
- public fileError(file: LoaderFile, xhr: XMLHttpRequest | null = null, reason: unknown = 0) {
1067
+ public fileError(file: LoaderFile, xhr: XMLHttpRequest | null = null, reason: unknown = 0): void {
1068
1068
  // const url = file.requestUrl || this.transformUrl(file.url, file);
1069
1069
  if (!reason && xhr) {
1070
1070
  reason = xhr.status;
@@ -1079,7 +1079,7 @@ export class Loader {
1079
1079
  * @param {XMLHttpRequest} xhr - TBD.
1080
1080
  * @throws {Error}
1081
1081
  */
1082
- public fileComplete(file: LoaderFile, xhr?: XMLHttpRequest) {
1082
+ public fileComplete(file: LoaderFile, xhr?: XMLHttpRequest): void {
1083
1083
  let loadNext = true;
1084
1084
  // By this point the audio candidate list has been resolved to a single URL.
1085
1085
  const url = typeof file.url === 'string' ? file.url : '';
@@ -1138,7 +1138,7 @@ export class Loader {
1138
1138
  file,
1139
1139
  this.transformUrl(file.atlasURL, file),
1140
1140
  'text',
1141
- (bitmapFontFile: LoaderFile, bitmapFontXhr: XMLHttpRequest) => {
1141
+ (bitmapFontFile: LoaderFile, bitmapFontXhr: XMLHttpRequest): void => {
1142
1142
  let json;
1143
1143
  try {
1144
1144
  // Try to parse as JSON, if it fails, then it's hopefully XML
@@ -1186,7 +1186,7 @@ export class Loader {
1186
1186
  * @param {object} file - The file object that was loaded successfully.
1187
1187
  * @param {XMLHttpRequest} xhr - The XMLHttpRequest object containing the file data.
1188
1188
  */
1189
- public jsonLoadComplete(file: LoaderFile, xhr: XMLHttpRequest) {
1189
+ public jsonLoadComplete(file: LoaderFile, xhr: XMLHttpRequest): void {
1190
1190
  const data = JSON.parse(xhr.responseText);
1191
1191
  const url = typeof file.url === 'string' ? file.url : '';
1192
1192
  if (file.type === 'bitmapfont') {
@@ -1210,7 +1210,7 @@ export class Loader {
1210
1210
  /**
1211
1211
  * TBD.
1212
1212
  */
1213
- public csvLoadComplete() {
1213
+ public csvLoadComplete(): void {
1214
1214
  // TODO
1215
1215
  this.game.logger.warn('loader.csvLoadComplete() is not implemented');
1216
1216
  }
@@ -1220,7 +1220,7 @@ export class Loader {
1220
1220
  * @param {object} file - The file object containing the JSON data.
1221
1221
  * @param {XMLHttpRequest} xhr - The XMLHttpRequest object containing the file data.
1222
1222
  */
1223
- public xmlLoadComplete(file: LoaderFile, xhr: XMLHttpRequest) {
1223
+ public xmlLoadComplete(file: LoaderFile, xhr: XMLHttpRequest): void {
1224
1224
  // Always try parsing the content as XML, regardless of actually response type
1225
1225
  const data = xhr.responseText;
1226
1226
  const xml = this.parseXml(data);
@@ -1278,7 +1278,7 @@ export class Loader {
1278
1278
  /**
1279
1279
  * Updates the preload sprite's progress indicator.
1280
1280
  */
1281
- public updateProgress() {
1281
+ public updateProgress(): void {
1282
1282
  if (this.preloadSprite) {
1283
1283
  if (this.preloadSprite.direction === 0) {
1284
1284
  this.preloadSprite.rect.width = Math.floor((this.preloadSprite.width / 100) * this.progress);
@@ -1299,7 +1299,7 @@ export class Loader {
1299
1299
  * @param {string} message - The message to log.
1300
1300
  * @param {string|object} data - Additional data to log with the message.
1301
1301
  */
1302
- public log(message: string, data: string | any = '') {
1302
+ public log(message: string, data: string | any = ''): void {
1303
1303
  if (!this.isUseLog) {
1304
1304
  return;
1305
1305
  }
@@ -1310,7 +1310,7 @@ export class Loader {
1310
1310
  * Gets the number of files that have been loaded.
1311
1311
  * @returns {number} The total number of loaded files.
1312
1312
  */
1313
- public totalLoadedFiles() {
1313
+ public totalLoadedFiles(): number {
1314
1314
  return this._loadedFileCount;
1315
1315
  }
1316
1316
 
@@ -1318,7 +1318,7 @@ export class Loader {
1318
1318
  * Gets the number of files that are still queued for loading.
1319
1319
  * @returns {number} The total number of queued files.
1320
1320
  */
1321
- public totalQueuedFiles() {
1321
+ public totalQueuedFiles(): number {
1322
1322
  return this._totalFileCount - this._loadedFileCount;
1323
1323
  }
1324
1324
 
@@ -1326,7 +1326,7 @@ export class Loader {
1326
1326
  * Gets the number of pack files that have been loaded.
1327
1327
  * @returns {number} The total number of loaded pack files.
1328
1328
  */
1329
- public totalLoadedPacks() {
1329
+ public totalLoadedPacks(): number {
1330
1330
  return this._totalPackCount;
1331
1331
  }
1332
1332
 
@@ -1334,7 +1334,7 @@ export class Loader {
1334
1334
  * Gets the number of pack files that are still queued for loading.
1335
1335
  * @returns {number} The total number of queued pack files.
1336
1336
  */
1337
- public totalQueuedPacks() {
1337
+ public totalQueuedPacks(): number {
1338
1338
  return this._totalPackCount - this._loadedPackCount;
1339
1339
  }
1340
1340
 
@@ -1342,7 +1342,7 @@ export class Loader {
1342
1342
  * Gets the loading progress as a percentage (0-100).
1343
1343
  * @returns {number} The current loading progress as a percentage.
1344
1344
  */
1345
- public get progressFloat() {
1345
+ public get progressFloat(): number {
1346
1346
  const progress = (this._loadedFileCount / this._totalFileCount) * 100;
1347
1347
  return Math.max(0, Math.min(100, progress || 0));
1348
1348
  }
@@ -1351,7 +1351,7 @@ export class Loader {
1351
1351
  * Gets the loading progress as a rounded percentage (0-100).
1352
1352
  * @returns {number} The current loading progress as a rounded percentage.
1353
1353
  */
1354
- public get progress() {
1354
+ public get progress(): number {
1355
1355
  return Math.round(this.progressFloat);
1356
1356
  }
1357
1357
  }
@@ -9,7 +9,7 @@ import type { BaseTexture } from '../display/webgl/base_texture.js';
9
9
  * @returns {object} The finalized bitmap font data.
10
10
  */
11
11
  export const finalizeBitmapFont = (baseTexture: BaseTexture, bitmapFontData: any) => {
12
- Object.keys(bitmapFontData.chars).forEach((charCode) => {
12
+ Object.keys(bitmapFontData.chars).forEach((charCode): void => {
13
13
  const letter = bitmapFontData.chars[charCode];
14
14
  letter.texture = new Texture(baseTexture, new Rectangle(letter.x, letter.y, letter.width, letter.height));
15
15
  });
@@ -87,7 +87,7 @@ export const jsonBitmapFont = (json: any, baseTexture: BaseTexture, xSpacing: nu
87
87
  lineHeight: Math.trunc(Number(json.font.common._lineHeight)) + ySpacing,
88
88
  chars: {},
89
89
  };
90
- json.font.chars.char.forEach((letter: Record<string, string>) => {
90
+ json.font.chars.char.forEach((letter: Record<string, string>): void => {
91
91
  const charCode = Math.trunc(Number(letter['_id']));
92
92
  data.chars[charCode] = {
93
93
  x: Math.trunc(Number(letter['_x'])),
@@ -101,7 +101,7 @@ export const jsonBitmapFont = (json: any, baseTexture: BaseTexture, xSpacing: nu
101
101
  };
102
102
  });
103
103
  if (json.font.kernings && json.font.kernings.kerning) {
104
- json.font.kernings.kerning.forEach((kerning: Record<string, string>) => {
104
+ json.font.kernings.kerning.forEach((kerning: Record<string, string>): void => {
105
105
  const char = data.chars[Math.trunc(Number(kerning['_second']))];
106
106
  if (char) {
107
107
  char.kerning[Math.trunc(Number(kerning['_first']))] = Math.trunc(Number(kerning['_amount']));
@@ -15,14 +15,14 @@ export class RequestAnimationFrame {
15
15
  /**
16
16
  * Starts an animation frame request.
17
17
  */
18
- public start = () => {
18
+ public start = (): void => {
19
19
  this.rafId = requestAnimationFrame(this.update);
20
20
  };
21
21
 
22
22
  /**
23
23
  * Cancels an animation frame request.
24
24
  */
25
- public stop = () => {
25
+ public stop = (): void => {
26
26
  cancelAnimationFrame(this.rafId);
27
27
  };
28
28
 
@@ -30,7 +30,7 @@ export class RequestAnimationFrame {
30
30
  * Performs an animation frame request.
31
31
  * @param {number} rafTime - The timestamp provided by the browser's animation frame.
32
32
  */
33
- public update = (rafTime: number) => {
33
+ public update = (rafTime: number): void => {
34
34
  this.game.update(rafTime);
35
35
  this.rafId = requestAnimationFrame(this.update);
36
36
  };