@vpmedia/phaser 1.16.0 → 1.18.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 +3 -3
- package/src/phaser/core/animation.js +31 -18
- package/src/phaser/core/animation_manager.js +36 -21
- package/src/phaser/core/animation_parser.js +1 -1
- package/src/phaser/core/array_set.js +17 -9
- package/src/phaser/core/cache.js +61 -45
- 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 +21 -21
- package/src/phaser/core/frame_data.js +1 -1
- package/src/phaser/core/game.js +1 -0
- package/src/phaser/core/input.js +37 -20
- package/src/phaser/core/input_handler.js +1 -1
- package/src/phaser/core/input_mouse.js +16 -12
- package/src/phaser/core/input_mspointer.js +7 -7
- package/src/phaser/core/input_pointer.js +26 -17
- package/src/phaser/core/input_touch.js +7 -7
- package/src/phaser/core/loader.js +104 -75
- package/src/phaser/core/raf.js +1 -1
- package/src/phaser/core/scale_manager.js +46 -29
- package/src/phaser/core/scene_manager.js +13 -9
- package/src/phaser/core/sound.js +3 -3
- package/src/phaser/core/sound_manager.js +17 -10
- package/src/phaser/core/sound_sprite.js +7 -4
- package/src/phaser/core/timer.js +38 -26
- package/src/phaser/core/timer_event.js +10 -8
- package/src/phaser/core/tween.js +66 -46
- package/src/phaser/core/tween_data.js +22 -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 +5 -4
- package/src/phaser/display/canvas/util.js +2 -2
- package/src/phaser/display/display_object.js +33 -16
- package/src/phaser/display/graphics.js +57 -36
- package/src/phaser/display/graphics_data.js +7 -7
- package/src/phaser/display/group.js +28 -20
- package/src/phaser/display/image.js +19 -12
- package/src/phaser/display/sprite_util.js +3 -2
- package/src/phaser/display/text.js +27 -14
- 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 +6 -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_data.js +1 -1
- package/src/phaser/display/webgl/render_texture.js +7 -3
- package/src/phaser/display/webgl/renderer.js +9 -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 +3 -3
- package/src/phaser/display/webgl/sprite_batch.js +9 -7
- package/src/phaser/display/webgl/stencil_manager.js +7 -7
- package/src/phaser/display/webgl/texture.js +8 -6
- package/types/phaser/core/animation.d.ts +43 -30
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +59 -43
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/animation_parser.d.ts +2 -2
- package/types/phaser/core/array_set.d.ts +24 -16
- package/types/phaser/core/array_set.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +79 -73
- 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 +28 -28
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/frame_data.d.ts +2 -2
- package/types/phaser/core/frame_data.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 +51 -34
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +2 -2
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +20 -19
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +15 -15
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +39 -30
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/input_touch.d.ts +15 -15
- package/types/phaser/core/input_touch.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +118 -92
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +3 -3
- package/types/phaser/core/raf.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +68 -51
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +18 -13
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/sound.d.ts +4 -4
- package/types/phaser/core/sound.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +22 -15
- 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 +47 -35
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +15 -14
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +81 -61
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +26 -19
- 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/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 +5 -4
- 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 +50 -33
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +65 -47
- 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/group.d.ts +38 -30
- package/types/phaser/display/group.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +24 -23
- 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 +33 -55
- 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/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 +12 -12
- 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_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 +9 -9
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +10 -7
- 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 +11 -11
- 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 +5 -5
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +16 -14
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +12 -12
- 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/src/phaser/core/cache.js
CHANGED
|
@@ -83,8 +83,9 @@ export class Cache {
|
|
|
83
83
|
/**
|
|
84
84
|
* TBD.
|
|
85
85
|
* @param {string} key - TBD.
|
|
86
|
-
* @param url
|
|
87
|
-
* @param data
|
|
86
|
+
* @param {string} url - TBD.
|
|
87
|
+
* @param data - TBD.
|
|
88
|
+
* @returns {object} TBD.
|
|
88
89
|
*/
|
|
89
90
|
addImage(key, url, data) {
|
|
90
91
|
if (this.checkImageKey(key)) {
|
|
@@ -110,9 +111,9 @@ export class Cache {
|
|
|
110
111
|
/**
|
|
111
112
|
* TBD.
|
|
112
113
|
* @param {string} key - TBD.
|
|
113
|
-
* @param url
|
|
114
|
-
* @param data
|
|
115
|
-
* @param atlasData
|
|
114
|
+
* @param {string} url - TBD.
|
|
115
|
+
* @param data - TBD.
|
|
116
|
+
* @param {object} atlasData - TBD.
|
|
116
117
|
*/
|
|
117
118
|
addTextureAtlas(key, url, data, atlasData) {
|
|
118
119
|
const obj = {
|
|
@@ -129,8 +130,8 @@ export class Cache {
|
|
|
129
130
|
/**
|
|
130
131
|
* TBD.
|
|
131
132
|
* @param {string} key - TBD.
|
|
132
|
-
* @param url
|
|
133
|
-
* @param data
|
|
133
|
+
* @param {string} url - TBD.
|
|
134
|
+
* @param data - TBD.
|
|
134
135
|
*/
|
|
135
136
|
addSound(key, url, data) {
|
|
136
137
|
this._cache.sound[key] = {
|
|
@@ -146,8 +147,8 @@ export class Cache {
|
|
|
146
147
|
/**
|
|
147
148
|
* TBD.
|
|
148
149
|
* @param {string} key - TBD.
|
|
149
|
-
* @param url
|
|
150
|
-
* @param data
|
|
150
|
+
* @param {string} url - TBD.
|
|
151
|
+
* @param data - TBD.
|
|
151
152
|
*/
|
|
152
153
|
addText(key, url, data) {
|
|
153
154
|
this._cache.text[key] = { url, data };
|
|
@@ -157,12 +158,12 @@ export class Cache {
|
|
|
157
158
|
/**
|
|
158
159
|
* TBD.
|
|
159
160
|
* @param {string} key - TBD.
|
|
160
|
-
* @param url
|
|
161
|
-
* @param data
|
|
162
|
-
* @param atlasData
|
|
163
|
-
* @param atlasType
|
|
164
|
-
* @param xSpacing
|
|
165
|
-
* @param ySpacing
|
|
161
|
+
* @param {string} url - TBD.
|
|
162
|
+
* @param data - TBD.
|
|
163
|
+
* @param atlasData - TBD.
|
|
164
|
+
* @param atlasType - TBD.
|
|
165
|
+
* @param xSpacing - TBD.
|
|
166
|
+
* @param ySpacing - TBD.
|
|
166
167
|
*/
|
|
167
168
|
addBitmapFont(key, url, data, atlasData, atlasType, xSpacing = 0, ySpacing = 0) {
|
|
168
169
|
const obj = {
|
|
@@ -183,8 +184,8 @@ export class Cache {
|
|
|
183
184
|
/**
|
|
184
185
|
* TBD.
|
|
185
186
|
* @param {string} key - TBD.
|
|
186
|
-
* @param url
|
|
187
|
-
* @param data
|
|
187
|
+
* @param {string} url - TBD.
|
|
188
|
+
* @param data - TBD.
|
|
188
189
|
*/
|
|
189
190
|
addJSON(key, url, data) {
|
|
190
191
|
this._cache.json[key] = { url, data };
|
|
@@ -194,8 +195,8 @@ export class Cache {
|
|
|
194
195
|
/**
|
|
195
196
|
* TBD.
|
|
196
197
|
* @param {string} key - TBD.
|
|
197
|
-
* @param url
|
|
198
|
-
* @param data
|
|
198
|
+
* @param {string} url - TBD.
|
|
199
|
+
* @param data - TBD.
|
|
199
200
|
*/
|
|
200
201
|
addXML(key, url, data) {
|
|
201
202
|
this._cache.xml[key] = { url, data };
|
|
@@ -233,8 +234,8 @@ export class Cache {
|
|
|
233
234
|
/**
|
|
234
235
|
* TBD.
|
|
235
236
|
* @param {string} key - TBD.
|
|
236
|
-
* @param property
|
|
237
|
-
* @param value
|
|
237
|
+
* @param {string} property - TBD.
|
|
238
|
+
* @param value - TBD.
|
|
238
239
|
*/
|
|
239
240
|
updateSound(key, property, value) {
|
|
240
241
|
const sound = this.getSound(key);
|
|
@@ -246,7 +247,7 @@ export class Cache {
|
|
|
246
247
|
/**
|
|
247
248
|
* TBD.
|
|
248
249
|
* @param {string} key - TBD.
|
|
249
|
-
* @param data
|
|
250
|
+
* @param data - TBD.
|
|
250
251
|
*/
|
|
251
252
|
decodedSound(key, data) {
|
|
252
253
|
const sound = this.getSound(key);
|
|
@@ -258,6 +259,7 @@ export class Cache {
|
|
|
258
259
|
/**
|
|
259
260
|
* TBD.
|
|
260
261
|
* @param {string} key - TBD.
|
|
262
|
+
* @returns {boolean} TBD.
|
|
261
263
|
*/
|
|
262
264
|
isSoundDecoded(key) {
|
|
263
265
|
const sound = this.getItem(key, SOUND, 'isSoundDecoded');
|
|
@@ -270,6 +272,7 @@ export class Cache {
|
|
|
270
272
|
/**
|
|
271
273
|
* TBD.
|
|
272
274
|
* @param {string} key - TBD.
|
|
275
|
+
* @returns {boolean} TBD.
|
|
273
276
|
*/
|
|
274
277
|
isSoundReady(key) {
|
|
275
278
|
const sound = this.getItem(key, SOUND, 'isSoundDecoded');
|
|
@@ -283,8 +286,9 @@ export class Cache {
|
|
|
283
286
|
|
|
284
287
|
/**
|
|
285
288
|
* TBD.
|
|
286
|
-
* @param cache
|
|
289
|
+
* @param {number} cache - TBD.
|
|
287
290
|
* @param {string} key - TBD.
|
|
291
|
+
* @returns {boolean} TBD.
|
|
288
292
|
*/
|
|
289
293
|
checkKey(cache, key) {
|
|
290
294
|
if (this._cacheMap[cache][key]) {
|
|
@@ -295,7 +299,8 @@ export class Cache {
|
|
|
295
299
|
|
|
296
300
|
/**
|
|
297
301
|
* TBD.
|
|
298
|
-
* @param url
|
|
302
|
+
* @param {string} url - TBD.
|
|
303
|
+
* @returns {boolean} TBD.
|
|
299
304
|
*/
|
|
300
305
|
checkURL(url) {
|
|
301
306
|
if (this._urlMap[this._resolveURL(url)]) {
|
|
@@ -307,6 +312,7 @@ export class Cache {
|
|
|
307
312
|
/**
|
|
308
313
|
* TBD.
|
|
309
314
|
* @param {string} key - TBD.
|
|
315
|
+
* @returns {boolean} TBD.
|
|
310
316
|
*/
|
|
311
317
|
checkCanvasKey(key) {
|
|
312
318
|
return this.checkKey(CANVAS, key);
|
|
@@ -315,6 +321,7 @@ export class Cache {
|
|
|
315
321
|
/**
|
|
316
322
|
* TBD.
|
|
317
323
|
* @param {string} key - TBD.
|
|
324
|
+
* @returns {boolean} TBD.
|
|
318
325
|
*/
|
|
319
326
|
checkImageKey(key) {
|
|
320
327
|
return this.checkKey(IMAGE, key);
|
|
@@ -323,6 +330,7 @@ export class Cache {
|
|
|
323
330
|
/**
|
|
324
331
|
* TBD.
|
|
325
332
|
* @param {string} key - TBD.
|
|
333
|
+
* @returns {boolean} TBD.
|
|
326
334
|
*/
|
|
327
335
|
checkTextureKey(key) {
|
|
328
336
|
return this.checkKey(TEXTURE, key);
|
|
@@ -331,6 +339,7 @@ export class Cache {
|
|
|
331
339
|
/**
|
|
332
340
|
* TBD.
|
|
333
341
|
* @param {string} key - TBD.
|
|
342
|
+
* @returns {boolean} TBD.
|
|
334
343
|
*/
|
|
335
344
|
checkSoundKey(key) {
|
|
336
345
|
return this.checkKey(SOUND, key);
|
|
@@ -339,6 +348,7 @@ export class Cache {
|
|
|
339
348
|
/**
|
|
340
349
|
* TBD.
|
|
341
350
|
* @param {string} key - TBD.
|
|
351
|
+
* @returns {boolean} TBD.
|
|
342
352
|
*/
|
|
343
353
|
checkTextKey(key) {
|
|
344
354
|
return this.checkKey(TEXT, key);
|
|
@@ -347,6 +357,7 @@ export class Cache {
|
|
|
347
357
|
/**
|
|
348
358
|
* TBD.
|
|
349
359
|
* @param {string} key - TBD.
|
|
360
|
+
* @returns {boolean} TBD.
|
|
350
361
|
*/
|
|
351
362
|
checkBitmapDataKey(key) {
|
|
352
363
|
return this.checkKey(BITMAPDATA, key);
|
|
@@ -355,6 +366,7 @@ export class Cache {
|
|
|
355
366
|
/**
|
|
356
367
|
* TBD.
|
|
357
368
|
* @param {string} key - TBD.
|
|
369
|
+
* @returns {boolean} TBD.
|
|
358
370
|
*/
|
|
359
371
|
checkBitmapFontKey(key) {
|
|
360
372
|
return this.checkKey(BITMAPFONT, key);
|
|
@@ -363,6 +375,7 @@ export class Cache {
|
|
|
363
375
|
/**
|
|
364
376
|
* TBD.
|
|
365
377
|
* @param {string} key - TBD.
|
|
378
|
+
* @returns {boolean} TBD.
|
|
366
379
|
*/
|
|
367
380
|
checkJSONKey(key) {
|
|
368
381
|
return this.checkKey(JSON, key);
|
|
@@ -371,6 +384,7 @@ export class Cache {
|
|
|
371
384
|
/**
|
|
372
385
|
* TBD.
|
|
373
386
|
* @param {string} key - TBD.
|
|
387
|
+
* @returns {boolean} TBD.
|
|
374
388
|
*/
|
|
375
389
|
checkXMLKey(key) {
|
|
376
390
|
return this.checkKey(XML, key);
|
|
@@ -381,9 +395,10 @@ export class Cache {
|
|
|
381
395
|
/**
|
|
382
396
|
* TBD.
|
|
383
397
|
* @param {string} key - TBD.
|
|
384
|
-
* @param cache
|
|
385
|
-
* @param method
|
|
386
|
-
* @param property
|
|
398
|
+
* @param {number} cache - TBD.
|
|
399
|
+
* @param {string} method - TBD.
|
|
400
|
+
* @param {string} property - TBD.
|
|
401
|
+
* @returns {*} TBD.
|
|
387
402
|
*/
|
|
388
403
|
getItem(key, cache, method, property = null) {
|
|
389
404
|
if (this.checkKey(cache, key)) {
|
|
@@ -406,7 +421,7 @@ export class Cache {
|
|
|
406
421
|
/**
|
|
407
422
|
* TBD.
|
|
408
423
|
* @param {string} key - TBD.
|
|
409
|
-
* @param full
|
|
424
|
+
* @param full - TBD.
|
|
410
425
|
*/
|
|
411
426
|
getImage(key = '__default', full = false) {
|
|
412
427
|
let img = this.getItem(key, IMAGE, 'getImage');
|
|
@@ -470,7 +485,7 @@ export class Cache {
|
|
|
470
485
|
/**
|
|
471
486
|
* TBD.
|
|
472
487
|
* @param {string} key - TBD.
|
|
473
|
-
* @param isClone
|
|
488
|
+
* @param {boolean} isClone - TBD.
|
|
474
489
|
*/
|
|
475
490
|
getJSON(key, isClone = false) {
|
|
476
491
|
const data = this.getItem(key, JSON, 'getJSON', 'data');
|
|
@@ -498,7 +513,7 @@ export class Cache {
|
|
|
498
513
|
/**
|
|
499
514
|
* TBD.
|
|
500
515
|
* @param {string} key - TBD.
|
|
501
|
-
* @param cache
|
|
516
|
+
* @param {number} cache - TBD.
|
|
502
517
|
*/
|
|
503
518
|
getBaseTexture(key, cache = IMAGE) {
|
|
504
519
|
return this.getItem(key, cache, 'getBaseTexture', 'base');
|
|
@@ -507,7 +522,7 @@ export class Cache {
|
|
|
507
522
|
/**
|
|
508
523
|
* TBD.
|
|
509
524
|
* @param {string} key - TBD.
|
|
510
|
-
* @param cache
|
|
525
|
+
* @param {number} cache - TBD.
|
|
511
526
|
*/
|
|
512
527
|
getFrame(key, cache = IMAGE) {
|
|
513
528
|
return this.getItem(key, cache, 'getFrame', 'frame');
|
|
@@ -516,7 +531,7 @@ export class Cache {
|
|
|
516
531
|
/**
|
|
517
532
|
* TBD.
|
|
518
533
|
* @param {string} key - TBD.
|
|
519
|
-
* @param cache
|
|
534
|
+
* @param {number} cache - TBD.
|
|
520
535
|
*/
|
|
521
536
|
getFrameCount(key, cache = IMAGE) {
|
|
522
537
|
const data = this.getFrameData(key, cache);
|
|
@@ -529,7 +544,7 @@ export class Cache {
|
|
|
529
544
|
/**
|
|
530
545
|
* TBD.
|
|
531
546
|
* @param {string} key - TBD.
|
|
532
|
-
* @param cache
|
|
547
|
+
* @param {number} cache - TBD.
|
|
533
548
|
*/
|
|
534
549
|
getFrameData(key, cache = IMAGE) {
|
|
535
550
|
return this.getItem(key, cache, 'getFrameData', 'frameData');
|
|
@@ -538,7 +553,7 @@ export class Cache {
|
|
|
538
553
|
/**
|
|
539
554
|
* TBD.
|
|
540
555
|
* @param {string} key - TBD.
|
|
541
|
-
* @param cache
|
|
556
|
+
* @param {number} cache - TBD.
|
|
542
557
|
*/
|
|
543
558
|
hasFrameData(key, cache = IMAGE) {
|
|
544
559
|
return this.getItem(key, cache, '', 'frameData') !== null;
|
|
@@ -547,8 +562,8 @@ export class Cache {
|
|
|
547
562
|
/**
|
|
548
563
|
* TBD.
|
|
549
564
|
* @param {string} key - TBD.
|
|
550
|
-
* @param frameData
|
|
551
|
-
* @param cache
|
|
565
|
+
* @param frameData - TBD.
|
|
566
|
+
* @param {number} cache - TBD.
|
|
552
567
|
*/
|
|
553
568
|
updateFrameData(key, frameData, cache = IMAGE) {
|
|
554
569
|
if (this._cacheMap[cache][key]) {
|
|
@@ -559,8 +574,8 @@ export class Cache {
|
|
|
559
574
|
/**
|
|
560
575
|
* TBD.
|
|
561
576
|
* @param {string} key - TBD.
|
|
562
|
-
* @param index - TBD.
|
|
563
|
-
* @param cache
|
|
577
|
+
* @param {number} index - TBD.
|
|
578
|
+
* @param {number} cache - TBD.
|
|
564
579
|
*/
|
|
565
580
|
getFrameByIndex(key, index, cache = IMAGE) {
|
|
566
581
|
const data = this.getFrameData(key, cache);
|
|
@@ -573,8 +588,8 @@ export class Cache {
|
|
|
573
588
|
/**
|
|
574
589
|
* TBD.
|
|
575
590
|
* @param {string} key - TBD.
|
|
576
|
-
* @param name
|
|
577
|
-
* @param cache
|
|
591
|
+
* @param {string} name - TBD.
|
|
592
|
+
* @param {number} cache - TBD.
|
|
578
593
|
*/
|
|
579
594
|
getFrameByName(key, name, cache = IMAGE) {
|
|
580
595
|
const data = this.getFrameData(key, cache);
|
|
@@ -586,7 +601,7 @@ export class Cache {
|
|
|
586
601
|
|
|
587
602
|
/**
|
|
588
603
|
* TBD.
|
|
589
|
-
* @param url
|
|
604
|
+
* @param {string} url - TBD.
|
|
590
605
|
*/
|
|
591
606
|
getURL(url) {
|
|
592
607
|
const resolvedURL = this._resolveURL(url);
|
|
@@ -599,7 +614,7 @@ export class Cache {
|
|
|
599
614
|
|
|
600
615
|
/**
|
|
601
616
|
* TBD.
|
|
602
|
-
* @param cache
|
|
617
|
+
* @param {object} cache - TBD.
|
|
603
618
|
*/
|
|
604
619
|
getKeys(cache = IMAGE) {
|
|
605
620
|
const result = [];
|
|
@@ -628,7 +643,7 @@ export class Cache {
|
|
|
628
643
|
/**
|
|
629
644
|
* TBD.
|
|
630
645
|
* @param {string} key - TBD.
|
|
631
|
-
* @param destroyBaseTexture
|
|
646
|
+
* @param {boolean} destroyBaseTexture - TBD.
|
|
632
647
|
*/
|
|
633
648
|
removeImage(key, destroyBaseTexture = true) {
|
|
634
649
|
const img = this.getImage(key, true);
|
|
@@ -723,8 +738,9 @@ export class Cache {
|
|
|
723
738
|
|
|
724
739
|
/**
|
|
725
740
|
* TBD.
|
|
726
|
-
* @param url
|
|
727
|
-
* @param data
|
|
741
|
+
* @param {string} url - TBD.
|
|
742
|
+
* @param data - TBD.
|
|
743
|
+
* @returns {string} TBD.
|
|
728
744
|
*/
|
|
729
745
|
_resolveURL(url, data) {
|
|
730
746
|
if (!this.autoResolveURL) {
|
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 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 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 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;
|