@vpmedia/phaser 1.16.0 → 1.17.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 +1 -1
- package/src/phaser/core/animation.js +28 -16
- package/src/phaser/core/animation_manager.js +34 -20
- 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/factory.js +10 -10
- package/src/phaser/core/frame_data.js +1 -1
- 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 +27 -27
- package/src/phaser/core/scene_manager.js +9 -9
- package/src/phaser/core/sound.js +3 -3
- package/src/phaser/core/sound_manager.js +8 -8
- package/src/phaser/core/sound_sprite.js +3 -3
- package/src/phaser/core/timer.js +9 -9
- package/src/phaser/core/timer_event.js +2 -2
- package/src/phaser/core/tween.js +1 -1
- package/src/phaser/display/group.js +28 -20
- package/src/phaser/display/image.js +3 -1
- package/types/phaser/core/animation.d.ts +38 -26
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +54 -39
- 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/factory.d.ts +17 -17
- 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/input.d.ts +49 -32
- 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 +34 -34
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +9 -9
- 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 +12 -12
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +3 -3
- package/types/phaser/core/timer.d.ts +14 -14
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +4 -4
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +3 -3
- package/types/phaser/core/tween.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 +7 -5
- package/types/phaser/display/image.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 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) {
|
|
@@ -21,7 +21,7 @@ export class GameObjectFactory {
|
|
|
21
21
|
* @param {number} y - TBD.
|
|
22
22
|
* @param {string} key - TBD.
|
|
23
23
|
* @param frame - TBD.
|
|
24
|
-
* @param group - TBD.
|
|
24
|
+
* @param {Group} group - TBD.
|
|
25
25
|
* @returns {Image} TBD.
|
|
26
26
|
*/
|
|
27
27
|
image(x, y, key, frame, group = null) {
|
|
@@ -33,9 +33,9 @@ export class GameObjectFactory {
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* TBD.
|
|
36
|
-
* @param parent - TBD.
|
|
37
|
-
* @param name - TBD.
|
|
38
|
-
* @param addToStage - TBD.
|
|
36
|
+
* @param {Group} parent - TBD.
|
|
37
|
+
* @param {string} name - TBD.
|
|
38
|
+
* @param {boolean} addToStage - TBD.
|
|
39
39
|
* @returns {Group} TBD.
|
|
40
40
|
*/
|
|
41
41
|
group(parent, name, addToStage) {
|
|
@@ -48,7 +48,7 @@ export class GameObjectFactory {
|
|
|
48
48
|
* @param {number} y - TBD.
|
|
49
49
|
* @param text - TBD.
|
|
50
50
|
* @param style - TBD.
|
|
51
|
-
* @param group - TBD.
|
|
51
|
+
* @param {Group} group - TBD.
|
|
52
52
|
* @returns {Text} TBD.
|
|
53
53
|
*/
|
|
54
54
|
text(x, y, text, style, group = null) {
|
|
@@ -61,13 +61,13 @@ export class GameObjectFactory {
|
|
|
61
61
|
* @param {number} x - TBD.
|
|
62
62
|
* @param {number} y - TBD.
|
|
63
63
|
* @param {string} key - TBD.
|
|
64
|
-
* @param callback - TBD.
|
|
65
|
-
* @param callbackContext - TBD.
|
|
64
|
+
* @param {Function} callback - TBD.
|
|
65
|
+
* @param {object} callbackContext - TBD.
|
|
66
66
|
* @param overFrame - TBD.
|
|
67
67
|
* @param outFrame - TBD.
|
|
68
68
|
* @param downFrame - TBD.
|
|
69
69
|
* @param upFrame - TBD.
|
|
70
|
-
* @param group - TBD.
|
|
70
|
+
* @param {Group} group - TBD.
|
|
71
71
|
* @returns {Button} TBD.
|
|
72
72
|
*/
|
|
73
73
|
button(x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame, group = null) {
|
|
@@ -81,7 +81,7 @@ export class GameObjectFactory {
|
|
|
81
81
|
* TBD.
|
|
82
82
|
* @param {number} x - TBD.
|
|
83
83
|
* @param {number} y - TBD.
|
|
84
|
-
* @param group - TBD.
|
|
84
|
+
* @param {Group} group - TBD.
|
|
85
85
|
* @returns {Graphics} TBD.
|
|
86
86
|
*/
|
|
87
87
|
graphics(x, y, group = null) {
|
|
@@ -96,7 +96,7 @@ export class GameObjectFactory {
|
|
|
96
96
|
* @param font - TBD.
|
|
97
97
|
* @param text - TBD.
|
|
98
98
|
* @param size - TBD.
|
|
99
|
-
* @param group - TBD.
|
|
99
|
+
* @param {Group} group - TBD.
|
|
100
100
|
* @param align - TBD.
|
|
101
101
|
* @returns {BitmapText} TBD.
|
|
102
102
|
*/
|
package/src/phaser/core/input.js
CHANGED
|
@@ -124,8 +124,8 @@ export class Input {
|
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* TBD.
|
|
127
|
-
* @param callback - TBD.
|
|
128
|
-
* @param context
|
|
127
|
+
* @param {Function} callback - TBD.
|
|
128
|
+
* @param context - TBD.
|
|
129
129
|
*/
|
|
130
130
|
setInteractiveCandidateHandler(callback, context) {
|
|
131
131
|
this.customCandidateHandler = callback;
|
|
@@ -134,8 +134,8 @@ export class Input {
|
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
* TBD.
|
|
137
|
-
* @param callback - TBD.
|
|
138
|
-
* @param context
|
|
137
|
+
* @param {Function} callback - TBD.
|
|
138
|
+
* @param context - TBD.
|
|
139
139
|
*/
|
|
140
140
|
addMoveCallback(callback, context) {
|
|
141
141
|
this.moveCallbacks.push({ callback, context });
|
|
@@ -143,8 +143,8 @@ export class Input {
|
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* TBD.
|
|
146
|
-
* @param callback - TBD.
|
|
147
|
-
* @param context
|
|
146
|
+
* @param {Function} callback - TBD.
|
|
147
|
+
* @param context - TBD.
|
|
148
148
|
*/
|
|
149
149
|
deleteMoveCallback(callback, context) {
|
|
150
150
|
let i = this.moveCallbacks.length;
|
|
@@ -159,6 +159,7 @@ export class Input {
|
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
161
|
* TBD.
|
|
162
|
+
* @returns {Pointer} TBD.
|
|
162
163
|
*/
|
|
163
164
|
addPointer() {
|
|
164
165
|
if (this.pointers.length >= MAX_POINTERS) {
|
|
@@ -192,7 +193,7 @@ export class Input {
|
|
|
192
193
|
|
|
193
194
|
/**
|
|
194
195
|
* TBD.
|
|
195
|
-
* @param hard
|
|
196
|
+
* @param {boolean} hard - TBD.
|
|
196
197
|
*/
|
|
197
198
|
reset(hard = false) {
|
|
198
199
|
if (!this.game.isBooted || this.resetLocked) {
|
|
@@ -231,7 +232,8 @@ export class Input {
|
|
|
231
232
|
|
|
232
233
|
/**
|
|
233
234
|
* TBD.
|
|
234
|
-
* @param event
|
|
235
|
+
* @param {MouseEvent|TouchEvent|PointerEvent} event - TBD.
|
|
236
|
+
* @returns {Pointer} TBD.
|
|
235
237
|
*/
|
|
236
238
|
startPointer(event) {
|
|
237
239
|
if (this.maxPointers >= 0 && this.countActivePointers(this.maxPointers) >= this.maxPointers) {
|
|
@@ -254,7 +256,8 @@ export class Input {
|
|
|
254
256
|
|
|
255
257
|
/**
|
|
256
258
|
* TBD.
|
|
257
|
-
* @param event
|
|
259
|
+
* @param {MouseEvent|TouchEvent|PointerEvent} event - TBD.
|
|
260
|
+
* @returns {Pointer} TBD.
|
|
258
261
|
*/
|
|
259
262
|
updatePointer(event) {
|
|
260
263
|
if (this.pointer1.active && this.pointer1.identifier === event.identifier) {
|
|
@@ -274,7 +277,8 @@ export class Input {
|
|
|
274
277
|
|
|
275
278
|
/**
|
|
276
279
|
* TBD.
|
|
277
|
-
* @param event
|
|
280
|
+
* @param {MouseEvent|TouchEvent|PointerEvent} event - TBD.
|
|
281
|
+
* @returns {Pointer} TBD.
|
|
278
282
|
*/
|
|
279
283
|
stopPointer(event) {
|
|
280
284
|
if (this.pointer1.active && this.pointer1.identifier === event.identifier) {
|
|
@@ -294,7 +298,8 @@ export class Input {
|
|
|
294
298
|
|
|
295
299
|
/**
|
|
296
300
|
* TBD.
|
|
297
|
-
* @param limit
|
|
301
|
+
* @param limit - TBD.
|
|
302
|
+
* @returns {number} TBD.
|
|
298
303
|
*/
|
|
299
304
|
countActivePointers(limit = this.pointers.length) {
|
|
300
305
|
let count = limit;
|
|
@@ -309,7 +314,8 @@ export class Input {
|
|
|
309
314
|
|
|
310
315
|
/**
|
|
311
316
|
* TBD.
|
|
312
|
-
* @param isActive
|
|
317
|
+
* @param {boolean} isActive - TBD.
|
|
318
|
+
* @returns {Pointer} TBD.
|
|
313
319
|
*/
|
|
314
320
|
getPointer(isActive = false) {
|
|
315
321
|
for (let i = 0; i < this.pointers.length; i += 1) {
|
|
@@ -323,7 +329,8 @@ export class Input {
|
|
|
323
329
|
|
|
324
330
|
/**
|
|
325
331
|
* TBD.
|
|
326
|
-
* @param identifier
|
|
332
|
+
* @param identifier - TBD.
|
|
333
|
+
* @returns {Pointer} TBD.
|
|
327
334
|
*/
|
|
328
335
|
getPointerFromIdentifier(identifier) {
|
|
329
336
|
for (let i = 0; i < this.pointers.length; i += 1) {
|
|
@@ -338,7 +345,8 @@ export class Input {
|
|
|
338
345
|
|
|
339
346
|
/**
|
|
340
347
|
* TBD.
|
|
341
|
-
* @param pointerId
|
|
348
|
+
* @param pointerId - TBD.
|
|
349
|
+
* @returns {Pointer} TBD.
|
|
342
350
|
*/
|
|
343
351
|
getPointerFromId(pointerId) {
|
|
344
352
|
for (let i = 0; i < this.pointers.length; i += 1) {
|
|
@@ -353,9 +361,10 @@ export class Input {
|
|
|
353
361
|
|
|
354
362
|
/**
|
|
355
363
|
* TBD.
|
|
356
|
-
* @param displayObject
|
|
357
|
-
* @param pointer
|
|
358
|
-
* @param output
|
|
364
|
+
* @param displayObject - TBD.
|
|
365
|
+
* @param pointer - TBD.
|
|
366
|
+
* @param output - TBD.
|
|
367
|
+
* @returns {Point} TBD.
|
|
359
368
|
*/
|
|
360
369
|
getLocalPosition(displayObject, pointer, output = null) {
|
|
361
370
|
const result = output || new Point();
|
|
@@ -369,9 +378,10 @@ export class Input {
|
|
|
369
378
|
|
|
370
379
|
/**
|
|
371
380
|
* TBD.
|
|
372
|
-
* @param displayObject
|
|
373
|
-
* @param pointer
|
|
374
|
-
* @param localPoint
|
|
381
|
+
* @param displayObject - TBD.
|
|
382
|
+
* @param pointer - TBD.
|
|
383
|
+
* @param localPoint - TBD.
|
|
384
|
+
* @returns {boolean} TBD.
|
|
375
385
|
*/
|
|
376
386
|
hitTest(displayObject, pointer, localPoint) {
|
|
377
387
|
if (!displayObject.worldVisible) {
|
|
@@ -418,6 +428,7 @@ export class Input {
|
|
|
418
428
|
|
|
419
429
|
/**
|
|
420
430
|
* TBD.
|
|
431
|
+
* @returns {number} TBD.
|
|
421
432
|
*/
|
|
422
433
|
get x() {
|
|
423
434
|
return this._x;
|
|
@@ -432,6 +443,7 @@ export class Input {
|
|
|
432
443
|
|
|
433
444
|
/**
|
|
434
445
|
* TBD.
|
|
446
|
+
* @returns {number} TBD.
|
|
435
447
|
*/
|
|
436
448
|
get y() {
|
|
437
449
|
return this._y;
|
|
@@ -446,6 +458,7 @@ export class Input {
|
|
|
446
458
|
|
|
447
459
|
/**
|
|
448
460
|
* TBD.
|
|
461
|
+
* @returns {boolean} TBD.
|
|
449
462
|
*/
|
|
450
463
|
get pollLocked() {
|
|
451
464
|
return this.pollRate > 0 && this._pollCounter < this.pollRate;
|
|
@@ -453,6 +466,7 @@ export class Input {
|
|
|
453
466
|
|
|
454
467
|
/**
|
|
455
468
|
* TBD.
|
|
469
|
+
* @returns {number} TBD.
|
|
456
470
|
*/
|
|
457
471
|
get totalInactivePointers() {
|
|
458
472
|
return this.pointers.length - this.countActivePointers();
|
|
@@ -460,6 +474,7 @@ export class Input {
|
|
|
460
474
|
|
|
461
475
|
/**
|
|
462
476
|
* TBD.
|
|
477
|
+
* @returns {number} TBD.
|
|
463
478
|
*/
|
|
464
479
|
get totalActivePointers() {
|
|
465
480
|
return this.countActivePointers();
|
|
@@ -467,6 +482,7 @@ export class Input {
|
|
|
467
482
|
|
|
468
483
|
/**
|
|
469
484
|
* TBD.
|
|
485
|
+
* @returns {number} TBD.
|
|
470
486
|
*/
|
|
471
487
|
get worldX() {
|
|
472
488
|
return this.x;
|
|
@@ -474,6 +490,7 @@ export class Input {
|
|
|
474
490
|
|
|
475
491
|
/**
|
|
476
492
|
* TBD.
|
|
493
|
+
* @returns {number} TBD.
|
|
477
494
|
*/
|
|
478
495
|
get worldY() {
|
|
479
496
|
return this.y;
|
|
@@ -525,7 +525,7 @@ export class InputHandler {
|
|
|
525
525
|
* @param {Pointer} pointer - TBD.
|
|
526
526
|
* @param {boolean} silent - TBD.
|
|
527
527
|
*/
|
|
528
|
-
_pointerOutHandler(pointer, silent) {
|
|
528
|
+
_pointerOutHandler(pointer, silent = false) {
|
|
529
529
|
if (this.sprite === null) {
|
|
530
530
|
// Abort. We've been destroyed.
|
|
531
531
|
return;
|