@vpmedia/phaser 1.104.0 → 1.106.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.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +164 -592
- 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 +38 -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 +13 -13
- package/src/index.ts +8 -0
- package/src/phaser/core/animation.ts +46 -61
- package/src/phaser/core/animation_manager.ts +27 -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 +24 -25
- 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 +72 -68
- package/src/phaser/core/input_handler.ts +93 -84
- 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 +108 -70
- package/src/phaser/core/loader_parser.ts +24 -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 +16 -10
- package/src/phaser/core/signal_binding.ts +9 -2
- package/src/phaser/core/sound.ts +71 -112
- package/src/phaser/core/sound_manager.ts +31 -30
- package/src/phaser/core/sound_sprite.ts +11 -12
- package/src/phaser/core/stage.ts +8 -8
- package/src/phaser/core/time.ts +34 -35
- package/src/phaser/core/timer.ts +40 -34
- package/src/phaser/core/timer_event.ts +23 -23
- package/src/phaser/core/tween.ts +62 -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 +11 -12
- package/src/phaser/core/world.ts +1 -2
- package/src/phaser/display/bitmap_text.ts +41 -31
- package/src/phaser/display/button.ts +34 -49
- 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 +17 -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 +19 -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 +38 -52
- package/src/phaser/display/sprite_batch.ts +1 -2
- package/src/phaser/display/sprite_util.ts +17 -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 +44 -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 +17 -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 +18 -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 +20 -8
- package/src/phaser/display/webgl/texture.ts +40 -24
- package/src/phaser/display/webgl/texture_util.ts +2 -3
- package/src/phaser/display/webgl/util.ts +10 -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 +27 -20
- package/src/phaser/geom/util/polygon.ts +1 -1
- package/src/phaser/geom/util/rectangle.ts +22 -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 { GROUP } from '../core/const.js';
|
|
3
2
|
import { Signal } from '../core/signal.js';
|
|
4
3
|
import { DisplayObject } from './display_object.js';
|
|
@@ -8,34 +7,20 @@ export const SORT_ASCENDING = -1;
|
|
|
8
7
|
export const SORT_DESCENDING = 1;
|
|
9
8
|
|
|
10
9
|
export class Group extends DisplayObject {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/** @type {Signal} */
|
|
26
|
-
onChildInputUp;
|
|
27
|
-
/** @type {Signal} */
|
|
28
|
-
onChildInputOver;
|
|
29
|
-
/** @type {Signal} */
|
|
30
|
-
onChildInputOut;
|
|
31
|
-
/** @type {Signal} */
|
|
32
|
-
onDestroy;
|
|
33
|
-
/** @type {number} */
|
|
34
|
-
cursorIndex;
|
|
35
|
-
/** @type {string} */
|
|
36
|
-
_sortProperty;
|
|
37
|
-
/** @type {object[] | null} */
|
|
38
|
-
filters;
|
|
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;
|
|
39
24
|
/**
|
|
40
25
|
* Creates a new Group object.
|
|
41
26
|
* @param {import('../core/game.js').Game} game - The game instance this group belongs to.
|
|
@@ -43,7 +28,12 @@ export class Group extends DisplayObject {
|
|
|
43
28
|
* @param {string} name - The name of this group.
|
|
44
29
|
* @param {boolean} addToStage - Whether to add this group to the stage.
|
|
45
30
|
*/
|
|
46
|
-
constructor(
|
|
31
|
+
constructor(
|
|
32
|
+
game: import('../core/game.js').Game,
|
|
33
|
+
parent: DisplayObject = null,
|
|
34
|
+
name: string = null,
|
|
35
|
+
addToStage: boolean = false
|
|
36
|
+
) {
|
|
47
37
|
super(game);
|
|
48
38
|
/** @type {number} */
|
|
49
39
|
this.type = GROUP;
|
|
@@ -90,7 +80,7 @@ export class Group extends DisplayObject {
|
|
|
90
80
|
* @param {boolean} destroyChildren - Whether to destroy children as well.
|
|
91
81
|
* @param {boolean} soft - Whether to perform a soft destroy (leaving the group in the parent's children list).
|
|
92
82
|
*/
|
|
93
|
-
destroy(destroyChildren = true, soft = false) {
|
|
83
|
+
destroy(destroyChildren: boolean = true, soft: boolean = false) {
|
|
94
84
|
if (this.game === null || this.ignoreDestroy) {
|
|
95
85
|
return;
|
|
96
86
|
}
|
|
@@ -115,7 +105,7 @@ export class Group extends DisplayObject {
|
|
|
115
105
|
* @param {number} index - The index to add the child at.
|
|
116
106
|
* @returns {DisplayObject} The added child.
|
|
117
107
|
*/
|
|
118
|
-
add(child, silent = false, index = -1) {
|
|
108
|
+
add(child: any, silent: boolean = false, index: number = -1) {
|
|
119
109
|
if (child.parent === this) {
|
|
120
110
|
return child;
|
|
121
111
|
}
|
|
@@ -144,7 +134,7 @@ export class Group extends DisplayObject {
|
|
|
144
134
|
* @param {number} index - The index to add the child at.
|
|
145
135
|
* @param {boolean} silent - Whether to dispatch events.
|
|
146
136
|
*/
|
|
147
|
-
addAt(child, index, silent) {
|
|
137
|
+
addAt(child: DisplayObject, index: number, silent: boolean) {
|
|
148
138
|
this.add(child, silent, index);
|
|
149
139
|
}
|
|
150
140
|
|
|
@@ -153,7 +143,7 @@ export class Group extends DisplayObject {
|
|
|
153
143
|
* @param {number} index - The index of the child to get.
|
|
154
144
|
* @returns {DisplayObject} The child at the specified index, or -1 if not found.
|
|
155
145
|
*/
|
|
156
|
-
getAt(index) {
|
|
146
|
+
getAt(index: number) {
|
|
157
147
|
if (index < 0 || index >= this.children.length) {
|
|
158
148
|
return -1;
|
|
159
149
|
}
|
|
@@ -212,7 +202,7 @@ export class Group extends DisplayObject {
|
|
|
212
202
|
* @param {DisplayObject} child1 - The first child to swap.
|
|
213
203
|
* @param {DisplayObject} child2 - The second child to swap.
|
|
214
204
|
*/
|
|
215
|
-
swap(child1, child2) {
|
|
205
|
+
swap(child1: DisplayObject, child2: DisplayObject) {
|
|
216
206
|
this.swapChildren(child1, child2);
|
|
217
207
|
this.updateZ();
|
|
218
208
|
}
|
|
@@ -222,7 +212,7 @@ export class Group extends DisplayObject {
|
|
|
222
212
|
* @param {DisplayObject} child - The child to bring to the top.
|
|
223
213
|
* @returns {DisplayObject} The child that was brought to the top.
|
|
224
214
|
*/
|
|
225
|
-
bringToTop(child) {
|
|
215
|
+
bringToTop(child: DisplayObject) {
|
|
226
216
|
if (child.parent === this && this.getIndex(child) < this.children.length) {
|
|
227
217
|
this.remove(child, false, true);
|
|
228
218
|
this.add(child, true);
|
|
@@ -235,7 +225,7 @@ export class Group extends DisplayObject {
|
|
|
235
225
|
* @param {DisplayObject} child - The child to send to the back.
|
|
236
226
|
* @returns {DisplayObject} The child that was sent to the back.
|
|
237
227
|
*/
|
|
238
|
-
sendToBack(child) {
|
|
228
|
+
sendToBack(child: DisplayObject) {
|
|
239
229
|
if (child.parent === this && this.getIndex(child) > 0) {
|
|
240
230
|
this.remove(child, false, true);
|
|
241
231
|
this.addAt(child, 0, true);
|
|
@@ -256,7 +246,7 @@ export class Group extends DisplayObject {
|
|
|
256
246
|
* @param {DisplayObject} child - The child to get the index of.
|
|
257
247
|
* @returns {number} The index of the child, or -1 if not found.
|
|
258
248
|
*/
|
|
259
|
-
getIndex(child) {
|
|
249
|
+
getIndex(child: DisplayObject) {
|
|
260
250
|
return this.children.indexOf(child);
|
|
261
251
|
}
|
|
262
252
|
|
|
@@ -304,7 +294,7 @@ export class Group extends DisplayObject {
|
|
|
304
294
|
* @param {boolean} silent - Whether to dispatch events.
|
|
305
295
|
* @returns {boolean} True if the child was removed, false otherwise.
|
|
306
296
|
*/
|
|
307
|
-
remove(child, destroy = true, silent = false) {
|
|
297
|
+
remove(child: any, destroy: boolean = true, silent: boolean = false) {
|
|
308
298
|
if (this.children.length === 0 || this.children.indexOf(child) === -1) {
|
|
309
299
|
return false;
|
|
310
300
|
}
|
|
@@ -317,7 +307,7 @@ export class Group extends DisplayObject {
|
|
|
317
307
|
this.next();
|
|
318
308
|
}
|
|
319
309
|
if (destroy && removed) {
|
|
320
|
-
removed.destroy(true);
|
|
310
|
+
(removed as any).destroy(true);
|
|
321
311
|
}
|
|
322
312
|
return true;
|
|
323
313
|
}
|
|
@@ -328,7 +318,7 @@ export class Group extends DisplayObject {
|
|
|
328
318
|
* @param {boolean} silent - Whether to dispatch events.
|
|
329
319
|
* @param {boolean} destroyTexture - Whether to destroy textures as well.
|
|
330
320
|
*/
|
|
331
|
-
removeAll(destroy = true, silent = false, destroyTexture = false) {
|
|
321
|
+
removeAll(destroy: boolean = true, silent: boolean = false, destroyTexture: boolean = false) {
|
|
332
322
|
if (this.children.length === 0) {
|
|
333
323
|
return;
|
|
334
324
|
}
|
|
@@ -338,7 +328,7 @@ export class Group extends DisplayObject {
|
|
|
338
328
|
}
|
|
339
329
|
const removed = this.removeChild(this.children[0]);
|
|
340
330
|
if (destroy && removed) {
|
|
341
|
-
removed.destroy(true, destroyTexture);
|
|
331
|
+
(removed as any).destroy(true, destroyTexture);
|
|
342
332
|
}
|
|
343
333
|
} while (this.children.length > 0);
|
|
344
334
|
this.cursor = null;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { AnimationManager } from '../core/animation_manager.js';
|
|
3
2
|
import { BLEND_NORMAL, IMAGE, PENDING_ATLAS, SCALE_NEAREST } from '../core/const.js';
|
|
4
3
|
import { EventManager } from '../core/event_manager.js';
|
|
@@ -9,44 +8,25 @@ import { getBounds, getLocalBounds, renderCanvas, renderWebGL, setTexture } from
|
|
|
9
8
|
import { Texture } from './webgl/texture.js';
|
|
10
9
|
|
|
11
10
|
export class Image extends DisplayObject {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
shader;
|
|
32
|
-
/** @type {import('../core/frame.js').Frame | null} */
|
|
33
|
-
_frame;
|
|
34
|
-
/** @type {boolean} */
|
|
35
|
-
pendingDestroy;
|
|
36
|
-
/** @type {EventManager} */
|
|
37
|
-
events;
|
|
38
|
-
/** @type {AnimationManager} */
|
|
39
|
-
animations;
|
|
40
|
-
/** @type {boolean} */
|
|
41
|
-
customRender;
|
|
42
|
-
/** @type {Rectangle | null} */
|
|
43
|
-
cropRect;
|
|
44
|
-
/** @type {Rectangle | null} */
|
|
45
|
-
_crop;
|
|
46
|
-
/** @type {boolean} */
|
|
47
|
-
refreshTexture;
|
|
48
|
-
/** @type {number} */
|
|
49
|
-
renderOrderID;
|
|
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;
|
|
50
30
|
/**
|
|
51
31
|
* Creates a new Image instance.
|
|
52
32
|
* @param {import('../core/game.js').Game} game - The game instance this image belongs to.
|
|
@@ -55,7 +35,13 @@ export class Image extends DisplayObject {
|
|
|
55
35
|
* @param {string | number | Texture} key - The texture key or texture to use.
|
|
56
36
|
* @param {string | number} frame - The frame identifier (name or index) to use.
|
|
57
37
|
*/
|
|
58
|
-
constructor(
|
|
38
|
+
constructor(
|
|
39
|
+
game: import('../core/game.js').Game,
|
|
40
|
+
x: number,
|
|
41
|
+
y: number,
|
|
42
|
+
key: string | number | Texture,
|
|
43
|
+
frame: string | number = 0
|
|
44
|
+
) {
|
|
59
45
|
super(game);
|
|
60
46
|
/** @type {number} */
|
|
61
47
|
this.type = IMAGE;
|
|
@@ -151,7 +137,7 @@ export class Image extends DisplayObject {
|
|
|
151
137
|
* @param {string | number | null | undefined} frame - The frame identifier (name or index) to use.
|
|
152
138
|
* @param {boolean} stopAnimation - Whether to stop the animation when changing textures.
|
|
153
139
|
*/
|
|
154
|
-
loadTexture(key, frame: string | number | null = 0, stopAnimation = true) {
|
|
140
|
+
loadTexture(key: string | number | Texture, frame: string | number | null = 0, stopAnimation: boolean = true) {
|
|
155
141
|
if (key === PENDING_ATLAS) {
|
|
156
142
|
key = frame;
|
|
157
143
|
frame = 0;
|
|
@@ -193,7 +179,7 @@ export class Image extends DisplayObject {
|
|
|
193
179
|
* Sets the current frame of this image.
|
|
194
180
|
* @param {import('../core/frame.js').Frame} frame - The frame to set.
|
|
195
181
|
*/
|
|
196
|
-
setFrame(frame) {
|
|
182
|
+
setFrame(frame: import('../core/frame.js').Frame) {
|
|
197
183
|
this._frame = frame;
|
|
198
184
|
this.texture.frame.x = frame.x;
|
|
199
185
|
this.texture.frame.y = frame.y;
|
|
@@ -240,7 +226,7 @@ export class Image extends DisplayObject {
|
|
|
240
226
|
* @param {number} width - The new width of the frame.
|
|
241
227
|
* @param {number} height - The new height of the frame.
|
|
242
228
|
*/
|
|
243
|
-
resizeFrame(parent, width, height) {
|
|
229
|
+
resizeFrame(parent: DisplayObject, width: number, height: number) {
|
|
244
230
|
this.texture.frame.resize(width, height);
|
|
245
231
|
this.texture.setFrame(this.texture.frame);
|
|
246
232
|
}
|
|
@@ -266,7 +252,7 @@ export class Image extends DisplayObject {
|
|
|
266
252
|
* Sets the current frame index of this image.
|
|
267
253
|
* @param {number} value - The new frame index to set.
|
|
268
254
|
*/
|
|
269
|
-
set frame(value) {
|
|
255
|
+
set frame(value: number) {
|
|
270
256
|
this.animations.frame = value;
|
|
271
257
|
}
|
|
272
258
|
|
|
@@ -282,7 +268,7 @@ export class Image extends DisplayObject {
|
|
|
282
268
|
* Sets the current frame name of this image.
|
|
283
269
|
* @param {string} value - The new frame name to set.
|
|
284
270
|
*/
|
|
285
|
-
set frameName(value) {
|
|
271
|
+
set frameName(value: string) {
|
|
286
272
|
this.animations.frameName = value;
|
|
287
273
|
}
|
|
288
274
|
|
|
@@ -293,7 +279,7 @@ export class Image extends DisplayObject {
|
|
|
293
279
|
* @param {Rectangle} rect - The rectangle to crop to.
|
|
294
280
|
* @param {boolean} copy - Whether to copy the rect or use it directly.
|
|
295
281
|
*/
|
|
296
|
-
crop(rect, copy = false) {
|
|
282
|
+
crop(rect: Rectangle, copy: boolean = false) {
|
|
297
283
|
if (rect) {
|
|
298
284
|
if (copy && this.cropRect !== null) {
|
|
299
285
|
this.cropRect.setTo(rect.x, rect.y, rect.width, rect.height);
|
|
@@ -354,7 +340,7 @@ export class Image extends DisplayObject {
|
|
|
354
340
|
* Sets the width of this image.
|
|
355
341
|
* @param {number} value - The new width in pixels.
|
|
356
342
|
*/
|
|
357
|
-
set width(value) {
|
|
343
|
+
set width(value: number) {
|
|
358
344
|
this.scale.x = value / this.texture.frame.width;
|
|
359
345
|
this._width = value;
|
|
360
346
|
}
|
|
@@ -371,7 +357,7 @@ export class Image extends DisplayObject {
|
|
|
371
357
|
* Sets the height of this image.
|
|
372
358
|
* @param {number} value - The new height in pixels.
|
|
373
359
|
*/
|
|
374
|
-
set height(value) {
|
|
360
|
+
set height(value: number) {
|
|
375
361
|
this.scale.y = value / this.texture.frame.height;
|
|
376
362
|
this._height = value;
|
|
377
363
|
}
|
|
@@ -394,7 +380,7 @@ export class Image extends DisplayObject {
|
|
|
394
380
|
* @param {Texture} texture - The new texture to set.
|
|
395
381
|
* @param {boolean} destroyBase - Whether to destroy the base texture.
|
|
396
382
|
*/
|
|
397
|
-
setTexture(texture, destroyBase = false) {
|
|
383
|
+
setTexture(texture: Texture, destroyBase: boolean = false) {
|
|
398
384
|
setTexture(this, texture, destroyBase);
|
|
399
385
|
}
|
|
400
386
|
|
|
@@ -403,7 +389,7 @@ export class Image extends DisplayObject {
|
|
|
403
389
|
* @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
|
|
404
390
|
* @returns {Rectangle} The bounds rectangle of this image.
|
|
405
391
|
*/
|
|
406
|
-
getBounds(matrix = null) {
|
|
392
|
+
getBounds(matrix: import('../geom/matrix.js').Matrix = null) {
|
|
407
393
|
return getBounds(this, matrix);
|
|
408
394
|
}
|
|
409
395
|
|
|
@@ -420,7 +406,7 @@ export class Image extends DisplayObject {
|
|
|
420
406
|
* @param {object} renderSession - The WebGL rendering session.
|
|
421
407
|
* @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
|
|
422
408
|
*/
|
|
423
|
-
renderWebGL(renderSession, matrix = null) {
|
|
409
|
+
renderWebGL(renderSession: any, matrix: import('../geom/matrix.js').Matrix = null) {
|
|
424
410
|
renderWebGL(this, renderSession, matrix);
|
|
425
411
|
}
|
|
426
412
|
|
|
@@ -429,7 +415,7 @@ export class Image extends DisplayObject {
|
|
|
429
415
|
* @param {object} renderSession - The Canvas rendering session.
|
|
430
416
|
* @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
|
|
431
417
|
*/
|
|
432
|
-
renderCanvas(renderSession, matrix = null) {
|
|
418
|
+
renderCanvas(renderSession: any, matrix: import('../geom/matrix.js').Matrix = null) {
|
|
433
419
|
renderCanvas(this, renderSession, matrix);
|
|
434
420
|
}
|
|
435
421
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { DisplayObject } from './display_object.js';
|
|
3
2
|
|
|
4
3
|
export class SpriteBatch extends DisplayObject {
|
|
@@ -6,7 +5,7 @@ export class SpriteBatch extends DisplayObject {
|
|
|
6
5
|
* Creates a new SpriteBatch object.
|
|
7
6
|
* @param {import('../core/game.js').Game} game - The game instance.
|
|
8
7
|
*/
|
|
9
|
-
constructor(game) {
|
|
8
|
+
constructor(game: import('../core/game.js').Game) {
|
|
10
9
|
super(game);
|
|
11
10
|
}
|
|
12
11
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { SCALE_LINEAR } from '../core/const.js';
|
|
3
2
|
import { getIdentityMatrix } from '../geom/util/matrix.js';
|
|
4
3
|
import { getTintedTexture } from './canvas/tinter.js';
|
|
@@ -9,7 +8,11 @@ import { getTintedTexture } from './canvas/tinter.js';
|
|
|
9
8
|
* @param {import('./webgl/texture.js').Texture} texture - The new texture to set.
|
|
10
9
|
* @param {boolean} destroyBase - Whether to destroy the base texture.
|
|
11
10
|
*/
|
|
12
|
-
export const setTexture = (
|
|
11
|
+
export const setTexture = (
|
|
12
|
+
target: import('./image.js').Image,
|
|
13
|
+
texture: import('./webgl/texture.js').Texture,
|
|
14
|
+
destroyBase: boolean = false
|
|
15
|
+
) => {
|
|
13
16
|
if (destroyBase) {
|
|
14
17
|
target.texture.baseTexture.destroy();
|
|
15
18
|
}
|
|
@@ -25,7 +28,7 @@ export const setTexture = (target, texture, destroyBase = false) => {
|
|
|
25
28
|
* @param {object} matrix - The transformation matrix.
|
|
26
29
|
* @returns {import('../geom/rectangle.js').Rectangle} The bounds rectangle.
|
|
27
30
|
*/
|
|
28
|
-
export const getBounds = (target, matrix = null) => {
|
|
31
|
+
export const getBounds = (target: import('./image.js').Image, matrix: any = null) => {
|
|
29
32
|
// TODO verify
|
|
30
33
|
if (target.currentBounds) {
|
|
31
34
|
return target.currentBounds;
|
|
@@ -107,7 +110,7 @@ export const getBounds = (target, matrix = null) => {
|
|
|
107
110
|
* @param {import('./image.js').Image} target - The target image to get local bounds for.
|
|
108
111
|
* @returns {import('../geom/rectangle.js').Rectangle} The local bounds rectangle.
|
|
109
112
|
*/
|
|
110
|
-
export const getLocalBounds = (target) => {
|
|
113
|
+
export const getLocalBounds = (target: import('./image.js').Image) => {
|
|
111
114
|
const matrixCache = target.worldTransform;
|
|
112
115
|
target.worldTransform = getIdentityMatrix();
|
|
113
116
|
let i;
|
|
@@ -128,7 +131,11 @@ export const getLocalBounds = (target) => {
|
|
|
128
131
|
* @param {object} renderSession - The render session object.
|
|
129
132
|
* @param {import('../geom/matrix.js').Matrix | null | undefined} matrix - The transformation matrix.
|
|
130
133
|
*/
|
|
131
|
-
export const renderWebGL = (
|
|
134
|
+
export const renderWebGL = (
|
|
135
|
+
target: import('./image.js').Image,
|
|
136
|
+
renderSession: any,
|
|
137
|
+
matrix: import('../geom/matrix.js').Matrix | null | undefined = null
|
|
138
|
+
) => {
|
|
132
139
|
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
|
133
140
|
if (!target.visible || target.alpha <= 0 || !target.renderable) {
|
|
134
141
|
return;
|
|
@@ -177,7 +184,11 @@ export const renderWebGL = (target, renderSession, matrix = null) => {
|
|
|
177
184
|
* @param {object} renderSession - The render session object.
|
|
178
185
|
* @param {import('../geom/matrix.js').Matrix | null | undefined} matrix - The transformation matrix.
|
|
179
186
|
*/
|
|
180
|
-
export const renderCanvas = (
|
|
187
|
+
export const renderCanvas = (
|
|
188
|
+
target: import('./image.js').Image,
|
|
189
|
+
renderSession: any,
|
|
190
|
+
matrix: import('../geom/matrix.js').Matrix | null | undefined = null
|
|
191
|
+
) => {
|
|
181
192
|
// If the sprite is not visible or the alpha is 0 then no need to render this element
|
|
182
193
|
if (
|
|
183
194
|
!target.visible ||
|