@vpmedia/phaser 1.17.0 → 1.19.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 +4 -4
- package/src/phaser/core/animation.js +3 -2
- package/src/phaser/core/animation_manager.js +3 -2
- package/src/phaser/core/cache.js +38 -17
- package/src/phaser/core/const.js +66 -0
- package/src/phaser/core/device.js +87 -0
- package/src/phaser/core/dom.js +13 -8
- package/src/phaser/core/event_manager.js +2 -1
- package/src/phaser/core/factory.js +11 -11
- package/src/phaser/core/game.js +1 -0
- package/src/phaser/core/input.js +13 -12
- package/src/phaser/core/input_handler.js +2 -1
- package/src/phaser/core/input_mouse.js +3 -2
- package/src/phaser/core/input_mspointer.js +6 -6
- package/src/phaser/core/input_pointer.js +3 -2
- package/src/phaser/core/loader.js +70 -69
- package/src/phaser/core/scale_manager.js +41 -24
- package/src/phaser/core/scene_manager.js +11 -7
- package/src/phaser/core/signal_binding.js +16 -7
- package/src/phaser/core/sound_manager.js +14 -7
- package/src/phaser/core/sound_sprite.js +7 -4
- package/src/phaser/core/timer.js +33 -21
- package/src/phaser/core/timer_event.js +8 -6
- package/src/phaser/core/tween.js +66 -45
- package/src/phaser/core/tween_data.js +23 -15
- package/src/phaser/core/tween_manager.js +10 -6
- package/src/phaser/display/bitmap_text.js +7 -6
- package/src/phaser/display/canvas/pool.js +1 -1
- package/src/phaser/display/canvas/renderer.js +9 -5
- package/src/phaser/display/canvas/util.js +2 -2
- package/src/phaser/display/display_object.js +35 -16
- package/src/phaser/display/graphics.js +61 -40
- package/src/phaser/display/graphics_data.js +7 -7
- package/src/phaser/display/image.js +19 -12
- package/src/phaser/display/sprite_util.js +3 -2
- package/src/phaser/display/text.js +57 -33
- package/src/phaser/display/webgl/abstract_filter.js +2 -2
- package/src/phaser/display/webgl/base_texture.js +2 -2
- package/src/phaser/display/webgl/blend_manager.js +3 -2
- package/src/phaser/display/webgl/earcut_node.js +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.js +8 -6
- package/src/phaser/display/webgl/filter_manager.js +1 -1
- package/src/phaser/display/webgl/filter_texture.js +2 -2
- package/src/phaser/display/webgl/graphics.js +6 -6
- package/src/phaser/display/webgl/graphics_data.js +1 -1
- package/src/phaser/display/webgl/render_texture.js +9 -3
- package/src/phaser/display/webgl/renderer.js +13 -6
- package/src/phaser/display/webgl/shader/complex.js +1 -1
- package/src/phaser/display/webgl/shader/fast.js +1 -1
- package/src/phaser/display/webgl/shader/normal.js +2 -2
- package/src/phaser/display/webgl/shader/primitive.js +1 -1
- package/src/phaser/display/webgl/shader/strip.js +1 -1
- package/src/phaser/display/webgl/shader_manager.js +4 -3
- package/src/phaser/display/webgl/sprite_batch.js +10 -7
- package/src/phaser/display/webgl/stencil_manager.js +12 -10
- package/src/phaser/display/webgl/texture.js +8 -6
- package/typedefs/global.d.ts +1 -1
- package/types/phaser/core/animation.d.ts +5 -4
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +7 -6
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +69 -45
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/const.d.ts +88 -22
- package/types/phaser/core/const.d.ts.map +1 -1
- package/types/phaser/core/device.d.ts +87 -0
- package/types/phaser/core/device.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +19 -27
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +4 -3
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +15 -15
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +1 -0
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +22 -21
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +5 -4
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +1 -1
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +13 -13
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +5 -4
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +104 -103
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +57 -40
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +16 -11
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +23 -15
- package/types/phaser/core/signal_binding.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +16 -9
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +10 -7
- package/types/phaser/core/sound_sprite.d.ts.map +1 -1
- package/types/phaser/core/timer.d.ts +41 -29
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +12 -11
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +82 -62
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +31 -23
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_manager.d.ts +16 -12
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +10 -9
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +3 -2
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/buffer.d.ts +2 -2
- package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/types/phaser/display/canvas/pool.d.ts +2 -2
- package/types/phaser/display/canvas/pool.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +11 -7
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/canvas/util.d.ts +2 -2
- package/types/phaser/display/canvas/util.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +55 -36
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +71 -53
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/graphics_data.d.ts +16 -16
- package/types/phaser/display/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +27 -25
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts +5 -4
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +82 -93
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/types/phaser/display/webgl/base_texture.d.ts +4 -4
- package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/blend_manager.d.ts +6 -5
- package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/earcut_node.d.ts +3 -3
- package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +14 -13
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_manager.d.ts +3 -3
- package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_texture.d.ts +7 -7
- package/types/phaser/display/webgl/filter_texture.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/graphics_data.d.ts +5 -5
- package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +12 -10
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +16 -9
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/complex.d.ts +11 -11
- package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/fast.d.ts +15 -15
- package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +12 -12
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/primitive.d.ts +12 -12
- package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/strip.d.ts +12 -12
- package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +9 -8
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +17 -14
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +17 -15
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture.d.ts +15 -12
- 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.19.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",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"main": "./src/index.js",
|
|
23
23
|
"types": "./types/index.d.ts",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"eslint": "^8.
|
|
25
|
+
"eslint": "^8.39.0",
|
|
26
26
|
"eslint-config-prettier": "^8.8.0",
|
|
27
27
|
"eslint-plugin-import": "^2.27.5",
|
|
28
28
|
"eslint-plugin-jest": "^27.2.1",
|
|
29
|
-
"eslint-plugin-jsdoc": "^43.0.
|
|
29
|
+
"eslint-plugin-jsdoc": "^43.0.7",
|
|
30
30
|
"eslint-plugin-prettier": "^4.2.1",
|
|
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,16 @@
|
|
|
1
1
|
import { Game } from './game';
|
|
2
2
|
import { Signal } from './signal';
|
|
3
3
|
import { FrameData } from './frame_data';
|
|
4
|
+
import { Image } from '../display/image';
|
|
4
5
|
|
|
5
6
|
export class Animation {
|
|
6
7
|
/**
|
|
7
8
|
* TBD.
|
|
8
9
|
* @param {Game} game - TBD.
|
|
9
|
-
* @param parent - TBD.
|
|
10
|
+
* @param {Image} parent - TBD.
|
|
10
11
|
* @param {string} name - TBD.
|
|
11
12
|
* @param {FrameData} frameData - TBD.
|
|
12
|
-
* @param frames - TBD.
|
|
13
|
+
* @param {string[]|number[]} frames - TBD.
|
|
13
14
|
* @param {number} frameRate - TBD.
|
|
14
15
|
* @param {boolean} loop - TBD.
|
|
15
16
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Animation } from './animation';
|
|
2
2
|
import { FrameData } from './frame_data';
|
|
3
|
+
import { Image } from '../display/image';
|
|
3
4
|
|
|
4
5
|
export class AnimationManager {
|
|
5
6
|
/**
|
|
6
7
|
* TBD.
|
|
7
|
-
* @param sprite - TBD.
|
|
8
|
+
* @param {Image} sprite - TBD.
|
|
8
9
|
*/
|
|
9
10
|
constructor(sprite) {
|
|
10
11
|
this.sprite = sprite;
|
|
@@ -131,7 +132,7 @@ export class AnimationManager {
|
|
|
131
132
|
|
|
132
133
|
/**
|
|
133
134
|
* TBD.
|
|
134
|
-
* @param {number[]} frames - TBD.
|
|
135
|
+
* @param {string[]|number[]} frames - TBD.
|
|
135
136
|
* @param {boolean} useNumericIndex - TBD.
|
|
136
137
|
* @returns {boolean} TBD.
|
|
137
138
|
*/
|
package/src/phaser/core/cache.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Texture } from '../display/webgl/texture';
|
|
2
2
|
import { BaseTexture } from '../display/webgl/base_texture';
|
|
3
|
+
import { RenderTexture } from '../display/webgl/render_texture';
|
|
3
4
|
import { Signal } from './signal';
|
|
4
5
|
import { Frame } from './frame';
|
|
5
6
|
import { FrameData } from './frame_data';
|
|
@@ -84,7 +85,7 @@ export class Cache {
|
|
|
84
85
|
* TBD.
|
|
85
86
|
* @param {string} key - TBD.
|
|
86
87
|
* @param {string} url - TBD.
|
|
87
|
-
* @param data - TBD.
|
|
88
|
+
* @param {HTMLImageElement} data - TBD.
|
|
88
89
|
* @returns {object} TBD.
|
|
89
90
|
*/
|
|
90
91
|
addImage(key, url, data) {
|
|
@@ -112,8 +113,8 @@ export class Cache {
|
|
|
112
113
|
* TBD.
|
|
113
114
|
* @param {string} key - TBD.
|
|
114
115
|
* @param {string} url - TBD.
|
|
115
|
-
* @param data - TBD.
|
|
116
|
-
* @param atlasData - TBD.
|
|
116
|
+
* @param {HTMLCanvasElement} data - TBD.
|
|
117
|
+
* @param {object} atlasData - TBD.
|
|
117
118
|
*/
|
|
118
119
|
addTextureAtlas(key, url, data, atlasData) {
|
|
119
120
|
const obj = {
|
|
@@ -131,7 +132,7 @@ export class Cache {
|
|
|
131
132
|
* TBD.
|
|
132
133
|
* @param {string} key - TBD.
|
|
133
134
|
* @param {string} url - TBD.
|
|
134
|
-
* @param data - TBD.
|
|
135
|
+
* @param {object} data - TBD.
|
|
135
136
|
*/
|
|
136
137
|
addSound(key, url, data) {
|
|
137
138
|
this._cache.sound[key] = {
|
|
@@ -148,7 +149,7 @@ export class Cache {
|
|
|
148
149
|
* TBD.
|
|
149
150
|
* @param {string} key - TBD.
|
|
150
151
|
* @param {string} url - TBD.
|
|
151
|
-
* @param data - TBD.
|
|
152
|
+
* @param {string} data - TBD.
|
|
152
153
|
*/
|
|
153
154
|
addText(key, url, data) {
|
|
154
155
|
this._cache.text[key] = { url, data };
|
|
@@ -159,11 +160,11 @@ export class Cache {
|
|
|
159
160
|
* TBD.
|
|
160
161
|
* @param {string} key - TBD.
|
|
161
162
|
* @param {string} url - TBD.
|
|
162
|
-
* @param data - TBD.
|
|
163
|
-
* @param atlasData - TBD.
|
|
164
|
-
* @param atlasType - TBD.
|
|
165
|
-
* @param xSpacing - TBD.
|
|
166
|
-
* @param ySpacing - TBD.
|
|
163
|
+
* @param {HTMLCanvasElement} data - TBD.
|
|
164
|
+
* @param {object} atlasData - TBD.
|
|
165
|
+
* @param {string} atlasType - TBD.
|
|
166
|
+
* @param {number} xSpacing - TBD.
|
|
167
|
+
* @param {number} ySpacing - TBD.
|
|
167
168
|
*/
|
|
168
169
|
addBitmapFont(key, url, data, atlasData, atlasType, xSpacing = 0, ySpacing = 0) {
|
|
169
170
|
const obj = {
|
|
@@ -185,7 +186,7 @@ export class Cache {
|
|
|
185
186
|
* TBD.
|
|
186
187
|
* @param {string} key - TBD.
|
|
187
188
|
* @param {string} url - TBD.
|
|
188
|
-
* @param data - TBD.
|
|
189
|
+
* @param {object} data - TBD.
|
|
189
190
|
*/
|
|
190
191
|
addJSON(key, url, data) {
|
|
191
192
|
this._cache.json[key] = { url, data };
|
|
@@ -196,7 +197,7 @@ export class Cache {
|
|
|
196
197
|
* TBD.
|
|
197
198
|
* @param {string} key - TBD.
|
|
198
199
|
* @param {string} url - TBD.
|
|
199
|
-
* @param data - TBD.
|
|
200
|
+
* @param {XMLDocument} data - TBD.
|
|
200
201
|
*/
|
|
201
202
|
addXML(key, url, data) {
|
|
202
203
|
this._cache.xml[key] = { url, data };
|
|
@@ -235,7 +236,7 @@ export class Cache {
|
|
|
235
236
|
* TBD.
|
|
236
237
|
* @param {string} key - TBD.
|
|
237
238
|
* @param {string} property - TBD.
|
|
238
|
-
* @param value - TBD.
|
|
239
|
+
* @param {any} value - TBD.
|
|
239
240
|
*/
|
|
240
241
|
updateSound(key, property, value) {
|
|
241
242
|
const sound = this.getSound(key);
|
|
@@ -247,7 +248,7 @@ export class Cache {
|
|
|
247
248
|
/**
|
|
248
249
|
* TBD.
|
|
249
250
|
* @param {string} key - TBD.
|
|
250
|
-
* @param data - TBD.
|
|
251
|
+
* @param {object} data - TBD.
|
|
251
252
|
*/
|
|
252
253
|
decodedSound(key, data) {
|
|
253
254
|
const sound = this.getSound(key);
|
|
@@ -413,6 +414,7 @@ export class Cache {
|
|
|
413
414
|
/**
|
|
414
415
|
* TBD.
|
|
415
416
|
* @param {string} key - TBD.
|
|
417
|
+
* @returns {HTMLCanvasElement} TBD.
|
|
416
418
|
*/
|
|
417
419
|
getCanvas(key) {
|
|
418
420
|
return this.getItem(key, CANVAS, 'getCanvas', 'canvas');
|
|
@@ -421,7 +423,8 @@ export class Cache {
|
|
|
421
423
|
/**
|
|
422
424
|
* TBD.
|
|
423
425
|
* @param {string} key - TBD.
|
|
424
|
-
* @param full - TBD.
|
|
426
|
+
* @param {boolean} full - TBD.
|
|
427
|
+
* @returns {HTMLImageElement} TBD.
|
|
425
428
|
*/
|
|
426
429
|
getImage(key = '__default', full = false) {
|
|
427
430
|
let img = this.getItem(key, IMAGE, 'getImage');
|
|
@@ -437,6 +440,7 @@ export class Cache {
|
|
|
437
440
|
/**
|
|
438
441
|
* TBD.
|
|
439
442
|
* @param {string} key - TBD.
|
|
443
|
+
* @returns {object} TBD.
|
|
440
444
|
*/
|
|
441
445
|
getTextureFrame(key) {
|
|
442
446
|
return this.getItem(key, TEXTURE, 'getTextureFrame', 'frame');
|
|
@@ -445,6 +449,7 @@ export class Cache {
|
|
|
445
449
|
/**
|
|
446
450
|
* TBD.
|
|
447
451
|
* @param {string} key - TBD.
|
|
452
|
+
* @returns {object} TBD.
|
|
448
453
|
*/
|
|
449
454
|
getSound(key) {
|
|
450
455
|
return this.getItem(key, SOUND, 'getSound');
|
|
@@ -453,6 +458,7 @@ export class Cache {
|
|
|
453
458
|
/**
|
|
454
459
|
* TBD.
|
|
455
460
|
* @param {string} key - TBD.
|
|
461
|
+
* @returns {object} TBD.
|
|
456
462
|
*/
|
|
457
463
|
getSoundData(key) {
|
|
458
464
|
return this.getItem(key, SOUND, 'getSoundData', 'data');
|
|
@@ -461,6 +467,7 @@ export class Cache {
|
|
|
461
467
|
/**
|
|
462
468
|
* TBD.
|
|
463
469
|
* @param {string} key - TBD.
|
|
470
|
+
* @returns {object} TBD.
|
|
464
471
|
*/
|
|
465
472
|
getText(key) {
|
|
466
473
|
return this.getItem(key, TEXT, 'getText', 'data');
|
|
@@ -469,6 +476,7 @@ export class Cache {
|
|
|
469
476
|
/**
|
|
470
477
|
* TBD.
|
|
471
478
|
* @param {string} key - TBD.
|
|
479
|
+
* @returns {object} TBD.
|
|
472
480
|
*/
|
|
473
481
|
getBitmapData(key) {
|
|
474
482
|
return this.getItem(key, BITMAPDATA, 'getBitmapData', 'data');
|
|
@@ -477,6 +485,7 @@ export class Cache {
|
|
|
477
485
|
/**
|
|
478
486
|
* TBD.
|
|
479
487
|
* @param {string} key - TBD.
|
|
488
|
+
* @returns {object} TBD.
|
|
480
489
|
*/
|
|
481
490
|
getBitmapFont(key) {
|
|
482
491
|
return this.getItem(key, BITMAPFONT, 'getBitmapFont');
|
|
@@ -486,6 +495,7 @@ export class Cache {
|
|
|
486
495
|
* TBD.
|
|
487
496
|
* @param {string} key - TBD.
|
|
488
497
|
* @param {boolean} isClone - TBD.
|
|
498
|
+
* @returns {object} TBD.
|
|
489
499
|
*/
|
|
490
500
|
getJSON(key, isClone = false) {
|
|
491
501
|
const data = this.getItem(key, JSON, 'getJSON', 'data');
|
|
@@ -495,6 +505,7 @@ export class Cache {
|
|
|
495
505
|
/**
|
|
496
506
|
* TBD.
|
|
497
507
|
* @param {string} key - TBD.
|
|
508
|
+
* @returns {XMLDocument} TBD.
|
|
498
509
|
*/
|
|
499
510
|
getXML(key) {
|
|
500
511
|
return this.getItem(key, XML, 'getXML', 'data');
|
|
@@ -503,6 +514,7 @@ export class Cache {
|
|
|
503
514
|
/**
|
|
504
515
|
* TBD.
|
|
505
516
|
* @param {string} key - TBD.
|
|
517
|
+
* @returns {RenderTexture} TBD.
|
|
506
518
|
*/
|
|
507
519
|
getRenderTexture(key) {
|
|
508
520
|
return this.getItem(key, RENDER_TEXTURE, 'getRenderTexture');
|
|
@@ -514,6 +526,7 @@ export class Cache {
|
|
|
514
526
|
* TBD.
|
|
515
527
|
* @param {string} key - TBD.
|
|
516
528
|
* @param {number} cache - TBD.
|
|
529
|
+
* @returns {BaseTexture} TBD.
|
|
517
530
|
*/
|
|
518
531
|
getBaseTexture(key, cache = IMAGE) {
|
|
519
532
|
return this.getItem(key, cache, 'getBaseTexture', 'base');
|
|
@@ -523,6 +536,7 @@ export class Cache {
|
|
|
523
536
|
* TBD.
|
|
524
537
|
* @param {string} key - TBD.
|
|
525
538
|
* @param {number} cache - TBD.
|
|
539
|
+
* @returns {Frame} TBD.
|
|
526
540
|
*/
|
|
527
541
|
getFrame(key, cache = IMAGE) {
|
|
528
542
|
return this.getItem(key, cache, 'getFrame', 'frame');
|
|
@@ -532,6 +546,7 @@ export class Cache {
|
|
|
532
546
|
* TBD.
|
|
533
547
|
* @param {string} key - TBD.
|
|
534
548
|
* @param {number} cache - TBD.
|
|
549
|
+
* @returns {number} TBD.
|
|
535
550
|
*/
|
|
536
551
|
getFrameCount(key, cache = IMAGE) {
|
|
537
552
|
const data = this.getFrameData(key, cache);
|
|
@@ -545,6 +560,7 @@ export class Cache {
|
|
|
545
560
|
* TBD.
|
|
546
561
|
* @param {string} key - TBD.
|
|
547
562
|
* @param {number} cache - TBD.
|
|
563
|
+
* @returns {FrameData} TBD.
|
|
548
564
|
*/
|
|
549
565
|
getFrameData(key, cache = IMAGE) {
|
|
550
566
|
return this.getItem(key, cache, 'getFrameData', 'frameData');
|
|
@@ -554,6 +570,7 @@ export class Cache {
|
|
|
554
570
|
* TBD.
|
|
555
571
|
* @param {string} key - TBD.
|
|
556
572
|
* @param {number} cache - TBD.
|
|
573
|
+
* @returns {boolean} TBD.
|
|
557
574
|
*/
|
|
558
575
|
hasFrameData(key, cache = IMAGE) {
|
|
559
576
|
return this.getItem(key, cache, '', 'frameData') !== null;
|
|
@@ -562,7 +579,7 @@ export class Cache {
|
|
|
562
579
|
/**
|
|
563
580
|
* TBD.
|
|
564
581
|
* @param {string} key - TBD.
|
|
565
|
-
* @param frameData - TBD.
|
|
582
|
+
* @param {FrameData} frameData - TBD.
|
|
566
583
|
* @param {number} cache - TBD.
|
|
567
584
|
*/
|
|
568
585
|
updateFrameData(key, frameData, cache = IMAGE) {
|
|
@@ -576,6 +593,7 @@ export class Cache {
|
|
|
576
593
|
* @param {string} key - TBD.
|
|
577
594
|
* @param {number} index - TBD.
|
|
578
595
|
* @param {number} cache - TBD.
|
|
596
|
+
* @returns {Frame} TBD.
|
|
579
597
|
*/
|
|
580
598
|
getFrameByIndex(key, index, cache = IMAGE) {
|
|
581
599
|
const data = this.getFrameData(key, cache);
|
|
@@ -590,6 +608,7 @@ export class Cache {
|
|
|
590
608
|
* @param {string} key - TBD.
|
|
591
609
|
* @param {string} name - TBD.
|
|
592
610
|
* @param {number} cache - TBD.
|
|
611
|
+
* @returns {Frame} TBD.
|
|
593
612
|
*/
|
|
594
613
|
getFrameByName(key, name, cache = IMAGE) {
|
|
595
614
|
const data = this.getFrameData(key, cache);
|
|
@@ -602,6 +621,7 @@ export class Cache {
|
|
|
602
621
|
/**
|
|
603
622
|
* TBD.
|
|
604
623
|
* @param {string} url - TBD.
|
|
624
|
+
* @returns {string} TBD.
|
|
605
625
|
*/
|
|
606
626
|
getURL(url) {
|
|
607
627
|
const resolvedURL = this._resolveURL(url);
|
|
@@ -615,6 +635,7 @@ export class Cache {
|
|
|
615
635
|
/**
|
|
616
636
|
* TBD.
|
|
617
637
|
* @param {object} cache - TBD.
|
|
638
|
+
* @returns {string[]} TBD.
|
|
618
639
|
*/
|
|
619
640
|
getKeys(cache = IMAGE) {
|
|
620
641
|
const result = [];
|
|
@@ -739,7 +760,7 @@ export class Cache {
|
|
|
739
760
|
/**
|
|
740
761
|
* TBD.
|
|
741
762
|
* @param {string} url - TBD.
|
|
742
|
-
* @param data - TBD.
|
|
763
|
+
* @param {object} data - TBD.
|
|
743
764
|
* @returns {string} TBD.
|
|
744
765
|
*/
|
|
745
766
|
_resolveURL(url, data) {
|
package/src/phaser/core/const.js
CHANGED
|
@@ -169,25 +169,91 @@ export const TOUCH_OVERRIDES_MOUSE = 1;
|
|
|
169
169
|
*/
|
|
170
170
|
export const MOUSE_TOUCH_COMBINE = 2;
|
|
171
171
|
// game objects
|
|
172
|
+
/**
|
|
173
|
+
* @type {number}
|
|
174
|
+
*/
|
|
172
175
|
export const GROUP = 7;
|
|
176
|
+
/**
|
|
177
|
+
* @type {number}
|
|
178
|
+
*/
|
|
173
179
|
export const SPRITE = 0;
|
|
180
|
+
/**
|
|
181
|
+
* @type {number}
|
|
182
|
+
*/
|
|
174
183
|
export const SPRITE_BATCH = 17;
|
|
184
|
+
/**
|
|
185
|
+
* @type {number}
|
|
186
|
+
*/
|
|
175
187
|
export const BUTTON = 1;
|
|
188
|
+
/**
|
|
189
|
+
* @type {number}
|
|
190
|
+
*/
|
|
176
191
|
export const IMAGE = 2;
|
|
192
|
+
/**
|
|
193
|
+
* @type {number}
|
|
194
|
+
*/
|
|
177
195
|
export const GRAPHICS = 3;
|
|
196
|
+
/**
|
|
197
|
+
* @type {number}
|
|
198
|
+
*/
|
|
178
199
|
export const TEXT = 4;
|
|
200
|
+
/**
|
|
201
|
+
* @type {number}
|
|
202
|
+
*/
|
|
179
203
|
export const BITMAP_TEXT = 6;
|
|
204
|
+
/**
|
|
205
|
+
* @type {number}
|
|
206
|
+
*/
|
|
180
207
|
export const TILE_SPRITE = 5;
|
|
208
|
+
/**
|
|
209
|
+
* @type {number}
|
|
210
|
+
*/
|
|
181
211
|
export const RENDER_TEXTURE = 8;
|
|
212
|
+
/**
|
|
213
|
+
* @type {number}
|
|
214
|
+
*/
|
|
182
215
|
export const FILTER_CANVAS = 14;
|
|
216
|
+
/**
|
|
217
|
+
* @type {number}
|
|
218
|
+
*/
|
|
183
219
|
export const FILTER_WEBGL = 15;
|
|
220
|
+
/**
|
|
221
|
+
* @type {number}
|
|
222
|
+
*/
|
|
184
223
|
export const POINTER = 19;
|
|
224
|
+
/**
|
|
225
|
+
* @type {number}
|
|
226
|
+
*/
|
|
185
227
|
export const GEOM_POLYGON = 12;
|
|
228
|
+
/**
|
|
229
|
+
* @type {number}
|
|
230
|
+
*/
|
|
186
231
|
export const GEOM_RECTANGLE = 22;
|
|
232
|
+
/**
|
|
233
|
+
* @type {number}
|
|
234
|
+
*/
|
|
187
235
|
export const GEOM_CIRCLE = 21;
|
|
236
|
+
/**
|
|
237
|
+
* @type {number}
|
|
238
|
+
*/
|
|
188
239
|
export const GEOM_ELLIPSE = 16;
|
|
240
|
+
/**
|
|
241
|
+
* @type {number}
|
|
242
|
+
*/
|
|
189
243
|
export const GEOM_ROUNDED_RECTANGLE = 26;
|
|
244
|
+
/**
|
|
245
|
+
* @type {number}
|
|
246
|
+
*/
|
|
190
247
|
export const GEOM_LINE = 23;
|
|
248
|
+
/**
|
|
249
|
+
* @type {number}
|
|
250
|
+
*/
|
|
191
251
|
export const GEOM_MATRIX = 24;
|
|
252
|
+
/**
|
|
253
|
+
* @type {number}
|
|
254
|
+
*/
|
|
192
255
|
export const GEOM_POINT = 25;
|
|
256
|
+
/**
|
|
257
|
+
* @type {number}
|
|
258
|
+
*/
|
|
193
259
|
export const PENDING_ATLAS = -1;
|
|
@@ -3,35 +3,122 @@ export class Device {
|
|
|
3
3
|
* TBD.
|
|
4
4
|
*/
|
|
5
5
|
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* @type {boolean}
|
|
8
|
+
*/
|
|
6
9
|
this.desktop = false;
|
|
10
|
+
/**
|
|
11
|
+
* @type {boolean}
|
|
12
|
+
*/
|
|
7
13
|
this.iOS = false;
|
|
14
|
+
/**
|
|
15
|
+
* @type {boolean}
|
|
16
|
+
*/
|
|
8
17
|
this.android = false;
|
|
18
|
+
/**
|
|
19
|
+
* @type {boolean}
|
|
20
|
+
*/
|
|
9
21
|
this.chromeOS = false;
|
|
22
|
+
/**
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
10
25
|
this.linux = false;
|
|
26
|
+
/**
|
|
27
|
+
* @type {boolean}
|
|
28
|
+
*/
|
|
11
29
|
this.macOS = false;
|
|
30
|
+
/**
|
|
31
|
+
* @type {boolean}
|
|
32
|
+
*/
|
|
12
33
|
this.windows = false;
|
|
34
|
+
/**
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
*/
|
|
13
37
|
this.windowsPhone = false;
|
|
38
|
+
/**
|
|
39
|
+
* @type {boolean}
|
|
40
|
+
*/
|
|
14
41
|
this.canvas = false;
|
|
42
|
+
/**
|
|
43
|
+
* @type {boolean}
|
|
44
|
+
*/
|
|
15
45
|
this.touch = false;
|
|
46
|
+
/**
|
|
47
|
+
* @type {boolean}
|
|
48
|
+
*/
|
|
16
49
|
this.mspointer = false;
|
|
17
50
|
this.wheelEvent = null;
|
|
51
|
+
/**
|
|
52
|
+
* @type {boolean}
|
|
53
|
+
*/
|
|
18
54
|
this.chrome = false;
|
|
55
|
+
/**
|
|
56
|
+
* @type {boolean}
|
|
57
|
+
*/
|
|
19
58
|
this.firefox = false;
|
|
59
|
+
/**
|
|
60
|
+
* @type {boolean}
|
|
61
|
+
*/
|
|
20
62
|
this.edge = false;
|
|
63
|
+
/**
|
|
64
|
+
* @type {boolean}
|
|
65
|
+
*/
|
|
21
66
|
this.safari = false;
|
|
67
|
+
/**
|
|
68
|
+
* @type {boolean}
|
|
69
|
+
*/
|
|
22
70
|
this.silk = false;
|
|
71
|
+
/**
|
|
72
|
+
* @type {boolean}
|
|
73
|
+
*/
|
|
23
74
|
this.ogg = false;
|
|
75
|
+
/**
|
|
76
|
+
* @type {boolean}
|
|
77
|
+
*/
|
|
24
78
|
this.opus = false;
|
|
79
|
+
/**
|
|
80
|
+
* @type {boolean}
|
|
81
|
+
*/
|
|
25
82
|
this.mp3 = false;
|
|
83
|
+
/**
|
|
84
|
+
* @type {boolean}
|
|
85
|
+
*/
|
|
26
86
|
this.wav = false;
|
|
87
|
+
/**
|
|
88
|
+
* @type {boolean}
|
|
89
|
+
*/
|
|
27
90
|
this.m4a = false;
|
|
91
|
+
/**
|
|
92
|
+
* @type {boolean}
|
|
93
|
+
*/
|
|
28
94
|
this.webm = false;
|
|
95
|
+
/**
|
|
96
|
+
* @type {boolean}
|
|
97
|
+
*/
|
|
29
98
|
this.dolby = false;
|
|
99
|
+
/**
|
|
100
|
+
* @type {boolean}
|
|
101
|
+
*/
|
|
30
102
|
this.avif = false;
|
|
103
|
+
/**
|
|
104
|
+
* @type {boolean}
|
|
105
|
+
*/
|
|
31
106
|
this.webp = false;
|
|
107
|
+
/**
|
|
108
|
+
* @type {boolean}
|
|
109
|
+
*/
|
|
32
110
|
this.fullscreen = false;
|
|
111
|
+
/**
|
|
112
|
+
* @type {string}
|
|
113
|
+
*/
|
|
33
114
|
this.requestFullscreen = '';
|
|
115
|
+
/**
|
|
116
|
+
* @type {string}
|
|
117
|
+
*/
|
|
34
118
|
this.cancelFullscreen = '';
|
|
119
|
+
/**
|
|
120
|
+
* @type {boolean}
|
|
121
|
+
*/
|
|
35
122
|
this.fullscreenKeyboard = false;
|
|
36
123
|
}
|
|
37
124
|
}
|
package/src/phaser/core/dom.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Point } from '../geom/point';
|
|
2
|
+
import { Device } from './device';
|
|
2
3
|
|
|
3
4
|
class VisualBoundsDesktopRectangle {
|
|
4
5
|
/**
|
|
@@ -182,7 +183,7 @@ class DocumentBoundsRectangle {
|
|
|
182
183
|
export class DOM {
|
|
183
184
|
/**
|
|
184
185
|
* TBD.
|
|
185
|
-
* @param device
|
|
186
|
+
* @param {Device} device - TBD.
|
|
186
187
|
*/
|
|
187
188
|
constructor(device) {
|
|
188
189
|
this.treatAsDesktop =
|
|
@@ -200,8 +201,9 @@ export class DOM {
|
|
|
200
201
|
|
|
201
202
|
/**
|
|
202
203
|
* TBD.
|
|
203
|
-
* @param element
|
|
204
|
-
* @param point
|
|
204
|
+
* @param {HTMLCanvasElement} element - TBD.
|
|
205
|
+
* @param {Point} point - TBD.
|
|
206
|
+
* @returns {Point} TBD.
|
|
205
207
|
*/
|
|
206
208
|
getOffset(element, point = null) {
|
|
207
209
|
point = point || new Point();
|
|
@@ -217,8 +219,9 @@ export class DOM {
|
|
|
217
219
|
|
|
218
220
|
/**
|
|
219
221
|
* TBD.
|
|
220
|
-
* @param element
|
|
221
|
-
* @param cushion
|
|
222
|
+
* @param {HTMLCanvasElement} element - TBD.
|
|
223
|
+
* @param {number} cushion - TBD.
|
|
224
|
+
* @returns {boolean} TBD.
|
|
222
225
|
*/
|
|
223
226
|
getBounds(element, cushion = 0) {
|
|
224
227
|
element = element && !element.nodeType ? element[0] : element;
|
|
@@ -230,8 +233,9 @@ export class DOM {
|
|
|
230
233
|
|
|
231
234
|
/**
|
|
232
235
|
* TBD.
|
|
233
|
-
* @param coords
|
|
234
|
-
* @param cushion
|
|
236
|
+
* @param {DOMRect} coords - TBD.
|
|
237
|
+
* @param {number} cushion - TBD.
|
|
238
|
+
* @returns {object} TBD.
|
|
235
239
|
*/
|
|
236
240
|
calibrate(coords, cushion = 0) {
|
|
237
241
|
const output = {
|
|
@@ -249,7 +253,8 @@ export class DOM {
|
|
|
249
253
|
|
|
250
254
|
/**
|
|
251
255
|
* TBD.
|
|
252
|
-
* @param primaryFallback
|
|
256
|
+
* @param {string} primaryFallback - TBD.
|
|
257
|
+
* @returns {string} TBD.
|
|
253
258
|
*/
|
|
254
259
|
getScreenOrientation(primaryFallback) {
|
|
255
260
|
const screen = window.screen;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Signal } from './signal';
|
|
2
|
+
import { DisplayObject } from '../display/display_object';
|
|
2
3
|
|
|
3
4
|
export class EventManager {
|
|
4
5
|
/**
|
|
5
6
|
* TBD.
|
|
6
|
-
* @param sprite - TBD.
|
|
7
|
+
* @param {DisplayObject} sprite - TBD.
|
|
7
8
|
*/
|
|
8
9
|
constructor(sprite) {
|
|
9
10
|
this.parent = sprite;
|
|
@@ -20,7 +20,7 @@ export class GameObjectFactory {
|
|
|
20
20
|
* @param {number} x - TBD.
|
|
21
21
|
* @param {number} y - TBD.
|
|
22
22
|
* @param {string} key - TBD.
|
|
23
|
-
* @param frame - TBD.
|
|
23
|
+
* @param {string} frame - TBD.
|
|
24
24
|
* @param {Group} group - TBD.
|
|
25
25
|
* @returns {Image} TBD.
|
|
26
26
|
*/
|
|
@@ -46,8 +46,8 @@ export class GameObjectFactory {
|
|
|
46
46
|
* TBD.
|
|
47
47
|
* @param {number} x - TBD.
|
|
48
48
|
* @param {number} y - TBD.
|
|
49
|
-
* @param text - TBD.
|
|
50
|
-
* @param style - TBD.
|
|
49
|
+
* @param {string} text - TBD.
|
|
50
|
+
* @param {object} style - TBD.
|
|
51
51
|
* @param {Group} group - TBD.
|
|
52
52
|
* @returns {Text} TBD.
|
|
53
53
|
*/
|
|
@@ -63,10 +63,10 @@ export class GameObjectFactory {
|
|
|
63
63
|
* @param {string} key - TBD.
|
|
64
64
|
* @param {Function} callback - TBD.
|
|
65
65
|
* @param {object} callbackContext - TBD.
|
|
66
|
-
* @param overFrame - TBD.
|
|
67
|
-
* @param outFrame - TBD.
|
|
68
|
-
* @param downFrame - TBD.
|
|
69
|
-
* @param upFrame - TBD.
|
|
66
|
+
* @param {string} overFrame - TBD.
|
|
67
|
+
* @param {string} outFrame - TBD.
|
|
68
|
+
* @param {string} downFrame - TBD.
|
|
69
|
+
* @param {string} upFrame - TBD.
|
|
70
70
|
* @param {Group} group - TBD.
|
|
71
71
|
* @returns {Button} TBD.
|
|
72
72
|
*/
|
|
@@ -93,11 +93,11 @@ export class GameObjectFactory {
|
|
|
93
93
|
* TBD.
|
|
94
94
|
* @param {number} x - TBD.
|
|
95
95
|
* @param {number} y - TBD.
|
|
96
|
-
* @param font - TBD.
|
|
97
|
-
* @param text - TBD.
|
|
98
|
-
* @param size - TBD.
|
|
96
|
+
* @param {string} font - TBD.
|
|
97
|
+
* @param {string} text - TBD.
|
|
98
|
+
* @param {number} size - TBD.
|
|
99
99
|
* @param {Group} group - TBD.
|
|
100
|
-
* @param align - TBD.
|
|
100
|
+
* @param {string} align - TBD.
|
|
101
101
|
* @returns {BitmapText} TBD.
|
|
102
102
|
*/
|
|
103
103
|
bitmapText(x, y, font, text, size, group = null, align = 'left') {
|