@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
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vpmedia/phaser
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/js/@vpmedia%2Fphaser)
|
|
4
4
|
[](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml)
|
|
5
5
|
|
|
6
6
|
@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/phaser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
|
|
5
5
|
"author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"husky": "^8.0.3",
|
|
32
32
|
"jest": "^29.5.0",
|
|
33
33
|
"lint-staged": "^13.2.1",
|
|
34
|
-
"prettier": "^2.8.
|
|
34
|
+
"prettier": "^2.8.8",
|
|
35
35
|
"typescript": "^5.0.4"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { Game } from './game';
|
|
2
1
|
import { Signal } from './signal';
|
|
3
|
-
import { FrameData } from './frame_data';
|
|
4
|
-
import { Image } from '../display/image';
|
|
5
2
|
|
|
6
3
|
export class Animation {
|
|
7
4
|
/**
|
|
8
5
|
* TBD.
|
|
9
|
-
* @param {Game} game - TBD.
|
|
6
|
+
* @param {import('./game').Game} game - TBD.
|
|
10
7
|
* @param {Image} parent - TBD.
|
|
11
8
|
* @param {string} name - TBD.
|
|
12
|
-
* @param {FrameData} frameData - TBD.
|
|
9
|
+
* @param {import('./frame_data').FrameData} frameData - TBD.
|
|
13
10
|
* @param {string[]|number[]} frames - TBD.
|
|
14
11
|
* @param {number} frameRate - TBD.
|
|
15
12
|
* @param {boolean} loop - TBD.
|
|
@@ -311,7 +308,7 @@ export class Animation {
|
|
|
311
308
|
|
|
312
309
|
/**
|
|
313
310
|
* TBD.
|
|
314
|
-
* @param {FrameData} frameData - TBD.
|
|
311
|
+
* @param {import('./frame_data').FrameData} frameData - TBD.
|
|
315
312
|
*/
|
|
316
313
|
updateFrameData(frameData) {
|
|
317
314
|
this._frameData = frameData;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Animation } from './animation';
|
|
2
|
-
import { FrameData } from './frame_data';
|
|
3
|
-
import { Image } from '../display/image';
|
|
4
2
|
|
|
5
3
|
export class AnimationManager {
|
|
6
4
|
/**
|
|
@@ -38,7 +36,7 @@ export class AnimationManager {
|
|
|
38
36
|
|
|
39
37
|
/**
|
|
40
38
|
* TBD.
|
|
41
|
-
* @param {FrameData} frameData - TBD.
|
|
39
|
+
* @param {import('./frame_data').FrameData} frameData - TBD.
|
|
42
40
|
* @param {number|string} frame - TBD.
|
|
43
41
|
* @returns {boolean} TBD.
|
|
44
42
|
*/
|
|
@@ -68,7 +66,7 @@ export class AnimationManager {
|
|
|
68
66
|
|
|
69
67
|
/**
|
|
70
68
|
* TBD.
|
|
71
|
-
* @param {FrameData} frameData - TBD.
|
|
69
|
+
* @param {import('./frame_data').FrameData} frameData - TBD.
|
|
72
70
|
* @param {number|string} frame - TBD.
|
|
73
71
|
* @returns {boolean} TBD.
|
|
74
72
|
*/
|
|
@@ -248,7 +246,7 @@ export class AnimationManager {
|
|
|
248
246
|
|
|
249
247
|
/**
|
|
250
248
|
* TBD.
|
|
251
|
-
* @returns {FrameData} TBD.
|
|
249
|
+
* @returns {import('./frame_data').FrameData} TBD.
|
|
252
250
|
*/
|
|
253
251
|
get frameData() {
|
|
254
252
|
return this._frameData;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Frame } from './frame';
|
|
2
2
|
import { FrameData } from './frame_data';
|
|
3
|
-
import { Game } from './game';
|
|
4
3
|
|
|
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} frameWidth - TBD.
|
|
10
9
|
* @param {number} frameHeight - TBD.
|
|
@@ -59,7 +58,7 @@ export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin
|
|
|
59
58
|
|
|
60
59
|
/**
|
|
61
60
|
* TBD.
|
|
62
|
-
* @param {Game} game - TBD.
|
|
61
|
+
* @param {import('./game').Game} game - TBD.
|
|
63
62
|
* @param {object} json - TBD.
|
|
64
63
|
* @returns {object} TBD.
|
|
65
64
|
*/
|
package/src/phaser/core/cache.js
CHANGED
|
@@ -5,7 +5,6 @@ import { Frame } from './frame';
|
|
|
5
5
|
import { FrameData } from './frame_data';
|
|
6
6
|
import { JSONDataHash } from './animation_parser';
|
|
7
7
|
import { jsonBitmapFont, xmlBitmapFont } from './loader_parser';
|
|
8
|
-
import { Game } from './game';
|
|
9
8
|
|
|
10
9
|
export const CANVAS = 0;
|
|
11
10
|
export const IMAGE = 1;
|
|
@@ -21,7 +20,7 @@ export const RENDER_TEXTURE = 9;
|
|
|
21
20
|
export class Cache {
|
|
22
21
|
/**
|
|
23
22
|
* TBD.
|
|
24
|
-
* @param {Game} game - TBD.
|
|
23
|
+
* @param {import('./game').Game} game - TBD.
|
|
25
24
|
*/
|
|
26
25
|
constructor(game) {
|
|
27
26
|
this.game = game;
|
|
@@ -84,7 +83,7 @@ export class Cache {
|
|
|
84
83
|
* TBD.
|
|
85
84
|
* @param {string} key - TBD.
|
|
86
85
|
* @param {string} url - TBD.
|
|
87
|
-
* @param data - TBD.
|
|
86
|
+
* @param {HTMLImageElement} data - TBD.
|
|
88
87
|
* @returns {object} TBD.
|
|
89
88
|
*/
|
|
90
89
|
addImage(key, url, data) {
|
|
@@ -112,7 +111,7 @@ export class Cache {
|
|
|
112
111
|
* TBD.
|
|
113
112
|
* @param {string} key - TBD.
|
|
114
113
|
* @param {string} url - TBD.
|
|
115
|
-
* @param data - TBD.
|
|
114
|
+
* @param {HTMLCanvasElement} data - TBD.
|
|
116
115
|
* @param {object} atlasData - TBD.
|
|
117
116
|
*/
|
|
118
117
|
addTextureAtlas(key, url, data, atlasData) {
|
|
@@ -131,7 +130,7 @@ export class Cache {
|
|
|
131
130
|
* TBD.
|
|
132
131
|
* @param {string} key - TBD.
|
|
133
132
|
* @param {string} url - TBD.
|
|
134
|
-
* @param data - TBD.
|
|
133
|
+
* @param {object} data - TBD.
|
|
135
134
|
*/
|
|
136
135
|
addSound(key, url, data) {
|
|
137
136
|
this._cache.sound[key] = {
|
|
@@ -148,7 +147,7 @@ export class Cache {
|
|
|
148
147
|
* TBD.
|
|
149
148
|
* @param {string} key - TBD.
|
|
150
149
|
* @param {string} url - TBD.
|
|
151
|
-
* @param data - TBD.
|
|
150
|
+
* @param {string} data - TBD.
|
|
152
151
|
*/
|
|
153
152
|
addText(key, url, data) {
|
|
154
153
|
this._cache.text[key] = { url, data };
|
|
@@ -159,11 +158,11 @@ export class Cache {
|
|
|
159
158
|
* TBD.
|
|
160
159
|
* @param {string} key - TBD.
|
|
161
160
|
* @param {string} url - TBD.
|
|
162
|
-
* @param data - TBD.
|
|
163
|
-
* @param atlasData - TBD.
|
|
164
|
-
* @param atlasType - TBD.
|
|
165
|
-
* @param xSpacing - TBD.
|
|
166
|
-
* @param ySpacing - TBD.
|
|
161
|
+
* @param {HTMLCanvasElement} data - TBD.
|
|
162
|
+
* @param {object} atlasData - TBD.
|
|
163
|
+
* @param {string} atlasType - TBD.
|
|
164
|
+
* @param {number} xSpacing - TBD.
|
|
165
|
+
* @param {number} ySpacing - TBD.
|
|
167
166
|
*/
|
|
168
167
|
addBitmapFont(key, url, data, atlasData, atlasType, xSpacing = 0, ySpacing = 0) {
|
|
169
168
|
const obj = {
|
|
@@ -185,7 +184,7 @@ export class Cache {
|
|
|
185
184
|
* TBD.
|
|
186
185
|
* @param {string} key - TBD.
|
|
187
186
|
* @param {string} url - TBD.
|
|
188
|
-
* @param data - TBD.
|
|
187
|
+
* @param {object} data - TBD.
|
|
189
188
|
*/
|
|
190
189
|
addJSON(key, url, data) {
|
|
191
190
|
this._cache.json[key] = { url, data };
|
|
@@ -196,7 +195,7 @@ export class Cache {
|
|
|
196
195
|
* TBD.
|
|
197
196
|
* @param {string} key - TBD.
|
|
198
197
|
* @param {string} url - TBD.
|
|
199
|
-
* @param data - TBD.
|
|
198
|
+
* @param {XMLDocument} data - TBD.
|
|
200
199
|
*/
|
|
201
200
|
addXML(key, url, data) {
|
|
202
201
|
this._cache.xml[key] = { url, data };
|
|
@@ -235,7 +234,7 @@ export class Cache {
|
|
|
235
234
|
* TBD.
|
|
236
235
|
* @param {string} key - TBD.
|
|
237
236
|
* @param {string} property - TBD.
|
|
238
|
-
* @param value - TBD.
|
|
237
|
+
* @param {any} value - TBD.
|
|
239
238
|
*/
|
|
240
239
|
updateSound(key, property, value) {
|
|
241
240
|
const sound = this.getSound(key);
|
|
@@ -247,7 +246,7 @@ export class Cache {
|
|
|
247
246
|
/**
|
|
248
247
|
* TBD.
|
|
249
248
|
* @param {string} key - TBD.
|
|
250
|
-
* @param data - TBD.
|
|
249
|
+
* @param {object} data - TBD.
|
|
251
250
|
*/
|
|
252
251
|
decodedSound(key, data) {
|
|
253
252
|
const sound = this.getSound(key);
|
|
@@ -413,6 +412,7 @@ export class Cache {
|
|
|
413
412
|
/**
|
|
414
413
|
* TBD.
|
|
415
414
|
* @param {string} key - TBD.
|
|
415
|
+
* @returns {HTMLCanvasElement} TBD.
|
|
416
416
|
*/
|
|
417
417
|
getCanvas(key) {
|
|
418
418
|
return this.getItem(key, CANVAS, 'getCanvas', 'canvas');
|
|
@@ -421,7 +421,8 @@ export class Cache {
|
|
|
421
421
|
/**
|
|
422
422
|
* TBD.
|
|
423
423
|
* @param {string} key - TBD.
|
|
424
|
-
* @param full - TBD.
|
|
424
|
+
* @param {boolean} full - TBD.
|
|
425
|
+
* @returns {HTMLImageElement} TBD.
|
|
425
426
|
*/
|
|
426
427
|
getImage(key = '__default', full = false) {
|
|
427
428
|
let img = this.getItem(key, IMAGE, 'getImage');
|
|
@@ -437,6 +438,7 @@ export class Cache {
|
|
|
437
438
|
/**
|
|
438
439
|
* TBD.
|
|
439
440
|
* @param {string} key - TBD.
|
|
441
|
+
* @returns {object} TBD.
|
|
440
442
|
*/
|
|
441
443
|
getTextureFrame(key) {
|
|
442
444
|
return this.getItem(key, TEXTURE, 'getTextureFrame', 'frame');
|
|
@@ -445,6 +447,7 @@ export class Cache {
|
|
|
445
447
|
/**
|
|
446
448
|
* TBD.
|
|
447
449
|
* @param {string} key - TBD.
|
|
450
|
+
* @returns {object} TBD.
|
|
448
451
|
*/
|
|
449
452
|
getSound(key) {
|
|
450
453
|
return this.getItem(key, SOUND, 'getSound');
|
|
@@ -453,6 +456,7 @@ export class Cache {
|
|
|
453
456
|
/**
|
|
454
457
|
* TBD.
|
|
455
458
|
* @param {string} key - TBD.
|
|
459
|
+
* @returns {object} TBD.
|
|
456
460
|
*/
|
|
457
461
|
getSoundData(key) {
|
|
458
462
|
return this.getItem(key, SOUND, 'getSoundData', 'data');
|
|
@@ -461,6 +465,7 @@ export class Cache {
|
|
|
461
465
|
/**
|
|
462
466
|
* TBD.
|
|
463
467
|
* @param {string} key - TBD.
|
|
468
|
+
* @returns {object} TBD.
|
|
464
469
|
*/
|
|
465
470
|
getText(key) {
|
|
466
471
|
return this.getItem(key, TEXT, 'getText', 'data');
|
|
@@ -469,6 +474,7 @@ export class Cache {
|
|
|
469
474
|
/**
|
|
470
475
|
* TBD.
|
|
471
476
|
* @param {string} key - TBD.
|
|
477
|
+
* @returns {object} TBD.
|
|
472
478
|
*/
|
|
473
479
|
getBitmapData(key) {
|
|
474
480
|
return this.getItem(key, BITMAPDATA, 'getBitmapData', 'data');
|
|
@@ -477,6 +483,7 @@ export class Cache {
|
|
|
477
483
|
/**
|
|
478
484
|
* TBD.
|
|
479
485
|
* @param {string} key - TBD.
|
|
486
|
+
* @returns {object} TBD.
|
|
480
487
|
*/
|
|
481
488
|
getBitmapFont(key) {
|
|
482
489
|
return this.getItem(key, BITMAPFONT, 'getBitmapFont');
|
|
@@ -486,6 +493,7 @@ export class Cache {
|
|
|
486
493
|
* TBD.
|
|
487
494
|
* @param {string} key - TBD.
|
|
488
495
|
* @param {boolean} isClone - TBD.
|
|
496
|
+
* @returns {object} TBD.
|
|
489
497
|
*/
|
|
490
498
|
getJSON(key, isClone = false) {
|
|
491
499
|
const data = this.getItem(key, JSON, 'getJSON', 'data');
|
|
@@ -495,6 +503,7 @@ export class Cache {
|
|
|
495
503
|
/**
|
|
496
504
|
* TBD.
|
|
497
505
|
* @param {string} key - TBD.
|
|
506
|
+
* @returns {XMLDocument} TBD.
|
|
498
507
|
*/
|
|
499
508
|
getXML(key) {
|
|
500
509
|
return this.getItem(key, XML, 'getXML', 'data');
|
|
@@ -503,6 +512,7 @@ export class Cache {
|
|
|
503
512
|
/**
|
|
504
513
|
* TBD.
|
|
505
514
|
* @param {string} key - TBD.
|
|
515
|
+
* @returns {import('../display/webgl/render_texture').RenderTexture} TBD.
|
|
506
516
|
*/
|
|
507
517
|
getRenderTexture(key) {
|
|
508
518
|
return this.getItem(key, RENDER_TEXTURE, 'getRenderTexture');
|
|
@@ -514,6 +524,7 @@ export class Cache {
|
|
|
514
524
|
* TBD.
|
|
515
525
|
* @param {string} key - TBD.
|
|
516
526
|
* @param {number} cache - TBD.
|
|
527
|
+
* @returns {BaseTexture} TBD.
|
|
517
528
|
*/
|
|
518
529
|
getBaseTexture(key, cache = IMAGE) {
|
|
519
530
|
return this.getItem(key, cache, 'getBaseTexture', 'base');
|
|
@@ -523,6 +534,7 @@ export class Cache {
|
|
|
523
534
|
* TBD.
|
|
524
535
|
* @param {string} key - TBD.
|
|
525
536
|
* @param {number} cache - TBD.
|
|
537
|
+
* @returns {Frame} TBD.
|
|
526
538
|
*/
|
|
527
539
|
getFrame(key, cache = IMAGE) {
|
|
528
540
|
return this.getItem(key, cache, 'getFrame', 'frame');
|
|
@@ -532,6 +544,7 @@ export class Cache {
|
|
|
532
544
|
* TBD.
|
|
533
545
|
* @param {string} key - TBD.
|
|
534
546
|
* @param {number} cache - TBD.
|
|
547
|
+
* @returns {number} TBD.
|
|
535
548
|
*/
|
|
536
549
|
getFrameCount(key, cache = IMAGE) {
|
|
537
550
|
const data = this.getFrameData(key, cache);
|
|
@@ -545,6 +558,7 @@ export class Cache {
|
|
|
545
558
|
* TBD.
|
|
546
559
|
* @param {string} key - TBD.
|
|
547
560
|
* @param {number} cache - TBD.
|
|
561
|
+
* @returns {FrameData} TBD.
|
|
548
562
|
*/
|
|
549
563
|
getFrameData(key, cache = IMAGE) {
|
|
550
564
|
return this.getItem(key, cache, 'getFrameData', 'frameData');
|
|
@@ -554,6 +568,7 @@ export class Cache {
|
|
|
554
568
|
* TBD.
|
|
555
569
|
* @param {string} key - TBD.
|
|
556
570
|
* @param {number} cache - TBD.
|
|
571
|
+
* @returns {boolean} TBD.
|
|
557
572
|
*/
|
|
558
573
|
hasFrameData(key, cache = IMAGE) {
|
|
559
574
|
return this.getItem(key, cache, '', 'frameData') !== null;
|
|
@@ -562,7 +577,7 @@ export class Cache {
|
|
|
562
577
|
/**
|
|
563
578
|
* TBD.
|
|
564
579
|
* @param {string} key - TBD.
|
|
565
|
-
* @param frameData - TBD.
|
|
580
|
+
* @param {FrameData} frameData - TBD.
|
|
566
581
|
* @param {number} cache - TBD.
|
|
567
582
|
*/
|
|
568
583
|
updateFrameData(key, frameData, cache = IMAGE) {
|
|
@@ -576,6 +591,7 @@ export class Cache {
|
|
|
576
591
|
* @param {string} key - TBD.
|
|
577
592
|
* @param {number} index - TBD.
|
|
578
593
|
* @param {number} cache - TBD.
|
|
594
|
+
* @returns {Frame} TBD.
|
|
579
595
|
*/
|
|
580
596
|
getFrameByIndex(key, index, cache = IMAGE) {
|
|
581
597
|
const data = this.getFrameData(key, cache);
|
|
@@ -590,6 +606,7 @@ export class Cache {
|
|
|
590
606
|
* @param {string} key - TBD.
|
|
591
607
|
* @param {string} name - TBD.
|
|
592
608
|
* @param {number} cache - TBD.
|
|
609
|
+
* @returns {Frame} TBD.
|
|
593
610
|
*/
|
|
594
611
|
getFrameByName(key, name, cache = IMAGE) {
|
|
595
612
|
const data = this.getFrameData(key, cache);
|
|
@@ -602,6 +619,7 @@ export class Cache {
|
|
|
602
619
|
/**
|
|
603
620
|
* TBD.
|
|
604
621
|
* @param {string} url - TBD.
|
|
622
|
+
* @returns {string} TBD.
|
|
605
623
|
*/
|
|
606
624
|
getURL(url) {
|
|
607
625
|
const resolvedURL = this._resolveURL(url);
|
|
@@ -615,6 +633,7 @@ export class Cache {
|
|
|
615
633
|
/**
|
|
616
634
|
* TBD.
|
|
617
635
|
* @param {object} cache - TBD.
|
|
636
|
+
* @returns {string[]} TBD.
|
|
618
637
|
*/
|
|
619
638
|
getKeys(cache = IMAGE) {
|
|
620
639
|
const result = [];
|
|
@@ -739,7 +758,7 @@ export class Cache {
|
|
|
739
758
|
/**
|
|
740
759
|
* TBD.
|
|
741
760
|
* @param {string} url - TBD.
|
|
742
|
-
* @param data - TBD.
|
|
761
|
+
* @param {object} data - TBD.
|
|
743
762
|
* @returns {string} TBD.
|
|
744
763
|
*/
|
|
745
764
|
_resolveURL(url, data) {
|
package/src/phaser/core/dom.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Point } from '../geom/point';
|
|
2
|
-
import { Device } from './device';
|
|
3
2
|
|
|
4
3
|
class VisualBoundsDesktopRectangle {
|
|
5
4
|
/**
|
|
@@ -183,7 +182,7 @@ class DocumentBoundsRectangle {
|
|
|
183
182
|
export class DOM {
|
|
184
183
|
/**
|
|
185
184
|
* TBD.
|
|
186
|
-
* @param {Device} device - TBD.
|
|
185
|
+
* @param {import('./device').Device} device - TBD.
|
|
187
186
|
*/
|
|
188
187
|
constructor(device) {
|
|
189
188
|
this.treatAsDesktop =
|
|
@@ -201,7 +200,7 @@ export class DOM {
|
|
|
201
200
|
|
|
202
201
|
/**
|
|
203
202
|
* TBD.
|
|
204
|
-
* @param element - TBD.
|
|
203
|
+
* @param {HTMLCanvasElement} element - TBD.
|
|
205
204
|
* @param {Point} point - TBD.
|
|
206
205
|
* @returns {Point} TBD.
|
|
207
206
|
*/
|
|
@@ -219,7 +218,7 @@ export class DOM {
|
|
|
219
218
|
|
|
220
219
|
/**
|
|
221
220
|
* TBD.
|
|
222
|
-
* @param element - TBD.
|
|
221
|
+
* @param {HTMLCanvasElement} element - TBD.
|
|
223
222
|
* @param {number} cushion - TBD.
|
|
224
223
|
* @returns {boolean} TBD.
|
|
225
224
|
*/
|
|
@@ -233,7 +232,7 @@ export class DOM {
|
|
|
233
232
|
|
|
234
233
|
/**
|
|
235
234
|
* TBD.
|
|
236
|
-
* @param coords - TBD.
|
|
235
|
+
* @param {DOMRect} coords - TBD.
|
|
237
236
|
* @param {number} cushion - TBD.
|
|
238
237
|
* @returns {object} TBD.
|
|
239
238
|
*/
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Signal } from './signal';
|
|
2
|
-
import { DisplayObject } from '../display/display_object';
|
|
3
2
|
|
|
4
3
|
export class EventManager {
|
|
5
4
|
/**
|
|
6
5
|
* TBD.
|
|
7
|
-
* @param {DisplayObject} sprite - TBD.
|
|
6
|
+
* @param {import('../display/display_object').DisplayObject} sprite - TBD.
|
|
8
7
|
*/
|
|
9
8
|
constructor(sprite) {
|
|
10
9
|
this.parent = sprite;
|
|
@@ -4,12 +4,11 @@ import { Group } from '../display/group';
|
|
|
4
4
|
import { Graphics } from '../display/graphics';
|
|
5
5
|
import { Image } from '../display/image';
|
|
6
6
|
import { Text } from '../display/text';
|
|
7
|
-
import { Game } from './game';
|
|
8
7
|
|
|
9
8
|
export class GameObjectFactory {
|
|
10
9
|
/**
|
|
11
10
|
* TBD.
|
|
12
|
-
* @param {Game} game - TBD.
|
|
11
|
+
* @param {import('./game').Game} game - TBD.
|
|
13
12
|
*/
|
|
14
13
|
constructor(game) {
|
|
15
14
|
this.game = game;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cloneFrameData } from './frame_util';
|
|
2
|
-
import { Frame } from './frame';
|
|
3
2
|
|
|
4
3
|
export class FrameData {
|
|
5
4
|
/**
|
|
@@ -7,7 +6,7 @@ export class FrameData {
|
|
|
7
6
|
*/
|
|
8
7
|
constructor() {
|
|
9
8
|
/**
|
|
10
|
-
* @type {Frame[]}
|
|
9
|
+
* @type {import('./frame').Frame[]}
|
|
11
10
|
*/
|
|
12
11
|
this._frames = [];
|
|
13
12
|
/**
|
|
@@ -18,8 +17,8 @@ export class FrameData {
|
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* TBD.
|
|
21
|
-
* @param {Frame} frame - TBD.
|
|
22
|
-
* @returns {Frame} TBD.
|
|
20
|
+
* @param {import('./frame').Frame} frame - TBD.
|
|
21
|
+
* @returns {import('./frame').Frame} TBD.
|
|
23
22
|
*/
|
|
24
23
|
addFrame(frame) {
|
|
25
24
|
frame.index = this._frames.length;
|
|
@@ -33,7 +32,7 @@ export class FrameData {
|
|
|
33
32
|
/**
|
|
34
33
|
* TBD.
|
|
35
34
|
* @param {number} index - TBD.
|
|
36
|
-
* @returns {Frame} TBD.
|
|
35
|
+
* @returns {import('./frame').Frame} TBD.
|
|
37
36
|
*/
|
|
38
37
|
getFrame(index = 0) {
|
|
39
38
|
if (index >= this._frames.length) {
|
|
@@ -45,7 +44,7 @@ export class FrameData {
|
|
|
45
44
|
/**
|
|
46
45
|
* TBD.
|
|
47
46
|
* @param {string} name - TBD.
|
|
48
|
-
* @returns {Frame} TBD.
|
|
47
|
+
* @returns {import('./frame').Frame} TBD.
|
|
49
48
|
*/
|
|
50
49
|
getFrameByName(name) {
|
|
51
50
|
if (typeof this._frameNames[name] === 'number') {
|
|
@@ -78,8 +77,8 @@ export class FrameData {
|
|
|
78
77
|
* TBD.
|
|
79
78
|
* @param {number} start - TBD.
|
|
80
79
|
* @param {number} end - TBD.
|
|
81
|
-
* @param {Frame[]} output - TBD.
|
|
82
|
-
* @returns {Frame[]} TBD.
|
|
80
|
+
* @param {import('./frame').Frame[]} output - TBD.
|
|
81
|
+
* @returns {import('./frame').Frame[]} TBD.
|
|
83
82
|
*/
|
|
84
83
|
getFrameRange(start, end, output = null) {
|
|
85
84
|
const result = output || [];
|
package/src/phaser/core/input.js
CHANGED
|
@@ -10,14 +10,13 @@ import { Pointer } from './input_pointer';
|
|
|
10
10
|
import { Touch } from './input_touch';
|
|
11
11
|
import { POINTER_CURSOR, POINTER_CONTACT, MOUSE_TOUCH_COMBINE } from './const';
|
|
12
12
|
import { create, remove } from '../display/canvas/pool';
|
|
13
|
-
import { Game } from './game';
|
|
14
13
|
|
|
15
14
|
const MAX_POINTERS = 10;
|
|
16
15
|
|
|
17
16
|
export class Input {
|
|
18
17
|
/**
|
|
19
18
|
* TBD.
|
|
20
|
-
* @param {Game} game - TBD.
|
|
19
|
+
* @param {import('./game').Game} game - TBD.
|
|
21
20
|
*/
|
|
22
21
|
constructor(game) {
|
|
23
22
|
this.game = game;
|
|
@@ -125,7 +124,7 @@ export class Input {
|
|
|
125
124
|
/**
|
|
126
125
|
* TBD.
|
|
127
126
|
* @param {Function} callback - TBD.
|
|
128
|
-
* @param context - TBD.
|
|
127
|
+
* @param {object} context - TBD.
|
|
129
128
|
*/
|
|
130
129
|
setInteractiveCandidateHandler(callback, context) {
|
|
131
130
|
this.customCandidateHandler = callback;
|
|
@@ -135,7 +134,7 @@ export class Input {
|
|
|
135
134
|
/**
|
|
136
135
|
* TBD.
|
|
137
136
|
* @param {Function} callback - TBD.
|
|
138
|
-
* @param context - TBD.
|
|
137
|
+
* @param {object} context - TBD.
|
|
139
138
|
*/
|
|
140
139
|
addMoveCallback(callback, context) {
|
|
141
140
|
this.moveCallbacks.push({ callback, context });
|
|
@@ -144,7 +143,7 @@ export class Input {
|
|
|
144
143
|
/**
|
|
145
144
|
* TBD.
|
|
146
145
|
* @param {Function} callback - TBD.
|
|
147
|
-
* @param context - TBD.
|
|
146
|
+
* @param {object} context - TBD.
|
|
148
147
|
*/
|
|
149
148
|
deleteMoveCallback(callback, context) {
|
|
150
149
|
let i = this.moveCallbacks.length;
|
|
@@ -298,7 +297,7 @@ export class Input {
|
|
|
298
297
|
|
|
299
298
|
/**
|
|
300
299
|
* TBD.
|
|
301
|
-
* @param limit - TBD.
|
|
300
|
+
* @param {number} limit - TBD.
|
|
302
301
|
* @returns {number} TBD.
|
|
303
302
|
*/
|
|
304
303
|
countActivePointers(limit = this.pointers.length) {
|
|
@@ -329,7 +328,7 @@ export class Input {
|
|
|
329
328
|
|
|
330
329
|
/**
|
|
331
330
|
* TBD.
|
|
332
|
-
* @param identifier - TBD.
|
|
331
|
+
* @param {number} identifier - TBD.
|
|
333
332
|
* @returns {Pointer} TBD.
|
|
334
333
|
*/
|
|
335
334
|
getPointerFromIdentifier(identifier) {
|
|
@@ -345,7 +344,7 @@ export class Input {
|
|
|
345
344
|
|
|
346
345
|
/**
|
|
347
346
|
* TBD.
|
|
348
|
-
* @param pointerId - TBD.
|
|
347
|
+
* @param {number} pointerId - TBD.
|
|
349
348
|
* @returns {Pointer} TBD.
|
|
350
349
|
*/
|
|
351
350
|
getPointerFromId(pointerId) {
|
|
@@ -361,9 +360,9 @@ export class Input {
|
|
|
361
360
|
|
|
362
361
|
/**
|
|
363
362
|
* TBD.
|
|
364
|
-
* @param displayObject - TBD.
|
|
365
|
-
* @param pointer - TBD.
|
|
366
|
-
* @param output - TBD.
|
|
363
|
+
* @param {import('../display/display_object').DisplayObject} displayObject - TBD.
|
|
364
|
+
* @param {Pointer} pointer - TBD.
|
|
365
|
+
* @param {Point} output - TBD.
|
|
367
366
|
* @returns {Point} TBD.
|
|
368
367
|
*/
|
|
369
368
|
getLocalPosition(displayObject, pointer, output = null) {
|
|
@@ -378,9 +377,9 @@ export class Input {
|
|
|
378
377
|
|
|
379
378
|
/**
|
|
380
379
|
* TBD.
|
|
381
|
-
* @param displayObject - TBD.
|
|
382
|
-
* @param pointer - TBD.
|
|
383
|
-
* @param localPoint - TBD.
|
|
380
|
+
* @param {import('../display/display_object').DisplayObject} displayObject - TBD.
|
|
381
|
+
* @param {Pointer} pointer - TBD.
|
|
382
|
+
* @param {Point} localPoint - TBD.
|
|
384
383
|
* @returns {boolean} TBD.
|
|
385
384
|
*/
|
|
386
385
|
hitTest(displayObject, pointer, localPoint) {
|