@vpmedia/phaser 1.112.0 → 1.114.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 +1261 -1314
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts +14 -10
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +10 -8
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts +5 -4
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +4 -3
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/const.d.ts.map +1 -1
- package/dist/phaser/core/device.d.ts.map +1 -1
- package/dist/phaser/core/device_util.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts +3 -2
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/event_manager.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts +1 -1
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/frame.d.ts.map +1 -1
- package/dist/phaser/core/frame_data.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +8 -6
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +40 -30
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts +3 -2
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts +3 -2
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +6 -4
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts +3 -2
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +4 -3
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +9 -8
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts +3 -2
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/registry.d.ts +7 -0
- package/dist/phaser/core/registry.d.ts.map +1 -0
- package/dist/phaser/core/scale_manager.d.ts +1 -1
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts +0 -1
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts +1 -1
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts +0 -1
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts +4 -3
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +6 -4
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +3 -2
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts +5 -4
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts +3 -2
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts +1 -1
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +1 -1
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/timer_event.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts +10 -7
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +3 -2
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_easing.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts +3 -2
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts +3 -2
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts +3 -2
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts +3 -2
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/graphics.d.ts +7 -6
- package/dist/phaser/display/canvas/graphics.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 +10 -8
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +3 -2
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts +2 -2
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +14 -12
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts +8 -5
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts +4 -3
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +13 -10
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_batch.d.ts +3 -2
- package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts +18 -15
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts +12 -10
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts +0 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +4 -3
- 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 +2 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +7 -6
- 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/render_texture.d.ts +4 -2
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts +16 -11
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts +16 -6
- package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts +19 -7
- package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts +33 -12
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts +15 -6
- package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts +15 -6
- package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts +16 -11
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts +29 -20
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts +12 -10
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts +3 -2
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts +4 -1
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts +1 -1
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/point.d.ts.map +1 -1
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts +3 -2
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts +2 -2
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/util/math.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/phaser/core/animation.ts +64 -60
- package/src/phaser/core/animation_manager.ts +50 -53
- package/src/phaser/core/animation_parser.ts +9 -9
- package/src/phaser/core/array_set.ts +16 -17
- package/src/phaser/core/cache.ts +92 -93
- package/src/phaser/core/const.ts +1 -1
- package/src/phaser/core/device.ts +24 -29
- package/src/phaser/core/device_util.ts +22 -26
- package/src/phaser/core/dom.ts +54 -65
- package/src/phaser/core/event_manager.ts +64 -94
- package/src/phaser/core/factory.ts +14 -14
- package/src/phaser/core/frame.ts +28 -28
- package/src/phaser/core/frame_data.test.ts +100 -0
- package/src/phaser/core/frame_data.ts +24 -24
- package/src/phaser/core/frame_util.ts +2 -2
- package/src/phaser/core/game.ts +47 -48
- package/src/phaser/core/input.ts +104 -110
- package/src/phaser/core/input_handler.test.ts +113 -0
- package/src/phaser/core/input_handler.ts +199 -218
- package/src/phaser/core/input_mouse.ts +71 -54
- package/src/phaser/core/input_mspointer.ts +52 -39
- package/src/phaser/core/input_pointer.ts +81 -80
- package/src/phaser/core/input_touch.ts +49 -36
- package/src/phaser/core/loader.ts +173 -152
- package/src/phaser/core/loader_parser.ts +39 -57
- package/src/phaser/core/raf.ts +8 -7
- package/src/phaser/core/registry.test.ts +31 -0
- package/src/phaser/core/registry.ts +9 -0
- package/src/phaser/core/scale_manager.ts +156 -152
- package/src/phaser/core/scene.ts +9 -13
- package/src/phaser/core/scene_manager.ts +47 -47
- package/src/phaser/core/signal.test.ts +4 -4
- package/src/phaser/core/signal.ts +41 -52
- package/src/phaser/core/signal_binding.ts +26 -25
- package/src/phaser/core/signal_dispatch.test.ts +180 -0
- package/src/phaser/core/sound.ts +75 -83
- package/src/phaser/core/sound_manager.ts +52 -51
- package/src/phaser/core/sound_sprite.ts +17 -16
- package/src/phaser/core/stage.ts +25 -24
- package/src/phaser/core/time.ts +52 -52
- package/src/phaser/core/timer.test.ts +187 -0
- package/src/phaser/core/timer.ts +82 -69
- package/src/phaser/core/timer_event.ts +10 -10
- package/src/phaser/core/tween.ts +90 -93
- package/src/phaser/core/tween_data.ts +45 -51
- package/src/phaser/core/tween_easing.test.ts +106 -0
- package/src/phaser/core/tween_easing.ts +151 -123
- package/src/phaser/core/tween_manager.ts +19 -18
- package/src/phaser/core/world.ts +4 -3
- package/src/phaser/display/bitmap_text.ts +56 -64
- package/src/phaser/display/button.ts +33 -32
- package/src/phaser/display/canvas/buffer.ts +8 -8
- package/src/phaser/display/canvas/graphics.ts +36 -37
- package/src/phaser/display/canvas/masker.ts +2 -2
- package/src/phaser/display/canvas/pool.test.ts +106 -0
- package/src/phaser/display/canvas/pool.ts +25 -27
- package/src/phaser/display/canvas/renderer.ts +32 -31
- package/src/phaser/display/canvas/tinter.ts +25 -25
- package/src/phaser/display/canvas/util.ts +7 -10
- package/src/phaser/display/display_object.ts +114 -118
- package/src/phaser/display/graphics.ts +121 -119
- package/src/phaser/display/graphics_data.ts +12 -12
- package/src/phaser/display/graphics_data_util.ts +2 -3
- package/src/phaser/display/group.ts +50 -57
- package/src/phaser/display/image.ts +55 -52
- package/src/phaser/display/sprite_batch.ts +3 -2
- package/src/phaser/display/sprite_util.ts +48 -54
- package/src/phaser/display/text.test.ts +110 -0
- package/src/phaser/display/text.ts +199 -204
- package/src/phaser/display/webgl/abstract_filter.ts +9 -9
- package/src/phaser/display/webgl/base_texture.ts +21 -24
- package/src/phaser/display/webgl/blend_manager.ts +6 -10
- package/src/phaser/display/webgl/earcut.ts +73 -37
- package/src/phaser/display/webgl/earcut_node.ts +10 -10
- package/src/phaser/display/webgl/fast_sprite_batch.ts +34 -34
- package/src/phaser/display/webgl/filter_manager.ts +13 -12
- package/src/phaser/display/webgl/filter_texture.ts +14 -13
- package/src/phaser/display/webgl/graphics.ts +51 -57
- package/src/phaser/display/webgl/graphics_data.ts +15 -14
- package/src/phaser/display/webgl/mask_manager.ts +2 -2
- package/src/phaser/display/webgl/render_texture.ts +26 -25
- package/src/phaser/display/webgl/renderer.ts +57 -62
- package/src/phaser/display/webgl/shader/complex.ts +28 -12
- package/src/phaser/display/webgl/shader/fast.ts +30 -12
- package/src/phaser/display/webgl/shader/normal.ts +70 -57
- package/src/phaser/display/webgl/shader/primitive.ts +26 -11
- package/src/phaser/display/webgl/shader/shader.test.ts +148 -0
- package/src/phaser/display/webgl/shader/strip.ts +27 -12
- package/src/phaser/display/webgl/shader_manager.test.ts +124 -0
- package/src/phaser/display/webgl/shader_manager.ts +26 -34
- package/src/phaser/display/webgl/sprite_batch.ts +67 -61
- package/src/phaser/display/webgl/stencil_manager.ts +23 -34
- package/src/phaser/display/webgl/texture.ts +43 -50
- package/src/phaser/display/webgl/texture_util.ts +2 -3
- package/src/phaser/display/webgl/util.ts +26 -25
- package/src/phaser/geom/circle.test.ts +2 -3
- package/src/phaser/geom/circle.ts +36 -36
- package/src/phaser/geom/ellipse.test.ts +73 -71
- package/src/phaser/geom/ellipse.ts +14 -14
- package/src/phaser/geom/line.test.ts +5 -5
- package/src/phaser/geom/line.ts +35 -35
- package/src/phaser/geom/matrix.test.ts +1 -1
- package/src/phaser/geom/matrix.ts +27 -27
- package/src/phaser/geom/point.test.ts +1 -2
- package/src/phaser/geom/point.ts +35 -35
- package/src/phaser/geom/polygon.test.ts +82 -0
- package/src/phaser/geom/polygon.ts +16 -16
- package/src/phaser/geom/rectangle.test.ts +14 -14
- package/src/phaser/geom/rectangle.ts +83 -75
- package/src/phaser/geom/rounded_rectangle.test.ts +1 -7
- package/src/phaser/geom/rounded_rectangle.ts +9 -9
- package/src/phaser/geom/util/circle.test.ts +25 -23
- package/src/phaser/geom/util/circle.ts +9 -18
- package/src/phaser/geom/util/ellipse.test.ts +7 -5
- package/src/phaser/geom/util/ellipse.ts +3 -2
- package/src/phaser/geom/util/line.test.ts +10 -8
- package/src/phaser/geom/util/line.ts +6 -16
- package/src/phaser/geom/util/matrix.test.ts +20 -18
- package/src/phaser/geom/util/matrix.ts +8 -15
- package/src/phaser/geom/util/point.test.ts +8 -6
- package/src/phaser/geom/util/point.ts +24 -28
- package/src/phaser/geom/util/polygon.test.ts +12 -10
- package/src/phaser/geom/util/polygon.ts +2 -2
- package/src/phaser/geom/util/rectangle.test.ts +10 -8
- package/src/phaser/geom/util/rectangle.ts +18 -37
- package/src/phaser/geom/util/rounded_rectangle.test.ts +11 -9
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
- package/src/phaser/util/math.test.ts +11 -11
- package/src/phaser/util/math.ts +29 -46
|
@@ -2,46 +2,40 @@ import { GROUP } from '../core/const.js';
|
|
|
2
2
|
import { Signal } from '../core/signal.js';
|
|
3
3
|
import { DisplayObject } from './display_object.js';
|
|
4
4
|
import { Image } from './image.js';
|
|
5
|
+
import type { Game } from '../core/game.js';
|
|
5
6
|
|
|
6
7
|
export const SORT_ASCENDING = -1;
|
|
7
8
|
export const SORT_DESCENDING = 1;
|
|
8
9
|
|
|
9
10
|
export class Group extends DisplayObject {
|
|
10
|
-
declare z: number;
|
|
11
|
-
ignoreDestroy!: boolean;
|
|
12
|
-
pendingDestroy!: boolean;
|
|
13
|
-
classType!: Function;
|
|
14
|
-
cursor!: DisplayObject | null;
|
|
15
|
-
inputEnableChildren!: boolean;
|
|
16
|
-
onChildInputDown!: Signal;
|
|
17
|
-
onChildInputUp!: Signal;
|
|
18
|
-
onChildInputOver!: Signal;
|
|
19
|
-
onChildInputOut!: Signal;
|
|
20
|
-
onDestroy!: Signal;
|
|
21
|
-
cursorIndex!: number;
|
|
22
|
-
_sortProperty!: string;
|
|
23
|
-
filters!: object[] | null;
|
|
11
|
+
declare public z: number;
|
|
12
|
+
public ignoreDestroy!: boolean;
|
|
13
|
+
public pendingDestroy!: boolean;
|
|
14
|
+
public classType!: Function;
|
|
15
|
+
public cursor!: DisplayObject | null;
|
|
16
|
+
public inputEnableChildren!: boolean;
|
|
17
|
+
public onChildInputDown!: Signal;
|
|
18
|
+
public onChildInputUp!: Signal;
|
|
19
|
+
public onChildInputOver!: Signal;
|
|
20
|
+
public onChildInputOut!: Signal;
|
|
21
|
+
public onDestroy!: Signal;
|
|
22
|
+
public cursorIndex!: number;
|
|
23
|
+
public _sortProperty!: string;
|
|
24
|
+
public filters!: object[] | null;
|
|
24
25
|
/**
|
|
25
26
|
* Creates a new Group object.
|
|
26
|
-
* @param {
|
|
27
|
+
* @param {Game} game - The game instance this group belongs to.
|
|
27
28
|
* @param {DisplayObject} parent - The parent display object.
|
|
28
29
|
* @param {string} name - The name of this group.
|
|
29
30
|
* @param {boolean} addToStage - Whether to add this group to the stage.
|
|
30
31
|
*/
|
|
31
|
-
constructor(
|
|
32
|
-
game: import('../core/game.js').Game,
|
|
33
|
-
parent: DisplayObject | null = null,
|
|
34
|
-
name: string | null = null,
|
|
35
|
-
addToStage: boolean = false
|
|
36
|
-
) {
|
|
32
|
+
public constructor(game: Game, parent: DisplayObject | null = null, name: string | null = null, addToStage = false) {
|
|
37
33
|
super(game);
|
|
38
34
|
/** @type {number} */
|
|
39
35
|
this.type = GROUP;
|
|
40
|
-
|
|
41
|
-
parent = game.world;
|
|
42
|
-
}
|
|
36
|
+
parent ??= game.world;
|
|
43
37
|
/** @type {string} */
|
|
44
|
-
this.name = name
|
|
38
|
+
this.name = name ?? 'group';
|
|
45
39
|
/** @type {number} */
|
|
46
40
|
this.z = 0;
|
|
47
41
|
if (addToStage) {
|
|
@@ -80,7 +74,7 @@ export class Group extends DisplayObject {
|
|
|
80
74
|
* @param {boolean} destroyChildren - Whether to destroy children as well.
|
|
81
75
|
* @param {boolean} soft - Whether to perform a soft destroy (leaving the group in the parent's children list).
|
|
82
76
|
*/
|
|
83
|
-
override destroy(destroyChildren
|
|
77
|
+
public override destroy(destroyChildren = true, soft = false) {
|
|
84
78
|
if (this.game === null || this.ignoreDestroy) {
|
|
85
79
|
return;
|
|
86
80
|
}
|
|
@@ -106,7 +100,7 @@ export class Group extends DisplayObject {
|
|
|
106
100
|
* @param {number} index - The index to add the child at.
|
|
107
101
|
* @returns {T} The added child.
|
|
108
102
|
*/
|
|
109
|
-
add<T extends DisplayObject>(child: T, silent
|
|
103
|
+
public add<T extends DisplayObject>(child: T, silent = false, index = -1): T {
|
|
110
104
|
if (child.parent === this) {
|
|
111
105
|
return child;
|
|
112
106
|
}
|
|
@@ -124,9 +118,7 @@ export class Group extends DisplayObject {
|
|
|
124
118
|
if (!silent && child.events) {
|
|
125
119
|
child.events.onAddedToGroup$dispatch(child, this);
|
|
126
120
|
}
|
|
127
|
-
|
|
128
|
-
this.cursor = child;
|
|
129
|
-
}
|
|
121
|
+
this.cursor ??= child;
|
|
130
122
|
return child;
|
|
131
123
|
}
|
|
132
124
|
|
|
@@ -136,7 +128,7 @@ export class Group extends DisplayObject {
|
|
|
136
128
|
* @param {number} index - The index to add the child at.
|
|
137
129
|
* @param {boolean} silent - Whether to dispatch events.
|
|
138
130
|
*/
|
|
139
|
-
addAt(child: DisplayObject, index: number, silent: boolean) {
|
|
131
|
+
public addAt(child: DisplayObject, index: number, silent: boolean) {
|
|
140
132
|
this.add(child, silent, index);
|
|
141
133
|
}
|
|
142
134
|
|
|
@@ -145,7 +137,7 @@ export class Group extends DisplayObject {
|
|
|
145
137
|
* @param {number} index - The index of the child to get.
|
|
146
138
|
* @returns {DisplayObject} The child at the specified index, or -1 if not found.
|
|
147
139
|
*/
|
|
148
|
-
getAt(index: number) {
|
|
140
|
+
public getAt(index: number) {
|
|
149
141
|
if (index < 0 || index >= this.children.length) {
|
|
150
142
|
return -1;
|
|
151
143
|
}
|
|
@@ -155,11 +147,11 @@ export class Group extends DisplayObject {
|
|
|
155
147
|
/**
|
|
156
148
|
* Updates the Z indices of all children in this group.
|
|
157
149
|
*/
|
|
158
|
-
updateZ() {
|
|
150
|
+
public updateZ() {
|
|
159
151
|
let i = this.children.length;
|
|
160
152
|
while (i) {
|
|
161
153
|
i -= 1;
|
|
162
|
-
this.children[i]
|
|
154
|
+
this.children[i]!.z = i;
|
|
163
155
|
}
|
|
164
156
|
}
|
|
165
157
|
|
|
@@ -167,7 +159,7 @@ export class Group extends DisplayObject {
|
|
|
167
159
|
* Gets the next child in this group (with circular wrapping).
|
|
168
160
|
* @returns {DisplayObject} The next child, or null if no children exist.
|
|
169
161
|
*/
|
|
170
|
-
next() {
|
|
162
|
+
public next() {
|
|
171
163
|
if (this.cursor) {
|
|
172
164
|
// Wrap the cursor?
|
|
173
165
|
if (this.cursorIndex >= this.children.length - 1) {
|
|
@@ -175,7 +167,7 @@ export class Group extends DisplayObject {
|
|
|
175
167
|
} else {
|
|
176
168
|
this.cursorIndex += 1;
|
|
177
169
|
}
|
|
178
|
-
this.cursor = this.children[this.cursorIndex];
|
|
170
|
+
this.cursor = this.children[this.cursorIndex] ?? null;
|
|
179
171
|
return this.cursor;
|
|
180
172
|
}
|
|
181
173
|
return null;
|
|
@@ -185,7 +177,7 @@ export class Group extends DisplayObject {
|
|
|
185
177
|
* Gets the previous child in this group (with circular wrapping).
|
|
186
178
|
* @returns {DisplayObject} The previous child, or null if no children exist.
|
|
187
179
|
*/
|
|
188
|
-
previous() {
|
|
180
|
+
public previous() {
|
|
189
181
|
if (this.cursor) {
|
|
190
182
|
// Wrap the cursor?
|
|
191
183
|
if (this.cursorIndex === 0) {
|
|
@@ -193,7 +185,7 @@ export class Group extends DisplayObject {
|
|
|
193
185
|
} else {
|
|
194
186
|
this.cursorIndex -= 1;
|
|
195
187
|
}
|
|
196
|
-
this.cursor = this.children[this.cursorIndex];
|
|
188
|
+
this.cursor = this.children[this.cursorIndex] ?? null;
|
|
197
189
|
return this.cursor;
|
|
198
190
|
}
|
|
199
191
|
return null;
|
|
@@ -204,7 +196,7 @@ export class Group extends DisplayObject {
|
|
|
204
196
|
* @param {DisplayObject} child1 - The first child to swap.
|
|
205
197
|
* @param {DisplayObject} child2 - The second child to swap.
|
|
206
198
|
*/
|
|
207
|
-
swap(child1: DisplayObject, child2: DisplayObject) {
|
|
199
|
+
public swap(child1: DisplayObject, child2: DisplayObject) {
|
|
208
200
|
this.swapChildren(child1, child2);
|
|
209
201
|
this.updateZ();
|
|
210
202
|
}
|
|
@@ -214,7 +206,7 @@ export class Group extends DisplayObject {
|
|
|
214
206
|
* @param {DisplayObject} child - The child to bring to the top.
|
|
215
207
|
* @returns {DisplayObject} The child that was brought to the top.
|
|
216
208
|
*/
|
|
217
|
-
bringToTop(child: DisplayObject) {
|
|
209
|
+
public bringToTop(child: DisplayObject) {
|
|
218
210
|
if (child.parent === this && this.getIndex(child) < this.children.length) {
|
|
219
211
|
this.remove(child, false, true);
|
|
220
212
|
this.add(child, true);
|
|
@@ -227,7 +219,7 @@ export class Group extends DisplayObject {
|
|
|
227
219
|
* @param {DisplayObject} child - The child to send to the back.
|
|
228
220
|
* @returns {DisplayObject} The child that was sent to the back.
|
|
229
221
|
*/
|
|
230
|
-
sendToBack(child: DisplayObject) {
|
|
222
|
+
public sendToBack(child: DisplayObject) {
|
|
231
223
|
if (child.parent === this && this.getIndex(child) > 0) {
|
|
232
224
|
this.remove(child, false, true);
|
|
233
225
|
this.addAt(child, 0, true);
|
|
@@ -238,7 +230,7 @@ export class Group extends DisplayObject {
|
|
|
238
230
|
/**
|
|
239
231
|
* Reverses the order of children in this group.
|
|
240
232
|
*/
|
|
241
|
-
reverse() {
|
|
233
|
+
public reverse() {
|
|
242
234
|
this.children.reverse();
|
|
243
235
|
this.updateZ();
|
|
244
236
|
}
|
|
@@ -248,14 +240,14 @@ export class Group extends DisplayObject {
|
|
|
248
240
|
* @param {DisplayObject} child - The child to get the index of.
|
|
249
241
|
* @returns {number} The index of the child, or -1 if not found.
|
|
250
242
|
*/
|
|
251
|
-
getIndex(child: DisplayObject) {
|
|
243
|
+
public getIndex(child: DisplayObject) {
|
|
252
244
|
return this.children.indexOf(child);
|
|
253
245
|
}
|
|
254
246
|
|
|
255
247
|
/**
|
|
256
248
|
* Updates the Z indices of all children in this group before the update cycle.
|
|
257
249
|
*/
|
|
258
|
-
override preUpdate() {
|
|
250
|
+
public override preUpdate() {
|
|
259
251
|
if (this.pendingDestroy) {
|
|
260
252
|
this.destroy();
|
|
261
253
|
return;
|
|
@@ -264,28 +256,28 @@ export class Group extends DisplayObject {
|
|
|
264
256
|
this.renderOrderID = -1;
|
|
265
257
|
return;
|
|
266
258
|
}
|
|
267
|
-
for (
|
|
268
|
-
|
|
259
|
+
for (const child of this.children) {
|
|
260
|
+
child.preUpdate();
|
|
269
261
|
}
|
|
270
262
|
}
|
|
271
263
|
|
|
272
264
|
/**
|
|
273
265
|
* Updates all children in this group during the update cycle.
|
|
274
266
|
*/
|
|
275
|
-
override update() {
|
|
267
|
+
public override update() {
|
|
276
268
|
let i = this.children.length;
|
|
277
269
|
while (i) {
|
|
278
270
|
i -= 1;
|
|
279
|
-
this.children[i]
|
|
271
|
+
this.children[i]!.update();
|
|
280
272
|
}
|
|
281
273
|
}
|
|
282
274
|
|
|
283
275
|
/**
|
|
284
276
|
* Updates all children in this group after the update cycle.
|
|
285
277
|
*/
|
|
286
|
-
override postUpdate() {
|
|
287
|
-
for (
|
|
288
|
-
|
|
278
|
+
public override postUpdate() {
|
|
279
|
+
for (const child of this.children) {
|
|
280
|
+
child.postUpdate();
|
|
289
281
|
}
|
|
290
282
|
}
|
|
291
283
|
|
|
@@ -296,8 +288,8 @@ export class Group extends DisplayObject {
|
|
|
296
288
|
* @param {boolean} silent - Whether to dispatch events.
|
|
297
289
|
* @returns {boolean} True if the child was removed, false otherwise.
|
|
298
290
|
*/
|
|
299
|
-
remove(child: any, destroy
|
|
300
|
-
if (this.children.length === 0 || this.children.
|
|
291
|
+
public remove(child: any, destroy = true, silent = false) {
|
|
292
|
+
if (this.children.length === 0 || !this.children.includes(child)) {
|
|
301
293
|
return false;
|
|
302
294
|
}
|
|
303
295
|
if (!silent && child.events && !child.destroyPhase) {
|
|
@@ -320,15 +312,16 @@ export class Group extends DisplayObject {
|
|
|
320
312
|
* @param {boolean} silent - Whether to dispatch events.
|
|
321
313
|
* @param {boolean} destroyTexture - Whether to destroy textures as well.
|
|
322
314
|
*/
|
|
323
|
-
removeAll(destroy
|
|
315
|
+
public removeAll(destroy = true, silent = false, destroyTexture = false) {
|
|
324
316
|
if (this.children.length === 0) {
|
|
325
317
|
return;
|
|
326
318
|
}
|
|
327
319
|
do {
|
|
328
|
-
|
|
329
|
-
|
|
320
|
+
const first = this.children[0]!;
|
|
321
|
+
if (!silent && first.events) {
|
|
322
|
+
first.events.onRemovedFromGroup$dispatch(first, this);
|
|
330
323
|
}
|
|
331
|
-
const removed = this.removeChild(
|
|
324
|
+
const removed = this.removeChild(first);
|
|
332
325
|
if (destroy && removed) {
|
|
333
326
|
(removed as any).destroy(true, destroyTexture);
|
|
334
327
|
}
|
|
@@ -6,37 +6,40 @@ import { clone } from '../geom/util/rectangle.js';
|
|
|
6
6
|
import { DisplayObject } from './display_object.js';
|
|
7
7
|
import { getBounds, getLocalBounds, renderCanvas, renderWebGL, setTexture } from './sprite_util.js';
|
|
8
8
|
import { Texture } from './webgl/texture.js';
|
|
9
|
+
import type { Game } from '../core/game.js';
|
|
10
|
+
import type { Frame } from '../core/frame.js';
|
|
11
|
+
import type { Matrix } from '../geom/matrix.js';
|
|
9
12
|
|
|
10
13
|
export class Image extends DisplayObject {
|
|
11
|
-
key!: any;
|
|
12
|
-
texture!: Texture;
|
|
13
|
-
declare _width: number;
|
|
14
|
-
declare _height: number;
|
|
15
|
-
tint!: number;
|
|
16
|
-
cachedTint!: number;
|
|
17
|
-
tilingTexture!: Texture | null;
|
|
18
|
-
tintedTexture!: Texture | null;
|
|
19
|
-
blendMode!: number;
|
|
20
|
-
shader!: object | null;
|
|
21
|
-
_frame!: any;
|
|
22
|
-
pendingDestroy!: boolean;
|
|
23
|
-
declare events: EventManager;
|
|
24
|
-
animations!: AnimationManager;
|
|
25
|
-
customRender!: boolean;
|
|
26
|
-
cropRect!: Rectangle | null;
|
|
27
|
-
_crop!: Rectangle | null;
|
|
28
|
-
refreshTexture!: boolean;
|
|
29
|
-
declare renderOrderID: number;
|
|
14
|
+
public key!: any;
|
|
15
|
+
public texture!: Texture;
|
|
16
|
+
declare public _width: number;
|
|
17
|
+
declare public _height: number;
|
|
18
|
+
public tint!: number;
|
|
19
|
+
public cachedTint!: number;
|
|
20
|
+
public tilingTexture!: Texture | null;
|
|
21
|
+
public tintedTexture!: Texture | null;
|
|
22
|
+
public blendMode!: number;
|
|
23
|
+
public shader!: object | null;
|
|
24
|
+
public _frame!: any;
|
|
25
|
+
public pendingDestroy!: boolean;
|
|
26
|
+
declare public events: EventManager;
|
|
27
|
+
public animations!: AnimationManager;
|
|
28
|
+
public customRender!: boolean;
|
|
29
|
+
public cropRect!: Rectangle | null;
|
|
30
|
+
public _crop!: Rectangle | null;
|
|
31
|
+
public refreshTexture!: boolean;
|
|
32
|
+
declare public renderOrderID: number;
|
|
30
33
|
/**
|
|
31
34
|
* Creates a new Image instance.
|
|
32
|
-
* @param {
|
|
35
|
+
* @param {Game} game - The game instance this image belongs to.
|
|
33
36
|
* @param {number} x - The x position of the image.
|
|
34
37
|
* @param {number} y - The y position of the image.
|
|
35
38
|
* @param {string | number | Texture} key - The texture key or texture to use.
|
|
36
39
|
* @param {string | number} frame - The frame identifier (name or index) to use.
|
|
37
40
|
*/
|
|
38
|
-
constructor(
|
|
39
|
-
game:
|
|
41
|
+
public constructor(
|
|
42
|
+
game: Game,
|
|
40
43
|
x: number,
|
|
41
44
|
y: number,
|
|
42
45
|
key: string | number | Texture | null,
|
|
@@ -49,7 +52,7 @@ export class Image extends DisplayObject {
|
|
|
49
52
|
this.renderable = true;
|
|
50
53
|
/** @type {string | number | Texture} */
|
|
51
54
|
this.key = key;
|
|
52
|
-
this.texture =
|
|
55
|
+
this.texture = globalThis.PhaserRegistry.CACHE_MISSING_IMAGE;
|
|
53
56
|
/** @type {object} */
|
|
54
57
|
this.data = {};
|
|
55
58
|
/** @type {number} */
|
|
@@ -84,7 +87,7 @@ export class Image extends DisplayObject {
|
|
|
84
87
|
/**
|
|
85
88
|
* Destroys this image and cleans up resources.
|
|
86
89
|
*/
|
|
87
|
-
override destroy() {
|
|
90
|
+
public override destroy() {
|
|
88
91
|
this.game = null!;
|
|
89
92
|
this.key = null;
|
|
90
93
|
this.data = null;
|
|
@@ -108,7 +111,7 @@ export class Image extends DisplayObject {
|
|
|
108
111
|
/**
|
|
109
112
|
* Called before the update cycle for this image.
|
|
110
113
|
*/
|
|
111
|
-
override preUpdate() {
|
|
114
|
+
public override preUpdate() {
|
|
112
115
|
if (this.pendingDestroy) {
|
|
113
116
|
this.destroy();
|
|
114
117
|
return;
|
|
@@ -124,8 +127,8 @@ export class Image extends DisplayObject {
|
|
|
124
127
|
if (this.animations) {
|
|
125
128
|
this.animations.update();
|
|
126
129
|
}
|
|
127
|
-
for (
|
|
128
|
-
|
|
130
|
+
for (const child of this.children) {
|
|
131
|
+
child.preUpdate();
|
|
129
132
|
}
|
|
130
133
|
}
|
|
131
134
|
|
|
@@ -137,12 +140,12 @@ export class Image extends DisplayObject {
|
|
|
137
140
|
* @param {string | number | null | undefined} frame - The frame identifier (name or index) to use.
|
|
138
141
|
* @param {boolean} stopAnimation - Whether to stop the animation when changing textures.
|
|
139
142
|
*/
|
|
140
|
-
loadTexture(key: string | number | Texture | null, frame: string | number | null = 0, stopAnimation
|
|
143
|
+
public loadTexture(key: string | number | Texture | null, frame: string | number | null = 0, stopAnimation = true) {
|
|
141
144
|
if (key === PENDING_ATLAS) {
|
|
142
145
|
key = frame ?? 0;
|
|
143
146
|
frame = 0;
|
|
144
147
|
} else {
|
|
145
|
-
frame = frame
|
|
148
|
+
frame = frame ?? 0;
|
|
146
149
|
}
|
|
147
150
|
if (stopAnimation) {
|
|
148
151
|
this.animations.stop();
|
|
@@ -177,9 +180,9 @@ export class Image extends DisplayObject {
|
|
|
177
180
|
|
|
178
181
|
/**
|
|
179
182
|
* Sets the current frame of this image.
|
|
180
|
-
* @param {
|
|
183
|
+
* @param {Frame} frame - The frame to set.
|
|
181
184
|
*/
|
|
182
|
-
setFrame(frame:
|
|
185
|
+
public setFrame(frame: Frame) {
|
|
183
186
|
this._frame = frame;
|
|
184
187
|
this.texture.frame.x = frame.x;
|
|
185
188
|
this.texture.frame.y = frame.y;
|
|
@@ -226,7 +229,7 @@ export class Image extends DisplayObject {
|
|
|
226
229
|
* @param {number} width - The new width of the frame.
|
|
227
230
|
* @param {number} height - The new height of the frame.
|
|
228
231
|
*/
|
|
229
|
-
resizeFrame(_parent: DisplayObject, width: number, height: number) {
|
|
232
|
+
public resizeFrame(_parent: DisplayObject, width: number, height: number) {
|
|
230
233
|
this.texture.frame.resize(width, height);
|
|
231
234
|
this.texture.setFrame(this.texture.frame);
|
|
232
235
|
}
|
|
@@ -234,7 +237,7 @@ export class Image extends DisplayObject {
|
|
|
234
237
|
/**
|
|
235
238
|
* Resets the frame of this image to its original frame.
|
|
236
239
|
*/
|
|
237
|
-
resetFrame() {
|
|
240
|
+
public resetFrame() {
|
|
238
241
|
if (this._frame) {
|
|
239
242
|
this.setFrame(this._frame);
|
|
240
243
|
}
|
|
@@ -244,7 +247,7 @@ export class Image extends DisplayObject {
|
|
|
244
247
|
* Gets the current frame index of this image.
|
|
245
248
|
* @returns {number} The current frame index.
|
|
246
249
|
*/
|
|
247
|
-
get frame() {
|
|
250
|
+
public get frame() {
|
|
248
251
|
return this.animations.frame;
|
|
249
252
|
}
|
|
250
253
|
|
|
@@ -252,7 +255,7 @@ export class Image extends DisplayObject {
|
|
|
252
255
|
* Sets the current frame index of this image.
|
|
253
256
|
* @param {number} value - The new frame index to set.
|
|
254
257
|
*/
|
|
255
|
-
set frame(value: number) {
|
|
258
|
+
public set frame(value: number) {
|
|
256
259
|
this.animations.frame = value;
|
|
257
260
|
}
|
|
258
261
|
|
|
@@ -260,7 +263,7 @@ export class Image extends DisplayObject {
|
|
|
260
263
|
* Gets the current frame name of this image.
|
|
261
264
|
* @returns {string} The current frame name.
|
|
262
265
|
*/
|
|
263
|
-
get frameName() {
|
|
266
|
+
public get frameName() {
|
|
264
267
|
return this.animations.frameName;
|
|
265
268
|
}
|
|
266
269
|
|
|
@@ -268,7 +271,7 @@ export class Image extends DisplayObject {
|
|
|
268
271
|
* Sets the current frame name of this image.
|
|
269
272
|
* @param {string} value - The new frame name to set.
|
|
270
273
|
*/
|
|
271
|
-
set frameName(value: string) {
|
|
274
|
+
public set frameName(value: string) {
|
|
272
275
|
this.animations.frameName = value;
|
|
273
276
|
}
|
|
274
277
|
|
|
@@ -279,7 +282,7 @@ export class Image extends DisplayObject {
|
|
|
279
282
|
* @param {Rectangle} rect - The rectangle to crop to.
|
|
280
283
|
* @param {boolean} copy - Whether to copy the rect or use it directly.
|
|
281
284
|
*/
|
|
282
|
-
crop(rect: Rectangle, copy
|
|
285
|
+
public crop(rect: Rectangle, copy = false) {
|
|
283
286
|
if (rect) {
|
|
284
287
|
if (copy && this.cropRect !== null) {
|
|
285
288
|
this.cropRect.setTo(rect.x, rect.y, rect.width, rect.height);
|
|
@@ -299,7 +302,7 @@ export class Image extends DisplayObject {
|
|
|
299
302
|
/**
|
|
300
303
|
* Updates the crop rectangle of this image.
|
|
301
304
|
*/
|
|
302
|
-
updateCrop() {
|
|
305
|
+
public updateCrop() {
|
|
303
306
|
if (!this.cropRect) {
|
|
304
307
|
return;
|
|
305
308
|
}
|
|
@@ -332,7 +335,7 @@ export class Image extends DisplayObject {
|
|
|
332
335
|
* Gets the width of this image.
|
|
333
336
|
* @returns {number} The width in pixels.
|
|
334
337
|
*/
|
|
335
|
-
override get width() {
|
|
338
|
+
public override get width() {
|
|
336
339
|
return this.scale.x * this.texture.frame.width;
|
|
337
340
|
}
|
|
338
341
|
|
|
@@ -340,7 +343,7 @@ export class Image extends DisplayObject {
|
|
|
340
343
|
* Sets the width of this image.
|
|
341
344
|
* @param {number} value - The new width in pixels.
|
|
342
345
|
*/
|
|
343
|
-
override set width(value: number) {
|
|
346
|
+
public override set width(value: number) {
|
|
344
347
|
this.scale.x = value / this.texture.frame.width;
|
|
345
348
|
this._width = value;
|
|
346
349
|
}
|
|
@@ -349,7 +352,7 @@ export class Image extends DisplayObject {
|
|
|
349
352
|
* Gets the height of this image.
|
|
350
353
|
* @returns {number} The height in pixels.
|
|
351
354
|
*/
|
|
352
|
-
override get height() {
|
|
355
|
+
public override get height() {
|
|
353
356
|
return this.scale.y * this.texture.frame.height;
|
|
354
357
|
}
|
|
355
358
|
|
|
@@ -357,7 +360,7 @@ export class Image extends DisplayObject {
|
|
|
357
360
|
* Sets the height of this image.
|
|
358
361
|
* @param {number} value - The new height in pixels.
|
|
359
362
|
*/
|
|
360
|
-
override set height(value: number) {
|
|
363
|
+
public override set height(value: number) {
|
|
361
364
|
this.scale.y = value / this.texture.frame.height;
|
|
362
365
|
this._height = value;
|
|
363
366
|
}
|
|
@@ -365,7 +368,7 @@ export class Image extends DisplayObject {
|
|
|
365
368
|
/**
|
|
366
369
|
* Called when the texture of this image is updated.
|
|
367
370
|
*/
|
|
368
|
-
onTextureUpdate() {
|
|
371
|
+
public onTextureUpdate() {
|
|
369
372
|
// So if _width is 0 then width was not set..
|
|
370
373
|
if (this._width) {
|
|
371
374
|
this.scale.x = this._width / this.texture.frame.width;
|
|
@@ -380,16 +383,16 @@ export class Image extends DisplayObject {
|
|
|
380
383
|
* @param {Texture} texture - The new texture to set.
|
|
381
384
|
* @param {boolean} destroyBase - Whether to destroy the base texture.
|
|
382
385
|
*/
|
|
383
|
-
setTexture(texture: Texture, destroyBase
|
|
386
|
+
public setTexture(texture: Texture, destroyBase = false) {
|
|
384
387
|
setTexture(this, texture, destroyBase);
|
|
385
388
|
}
|
|
386
389
|
|
|
387
390
|
/**
|
|
388
391
|
* Gets the bounds of this image.
|
|
389
|
-
* @param {
|
|
392
|
+
* @param {Matrix} matrix - The transformation matrix to use.
|
|
390
393
|
* @returns {Rectangle} The bounds rectangle of this image.
|
|
391
394
|
*/
|
|
392
|
-
override getBounds(matrix:
|
|
395
|
+
public override getBounds(matrix: Matrix | null = null) {
|
|
393
396
|
return getBounds(this, matrix);
|
|
394
397
|
}
|
|
395
398
|
|
|
@@ -397,25 +400,25 @@ export class Image extends DisplayObject {
|
|
|
397
400
|
* Gets the local bounds of this image.
|
|
398
401
|
* @returns {Rectangle} The local bounds rectangle of this image.
|
|
399
402
|
*/
|
|
400
|
-
override getLocalBounds() {
|
|
403
|
+
public override getLocalBounds() {
|
|
401
404
|
return getLocalBounds(this);
|
|
402
405
|
}
|
|
403
406
|
|
|
404
407
|
/**
|
|
405
408
|
* Renders this image using WebGL.
|
|
406
409
|
* @param {object} renderSession - The WebGL rendering session.
|
|
407
|
-
* @param {
|
|
410
|
+
* @param {Matrix} matrix - The transformation matrix to use.
|
|
408
411
|
*/
|
|
409
|
-
override renderWebGL(renderSession: any, matrix:
|
|
412
|
+
public override renderWebGL(renderSession: any, matrix: Matrix | null = null) {
|
|
410
413
|
renderWebGL(this, renderSession, matrix);
|
|
411
414
|
}
|
|
412
415
|
|
|
413
416
|
/**
|
|
414
417
|
* Renders this image using Canvas.
|
|
415
418
|
* @param {object} renderSession - The Canvas rendering session.
|
|
416
|
-
* @param {
|
|
419
|
+
* @param {Matrix} matrix - The transformation matrix to use.
|
|
417
420
|
*/
|
|
418
|
-
override renderCanvas(renderSession: any, matrix:
|
|
421
|
+
public override renderCanvas(renderSession: any, matrix: Matrix | null = null) {
|
|
419
422
|
renderCanvas(this, renderSession, matrix);
|
|
420
423
|
}
|
|
421
424
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { DisplayObject } from './display_object.js';
|
|
2
|
+
import type { Game } from '../core/game.js';
|
|
2
3
|
|
|
3
4
|
export class SpriteBatch extends DisplayObject {
|
|
4
5
|
/**
|
|
5
6
|
* Creates a new SpriteBatch object.
|
|
6
|
-
* @param {
|
|
7
|
+
* @param {Game} game - The game instance.
|
|
7
8
|
*/
|
|
8
|
-
constructor(game:
|
|
9
|
+
public constructor(game: Game) {
|
|
9
10
|
super(game);
|
|
10
11
|
}
|
|
11
12
|
}
|