@vpmedia/phaser 1.104.0 → 1.105.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.
- package/dist/index.js +151 -574
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts +35 -57
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +11 -10
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts +2 -2
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts +3 -3
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +60 -60
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/device.d.ts.map +1 -1
- package/dist/phaser/core/device_util.d.ts +10 -10
- package/dist/phaser/core/device_util.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts +6 -5
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/event_manager.d.ts +49 -174
- package/dist/phaser/core/event_manager.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts +7 -7
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/frame.d.ts +27 -48
- package/dist/phaser/core/frame.d.ts.map +1 -1
- package/dist/phaser/core/frame_data.d.ts +11 -60
- package/dist/phaser/core/frame_data.d.ts.map +1 -1
- package/dist/phaser/core/frame_util.d.ts +4 -14
- package/dist/phaser/core/frame_util.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts +49 -58
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +15 -13
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +23 -20
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts +26 -1
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts +2 -2
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +9 -9
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts +2 -1
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +28 -28
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +4 -4
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts +2 -2
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/scale_manager.d.ts +22 -17
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts +1 -1
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts +10 -9
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts +9 -8
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts +2 -2
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +56 -101
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +11 -9
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts +4 -4
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts +3 -3
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts +5 -5
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +10 -10
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/timer_event.d.ts +11 -21
- package/dist/phaser/core/timer_event.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts +37 -59
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +6 -5
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_easing.d.ts +31 -31
- package/dist/phaser/core/tween_easing.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts +4 -4
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts +1 -1
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts +22 -20
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts +23 -35
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts +2 -2
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/graphics.d.ts +3 -3
- package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
- package/dist/phaser/display/canvas/pool.d.ts +2 -2
- package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
- package/dist/phaser/display/canvas/renderer.d.ts +5 -5
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +3 -3
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts +9 -9
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +45 -42
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts +24 -16
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts +24 -37
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +34 -49
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_batch.d.ts +1 -1
- package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts +5 -5
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts +86 -66
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts +2 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/base_texture.d.ts +2 -2
- package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts +3 -2
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts +10 -10
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +2 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts +2 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts +3 -2
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +11 -10
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts +2 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts +2 -1
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts +8 -6
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts +1 -0
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts +4 -2
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts +3 -2
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts +5 -4
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts +15 -2
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts +6 -6
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts +11 -10
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts +6 -5
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts +14 -14
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts +13 -12
- package/dist/phaser/geom/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/point.d.ts +19 -19
- package/dist/phaser/geom/point.d.ts.map +1 -1
- package/dist/phaser/geom/polygon.d.ts +6 -6
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts +20 -20
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/rounded_rectangle.d.ts +2 -2
- package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts +9 -7
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts +5 -3
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts +2 -1
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts +19 -19
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/polygon.d.ts +2 -1
- package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +17 -15
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts +2 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/util/math.d.ts +51 -142
- package/dist/phaser/util/math.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/phaser/core/animation.ts +38 -61
- package/src/phaser/core/animation_manager.ts +21 -21
- package/src/phaser/core/animation_parser.ts +11 -3
- package/src/phaser/core/array_set.ts +8 -8
- package/src/phaser/core/cache.ts +75 -68
- package/src/phaser/core/device.ts +23 -24
- package/src/phaser/core/device_util.ts +10 -10
- package/src/phaser/core/dom.ts +5 -5
- package/src/phaser/core/event_manager.ts +52 -193
- package/src/phaser/core/factory.ts +25 -18
- package/src/phaser/core/frame.ts +37 -51
- package/src/phaser/core/frame_data.ts +29 -76
- package/src/phaser/core/frame_util.ts +3 -16
- package/src/phaser/core/game.ts +36 -63
- package/src/phaser/core/input.ts +68 -68
- package/src/phaser/core/input_handler.ts +81 -86
- package/src/phaser/core/input_mouse.ts +42 -36
- package/src/phaser/core/input_mspointer.ts +24 -25
- package/src/phaser/core/input_pointer.ts +55 -56
- package/src/phaser/core/input_touch.ts +26 -26
- package/src/phaser/core/loader.ts +97 -70
- package/src/phaser/core/loader_parser.ts +6 -7
- package/src/phaser/core/raf.ts +2 -2
- package/src/phaser/core/scale_manager.ts +85 -82
- package/src/phaser/core/scene.ts +3 -4
- package/src/phaser/core/scene_manager.ts +26 -26
- package/src/phaser/core/signal.ts +10 -10
- package/src/phaser/core/signal_binding.ts +2 -2
- package/src/phaser/core/sound.ts +65 -112
- package/src/phaser/core/sound_manager.ts +31 -30
- package/src/phaser/core/sound_sprite.ts +10 -11
- package/src/phaser/core/stage.ts +8 -8
- package/src/phaser/core/time.ts +33 -34
- package/src/phaser/core/timer.ts +40 -34
- package/src/phaser/core/timer_event.ts +23 -23
- package/src/phaser/core/tween.ts +42 -68
- package/src/phaser/core/tween_data.ts +31 -31
- package/src/phaser/core/tween_easing.ts +31 -31
- package/src/phaser/core/tween_manager.ts +10 -11
- package/src/phaser/core/world.ts +1 -2
- package/src/phaser/display/bitmap_text.ts +41 -31
- package/src/phaser/display/button.ts +24 -51
- package/src/phaser/display/canvas/buffer.ts +6 -7
- package/src/phaser/display/canvas/graphics.ts +3 -4
- package/src/phaser/display/canvas/masker.ts +2 -3
- package/src/phaser/display/canvas/pool.ts +3 -4
- package/src/phaser/display/canvas/renderer.ts +19 -20
- package/src/phaser/display/canvas/tinter.ts +4 -5
- package/src/phaser/display/canvas/util.ts +9 -9
- package/src/phaser/display/display_object.ts +49 -50
- package/src/phaser/display/graphics.ts +56 -43
- package/src/phaser/display/graphics_data.ts +11 -12
- package/src/phaser/display/graphics_data_util.ts +1 -2
- package/src/phaser/display/group.ts +32 -42
- package/src/phaser/display/image.ts +32 -52
- package/src/phaser/display/sprite_batch.ts +1 -2
- package/src/phaser/display/sprite_util.ts +5 -6
- package/src/phaser/display/text.ts +82 -56
- package/src/phaser/display/webgl/abstract_filter.ts +8 -8
- package/src/phaser/display/webgl/base_texture.ts +14 -15
- package/src/phaser/display/webgl/blend_manager.ts +5 -5
- package/src/phaser/display/webgl/earcut.ts +27 -27
- package/src/phaser/display/webgl/earcut_node.ts +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.ts +19 -19
- package/src/phaser/display/webgl/filter_manager.ts +5 -5
- package/src/phaser/display/webgl/filter_texture.ts +7 -7
- package/src/phaser/display/webgl/graphics.ts +10 -11
- package/src/phaser/display/webgl/graphics_data.ts +11 -11
- package/src/phaser/display/webgl/mask_manager.ts +2 -3
- package/src/phaser/display/webgl/render_texture.ts +12 -12
- package/src/phaser/display/webgl/renderer.ts +24 -24
- package/src/phaser/display/webgl/shader/complex.ts +7 -7
- package/src/phaser/display/webgl/shader/fast.ts +8 -8
- package/src/phaser/display/webgl/shader/normal.ts +12 -12
- package/src/phaser/display/webgl/shader/primitive.ts +7 -7
- package/src/phaser/display/webgl/shader/strip.ts +7 -7
- package/src/phaser/display/webgl/shader_manager.ts +13 -13
- package/src/phaser/display/webgl/sprite_batch.ts +20 -20
- package/src/phaser/display/webgl/stencil_manager.ts +8 -8
- package/src/phaser/display/webgl/texture.ts +35 -24
- package/src/phaser/display/webgl/texture_util.ts +2 -3
- package/src/phaser/display/webgl/util.ts +6 -6
- package/src/phaser/geom/circle.ts +10 -10
- package/src/phaser/geom/ellipse.ts +6 -6
- package/src/phaser/geom/line.ts +14 -14
- package/src/phaser/geom/matrix.ts +12 -12
- package/src/phaser/geom/point.ts +19 -19
- package/src/phaser/geom/polygon.ts +5 -5
- package/src/phaser/geom/rectangle.ts +21 -21
- package/src/phaser/geom/rounded_rectangle.ts +2 -2
- package/src/phaser/geom/util/circle.ts +7 -7
- package/src/phaser/geom/util/ellipse.ts +1 -1
- package/src/phaser/geom/util/line.ts +5 -5
- package/src/phaser/geom/util/matrix.ts +1 -1
- package/src/phaser/geom/util/point.ts +20 -20
- package/src/phaser/geom/util/polygon.ts +1 -1
- package/src/phaser/geom/util/rectangle.ts +15 -15
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
- package/src/phaser/util/math.ts +65 -151
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { Rectangle } from '../geom/rectangle.js';
|
|
3
2
|
import { canPlayAudio } from './device_util.js';
|
|
4
3
|
import { ENGINE_ERROR_INVALID_BITMAP_FONT_ATLAS } from './error_code.js';
|
|
@@ -7,39 +6,39 @@ import { Signal } from './signal.js';
|
|
|
7
6
|
const TEXTURE_ATLAS_JSON_HASH = 1;
|
|
8
7
|
|
|
9
8
|
export class Loader {
|
|
10
|
-
game;
|
|
11
|
-
cache;
|
|
12
|
-
isLoading;
|
|
13
|
-
isUseLog;
|
|
14
|
-
isUseRetry;
|
|
15
|
-
maxRetry;
|
|
16
|
-
hasLoaded;
|
|
17
|
-
preloadSprite;
|
|
18
|
-
crossOrigin;
|
|
19
|
-
baseURL;
|
|
20
|
-
path;
|
|
21
|
-
headers;
|
|
22
|
-
onLoadStart;
|
|
23
|
-
onLoadComplete;
|
|
24
|
-
onPackComplete;
|
|
25
|
-
onFileStart;
|
|
26
|
-
onFileComplete;
|
|
27
|
-
onFileError;
|
|
28
|
-
maxParallelDownloads;
|
|
29
|
-
_withSyncPointDepth;
|
|
30
|
-
_fileList;
|
|
31
|
-
_flightQueue;
|
|
32
|
-
_processingHead;
|
|
33
|
-
_fileLoadStarted;
|
|
34
|
-
_totalPackCount;
|
|
35
|
-
_totalFileCount;
|
|
36
|
-
_loadedPackCount;
|
|
37
|
-
_loadedFileCount;
|
|
9
|
+
game!: any;
|
|
10
|
+
cache!: any;
|
|
11
|
+
isLoading!: any;
|
|
12
|
+
isUseLog!: any;
|
|
13
|
+
isUseRetry!: any;
|
|
14
|
+
maxRetry!: any;
|
|
15
|
+
hasLoaded!: any;
|
|
16
|
+
preloadSprite!: any;
|
|
17
|
+
crossOrigin!: any;
|
|
18
|
+
baseURL!: any;
|
|
19
|
+
path!: any;
|
|
20
|
+
headers!: any;
|
|
21
|
+
onLoadStart!: any;
|
|
22
|
+
onLoadComplete!: any;
|
|
23
|
+
onPackComplete!: any;
|
|
24
|
+
onFileStart!: any;
|
|
25
|
+
onFileComplete!: any;
|
|
26
|
+
onFileError!: any;
|
|
27
|
+
maxParallelDownloads!: any;
|
|
28
|
+
_withSyncPointDepth!: any;
|
|
29
|
+
_fileList!: any;
|
|
30
|
+
_flightQueue!: any;
|
|
31
|
+
_processingHead!: any;
|
|
32
|
+
_fileLoadStarted!: any;
|
|
33
|
+
_totalPackCount!: any;
|
|
34
|
+
_totalFileCount!: any;
|
|
35
|
+
_loadedPackCount!: any;
|
|
36
|
+
_loadedFileCount!: any;
|
|
38
37
|
/**
|
|
39
38
|
* Creates a new Loader instance.
|
|
40
39
|
* @param {import('./game.js').Game} game - Reference to the Phaser Game instance.
|
|
41
40
|
*/
|
|
42
|
-
constructor(game) {
|
|
41
|
+
constructor(game: import('./game.js').Game) {
|
|
43
42
|
this.game = game;
|
|
44
43
|
this.cache = game.cache;
|
|
45
44
|
this.isLoading = false;
|
|
@@ -79,7 +78,7 @@ _loadedFileCount;
|
|
|
79
78
|
* @param {import('../display/image.js').Image} sprite - The image to use as the preload sprite.
|
|
80
79
|
* @param {number} direction - The direction of the progress (0 = horizontal, 1 = vertical).
|
|
81
80
|
*/
|
|
82
|
-
setPreloadSprite(sprite, direction = 0) {
|
|
81
|
+
setPreloadSprite(sprite: import('../display/image.js').Image, direction: number = 0) {
|
|
83
82
|
this.preloadSprite = {
|
|
84
83
|
sprite,
|
|
85
84
|
direction,
|
|
@@ -113,7 +112,7 @@ _loadedFileCount;
|
|
|
113
112
|
* @param {string} key - The key of the file to check for.
|
|
114
113
|
* @returns {boolean} True if the file exists, false otherwise.
|
|
115
114
|
*/
|
|
116
|
-
checkKeyExists(type, key) {
|
|
115
|
+
checkKeyExists(type: string, key: string) {
|
|
117
116
|
return this.getAssetIndex(type, key) > -1;
|
|
118
117
|
}
|
|
119
118
|
|
|
@@ -123,7 +122,7 @@ _loadedFileCount;
|
|
|
123
122
|
* @param {string} key - The key of the file to find.
|
|
124
123
|
* @returns {number} The index of the file in the list, or -1 if not found.
|
|
125
124
|
*/
|
|
126
|
-
getAssetIndex(type, key) {
|
|
125
|
+
getAssetIndex(type: string, key: string) {
|
|
127
126
|
let bestFound = -1;
|
|
128
127
|
for (let i = 0; i < this._fileList.length; i += 1) {
|
|
129
128
|
const file = this._fileList[i];
|
|
@@ -145,7 +144,7 @@ _loadedFileCount;
|
|
|
145
144
|
* @param {string} key - The key of the file to get.
|
|
146
145
|
* @returns {{index: number, file: object} | null} The file and its index, or null if not found.
|
|
147
146
|
*/
|
|
148
|
-
getAsset(type, key) {
|
|
147
|
+
getAsset(type: string, key: string) {
|
|
149
148
|
const fileIndex = this.getAssetIndex(type, key);
|
|
150
149
|
if (fileIndex > -1) {
|
|
151
150
|
return { index: fileIndex, file: this._fileList[fileIndex] };
|
|
@@ -158,7 +157,7 @@ _loadedFileCount;
|
|
|
158
157
|
* @param {boolean} hard - Whether to perform a hard reset (clears preload sprite).
|
|
159
158
|
* @param {boolean} clearEvents - Whether to clear event listeners.
|
|
160
159
|
*/
|
|
161
|
-
reset(hard = false, clearEvents = false) {
|
|
160
|
+
reset(hard: boolean = false, clearEvents: boolean = false) {
|
|
162
161
|
if (hard) {
|
|
163
162
|
this.preloadSprite = null;
|
|
164
163
|
}
|
|
@@ -191,7 +190,14 @@ _loadedFileCount;
|
|
|
191
190
|
* @param {string} extension - The file extension to use if URL is not provided.
|
|
192
191
|
* @returns {Loader} This Loader instance for chaining.
|
|
193
192
|
*/
|
|
194
|
-
addToFileList(
|
|
193
|
+
addToFileList(
|
|
194
|
+
type: string,
|
|
195
|
+
key: string = '',
|
|
196
|
+
url: string = null,
|
|
197
|
+
properties: any = null,
|
|
198
|
+
overwrite: boolean = false,
|
|
199
|
+
extension: string = null
|
|
200
|
+
) {
|
|
195
201
|
if (key === undefined || key === '') {
|
|
196
202
|
this.game.logger.warn(`Loader: Invalid or no key given of type ${type}`);
|
|
197
203
|
return this;
|
|
@@ -246,7 +252,7 @@ _loadedFileCount;
|
|
|
246
252
|
* @param {object} properties - The new properties for the file.
|
|
247
253
|
* @returns {Loader} This Loader instance for chaining.
|
|
248
254
|
*/
|
|
249
|
-
replaceInFileList(type, key, url, properties) {
|
|
255
|
+
replaceInFileList(type: string, key: string, url: string, properties: any) {
|
|
250
256
|
return this.addToFileList(type, key, url, properties, true);
|
|
251
257
|
}
|
|
252
258
|
|
|
@@ -258,7 +264,7 @@ _loadedFileCount;
|
|
|
258
264
|
* @param {object} callbackContext - The context in which to call the callback.
|
|
259
265
|
* @returns {Loader} This Loader instance for chaining.
|
|
260
266
|
*/
|
|
261
|
-
pack(key, url, data, callbackContext) {
|
|
267
|
+
pack(key: string, url: string, data: any, callbackContext: any) {
|
|
262
268
|
const pack = {
|
|
263
269
|
type: 'packfile',
|
|
264
270
|
key: key,
|
|
@@ -296,7 +302,7 @@ _loadedFileCount;
|
|
|
296
302
|
* @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
|
|
297
303
|
* @returns {Loader} This Loader instance for chaining.
|
|
298
304
|
*/
|
|
299
|
-
image(key, url, overwrite = false) {
|
|
305
|
+
image(key: string, url?: any, overwrite: boolean = false) {
|
|
300
306
|
return this.addToFileList('image', key, url, undefined, overwrite, '.png');
|
|
301
307
|
}
|
|
302
308
|
|
|
@@ -306,7 +312,7 @@ _loadedFileCount;
|
|
|
306
312
|
* @param {string[]} urls - The URLs of the image files to load.
|
|
307
313
|
* @returns {Loader} This Loader instance for chaining.
|
|
308
314
|
*/
|
|
309
|
-
images(keys, urls) {
|
|
315
|
+
images(keys: string[], urls: string[]) {
|
|
310
316
|
if (Array.isArray(urls)) {
|
|
311
317
|
for (let i = 0; i < keys.length; i += 1) {
|
|
312
318
|
this.image(keys[i], urls[i]);
|
|
@@ -326,7 +332,7 @@ _loadedFileCount;
|
|
|
326
332
|
* @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
|
|
327
333
|
* @returns {Loader} This Loader instance for chaining.
|
|
328
334
|
*/
|
|
329
|
-
text(key, url, overwrite = false) {
|
|
335
|
+
text(key: string, url: string, overwrite: boolean = false) {
|
|
330
336
|
return this.addToFileList('text', key, url, undefined, overwrite, '.txt');
|
|
331
337
|
}
|
|
332
338
|
|
|
@@ -337,7 +343,7 @@ _loadedFileCount;
|
|
|
337
343
|
* @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
|
|
338
344
|
* @returns {Loader} This Loader instance for chaining.
|
|
339
345
|
*/
|
|
340
|
-
json(key, url, overwrite = false) {
|
|
346
|
+
json(key: string, url: string, overwrite: boolean = false) {
|
|
341
347
|
return this.addToFileList('json', key, url, undefined, overwrite, '.json');
|
|
342
348
|
}
|
|
343
349
|
|
|
@@ -348,7 +354,7 @@ _loadedFileCount;
|
|
|
348
354
|
* @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
|
|
349
355
|
* @returns {Loader} This Loader instance for chaining.
|
|
350
356
|
*/
|
|
351
|
-
xml(key, url, overwrite = false) {
|
|
357
|
+
xml(key: string, url: string, overwrite: boolean = false) {
|
|
352
358
|
return this.addToFileList('xml', key, url, undefined, overwrite, '.xml');
|
|
353
359
|
}
|
|
354
360
|
|
|
@@ -363,7 +369,15 @@ _loadedFileCount;
|
|
|
363
369
|
* @param {number} spacing - The spacing between frames in pixels.
|
|
364
370
|
* @returns {Loader} This Loader instance for chaining.
|
|
365
371
|
*/
|
|
366
|
-
spritesheet(
|
|
372
|
+
spritesheet(
|
|
373
|
+
key: string,
|
|
374
|
+
url: string,
|
|
375
|
+
frameWidth: number,
|
|
376
|
+
frameHeight: number,
|
|
377
|
+
frameMax: number = -1,
|
|
378
|
+
margin: number = 0,
|
|
379
|
+
spacing: number = 0
|
|
380
|
+
) {
|
|
367
381
|
return this.addToFileList(
|
|
368
382
|
'spritesheet',
|
|
369
383
|
key,
|
|
@@ -381,7 +395,7 @@ _loadedFileCount;
|
|
|
381
395
|
* @param {boolean} autoDecode - Whether to automatically decode the audio file.
|
|
382
396
|
* @returns {Loader} This Loader instance for chaining.
|
|
383
397
|
*/
|
|
384
|
-
audio(key, urls, autoDecode = true) {
|
|
398
|
+
audio(key: string, urls: any, autoDecode: boolean = true) {
|
|
385
399
|
if (this.game.sound.noAudio || this.game.device.noAudioFormat) {
|
|
386
400
|
return this;
|
|
387
401
|
}
|
|
@@ -400,7 +414,7 @@ _loadedFileCount;
|
|
|
400
414
|
* @param {boolean} autoDecode - Whether to automatically decode the audio file.
|
|
401
415
|
* @returns {Loader} This Loader instance for chaining.
|
|
402
416
|
*/
|
|
403
|
-
audioSprite(key, urls, jsonURL, jsonData, autoDecode = true) {
|
|
417
|
+
audioSprite(key: string, urls: string, jsonURL: string, jsonData: any, autoDecode: boolean = true) {
|
|
404
418
|
if (this.game.sound.noAudio || this.game.device.noAudioFormat) {
|
|
405
419
|
return this;
|
|
406
420
|
}
|
|
@@ -427,7 +441,14 @@ _loadedFileCount;
|
|
|
427
441
|
* @returns {Loader} This Loader instance for chaining.
|
|
428
442
|
* @throws {Error} If the bitmap font atlas data is invalid.
|
|
429
443
|
*/
|
|
430
|
-
bitmapFont(
|
|
444
|
+
bitmapFont(
|
|
445
|
+
key: string,
|
|
446
|
+
textureURL: string = null,
|
|
447
|
+
atlasURL: string = null,
|
|
448
|
+
atlasData: any = null,
|
|
449
|
+
xSpacing: number = 0,
|
|
450
|
+
ySpacing: number = 0
|
|
451
|
+
) {
|
|
431
452
|
if (textureURL === undefined || textureURL === null) {
|
|
432
453
|
textureURL = `${key}.png`;
|
|
433
454
|
}
|
|
@@ -469,7 +490,13 @@ _loadedFileCount;
|
|
|
469
490
|
* @param {number} format - The format of the atlas file (JSON or XML).
|
|
470
491
|
* @returns {Loader} This Loader instance for chaining.
|
|
471
492
|
*/
|
|
472
|
-
atlas(
|
|
493
|
+
atlas(
|
|
494
|
+
key: string,
|
|
495
|
+
textureURL: string,
|
|
496
|
+
atlasURL: string = null,
|
|
497
|
+
atlasData: any = null,
|
|
498
|
+
format: number = TEXTURE_ATLAS_JSON_HASH
|
|
499
|
+
) {
|
|
473
500
|
if (textureURL === undefined || textureURL === null) {
|
|
474
501
|
textureURL = `${key}.png`;
|
|
475
502
|
}
|
|
@@ -491,7 +518,7 @@ _loadedFileCount;
|
|
|
491
518
|
* @param {object} callbackContext - The context in which to call the callback.
|
|
492
519
|
* @returns {Loader} This Loader instance for chaining.
|
|
493
520
|
*/
|
|
494
|
-
withSyncPoint(callback, callbackContext) {
|
|
521
|
+
withSyncPoint(callback: Function, callbackContext: any) {
|
|
495
522
|
this._withSyncPointDepth += 1;
|
|
496
523
|
try {
|
|
497
524
|
callback.call(callbackContext || this, this);
|
|
@@ -507,7 +534,7 @@ _loadedFileCount;
|
|
|
507
534
|
* @param {string} key - The key of the file to add a sync point to.
|
|
508
535
|
* @returns {Loader} This Loader instance for chaining.
|
|
509
536
|
*/
|
|
510
|
-
addSyncPoint(type, key) {
|
|
537
|
+
addSyncPoint(type: string, key: string) {
|
|
511
538
|
const asset = this.getAsset(type, key);
|
|
512
539
|
if (asset) {
|
|
513
540
|
asset.file.syncPoint = true;
|
|
@@ -520,10 +547,10 @@ _loadedFileCount;
|
|
|
520
547
|
* @param {string} type - The type of file to remove.
|
|
521
548
|
* @param {string} key - The key of the file to remove.
|
|
522
549
|
*/
|
|
523
|
-
removeFile(type, key) {
|
|
550
|
+
removeFile(type: string, key: string) {
|
|
524
551
|
const asset = this.getAsset(type, key);
|
|
525
552
|
if (asset) {
|
|
526
|
-
if (!asset.loaded && !asset.loading) {
|
|
553
|
+
if (!asset.file.loaded && !asset.file.loading) {
|
|
527
554
|
this._fileList.splice(asset.index, 1);
|
|
528
555
|
}
|
|
529
556
|
}
|
|
@@ -652,7 +679,7 @@ _loadedFileCount;
|
|
|
652
679
|
* Finishes the loading process, optionally reporting an abnormal termination.
|
|
653
680
|
* @param {boolean} abnormal - Whether the loading was terminated abnormally.
|
|
654
681
|
*/
|
|
655
|
-
finishedLoading(abnormal = false) {
|
|
682
|
+
finishedLoading(abnormal: boolean = false) {
|
|
656
683
|
if (this.hasLoaded) {
|
|
657
684
|
return;
|
|
658
685
|
}
|
|
@@ -676,7 +703,7 @@ _loadedFileCount;
|
|
|
676
703
|
* @param {object} file - The file to complete or mark as failed.
|
|
677
704
|
* @param {string} errorMessage - An error message if the file failed to load.
|
|
678
705
|
*/
|
|
679
|
-
asyncComplete(file, errorMessage = '') {
|
|
706
|
+
asyncComplete(file: any, errorMessage: string = '') {
|
|
680
707
|
file.loaded = true;
|
|
681
708
|
file.error = !!errorMessage;
|
|
682
709
|
if (file.error) {
|
|
@@ -691,7 +718,7 @@ _loadedFileCount;
|
|
|
691
718
|
* Processes a pack file, adding its contained files to the loader.
|
|
692
719
|
* @param {object} pack - The pack file object to process.
|
|
693
720
|
*/
|
|
694
|
-
processPack(pack) {
|
|
721
|
+
processPack(pack: any) {
|
|
695
722
|
const packData = pack.data[pack.key];
|
|
696
723
|
if (!packData) {
|
|
697
724
|
this.game.logger.warn('Missing loader pack key', { key: pack.key });
|
|
@@ -756,7 +783,7 @@ _loadedFileCount;
|
|
|
756
783
|
* @param {object} file - The file object containing path information.
|
|
757
784
|
* @returns {string} The transformed URL.
|
|
758
785
|
*/
|
|
759
|
-
transformUrl(url, file) {
|
|
786
|
+
transformUrl(url: any, file: any): any {
|
|
760
787
|
if (!url) {
|
|
761
788
|
return false;
|
|
762
789
|
}
|
|
@@ -770,7 +797,7 @@ _loadedFileCount;
|
|
|
770
797
|
* Loads a file using XMLHttpRequest, handling image files specially.
|
|
771
798
|
* @param {object} file - The file object to load.
|
|
772
799
|
*/
|
|
773
|
-
loadFile(file) {
|
|
800
|
+
loadFile(file: any) {
|
|
774
801
|
switch (file.type) {
|
|
775
802
|
case 'packfile':
|
|
776
803
|
this.xhrLoad(file, this.transformUrl(file.url, file), 'text', this.fileComplete);
|
|
@@ -812,7 +839,7 @@ _loadedFileCount;
|
|
|
812
839
|
* Loads an image file using the Image DOM element.
|
|
813
840
|
* @param {object} file - The file object to load.
|
|
814
841
|
*/
|
|
815
|
-
loadImageTag(file) {
|
|
842
|
+
loadImageTag(file: any) {
|
|
816
843
|
this.log('loadImageTag', file);
|
|
817
844
|
const scope = this;
|
|
818
845
|
file.data = new Image();
|
|
@@ -850,7 +877,7 @@ _loadedFileCount;
|
|
|
850
877
|
* @param {Function} onload - The function to call when the file loads successfully.
|
|
851
878
|
* @param {Function} onerror - The function to call if the file fails to load.
|
|
852
879
|
*/
|
|
853
|
-
xhrLoad(file, url, type, onload, onerror = null) {
|
|
880
|
+
xhrLoad(file: any, url: any, type: any, onload: Function, onerror: Function = null) {
|
|
854
881
|
this.log('xhrLoad', file);
|
|
855
882
|
const scope = this;
|
|
856
883
|
const xhr = new XMLHttpRequest();
|
|
@@ -883,7 +910,7 @@ _loadedFileCount;
|
|
|
883
910
|
// If this was the last file in the queue and an error is thrown in the create method
|
|
884
911
|
// then it's caught here, so be sure we don't carry on processing it
|
|
885
912
|
if (!scope.hasLoaded) {
|
|
886
|
-
scope.asyncComplete(file,
|
|
913
|
+
scope.asyncComplete(file, typedError.message || 'Exception');
|
|
887
914
|
} else {
|
|
888
915
|
scope.game.logger.exception('Loader', typedError);
|
|
889
916
|
}
|
|
@@ -902,7 +929,7 @@ _loadedFileCount;
|
|
|
902
929
|
} catch (error) {
|
|
903
930
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
904
931
|
if (!scope.hasLoaded) {
|
|
905
|
-
scope.asyncComplete(file,
|
|
932
|
+
scope.asyncComplete(file, typedError.message || 'Exception');
|
|
906
933
|
} else {
|
|
907
934
|
scope.game.logger.exception('Loader', typedError);
|
|
908
935
|
}
|
|
@@ -928,7 +955,7 @@ _loadedFileCount;
|
|
|
928
955
|
* @param {object[]} urls - The array of URLs to check for supported audio formats.
|
|
929
956
|
* @returns {string} The first URL with a supported audio format, or null if none found.
|
|
930
957
|
*/
|
|
931
|
-
getAudioURL(urls) {
|
|
958
|
+
getAudioURL(urls: any[]) {
|
|
932
959
|
if (this.game.sound.noAudio || this.game.device.noAudioFormat) {
|
|
933
960
|
return null;
|
|
934
961
|
}
|
|
@@ -969,7 +996,7 @@ _loadedFileCount;
|
|
|
969
996
|
* @param {XMLHttpRequest} xhr - The XMLHttpRequest object that failed.
|
|
970
997
|
* @param {number | string} reason - The error code or message explaining the failure.
|
|
971
998
|
*/
|
|
972
|
-
fileError(file, xhr = null, reason = 0) {
|
|
999
|
+
fileError(file: any, xhr: any = null, reason: any = 0) {
|
|
973
1000
|
// const url = file.requestUrl || this.transformUrl(file.url, file);
|
|
974
1001
|
if (!reason && xhr) {
|
|
975
1002
|
reason = xhr.status;
|
|
@@ -984,7 +1011,7 @@ _loadedFileCount;
|
|
|
984
1011
|
* @param {XMLHttpRequest} xhr - TBD.
|
|
985
1012
|
* @throws {Error}
|
|
986
1013
|
*/
|
|
987
|
-
fileComplete(file, xhr) {
|
|
1014
|
+
fileComplete(file: any, xhr?: any) {
|
|
988
1015
|
let loadNext = true;
|
|
989
1016
|
switch (file.type) {
|
|
990
1017
|
case 'packfile':
|
|
@@ -1075,7 +1102,7 @@ _loadedFileCount;
|
|
|
1075
1102
|
* @param {object} file - The file object that was loaded successfully.
|
|
1076
1103
|
* @param {XMLHttpRequest} xhr - The XMLHttpRequest object containing the file data.
|
|
1077
1104
|
*/
|
|
1078
|
-
jsonLoadComplete(file, xhr) {
|
|
1105
|
+
jsonLoadComplete(file: any, xhr: XMLHttpRequest) {
|
|
1079
1106
|
const data = JSON.parse(xhr.responseText);
|
|
1080
1107
|
if (file.type === 'bitmapfont') {
|
|
1081
1108
|
this.cache.addBitmapFont(file.key, file.url, file.data, data, file.atlasType, file.xSpacing, file.ySpacing);
|
|
@@ -1100,12 +1127,12 @@ _loadedFileCount;
|
|
|
1100
1127
|
* @param {object} file - The file object containing the JSON data.
|
|
1101
1128
|
* @param {XMLHttpRequest} xhr - The XMLHttpRequest object containing the file data.
|
|
1102
1129
|
*/
|
|
1103
|
-
xmlLoadComplete(file, xhr) {
|
|
1130
|
+
xmlLoadComplete(file: any, xhr: XMLHttpRequest) {
|
|
1104
1131
|
// Always try parsing the content as XML, regardless of actually response type
|
|
1105
1132
|
const data = xhr.responseText;
|
|
1106
1133
|
const xml = this.parseXml(data);
|
|
1107
1134
|
if (!xml) {
|
|
1108
|
-
const responseType = xhr.responseType || xhr.contentType; // contentType for MS-XDomainRequest
|
|
1135
|
+
const responseType = xhr.responseType || (xhr as any).contentType; // contentType for MS-XDomainRequest
|
|
1109
1136
|
this.game.logger.warn(`${file.key}: invalid XML (${responseType})`);
|
|
1110
1137
|
this.asyncComplete(file, 'invalid XML');
|
|
1111
1138
|
return;
|
|
@@ -1125,7 +1152,7 @@ _loadedFileCount;
|
|
|
1125
1152
|
* @param {object} data - The XML string data to parse.
|
|
1126
1153
|
* @returns {Document} The parsed DOM Document, or null if parsing failed.
|
|
1127
1154
|
*/
|
|
1128
|
-
parseXml(data) {
|
|
1155
|
+
parseXml(data: any) {
|
|
1129
1156
|
let xml = null;
|
|
1130
1157
|
try {
|
|
1131
1158
|
if (window.DOMParser) {
|
|
@@ -1170,7 +1197,7 @@ _loadedFileCount;
|
|
|
1170
1197
|
* @param {string} message - The message to log.
|
|
1171
1198
|
* @param {string|object} data - Additional data to log with the message.
|
|
1172
1199
|
*/
|
|
1173
|
-
log(message, data = '') {
|
|
1200
|
+
log(message: string, data: string | any = '') {
|
|
1174
1201
|
if (!this.isUseLog) {
|
|
1175
1202
|
return;
|
|
1176
1203
|
}
|
|
@@ -1225,4 +1252,4 @@ _loadedFileCount;
|
|
|
1225
1252
|
get progress() {
|
|
1226
1253
|
return Math.round(this.progressFloat);
|
|
1227
1254
|
}
|
|
1228
|
-
}
|
|
1255
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { Texture } from '../display/webgl/texture.js';
|
|
3
2
|
import { Rectangle } from '../geom/rectangle.js';
|
|
4
3
|
|
|
@@ -8,7 +7,7 @@ import { Rectangle } from '../geom/rectangle.js';
|
|
|
8
7
|
* @param {object} bitmapFontData - The bitmap font data to finalize.
|
|
9
8
|
* @returns {object} The finalized bitmap font data.
|
|
10
9
|
*/
|
|
11
|
-
export const finalizeBitmapFont = (baseTexture, bitmapFontData) => {
|
|
10
|
+
export const finalizeBitmapFont = (baseTexture: import('../display/webgl/base_texture.js').BaseTexture, bitmapFontData: any) => {
|
|
12
11
|
Object.keys(bitmapFontData.chars).forEach((charCode) => {
|
|
13
12
|
const letter = bitmapFontData.chars[charCode];
|
|
14
13
|
letter.texture = new Texture(baseTexture, new Rectangle(letter.x, letter.y, letter.width, letter.height));
|
|
@@ -24,8 +23,8 @@ export const finalizeBitmapFont = (baseTexture, bitmapFontData) => {
|
|
|
24
23
|
* @param {number} ySpacing - Vertical spacing between characters.
|
|
25
24
|
* @returns {object} The parsed bitmap font data.
|
|
26
25
|
*/
|
|
27
|
-
export const xmlBitmapFont = (xml, baseTexture, xSpacing, ySpacing) => {
|
|
28
|
-
const data = {};
|
|
26
|
+
export const xmlBitmapFont = (xml: any, baseTexture: import('../display/webgl/base_texture.js').BaseTexture, xSpacing: number, ySpacing: number) => {
|
|
27
|
+
const data: any = {};
|
|
29
28
|
const info = xml.getElementsByTagName('info')[0];
|
|
30
29
|
const common = xml.getElementsByTagName('common')[0];
|
|
31
30
|
data.font = info.getAttribute('face');
|
|
@@ -64,7 +63,7 @@ export const xmlBitmapFont = (xml, baseTexture, xSpacing, ySpacing) => {
|
|
|
64
63
|
* @param {number} ySpacing - Vertical spacing between characters.
|
|
65
64
|
* @returns {object} The parsed bitmap font data.
|
|
66
65
|
*/
|
|
67
|
-
export const bitmapFont = (xml, baseTexture, xSpacing, ySpacing) => {
|
|
66
|
+
export const bitmapFont = (xml: any, baseTexture: import('../display/webgl/base_texture.js').BaseTexture, xSpacing: number, ySpacing: number) => {
|
|
68
67
|
return xmlBitmapFont(xml, baseTexture, xSpacing, ySpacing);
|
|
69
68
|
};
|
|
70
69
|
|
|
@@ -76,7 +75,7 @@ export const bitmapFont = (xml, baseTexture, xSpacing, ySpacing) => {
|
|
|
76
75
|
* @param {number} ySpacing - Vertical spacing between characters.
|
|
77
76
|
* @returns {object} The parsed bitmap font data.
|
|
78
77
|
*/
|
|
79
|
-
export const jsonBitmapFont = (json, baseTexture, xSpacing, ySpacing) => {
|
|
78
|
+
export const jsonBitmapFont = (json: any, baseTexture: import('../display/webgl/base_texture.js').BaseTexture, xSpacing: number, ySpacing: number) => {
|
|
80
79
|
const data = {
|
|
81
80
|
font: json.font.info._face,
|
|
82
81
|
size: Number.parseInt(json.font.info._size, 10),
|
|
@@ -102,4 +101,4 @@ export const jsonBitmapFont = (json, baseTexture, xSpacing, ySpacing) => {
|
|
|
102
101
|
});
|
|
103
102
|
}
|
|
104
103
|
return finalizeBitmapFont(baseTexture, data);
|
|
105
|
-
};
|
|
104
|
+
};
|
package/src/phaser/core/raf.ts
CHANGED
|
@@ -6,7 +6,7 @@ export class RequestAnimationFrame {
|
|
|
6
6
|
* Constructor.
|
|
7
7
|
* @param {import('./game.js').Game} game - Reference to the game instance.
|
|
8
8
|
*/
|
|
9
|
-
constructor(game) {
|
|
9
|
+
constructor(game: import('./game.js').Game) {
|
|
10
10
|
this.game = game;
|
|
11
11
|
this.rafId = 0;
|
|
12
12
|
}
|
|
@@ -29,7 +29,7 @@ export class RequestAnimationFrame {
|
|
|
29
29
|
* Performs an animation frame request.
|
|
30
30
|
* @param {number} rafTime - The timestamp provided by the browser's animation frame.
|
|
31
31
|
*/
|
|
32
|
-
update = (rafTime) => {
|
|
32
|
+
update = (rafTime: number) => {
|
|
33
33
|
this.game.update(rafTime);
|
|
34
34
|
this.rafId = requestAnimationFrame(this.update);
|
|
35
35
|
};
|