@vpmedia/phaser 1.20.0 → 1.22.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 +1 -1
- package/package.json +2 -2
- package/src/phaser/core/animation.js +3 -6
- package/src/phaser/core/animation_manager.js +3 -5
- package/src/phaser/core/animation_parser.js +2 -3
- package/src/phaser/core/cache.js +37 -18
- package/src/phaser/core/dom.js +4 -5
- package/src/phaser/core/event_manager.js +1 -2
- package/src/phaser/core/factory.js +1 -2
- package/src/phaser/core/frame_data.js +7 -8
- package/src/phaser/core/input.js +13 -14
- package/src/phaser/core/input_handler.js +16 -19
- package/src/phaser/core/input_mouse.js +4 -5
- package/src/phaser/core/input_mspointer.js +1 -3
- package/src/phaser/core/input_pointer.js +2 -3
- package/src/phaser/core/input_touch.js +1 -3
- package/src/phaser/core/loader.js +70 -71
- package/src/phaser/core/raf.js +1 -3
- package/src/phaser/core/scale_manager.js +1 -2
- package/src/phaser/core/scene_manager.js +2 -3
- package/src/phaser/core/signal_binding.js +14 -7
- package/src/phaser/core/sound.js +1 -2
- package/src/phaser/core/sound_manager.js +1 -2
- package/src/phaser/core/sound_sprite.js +3 -6
- package/src/phaser/core/stage.js +1 -2
- package/src/phaser/core/time.js +1 -2
- package/src/phaser/core/timer.js +1 -2
- package/src/phaser/core/timer_event.js +1 -3
- package/src/phaser/core/tween.js +8 -10
- package/src/phaser/core/tween_data.js +1 -1
- package/src/phaser/core/tween_manager.js +1 -2
- package/src/phaser/core/world.js +1 -2
- package/src/phaser/display/bitmap_text.js +1 -2
- package/src/phaser/display/button.js +1 -2
- package/src/phaser/display/canvas/renderer.js +6 -7
- package/src/phaser/display/display_object.js +1 -0
- package/src/phaser/display/graphics.js +7 -9
- package/src/phaser/display/group.js +1 -2
- package/src/phaser/display/image.js +9 -10
- package/src/phaser/display/sprite_batch.js +1 -2
- package/src/phaser/display/sprite_util.js +2 -3
- package/src/phaser/display/text.js +43 -34
- package/src/phaser/display/webgl/abstract_filter.js +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.js +3 -3
- package/src/phaser/display/webgl/graphics.js +6 -6
- package/src/phaser/display/webgl/render_texture.js +1 -1
- package/src/phaser/display/webgl/renderer.js +8 -9
- package/src/phaser/display/webgl/shader/normal.js +1 -1
- package/src/phaser/display/webgl/shader_manager.js +3 -2
- package/src/phaser/display/webgl/sprite_batch.js +3 -5
- package/src/phaser/display/webgl/stencil_manager.js +6 -6
- package/src/phaser/display/webgl/texture.js +1 -2
- package/types/phaser/core/animation.d.ts +8 -11
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +10 -12
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/animation_parser.d.ts +4 -5
- package/types/phaser/core/animation_parser.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +70 -48
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +8 -9
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +3 -4
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +3 -4
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/frame_data.d.ts +12 -13
- package/types/phaser/core/frame_data.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +22 -23
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +34 -37
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +5 -6
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +4 -5
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +5 -6
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/input_touch.d.ts +4 -5
- package/types/phaser/core/input_touch.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +104 -105
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +3 -4
- package/types/phaser/core/raf.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +3 -4
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +5 -6
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +22 -15
- package/types/phaser/core/signal_binding.d.ts.map +1 -1
- package/types/phaser/core/sound.d.ts +3 -4
- package/types/phaser/core/sound.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +3 -4
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +7 -9
- package/types/phaser/core/sound_sprite.d.ts.map +1 -1
- package/types/phaser/core/stage.d.ts +3 -4
- package/types/phaser/core/stage.d.ts.map +1 -1
- package/types/phaser/core/time.d.ts +3 -4
- package/types/phaser/core/time.d.ts.map +1 -1
- package/types/phaser/core/timer.d.ts +3 -4
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +3 -4
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +16 -19
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +5 -5
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_manager.d.ts +3 -4
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/core/world.d.ts +2 -3
- package/types/phaser/core/world.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +3 -4
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +2 -3
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +9 -10
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +4 -3
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +13 -15
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/group.d.ts +3 -4
- package/types/phaser/display/group.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +22 -22
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_batch.d.ts +3 -4
- package/types/phaser/display/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts +4 -5
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +63 -53
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +3 -3
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +6 -6
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics.d.ts +13 -12
- package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +3 -3
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +12 -13
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +2 -2
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +6 -5
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +5 -7
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +9 -9
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture.d.ts +3 -4
- package/types/phaser/display/webgl/texture.d.ts.map +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export class SignalBinding {
|
|
2
2
|
/**
|
|
3
3
|
* TBD.
|
|
4
|
-
* @param signal
|
|
5
|
-
* @param listener
|
|
6
|
-
* @param isOnce
|
|
7
|
-
* @param listenerContext
|
|
8
|
-
* @param priority
|
|
9
|
-
* @param args - TBD.
|
|
4
|
+
* @param {import('./signal').Signal} signal - TBD.
|
|
5
|
+
* @param {Function} listener - TBD.
|
|
6
|
+
* @param {boolean} isOnce - TBD.
|
|
7
|
+
* @param {object} listenerContext - TBD.
|
|
8
|
+
* @param {number} priority - TBD.
|
|
9
|
+
* @param {...any} args - TBD.
|
|
10
10
|
*/
|
|
11
11
|
constructor(signal, listener, isOnce = false, listenerContext = null, priority = 0, args = null) {
|
|
12
12
|
this._signal = signal;
|
|
@@ -22,7 +22,8 @@ export class SignalBinding {
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* TBD.
|
|
25
|
-
* @param paramsArr
|
|
25
|
+
* @param {any[]} paramsArr - TBD.
|
|
26
|
+
* @returns {Function} TBD.
|
|
26
27
|
*/
|
|
27
28
|
execute(paramsArr) {
|
|
28
29
|
let handlerReturn;
|
|
@@ -43,6 +44,7 @@ export class SignalBinding {
|
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
46
|
* TBD.
|
|
47
|
+
* @returns {Function} TBD.
|
|
46
48
|
*/
|
|
47
49
|
detach() {
|
|
48
50
|
return this.isBound() ? this._signal.remove(this._listener, this.context) : null;
|
|
@@ -50,6 +52,7 @@ export class SignalBinding {
|
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* TBD.
|
|
55
|
+
* @returns {boolean} TBD.
|
|
53
56
|
*/
|
|
54
57
|
isBound() {
|
|
55
58
|
return !!this._signal && !!this._listener;
|
|
@@ -57,6 +60,7 @@ export class SignalBinding {
|
|
|
57
60
|
|
|
58
61
|
/**
|
|
59
62
|
* TBD.
|
|
63
|
+
* @returns {boolean} TBD.
|
|
60
64
|
*/
|
|
61
65
|
isOnce() {
|
|
62
66
|
return this._isOnce;
|
|
@@ -64,6 +68,7 @@ export class SignalBinding {
|
|
|
64
68
|
|
|
65
69
|
/**
|
|
66
70
|
* TBD.
|
|
71
|
+
* @returns {Function} TBD.
|
|
67
72
|
*/
|
|
68
73
|
getListener() {
|
|
69
74
|
return this._listener;
|
|
@@ -71,6 +76,7 @@ export class SignalBinding {
|
|
|
71
76
|
|
|
72
77
|
/**
|
|
73
78
|
* TBD.
|
|
79
|
+
* @returns {import('./signal').Signal} TBD.
|
|
74
80
|
*/
|
|
75
81
|
getSignal() {
|
|
76
82
|
return this._signal;
|
|
@@ -87,6 +93,7 @@ export class SignalBinding {
|
|
|
87
93
|
|
|
88
94
|
/**
|
|
89
95
|
* TBD.
|
|
96
|
+
* @returns {string} TBD.
|
|
90
97
|
*/
|
|
91
98
|
toString() {
|
|
92
99
|
return '[SignalBinding isOnce:' + this._isOnce + ', isBound:' + this.isBound() + ', active:' + this.active + ']';
|
package/src/phaser/core/sound.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Game } from './game';
|
|
2
1
|
import { Signal } from './signal';
|
|
3
2
|
|
|
4
3
|
export class Sound {
|
|
5
4
|
/**
|
|
6
5
|
* TBD.
|
|
7
|
-
* @param {Game} game - TBD.
|
|
6
|
+
* @param {import('./game').Game} game - TBD.
|
|
8
7
|
* @param {string} key - TBD.
|
|
9
8
|
* @param {number} volume - TBD.
|
|
10
9
|
* @param {boolean} loop - TBD.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ArraySet } from './array_set';
|
|
2
|
-
import { Game } from './game';
|
|
3
2
|
import { Signal } from './signal';
|
|
4
3
|
import { Sound } from './sound';
|
|
5
4
|
import { SoundSprite } from './sound_sprite';
|
|
@@ -7,7 +6,7 @@ import { SoundSprite } from './sound_sprite';
|
|
|
7
6
|
export class SoundManager {
|
|
8
7
|
/**
|
|
9
8
|
* TBD.
|
|
10
|
-
* @param {Game} game - TBD.
|
|
9
|
+
* @param {import('./game').Game} game - TBD.
|
|
11
10
|
*/
|
|
12
11
|
constructor(game) {
|
|
13
12
|
this.game = game;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { Game } from './game';
|
|
2
|
-
import { Sound } from './sound';
|
|
3
|
-
|
|
4
1
|
export class SoundSprite {
|
|
5
2
|
/**
|
|
6
3
|
* TBD.
|
|
7
|
-
* @param {Game} game - TBD.
|
|
4
|
+
* @param {import('./game').Game} game - TBD.
|
|
8
5
|
* @param {string} key - TBD.
|
|
9
6
|
*/
|
|
10
7
|
constructor(game, key) {
|
|
@@ -31,7 +28,7 @@ export class SoundSprite {
|
|
|
31
28
|
* TBD.
|
|
32
29
|
* @param {string} marker - TBD.
|
|
33
30
|
* @param {number} volume - TBD.
|
|
34
|
-
* @returns {Sound} TBD.
|
|
31
|
+
* @returns {import('./sound').Sound} TBD.
|
|
35
32
|
*/
|
|
36
33
|
play(marker, volume = 1) {
|
|
37
34
|
return this.sounds[marker].play(marker, null, volume);
|
|
@@ -54,7 +51,7 @@ export class SoundSprite {
|
|
|
54
51
|
/**
|
|
55
52
|
* TBD.
|
|
56
53
|
* @param {string} marker - TBD.
|
|
57
|
-
* @returns {Sound} TBD.
|
|
54
|
+
* @returns {import('./sound').Sound} TBD.
|
|
58
55
|
*/
|
|
59
56
|
get(marker) {
|
|
60
57
|
return this.sounds[marker];
|
package/src/phaser/core/stage.js
CHANGED
|
@@ -3,12 +3,11 @@ import { DisplayObject } from '../display/display_object';
|
|
|
3
3
|
import { setUserSelect, setTouchAction } from '../display/canvas/util';
|
|
4
4
|
import { valueToColor } from '../util/math';
|
|
5
5
|
import { SCALE_LINEAR, SCALE_NEAREST } from './const';
|
|
6
|
-
import { Game } from './game';
|
|
7
6
|
|
|
8
7
|
export class Stage extends DisplayObject {
|
|
9
8
|
/**
|
|
10
9
|
* TBD.
|
|
11
|
-
* @param {Game} game - TBD.
|
|
10
|
+
* @param {import('./game').Game} game - TBD.
|
|
12
11
|
*/
|
|
13
12
|
constructor(game) {
|
|
14
13
|
super();
|
package/src/phaser/core/time.js
CHANGED
package/src/phaser/core/timer.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Game } from './game';
|
|
2
1
|
import { Signal } from './signal';
|
|
3
2
|
import { TimerEvent } from './timer_event';
|
|
4
3
|
|
|
5
4
|
export class Timer {
|
|
6
5
|
/**
|
|
7
6
|
* TBD.
|
|
8
|
-
* @param {Game} game - TBD.
|
|
7
|
+
* @param {import('./game').Game} game - TBD.
|
|
9
8
|
* @param {boolean} autoDestroy - TBD.
|
|
10
9
|
*/
|
|
11
10
|
constructor(game, autoDestroy = false) {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { Timer } from './timer';
|
|
2
|
-
|
|
3
1
|
export class TimerEvent {
|
|
4
2
|
/**
|
|
5
3
|
* TBD.
|
|
6
|
-
* @param {Timer} timer - TBD.
|
|
4
|
+
* @param {import('./timer').Timer} timer - TBD.
|
|
7
5
|
* @param {number} delay - TBD.
|
|
8
6
|
* @param {number} tick - TBD.
|
|
9
7
|
* @param {number} repeatCount - TBD.
|
package/src/phaser/core/tween.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { Signal } from './signal';
|
|
2
2
|
import { TweenData } from './tween_data';
|
|
3
|
-
import { TweenManager } from './tween_manager';
|
|
4
|
-
import { DisplayObject } from '../display/display_object';
|
|
5
3
|
import * as MathUtils from '../util/math';
|
|
6
4
|
import { TWEEN_PENDING, TWEEN_RUNNING, TWEEN_COMPLETE, TWEEN_LOOPED } from './const';
|
|
7
|
-
import { Game } from './game';
|
|
8
5
|
|
|
9
6
|
export class Tween {
|
|
10
7
|
/**
|
|
11
8
|
* TBD.
|
|
12
|
-
* @param {DisplayObject} target - TBD.
|
|
13
|
-
* @param {Game} game - TBD.
|
|
14
|
-
* @param {TweenManager} manager - TBD.
|
|
9
|
+
* @param {import('../display/display_object').DisplayObject} target - TBD.
|
|
10
|
+
* @param {import('./game').Game} game - TBD.
|
|
11
|
+
* @param {import('./tween_manager').TweenManager} manager - TBD.
|
|
15
12
|
*/
|
|
16
13
|
constructor(target, game, manager) {
|
|
17
14
|
this.game = game;
|
|
@@ -148,7 +145,7 @@ export class Tween {
|
|
|
148
145
|
/**
|
|
149
146
|
* TBD.
|
|
150
147
|
* @param {string} property - TBD.
|
|
151
|
-
* @param {
|
|
148
|
+
* @param {object} value - TBD.
|
|
152
149
|
* @param {number} index - TBD.
|
|
153
150
|
* @returns {Tween} TBD.
|
|
154
151
|
*/
|
|
@@ -235,8 +232,8 @@ export class Tween {
|
|
|
235
232
|
|
|
236
233
|
/**
|
|
237
234
|
* TBD.
|
|
238
|
-
* @param interpolation - TBD.
|
|
239
|
-
* @param context - TBD.
|
|
235
|
+
* @param {Function} interpolation - TBD.
|
|
236
|
+
* @param {object} context - TBD.
|
|
240
237
|
* @param {number} index - TBD.
|
|
241
238
|
* @returns {Tween} TBD.
|
|
242
239
|
*/
|
|
@@ -424,7 +421,8 @@ export class Tween {
|
|
|
424
421
|
/**
|
|
425
422
|
* TBD.
|
|
426
423
|
* @param {number} frameRate - TBD.
|
|
427
|
-
* @param data - TBD.
|
|
424
|
+
* @param {object[]} data - TBD.
|
|
425
|
+
* @returns {object[]} TBD.
|
|
428
426
|
*/
|
|
429
427
|
generateData(frameRate = 60, data = []) {
|
|
430
428
|
if (this.game === null || this.target === null) {
|
|
@@ -33,12 +33,11 @@ import {
|
|
|
33
33
|
BounceInOut,
|
|
34
34
|
} from './tween_easing';
|
|
35
35
|
import { GROUP } from './const';
|
|
36
|
-
import { Game } from './game';
|
|
37
36
|
|
|
38
37
|
export class TweenManager {
|
|
39
38
|
/**
|
|
40
39
|
* TBD.
|
|
41
|
-
* @param {Game} game - TBD.
|
|
40
|
+
* @param {import('./game').Game} game - TBD.
|
|
42
41
|
*/
|
|
43
42
|
constructor(game) {
|
|
44
43
|
this.game = game;
|
package/src/phaser/core/world.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Group } from '../display/group';
|
|
2
|
-
import { Game } from './game';
|
|
3
2
|
|
|
4
3
|
export class World extends Group {
|
|
5
4
|
/**
|
|
6
5
|
* TBD.
|
|
7
|
-
* @param {Game} game - TBD.
|
|
6
|
+
* @param {import('./game').Game} game - TBD.
|
|
8
7
|
*/
|
|
9
8
|
constructor(game) {
|
|
10
9
|
super(game, null, '__world', false);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { DisplayObject } from './display_object';
|
|
2
2
|
import { Image } from './image';
|
|
3
|
-
import { Game } from '../core/game';
|
|
4
3
|
import { Point } from '../geom/point';
|
|
5
4
|
import { BITMAP_TEXT, SCALE_LINEAR, SCALE_NEAREST } from '../core/const';
|
|
6
5
|
|
|
7
6
|
export class BitmapText extends DisplayObject {
|
|
8
7
|
/**
|
|
9
8
|
* TBD.
|
|
10
|
-
* @param {Game} game - TBD.
|
|
9
|
+
* @param {import('../core/game').Game} game - TBD.
|
|
11
10
|
* @param {number} x - TBD.
|
|
12
11
|
* @param {number} y - TBD.
|
|
13
12
|
* @param {string} font - TBD.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Image } from './image';
|
|
2
2
|
import { Signal } from '../core/signal';
|
|
3
|
-
import { Game } from '../core/game';
|
|
4
3
|
import { InputHandler } from '../core/input_handler';
|
|
5
4
|
import { BUTTON, POINTER_CONTACT } from '../core/const';
|
|
6
5
|
|
|
@@ -13,7 +12,7 @@ const STATE_DISABLED = 'Disabled';
|
|
|
13
12
|
export class Button extends Image {
|
|
14
13
|
/**
|
|
15
14
|
* TBD.
|
|
16
|
-
* @param {Game} game - TBD.
|
|
15
|
+
* @param {import('../core/game').Game} game - TBD.
|
|
17
16
|
* @param {number} x - TBD.
|
|
18
17
|
* @param {number} y - TBD.
|
|
19
18
|
* @param {string} key - TBD.
|
|
@@ -23,12 +23,11 @@ import {
|
|
|
23
23
|
import { getSmoothingPrefix } from './util';
|
|
24
24
|
import { detectCapabilities } from './tinter';
|
|
25
25
|
import * as CanvasMaskManager from './masker';
|
|
26
|
-
import { Game } from '../../core/game';
|
|
27
26
|
|
|
28
27
|
export class CanvasRenderer {
|
|
29
28
|
/**
|
|
30
29
|
* TBD.
|
|
31
|
-
* @param {Game} game - TBD.
|
|
30
|
+
* @param {import('../../core/game').Game} game - TBD.
|
|
32
31
|
*/
|
|
33
32
|
constructor(game) {
|
|
34
33
|
detectCapabilities();
|
|
@@ -60,7 +59,7 @@ export class CanvasRenderer {
|
|
|
60
59
|
|
|
61
60
|
/**
|
|
62
61
|
* TBD.
|
|
63
|
-
* @param root - TBD.
|
|
62
|
+
* @param {import('../../core/stage').Stage} root - TBD.
|
|
64
63
|
*/
|
|
65
64
|
render(root) {
|
|
66
65
|
if (!this.context) {
|
|
@@ -85,7 +84,7 @@ export class CanvasRenderer {
|
|
|
85
84
|
|
|
86
85
|
/**
|
|
87
86
|
* TBD.
|
|
88
|
-
* @param removeView - TBD.
|
|
87
|
+
* @param {boolean} removeView - TBD.
|
|
89
88
|
*/
|
|
90
89
|
destroy(removeView = true) {
|
|
91
90
|
if (removeView && this.view.parent) {
|
|
@@ -117,9 +116,9 @@ export class CanvasRenderer {
|
|
|
117
116
|
|
|
118
117
|
/**
|
|
119
118
|
* TBD.
|
|
120
|
-
* @param displayObject - TBD.
|
|
121
|
-
* @param context - TBD.
|
|
122
|
-
* @param matrix - TBD.
|
|
119
|
+
* @param {Image} displayObject - TBD.
|
|
120
|
+
* @param {CanvasRenderingContext2D} context - TBD.
|
|
121
|
+
* @param {import('../../geom/matrix').Matrix} matrix - TBD.
|
|
123
122
|
*/
|
|
124
123
|
renderDisplayObject(displayObject, context, matrix) {
|
|
125
124
|
this.renderSession.context = context || this.context;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { DisplayObject } from './display_object';
|
|
2
2
|
import { Image } from './image';
|
|
3
|
-
import { Game } from '../core/game';
|
|
4
3
|
import { Rectangle } from '../geom/rectangle';
|
|
5
4
|
import { RoundedRectangle } from '../geom/rounded_rectangle';
|
|
6
5
|
import { Polygon } from '../geom/polygon';
|
|
7
6
|
import { Circle } from '../geom/circle';
|
|
8
7
|
import { Ellipse } from '../geom/ellipse';
|
|
9
8
|
import { Point } from '../geom/point';
|
|
10
|
-
import { Matrix } from '../geom/matrix';
|
|
11
9
|
import { GraphicsData } from './graphics_data';
|
|
12
10
|
import { CanvasBuffer } from './canvas/buffer';
|
|
13
11
|
import { textureFromCanvas } from './webgl/texture_util';
|
|
@@ -29,7 +27,7 @@ import {
|
|
|
29
27
|
export class Graphics extends DisplayObject {
|
|
30
28
|
/**
|
|
31
29
|
* TBD.
|
|
32
|
-
* @param {Game} game - TBD.
|
|
30
|
+
* @param {import('../core/game').Game} game - TBD.
|
|
33
31
|
* @param {number} x - TBD.
|
|
34
32
|
* @param {number} y - TBD.
|
|
35
33
|
*/
|
|
@@ -555,7 +553,7 @@ export class Graphics extends DisplayObject {
|
|
|
555
553
|
|
|
556
554
|
/**
|
|
557
555
|
* TBD.
|
|
558
|
-
* @param {Matrix} matrix - TBD.
|
|
556
|
+
* @param {import('../geom/matrix').Matrix} matrix - TBD.
|
|
559
557
|
* @returns {Rectangle} TBD.
|
|
560
558
|
*/
|
|
561
559
|
getBounds(matrix = null) {
|
|
@@ -791,7 +789,7 @@ export class Graphics extends DisplayObject {
|
|
|
791
789
|
|
|
792
790
|
/**
|
|
793
791
|
* TBD.
|
|
794
|
-
* @param shape - TBD.
|
|
792
|
+
* @param {object} shape - TBD.
|
|
795
793
|
* @returns {GraphicsData} TBD.
|
|
796
794
|
*/
|
|
797
795
|
drawShape(shape) {
|
|
@@ -841,8 +839,8 @@ export class Graphics extends DisplayObject {
|
|
|
841
839
|
|
|
842
840
|
/**
|
|
843
841
|
* TBD.
|
|
844
|
-
* @param points - TBD.
|
|
845
|
-
* @param cull - TBD.
|
|
842
|
+
* @param {Point[]} points - TBD.
|
|
843
|
+
* @param {boolean} cull - TBD.
|
|
846
844
|
*/
|
|
847
845
|
drawTriangle(points, cull = false) {
|
|
848
846
|
const triangle = new Polygon(points);
|
|
@@ -861,8 +859,8 @@ export class Graphics extends DisplayObject {
|
|
|
861
859
|
|
|
862
860
|
/**
|
|
863
861
|
* TBD.
|
|
864
|
-
* @param vertices - TBD.
|
|
865
|
-
* @param indices - TBD.
|
|
862
|
+
* @param {number[]|Point[]} vertices - TBD.
|
|
863
|
+
* @param {number[]} indices - TBD.
|
|
866
864
|
* @param {boolean} cull - TBD.
|
|
867
865
|
*/
|
|
868
866
|
drawTriangles(vertices, indices, cull = false) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DisplayObject } from './display_object';
|
|
2
2
|
import { Image } from './image';
|
|
3
3
|
import { Signal } from '../core/signal';
|
|
4
|
-
import { Game } from '../core/game';
|
|
5
4
|
import { GROUP } from '../core/const';
|
|
6
5
|
|
|
7
6
|
export const SORT_ASCENDING = -1;
|
|
@@ -10,7 +9,7 @@ export const SORT_DESCENDING = 1;
|
|
|
10
9
|
export class Group extends DisplayObject {
|
|
11
10
|
/**
|
|
12
11
|
* TBD.
|
|
13
|
-
* @param {Game} game - TBD.
|
|
12
|
+
* @param {import('../core/game').Game} game - TBD.
|
|
14
13
|
* @param {DisplayObject} parent - TBD.
|
|
15
14
|
* @param {string} name - TBD.
|
|
16
15
|
* @param {boolean} addToStage - TBD.
|
|
@@ -2,9 +2,7 @@ import { Texture } from './webgl/texture';
|
|
|
2
2
|
import { AnimationManager } from '../core/animation_manager';
|
|
3
3
|
import { EventManager } from '../core/event_manager';
|
|
4
4
|
import { Rectangle } from '../geom/rectangle';
|
|
5
|
-
import { Matrix } from '../geom/matrix';
|
|
6
5
|
import { DisplayObject } from './display_object';
|
|
7
|
-
import { Game } from '../core/game';
|
|
8
6
|
import { clone } from '../geom/util/rectangle';
|
|
9
7
|
import { IMAGE, PENDING_ATLAS, BLEND_NORMAL, SCALE_NEAREST } from '../core/const';
|
|
10
8
|
import { setTexture, getBounds, getLocalBounds, renderCanvas, renderWebGL } from './sprite_util';
|
|
@@ -12,7 +10,7 @@ import { setTexture, getBounds, getLocalBounds, renderCanvas, renderWebGL } from
|
|
|
12
10
|
export class Image extends DisplayObject {
|
|
13
11
|
/**
|
|
14
12
|
* TBD.
|
|
15
|
-
* @param {Game} game - TBD.
|
|
13
|
+
* @param {import('../core/game').Game} game - TBD.
|
|
16
14
|
* @param {number} x - TBD.
|
|
17
15
|
* @param {number} y - TBD.
|
|
18
16
|
* @param {string} key - TBD.
|
|
@@ -140,7 +138,7 @@ export class Image extends DisplayObject {
|
|
|
140
138
|
|
|
141
139
|
/**
|
|
142
140
|
* TBD.
|
|
143
|
-
* @param frame - TBD.
|
|
141
|
+
* @param {import('../core/frame').Frame} frame - TBD.
|
|
144
142
|
*/
|
|
145
143
|
setFrame(frame) {
|
|
146
144
|
this._frame = frame;
|
|
@@ -185,7 +183,7 @@ export class Image extends DisplayObject {
|
|
|
185
183
|
|
|
186
184
|
/**
|
|
187
185
|
* TBD.
|
|
188
|
-
* @param parent - TBD.
|
|
186
|
+
* @param {DisplayObject} parent - TBD.
|
|
189
187
|
* @param {number} width - TBD.
|
|
190
188
|
* @param {number} height - TBD.
|
|
191
189
|
*/
|
|
@@ -205,6 +203,7 @@ export class Image extends DisplayObject {
|
|
|
205
203
|
|
|
206
204
|
/**
|
|
207
205
|
* TBD.
|
|
206
|
+
* @returns {number} TBD.
|
|
208
207
|
*/
|
|
209
208
|
get frame() {
|
|
210
209
|
return this.animations.frame;
|
|
@@ -236,7 +235,7 @@ export class Image extends DisplayObject {
|
|
|
236
235
|
|
|
237
236
|
/**
|
|
238
237
|
* TBD.
|
|
239
|
-
* @param rect - TBD.
|
|
238
|
+
* @param {Rectangle} rect - TBD.
|
|
240
239
|
* @param {boolean} copy - TBD.
|
|
241
240
|
*/
|
|
242
241
|
crop(rect, copy = false) {
|
|
@@ -335,7 +334,7 @@ export class Image extends DisplayObject {
|
|
|
335
334
|
|
|
336
335
|
/**
|
|
337
336
|
* TBD.
|
|
338
|
-
* @param texture - TBD.
|
|
337
|
+
* @param {Texture} texture - TBD.
|
|
339
338
|
* @param {boolean} destroyBase - TBD.
|
|
340
339
|
*/
|
|
341
340
|
setTexture(texture, destroyBase = false) {
|
|
@@ -344,7 +343,7 @@ export class Image extends DisplayObject {
|
|
|
344
343
|
|
|
345
344
|
/**
|
|
346
345
|
* TBD.
|
|
347
|
-
* @param {Matrix} matrix - TBD.
|
|
346
|
+
* @param {import('../geom/matrix').Matrix} matrix - TBD.
|
|
348
347
|
* @returns {Rectangle} TBD.
|
|
349
348
|
*/
|
|
350
349
|
getBounds(matrix = null) {
|
|
@@ -362,7 +361,7 @@ export class Image extends DisplayObject {
|
|
|
362
361
|
/**
|
|
363
362
|
* TBD.
|
|
364
363
|
* @param {object} renderSession - TBD.
|
|
365
|
-
* @param {Matrix} matrix - TBD.
|
|
364
|
+
* @param {import('../geom/matrix').Matrix} matrix - TBD.
|
|
366
365
|
*/
|
|
367
366
|
renderWebGL(renderSession, matrix = null) {
|
|
368
367
|
renderWebGL(this, renderSession, matrix);
|
|
@@ -371,7 +370,7 @@ export class Image extends DisplayObject {
|
|
|
371
370
|
/**
|
|
372
371
|
* TBD.
|
|
373
372
|
* @param {object} renderSession - TBD.
|
|
374
|
-
* @param {Matrix} matrix - TBD.
|
|
373
|
+
* @param {import('../geom/matrix').Matrix} matrix - TBD.
|
|
375
374
|
*/
|
|
376
375
|
renderCanvas(renderSession, matrix = null) {
|
|
377
376
|
renderCanvas(this, renderSession, matrix);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Game } from '../core/game';
|
|
2
1
|
import { DisplayObject } from './display_object';
|
|
3
2
|
|
|
4
3
|
export class SpriteBatch extends DisplayObject {
|
|
5
4
|
/**
|
|
6
5
|
* TBD.
|
|
7
|
-
* @param {Game} game - TBD.
|
|
6
|
+
* @param {import('../core/game').Game} game - TBD.
|
|
8
7
|
*/
|
|
9
8
|
constructor(game) {
|
|
10
9
|
super();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getTintedTexture } from './canvas/tinter';
|
|
2
2
|
import { getIdentityMatrix } from '../geom/util/matrix';
|
|
3
|
-
import { Rectangle } from '../geom/rectangle';
|
|
4
3
|
import { SCALE_LINEAR } from '../core/const';
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -23,7 +22,7 @@ export function setTexture(target, texture, destroyBase = false) {
|
|
|
23
22
|
* TBD.
|
|
24
23
|
* @param {object} target - TBD.
|
|
25
24
|
* @param {object} matrix - TBD.
|
|
26
|
-
* @returns {Rectangle} TBD.
|
|
25
|
+
* @returns {import('../geom/rectangle').Rectangle} TBD.
|
|
27
26
|
*/
|
|
28
27
|
export function getBounds(target, matrix = null) {
|
|
29
28
|
// TODO verify
|
|
@@ -105,7 +104,7 @@ export function getBounds(target, matrix = null) {
|
|
|
105
104
|
/**
|
|
106
105
|
* TBD.
|
|
107
106
|
* @param {object} target - TBD.
|
|
108
|
-
* @returns {Rectangle} TBD.
|
|
107
|
+
* @returns {import('../geom/rectangle').Rectangle} TBD.
|
|
109
108
|
*/
|
|
110
109
|
export function getLocalBounds(target) {
|
|
111
110
|
const matrixCache = target.worldTransform;
|