@vpmedia/phaser 1.14.0 → 1.16.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/README.md +3 -3
- package/package.json +6 -5
- package/src/index.js +15 -18
- package/src/phaser/core/animation.js +102 -6
- package/src/phaser/core/animation_manager.js +88 -10
- package/src/phaser/core/animation_parser.js +5 -20
- package/src/phaser/core/array_set.js +51 -5
- package/src/phaser/core/cache.js +291 -6
- package/src/phaser/core/const.js +107 -4
- package/src/phaser/core/device.js +5 -6
- package/src/phaser/core/device_util.js +3 -25
- package/src/phaser/core/dom.js +127 -29
- package/src/phaser/core/event_manager.js +128 -6
- package/src/phaser/core/factory.js +69 -34
- package/src/phaser/core/frame.js +43 -6
- package/src/phaser/core/frame_data.js +55 -5
- package/src/phaser/core/frame_util.js +7 -14
- package/src/phaser/core/game.js +35 -7
- package/src/phaser/core/input.js +116 -17
- package/src/phaser/core/input_handler.js +242 -42
- package/src/phaser/core/input_mouse.js +68 -7
- package/src/phaser/core/input_mspointer.js +40 -9
- package/src/phaser/core/input_pointer.js +79 -17
- package/src/phaser/core/input_touch.js +42 -5
- package/src/phaser/core/loader.js +274 -101
- package/src/phaser/core/loader_parser.js +2 -14
- package/src/phaser/core/raf.js +16 -5
- package/src/phaser/core/scale_manager.js +204 -39
- package/src/phaser/core/scene.js +24 -5
- package/src/phaser/core/scene_manager.js +81 -11
- package/src/phaser/core/signal.js +88 -11
- package/src/phaser/core/signal_binding.js +35 -15
- package/src/phaser/core/sound.js +99 -10
- package/src/phaser/core/sound_manager.js +89 -13
- package/src/phaser/core/sound_sprite.js +20 -5
- package/src/phaser/core/stage.js +43 -7
- package/src/phaser/core/time.js +67 -5
- package/src/phaser/core/timer.js +107 -30
- package/src/phaser/core/timer_event.js +11 -6
- package/src/phaser/core/tween.js +124 -30
- package/src/phaser/core/tween_data.js +42 -18
- package/src/phaser/core/tween_easing.js +1 -39
- package/src/phaser/core/tween_manager.js +47 -5
- package/src/phaser/core/world.js +9 -6
- package/src/phaser/display/bitmap_text.js +92 -11
- package/src/phaser/display/button.js +64 -13
- package/src/phaser/display/canvas/buffer.js +16 -6
- package/src/phaser/display/canvas/graphics.js +1 -16
- package/src/phaser/display/canvas/masker.js +0 -8
- package/src/phaser/display/canvas/pool.js +0 -14
- package/src/phaser/display/canvas/renderer.js +28 -8
- package/src/phaser/display/canvas/tinter.js +4 -48
- package/src/phaser/display/canvas/util.js +0 -15
- package/src/phaser/display/display_object.js +192 -20
- package/src/phaser/display/graphics.js +162 -27
- package/src/phaser/display/graphics_data.js +14 -6
- package/src/phaser/display/graphics_data_util.js +2 -9
- package/src/phaser/display/group.js +75 -10
- package/src/phaser/display/image.js +86 -10
- package/src/phaser/display/sprite_batch.js +3 -9
- package/src/phaser/display/sprite_util.js +3 -28
- package/src/phaser/display/text.js +332 -32
- package/src/phaser/display/webgl/abstract_filter.js +8 -7
- package/src/phaser/display/webgl/base_texture.js +20 -12
- package/src/phaser/display/webgl/blend_manager.js +14 -7
- package/src/phaser/display/webgl/earcut.js +4 -50
- package/src/phaser/display/webgl/earcut_node.js +6 -7
- package/src/phaser/display/webgl/fast_sprite_batch.js +34 -11
- package/src/phaser/display/webgl/filter_manager.js +25 -7
- package/src/phaser/display/webgl/filter_texture.js +21 -22
- package/src/phaser/display/webgl/graphics.js +5 -40
- package/src/phaser/display/webgl/graphics_data.js +10 -7
- package/src/phaser/display/webgl/mask_manager.js +0 -8
- package/src/phaser/display/webgl/render_texture.js +33 -21
- package/src/phaser/display/webgl/renderer.js +38 -11
- package/src/phaser/display/webgl/shader/complex.js +10 -6
- package/src/phaser/display/webgl/shader/fast.js +10 -6
- package/src/phaser/display/webgl/shader/normal.js +23 -32
- package/src/phaser/display/webgl/shader/primitive.js +10 -6
- package/src/phaser/display/webgl/shader/strip.js +10 -6
- package/src/phaser/display/webgl/shader_manager.js +18 -6
- package/src/phaser/display/webgl/sprite_batch.js +41 -8
- package/src/phaser/display/webgl/stencil_manager.js +28 -6
- package/src/phaser/display/webgl/texture.js +28 -15
- package/src/phaser/display/webgl/texture_util.js +0 -8
- package/src/phaser/display/webgl/util.js +0 -11
- package/src/phaser/geom/circle.js +123 -19
- package/src/phaser/geom/ellipse.js +39 -19
- package/src/phaser/geom/line.js +148 -17
- package/src/phaser/geom/matrix.js +73 -7
- package/src/phaser/geom/point.js +152 -7
- package/src/phaser/geom/polygon.js +42 -14
- package/src/phaser/geom/rectangle.js +233 -7
- package/src/phaser/geom/rounded_rectangle.js +10 -7
- package/src/phaser/geom/util/circle.js +3 -16
- package/src/phaser/geom/util/ellipse.js +0 -8
- package/src/phaser/geom/util/line.js +5 -19
- package/src/phaser/geom/util/matrix.js +1 -10
- package/src/phaser/geom/util/point.js +0 -26
- package/src/phaser/geom/util/polygon.js +1 -8
- package/src/phaser/geom/util/rectangle.js +1 -23
- package/src/phaser/geom/util/rounded_rectangle.js +1 -8
- package/src/phaser/util/math.js +3 -43
- package/{types → typedefs}/global.d.ts +1 -1
- package/types/index.d.ts +2 -1
- package/types/index.d.ts.map +1 -1
- package/types/phaser/core/animation.d.ts +106 -5
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +88 -1
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/animation_parser.d.ts +5 -6
- package/types/phaser/core/animation_parser.d.ts.map +1 -1
- package/types/phaser/core/array_set.d.ts +53 -7
- package/types/phaser/core/array_set.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +348 -58
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/const.d.ts +143 -40
- package/types/phaser/core/const.d.ts.map +1 -1
- package/types/phaser/core/device.d.ts +2 -5
- package/types/phaser/core/device.d.ts.map +1 -1
- package/types/phaser/core/device_util.d.ts +1 -10
- package/types/phaser/core/device_util.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +122 -3
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +142 -15
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +74 -7
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/frame.d.ts +68 -26
- package/types/phaser/core/frame.d.ts.map +1 -1
- package/types/phaser/core/frame_data.d.ts +61 -9
- package/types/phaser/core/frame_data.d.ts.map +1 -1
- package/types/phaser/core/frame_util.d.ts +10 -10
- package/types/phaser/core/frame_util.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +54 -20
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +132 -21
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +258 -25
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +59 -12
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +49 -15
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +80 -4
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/input_touch.d.ts +52 -15
- package/types/phaser/core/input_touch.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +268 -23
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/loader_parser.d.ts +0 -4
- package/types/phaser/core/loader_parser.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +17 -7
- package/types/phaser/core/raf.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +210 -15
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene.d.ts +21 -5
- package/types/phaser/core/scene.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +90 -10
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal.d.ts +95 -11
- package/types/phaser/core/signal.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +35 -6
- package/types/phaser/core/signal_binding.d.ts.map +1 -1
- package/types/phaser/core/sound.d.ts +111 -14
- package/types/phaser/core/sound.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +94 -8
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +22 -8
- package/types/phaser/core/sound_sprite.d.ts.map +1 -1
- package/types/phaser/core/stage.d.ts +32 -3
- package/types/phaser/core/stage.d.ts.map +1 -1
- package/types/phaser/core/time.d.ts +73 -6
- package/types/phaser/core/time.d.ts.map +1 -1
- package/types/phaser/core/timer.d.ts +103 -2
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +11 -5
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +123 -3
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +42 -3
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_easing.d.ts +0 -36
- package/types/phaser/core/tween_easing.d.ts.map +1 -1
- package/types/phaser/core/tween_manager.d.ts +49 -2
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/core/world.d.ts +9 -1
- package/types/phaser/core/world.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +89 -12
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +68 -11
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/buffer.d.ts +21 -5
- package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/types/phaser/display/canvas/graphics.d.ts +0 -3
- package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/types/phaser/display/canvas/masker.d.ts +0 -2
- package/types/phaser/display/canvas/masker.d.ts.map +1 -1
- package/types/phaser/display/canvas/pool.d.ts +0 -13
- package/types/phaser/display/canvas/pool.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +30 -3
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/canvas/tinter.d.ts +0 -5
- package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/types/phaser/display/canvas/util.d.ts +0 -9
- package/types/phaser/display/canvas/util.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +196 -9
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +142 -16
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/graphics_data.d.ts +15 -1
- package/types/phaser/display/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/graphics_data_util.d.ts +3 -3
- package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/types/phaser/display/group.d.ts +68 -6
- package/types/phaser/display/group.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +77 -15
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_batch.d.ts +4 -4
- package/types/phaser/display/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts +0 -5
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +373 -53
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +8 -6
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/types/phaser/display/webgl/base_texture.d.ts +20 -1
- package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/blend_manager.d.ts +11 -6
- package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/earcut.d.ts +0 -27
- package/types/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/types/phaser/display/webgl/earcut_node.d.ts +9 -9
- package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +33 -6
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_manager.d.ts +23 -7
- package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_texture.d.ts +21 -3
- package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics.d.ts +0 -12
- package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics_data.d.ts +12 -8
- package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/webgl/mask_manager.d.ts +0 -2
- package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +31 -4
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +42 -5
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/complex.d.ts +12 -2
- package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/fast.d.ts +12 -2
- package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +21 -1
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/primitive.d.ts +12 -2
- package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/strip.d.ts +12 -2
- package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +20 -5
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +38 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +25 -0
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture.d.ts +22 -1
- package/types/phaser/display/webgl/texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture_util.d.ts +0 -2
- package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/types/phaser/display/webgl/util.d.ts +0 -10
- package/types/phaser/display/webgl/util.d.ts.map +1 -1
- package/types/phaser/geom/circle.d.ts +130 -10
- package/types/phaser/geom/circle.d.ts.map +1 -1
- package/types/phaser/geom/ellipse.d.ts +42 -6
- package/types/phaser/geom/ellipse.d.ts.map +1 -1
- package/types/phaser/geom/line.d.ts +159 -14
- package/types/phaser/geom/line.d.ts.map +1 -1
- package/types/phaser/geom/matrix.d.ts +84 -12
- package/types/phaser/geom/matrix.d.ts.map +1 -1
- package/types/phaser/geom/point.d.ts +170 -19
- package/types/phaser/geom/point.d.ts.map +1 -1
- package/types/phaser/geom/polygon.d.ts +45 -5
- package/types/phaser/geom/polygon.d.ts.map +1 -1
- package/types/phaser/geom/rectangle.d.ts +253 -21
- package/types/phaser/geom/rectangle.d.ts.map +1 -1
- package/types/phaser/geom/rounded_rectangle.d.ts +11 -2
- package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/types/phaser/geom/util/circle.d.ts +3 -10
- package/types/phaser/geom/util/circle.d.ts.map +1 -1
- package/types/phaser/geom/util/ellipse.d.ts +0 -7
- package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/types/phaser/geom/util/line.d.ts +5 -10
- package/types/phaser/geom/util/line.d.ts.map +1 -1
- package/types/phaser/geom/util/matrix.d.ts +0 -3
- package/types/phaser/geom/util/matrix.d.ts.map +1 -1
- package/types/phaser/geom/util/point.d.ts +0 -20
- package/types/phaser/geom/util/point.d.ts.map +1 -1
- package/types/phaser/geom/util/polygon.d.ts +0 -1
- package/types/phaser/geom/util/polygon.d.ts.map +1 -1
- package/types/phaser/geom/util/rectangle.d.ts +0 -16
- package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/types/phaser/geom/util/rounded_rectangle.d.ts +0 -1
- package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/types/phaser/util/math.d.ts +0 -27
- package/types/phaser/util/math.d.ts.map +1 -1
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module display/image
|
|
3
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
4
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
5
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
6
|
-
*/
|
|
7
1
|
import { Texture } from './webgl/texture';
|
|
8
2
|
import { AnimationManager } from '../core/animation_manager';
|
|
9
3
|
import { EventManager } from '../core/event_manager';
|
|
10
|
-
import { Rectangle } from
|
|
11
|
-
import { DisplayObject } from
|
|
4
|
+
import { Rectangle } from '../geom/rectangle';
|
|
5
|
+
import { DisplayObject } from './display_object';
|
|
6
|
+
import { Game } from '../core/game';
|
|
12
7
|
import { clone } from '../geom/util/rectangle';
|
|
13
8
|
import { IMAGE, PENDING_ATLAS, BLEND_NORMAL, SCALE_NEAREST } from '../core/const';
|
|
14
9
|
import { setTexture, getBounds, getLocalBounds, renderCanvas, renderWebGL } from './sprite_util';
|
|
@@ -16,8 +11,7 @@ import { setTexture, getBounds, getLocalBounds, renderCanvas, renderWebGL } from
|
|
|
16
11
|
export class Image extends DisplayObject {
|
|
17
12
|
/**
|
|
18
13
|
* TBD.
|
|
19
|
-
*
|
|
20
|
-
* @param {object} game - TBD.
|
|
14
|
+
* @param {Game} game - TBD.
|
|
21
15
|
* @param {number} x - TBD.
|
|
22
16
|
* @param {number} y - TBD.
|
|
23
17
|
* @param {string} key - TBD.
|
|
@@ -48,6 +42,9 @@ export class Image extends DisplayObject {
|
|
|
48
42
|
this.loadTexture(key, frame);
|
|
49
43
|
}
|
|
50
44
|
|
|
45
|
+
/**
|
|
46
|
+
* TBD.
|
|
47
|
+
*/
|
|
51
48
|
destroy() {
|
|
52
49
|
this.game = null;
|
|
53
50
|
this.key = null;
|
|
@@ -69,6 +66,9 @@ export class Image extends DisplayObject {
|
|
|
69
66
|
super.destroy();
|
|
70
67
|
}
|
|
71
68
|
|
|
69
|
+
/**
|
|
70
|
+
* TBD.
|
|
71
|
+
*/
|
|
72
72
|
preUpdate() {
|
|
73
73
|
if (this.pendingDestroy) {
|
|
74
74
|
this.destroy();
|
|
@@ -92,6 +92,12 @@ export class Image extends DisplayObject {
|
|
|
92
92
|
|
|
93
93
|
// LoadTexture
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* TBD.
|
|
97
|
+
* @param {string} key - TBD.
|
|
98
|
+
* @param frame - TBD.
|
|
99
|
+
* @param stopAnimation - TBD.
|
|
100
|
+
*/
|
|
95
101
|
loadTexture(key, frame = 0, stopAnimation = true) {
|
|
96
102
|
if (key === PENDING_ATLAS) {
|
|
97
103
|
key = frame;
|
|
@@ -130,6 +136,10 @@ export class Image extends DisplayObject {
|
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
|
|
139
|
+
/**
|
|
140
|
+
* TBD.
|
|
141
|
+
* @param frame - TBD.
|
|
142
|
+
*/
|
|
133
143
|
setFrame(frame) {
|
|
134
144
|
this._frame = frame;
|
|
135
145
|
this.texture.frame.x = frame.x;
|
|
@@ -171,35 +181,61 @@ export class Image extends DisplayObject {
|
|
|
171
181
|
}
|
|
172
182
|
}
|
|
173
183
|
|
|
184
|
+
/**
|
|
185
|
+
* TBD.
|
|
186
|
+
* @param parent
|
|
187
|
+
* @param {number} width - TBD.
|
|
188
|
+
* @param {number} height - TBD.
|
|
189
|
+
*/
|
|
174
190
|
resizeFrame(parent, width, height) {
|
|
175
191
|
this.texture.frame.resize(width, height);
|
|
176
192
|
this.texture.setFrame(this.texture.frame);
|
|
177
193
|
}
|
|
178
194
|
|
|
195
|
+
/**
|
|
196
|
+
* TBD.
|
|
197
|
+
*/
|
|
179
198
|
resetFrame() {
|
|
180
199
|
if (this._frame) {
|
|
181
200
|
this.setFrame(this._frame);
|
|
182
201
|
}
|
|
183
202
|
}
|
|
184
203
|
|
|
204
|
+
/**
|
|
205
|
+
* TBD.
|
|
206
|
+
*/
|
|
185
207
|
get frame() {
|
|
186
208
|
return this.animations.frame;
|
|
187
209
|
}
|
|
188
210
|
|
|
211
|
+
/**
|
|
212
|
+
* TBD.
|
|
213
|
+
*/
|
|
189
214
|
set frame(value) {
|
|
190
215
|
this.animations.frame = value;
|
|
191
216
|
}
|
|
192
217
|
|
|
218
|
+
/**
|
|
219
|
+
* TBD.
|
|
220
|
+
*/
|
|
193
221
|
get frameName() {
|
|
194
222
|
return this.animations.frameName;
|
|
195
223
|
}
|
|
196
224
|
|
|
225
|
+
/**
|
|
226
|
+
* TBD.
|
|
227
|
+
*/
|
|
197
228
|
set frameName(value) {
|
|
198
229
|
this.animations.frameName = value;
|
|
199
230
|
}
|
|
200
231
|
|
|
201
232
|
// Crop
|
|
202
233
|
|
|
234
|
+
/**
|
|
235
|
+
* TBD.
|
|
236
|
+
* @param rect
|
|
237
|
+
* @param copy
|
|
238
|
+
*/
|
|
203
239
|
crop(rect, copy = false) {
|
|
204
240
|
if (rect) {
|
|
205
241
|
if (copy && this.cropRect !== null) {
|
|
@@ -217,6 +253,9 @@ export class Image extends DisplayObject {
|
|
|
217
253
|
}
|
|
218
254
|
}
|
|
219
255
|
|
|
256
|
+
/**
|
|
257
|
+
* TBD.
|
|
258
|
+
*/
|
|
220
259
|
updateCrop() {
|
|
221
260
|
if (!this.cropRect) {
|
|
222
261
|
return;
|
|
@@ -246,24 +285,39 @@ export class Image extends DisplayObject {
|
|
|
246
285
|
}
|
|
247
286
|
}
|
|
248
287
|
|
|
288
|
+
/**
|
|
289
|
+
* TBD.
|
|
290
|
+
*/
|
|
249
291
|
get width() {
|
|
250
292
|
return this.scale.x * this.texture.frame.width;
|
|
251
293
|
}
|
|
252
294
|
|
|
295
|
+
/**
|
|
296
|
+
* TBD.
|
|
297
|
+
*/
|
|
253
298
|
set width(value) {
|
|
254
299
|
this.scale.x = value / this.texture.frame.width;
|
|
255
300
|
this._width = value;
|
|
256
301
|
}
|
|
257
302
|
|
|
303
|
+
/**
|
|
304
|
+
* TBD.
|
|
305
|
+
*/
|
|
258
306
|
get height() {
|
|
259
307
|
return this.scale.y * this.texture.frame.height;
|
|
260
308
|
}
|
|
261
309
|
|
|
310
|
+
/**
|
|
311
|
+
* TBD.
|
|
312
|
+
*/
|
|
262
313
|
set height(value) {
|
|
263
314
|
this.scale.y = value / this.texture.frame.height;
|
|
264
315
|
this._height = value;
|
|
265
316
|
}
|
|
266
317
|
|
|
318
|
+
/**
|
|
319
|
+
* TBD.
|
|
320
|
+
*/
|
|
267
321
|
onTextureUpdate() {
|
|
268
322
|
// so if _width is 0 then width was not set..
|
|
269
323
|
if (this._width) {
|
|
@@ -274,22 +328,44 @@ export class Image extends DisplayObject {
|
|
|
274
328
|
}
|
|
275
329
|
}
|
|
276
330
|
|
|
331
|
+
/**
|
|
332
|
+
* TBD.
|
|
333
|
+
* @param texture
|
|
334
|
+
* @param destroyBase
|
|
335
|
+
*/
|
|
277
336
|
setTexture(texture, destroyBase = false) {
|
|
278
337
|
setTexture(this, texture, destroyBase);
|
|
279
338
|
}
|
|
280
339
|
|
|
340
|
+
/**
|
|
341
|
+
* TBD.
|
|
342
|
+
* @param matrix - TBD.
|
|
343
|
+
*/
|
|
281
344
|
getBounds(matrix = null) {
|
|
282
345
|
return getBounds(this, matrix);
|
|
283
346
|
}
|
|
284
347
|
|
|
348
|
+
/**
|
|
349
|
+
* TBD.
|
|
350
|
+
*/
|
|
285
351
|
getLocalBounds() {
|
|
286
352
|
return getLocalBounds(this);
|
|
287
353
|
}
|
|
288
354
|
|
|
355
|
+
/**
|
|
356
|
+
* TBD.
|
|
357
|
+
* @param renderSession - TBD.
|
|
358
|
+
* @param matrix - TBD.
|
|
359
|
+
*/
|
|
289
360
|
renderWebGL(renderSession, matrix = null) {
|
|
290
361
|
renderWebGL(this, renderSession, matrix);
|
|
291
362
|
}
|
|
292
363
|
|
|
364
|
+
/**
|
|
365
|
+
* TBD.
|
|
366
|
+
* @param renderSession - TBD.
|
|
367
|
+
* @param matrix - TBD.
|
|
368
|
+
*/
|
|
293
369
|
renderCanvas(renderSession, matrix = null) {
|
|
294
370
|
renderCanvas(this, renderSession, matrix);
|
|
295
371
|
}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
4
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
5
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
6
|
-
*/
|
|
7
|
-
import { DisplayObject } from './display_object';
|
|
1
|
+
import { Game } from '../core/game';
|
|
2
|
+
import { DisplayObject } from './display_object';
|
|
8
3
|
|
|
9
4
|
export class SpriteBatch extends DisplayObject {
|
|
10
5
|
/**
|
|
11
6
|
* TBD.
|
|
12
|
-
*
|
|
13
|
-
* @param {object} game - TBD.
|
|
7
|
+
* @param {Game} game - TBD.
|
|
14
8
|
*/
|
|
15
9
|
constructor(game) {
|
|
16
10
|
super();
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module display/sprite_util
|
|
3
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
4
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
5
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
6
|
-
*/
|
|
7
1
|
import { getTintedTexture } from './canvas/tinter';
|
|
8
2
|
import { getIdentityMatrix } from '../geom/util/matrix';
|
|
9
3
|
import { SCALE_LINEAR } from '../core/const';
|
|
10
4
|
|
|
11
5
|
/**
|
|
12
6
|
* TBD.
|
|
13
|
-
*
|
|
14
7
|
* @param {object} target - TBD.
|
|
15
8
|
* @param {object} texture - TBD.
|
|
16
9
|
* @param {boolean} destroyBase - TBD.
|
|
@@ -27,7 +20,6 @@ export function setTexture(target, texture, destroyBase = false) {
|
|
|
27
20
|
|
|
28
21
|
/**
|
|
29
22
|
* TBD.
|
|
30
|
-
*
|
|
31
23
|
* @param {object} target - TBD.
|
|
32
24
|
* @param {object} matrix - TBD.
|
|
33
25
|
* @returns {object} TBD.
|
|
@@ -111,7 +103,6 @@ export function getBounds(target, matrix = null) {
|
|
|
111
103
|
|
|
112
104
|
/**
|
|
113
105
|
* TBD.
|
|
114
|
-
*
|
|
115
106
|
* @param {object} target - TBD.
|
|
116
107
|
* @returns {object} TBD.
|
|
117
108
|
*/
|
|
@@ -132,7 +123,6 @@ export function getLocalBounds(target) {
|
|
|
132
123
|
|
|
133
124
|
/**
|
|
134
125
|
* TBD.
|
|
135
|
-
*
|
|
136
126
|
* @param {object} target - TBD.
|
|
137
127
|
* @param {object} renderSession - TBD.
|
|
138
128
|
* @param {object} matrix - TBD.
|
|
@@ -182,7 +172,6 @@ export function renderWebGL(target, renderSession, matrix) {
|
|
|
182
172
|
|
|
183
173
|
/**
|
|
184
174
|
* TBD.
|
|
185
|
-
*
|
|
186
175
|
* @param {object} target - TBD.
|
|
187
176
|
* @param {object} renderSession - TBD.
|
|
188
177
|
* @param {object} matrix - TBD.
|
|
@@ -217,13 +206,9 @@ export function renderCanvas(target, renderSession, matrix) {
|
|
|
217
206
|
renderSession.context.globalAlpha = target.worldAlpha;
|
|
218
207
|
|
|
219
208
|
// If smoothingEnabled is supported and we need to change the smoothing property for this texture
|
|
220
|
-
if (
|
|
221
|
-
renderSession.smoothProperty &&
|
|
222
|
-
renderSession.scaleMode !== target.texture.baseTexture.scaleMode
|
|
223
|
-
) {
|
|
209
|
+
if (renderSession.smoothProperty && renderSession.scaleMode !== target.texture.baseTexture.scaleMode) {
|
|
224
210
|
renderSession.scaleMode = target.texture.baseTexture.scaleMode;
|
|
225
|
-
renderSession.context[renderSession.smoothProperty] =
|
|
226
|
-
renderSession.scaleMode === SCALE_LINEAR;
|
|
211
|
+
renderSession.context[renderSession.smoothProperty] = renderSession.scaleMode === SCALE_LINEAR;
|
|
227
212
|
}
|
|
228
213
|
// If the texture is trimmed we offset by the trim x/y, otherwise we use the frame dimensions
|
|
229
214
|
let dx = target.texture.trim
|
|
@@ -252,17 +237,7 @@ export function renderCanvas(target, renderSession, matrix) {
|
|
|
252
237
|
target.cachedTint = target.tint;
|
|
253
238
|
target.texture.requiresReTint = false;
|
|
254
239
|
}
|
|
255
|
-
renderSession.context.drawImage(
|
|
256
|
-
target.tintedTexture,
|
|
257
|
-
0,
|
|
258
|
-
0,
|
|
259
|
-
cw,
|
|
260
|
-
ch,
|
|
261
|
-
dx,
|
|
262
|
-
dy,
|
|
263
|
-
cw / resolution,
|
|
264
|
-
ch / resolution
|
|
265
|
-
);
|
|
240
|
+
renderSession.context.drawImage(target.tintedTexture, 0, 0, cw, ch, dx, dy, cw / resolution, ch / resolution);
|
|
266
241
|
} else {
|
|
267
242
|
const cx = target.texture.crop.x;
|
|
268
243
|
const cy = target.texture.crop.y;
|