@vpmedia/phaser 1.105.0 → 1.106.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/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -18
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/device.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +10 -0
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/index.ts +8 -0
- package/src/phaser/core/animation.ts +10 -2
- package/src/phaser/core/animation_manager.ts +9 -3
- package/src/phaser/core/device.ts +24 -24
- package/src/phaser/core/input.ts +8 -4
- package/src/phaser/core/input_handler.ts +16 -2
- package/src/phaser/core/input_mspointer.ts +16 -16
- package/src/phaser/core/input_pointer.ts +48 -48
- package/src/phaser/core/loader.ts +11 -0
- package/src/phaser/core/loader_parser.ts +22 -4
- package/src/phaser/core/scene.ts +2 -2
- package/src/phaser/core/signal.ts +7 -1
- package/src/phaser/core/signal_binding.ts +8 -1
- package/src/phaser/core/sound.ts +7 -1
- package/src/phaser/core/sound_sprite.ts +7 -7
- package/src/phaser/core/time.ts +28 -28
- package/src/phaser/core/tween.ts +24 -4
- package/src/phaser/core/tween_manager.ts +5 -5
- package/src/phaser/display/button.ts +13 -1
- package/src/phaser/display/canvas/buffer.ts +4 -4
- package/src/phaser/display/canvas/util.ts +9 -1
- package/src/phaser/display/graphics_data.ts +19 -11
- package/src/phaser/display/image.ts +7 -1
- package/src/phaser/display/sprite_util.ts +15 -3
- package/src/phaser/display/webgl/blend_manager.ts +2 -2
- package/src/phaser/display/webgl/earcut.ts +19 -2
- package/src/phaser/display/webgl/fast_sprite_batch.ts +15 -15
- package/src/phaser/display/webgl/filter_manager.ts +3 -3
- package/src/phaser/display/webgl/filter_texture.ts +4 -4
- package/src/phaser/display/webgl/graphics.ts +8 -1
- package/src/phaser/display/webgl/graphics_data.ts +9 -9
- package/src/phaser/display/webgl/render_texture.ts +7 -1
- package/src/phaser/display/webgl/shader/complex.ts +5 -5
- package/src/phaser/display/webgl/shader/fast.ts +6 -6
- package/src/phaser/display/webgl/shader/normal.ts +10 -10
- package/src/phaser/display/webgl/shader/primitive.ts +5 -5
- package/src/phaser/display/webgl/shader/strip.ts +5 -5
- package/src/phaser/display/webgl/shader_manager.ts +10 -10
- package/src/phaser/display/webgl/sprite_batch.ts +16 -16
- package/src/phaser/display/webgl/stencil_manager.ts +18 -6
- package/src/phaser/display/webgl/texture.ts +6 -1
- package/src/phaser/display/webgl/util.ts +8 -4
- package/src/phaser/geom/util/point.ts +8 -1
- package/src/phaser/geom/util/rectangle.ts +8 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
export class Device {
|
|
2
|
-
desktop!: any;
|
|
3
|
-
iOS!: any;
|
|
4
|
-
android!: any;
|
|
5
|
-
chromeOS!: any;
|
|
6
|
-
linux!: any;
|
|
7
|
-
macOS!: any;
|
|
8
|
-
windows!: any;
|
|
9
|
-
windowsPhone!: any;
|
|
10
|
-
canvas!: any;
|
|
11
|
-
touch!: any;
|
|
12
|
-
mspointer!: any;
|
|
13
|
-
wheelEvent!: any;
|
|
14
|
-
chrome!: any;
|
|
15
|
-
firefox!: any;
|
|
16
|
-
edge!: any;
|
|
17
|
-
safari!: any;
|
|
18
|
-
fullscreen!: any;
|
|
19
|
-
requestFullscreen!: any;
|
|
20
|
-
cancelFullscreen!: any;
|
|
21
|
-
fullscreenKeyboard!: any;
|
|
22
|
-
noAudioFormat!: any;
|
|
23
|
-
supportedAudioFormats!: any;
|
|
24
|
-
supportedImageFormats!: any;
|
|
2
|
+
desktop!: any;
|
|
3
|
+
iOS!: any;
|
|
4
|
+
android!: any;
|
|
5
|
+
chromeOS!: any;
|
|
6
|
+
linux!: any;
|
|
7
|
+
macOS!: any;
|
|
8
|
+
windows!: any;
|
|
9
|
+
windowsPhone!: any;
|
|
10
|
+
canvas!: any;
|
|
11
|
+
touch!: any;
|
|
12
|
+
mspointer!: any;
|
|
13
|
+
wheelEvent!: any;
|
|
14
|
+
chrome!: any;
|
|
15
|
+
firefox!: any;
|
|
16
|
+
edge!: any;
|
|
17
|
+
safari!: any;
|
|
18
|
+
fullscreen!: any;
|
|
19
|
+
requestFullscreen!: any;
|
|
20
|
+
cancelFullscreen!: any;
|
|
21
|
+
fullscreenKeyboard!: any;
|
|
22
|
+
noAudioFormat!: any;
|
|
23
|
+
supportedAudioFormats!: any;
|
|
24
|
+
supportedImageFormats!: any;
|
|
25
25
|
/**
|
|
26
26
|
* Creates a new Device instance.
|
|
27
27
|
* This class provides information about the current device and browser capabilities.
|
|
@@ -117,4 +117,4 @@ supportedImageFormats!: any;
|
|
|
117
117
|
*/
|
|
118
118
|
this.supportedImageFormats = {};
|
|
119
119
|
}
|
|
120
|
-
}
|
|
120
|
+
}
|
package/src/phaser/core/input.ts
CHANGED
|
@@ -286,7 +286,7 @@ export class Input {
|
|
|
286
286
|
* @param {MouseEvent|TouchEvent|PointerEvent} event - TBD.
|
|
287
287
|
* @returns {Pointer} TBD.
|
|
288
288
|
*/
|
|
289
|
-
startPointer(event: any|TouchEvent|PointerEvent) {
|
|
289
|
+
startPointer(event: any | TouchEvent | PointerEvent) {
|
|
290
290
|
if (this.maxPointers >= 0 && this.countActivePointers(this.maxPointers) >= this.maxPointers) {
|
|
291
291
|
return null;
|
|
292
292
|
}
|
|
@@ -310,7 +310,7 @@ export class Input {
|
|
|
310
310
|
* @param {MouseEvent|TouchEvent|PointerEvent} event - TBD.
|
|
311
311
|
* @returns {Pointer} TBD.
|
|
312
312
|
*/
|
|
313
|
-
updatePointer(event: any|TouchEvent|PointerEvent) {
|
|
313
|
+
updatePointer(event: any | TouchEvent | PointerEvent) {
|
|
314
314
|
if (this.pointer1.active && this.pointer1.identifier === event.identifier) {
|
|
315
315
|
return this.pointer1.move(event);
|
|
316
316
|
}
|
|
@@ -331,7 +331,7 @@ export class Input {
|
|
|
331
331
|
* @param {MouseEvent|TouchEvent|PointerEvent} event - TBD.
|
|
332
332
|
* @returns {Pointer} TBD.
|
|
333
333
|
*/
|
|
334
|
-
stopPointer(event: any|TouchEvent|PointerEvent) {
|
|
334
|
+
stopPointer(event: any | TouchEvent | PointerEvent) {
|
|
335
335
|
if (this.pointer1.active && this.pointer1.identifier === event.identifier) {
|
|
336
336
|
return this.pointer1.stop(event);
|
|
337
337
|
}
|
|
@@ -417,7 +417,11 @@ export class Input {
|
|
|
417
417
|
* @param {Point} output - TBD.
|
|
418
418
|
* @returns {Point} TBD.
|
|
419
419
|
*/
|
|
420
|
-
getLocalPosition(
|
|
420
|
+
getLocalPosition(
|
|
421
|
+
displayObject: import('../display/display_object.js').DisplayObject,
|
|
422
|
+
pointer: Pointer,
|
|
423
|
+
output: Point = null
|
|
424
|
+
) {
|
|
421
425
|
const result = output || new Point();
|
|
422
426
|
const wt = displayObject.worldTransform;
|
|
423
427
|
const id = 1 / (wt.a * wt.d + wt.c * -wt.b);
|
|
@@ -813,7 +813,14 @@ export class InputHandler {
|
|
|
813
813
|
* @param {import('../geom/rectangle.js').Rectangle | null | undefined} boundsRect - TBD.
|
|
814
814
|
* @param {import('../display/display_object.js').DisplayObject | null | undefined} boundsSprite - TBD.
|
|
815
815
|
*/
|
|
816
|
-
enableDrag(
|
|
816
|
+
enableDrag(
|
|
817
|
+
lockCenter: boolean = false,
|
|
818
|
+
bringToTop: boolean = false,
|
|
819
|
+
pixelPerfect: boolean = false,
|
|
820
|
+
alphaThreshold: number = 255,
|
|
821
|
+
boundsRect: import('../geom/rectangle.js').Rectangle | null | undefined = null,
|
|
822
|
+
boundsSprite: import('../display/display_object.js').DisplayObject | null | undefined = null
|
|
823
|
+
) {
|
|
817
824
|
this._dragPoint = new Point();
|
|
818
825
|
this.draggable = true;
|
|
819
826
|
this.bringToTop = bringToTop;
|
|
@@ -944,7 +951,14 @@ export class InputHandler {
|
|
|
944
951
|
* @param {number} snapOffsetX - TBD.
|
|
945
952
|
* @param {number} snapOffsetY - TBD.
|
|
946
953
|
*/
|
|
947
|
-
enableSnap(
|
|
954
|
+
enableSnap(
|
|
955
|
+
snapX: number,
|
|
956
|
+
snapY: number,
|
|
957
|
+
onDrag: boolean = true,
|
|
958
|
+
onRelease: boolean = false,
|
|
959
|
+
snapOffsetX: number = 0,
|
|
960
|
+
snapOffsetY: number = 0
|
|
961
|
+
) {
|
|
948
962
|
this.snapX = snapX;
|
|
949
963
|
this.snapY = snapY;
|
|
950
964
|
this.snapOffsetX = snapOffsetX;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export class MSPointer {
|
|
2
|
-
game!: any;
|
|
3
|
-
input!: any;
|
|
4
|
-
callbackContext!: any;
|
|
5
|
-
pointerDownCallback!: any;
|
|
6
|
-
pointerMoveCallback!: any;
|
|
7
|
-
pointerUpCallback!: any;
|
|
8
|
-
capture!: any;
|
|
9
|
-
button!: any;
|
|
10
|
-
event!: any;
|
|
11
|
-
enabled!: any;
|
|
12
|
-
_onMSPointerDown!: any;
|
|
13
|
-
_onMSPointerMove!: any;
|
|
14
|
-
_onMSPointerUp!: any;
|
|
15
|
-
_onMSPointerUpGlobal!: any;
|
|
16
|
-
_onMSPointerOut!: any;
|
|
17
|
-
_onMSPointerOver!: any;
|
|
2
|
+
game!: any;
|
|
3
|
+
input!: any;
|
|
4
|
+
callbackContext!: any;
|
|
5
|
+
pointerDownCallback!: any;
|
|
6
|
+
pointerMoveCallback!: any;
|
|
7
|
+
pointerUpCallback!: any;
|
|
8
|
+
capture!: any;
|
|
9
|
+
button!: any;
|
|
10
|
+
event!: any;
|
|
11
|
+
enabled!: any;
|
|
12
|
+
_onMSPointerDown!: any;
|
|
13
|
+
_onMSPointerMove!: any;
|
|
14
|
+
_onMSPointerUp!: any;
|
|
15
|
+
_onMSPointerUpGlobal!: any;
|
|
16
|
+
_onMSPointerOut!: any;
|
|
17
|
+
_onMSPointerOver!: any;
|
|
18
18
|
/**
|
|
19
19
|
* TBD.
|
|
20
20
|
* @param {import('./game.js').Game} game - TBD.
|
|
@@ -10,50 +10,50 @@ import {
|
|
|
10
10
|
} from './const.js';
|
|
11
11
|
|
|
12
12
|
export class Pointer {
|
|
13
|
-
game!: any;
|
|
14
|
-
id!: any;
|
|
15
|
-
type!: any;
|
|
16
|
-
exists!: any;
|
|
17
|
-
identifier!: any;
|
|
18
|
-
pointerId!: any;
|
|
19
|
-
pointerMode!: any;
|
|
20
|
-
target!: any;
|
|
21
|
-
button!: any;
|
|
22
|
-
_holdSent!: any;
|
|
23
|
-
_history!: any;
|
|
24
|
-
_nextDrop!: any;
|
|
25
|
-
_stateReset!: any;
|
|
26
|
-
withinGame!: any;
|
|
27
|
-
clientX!: any;
|
|
28
|
-
clientY!: any;
|
|
29
|
-
pageX!: any;
|
|
30
|
-
pageY!: any;
|
|
31
|
-
screenX!: any;
|
|
32
|
-
screenY!: any;
|
|
33
|
-
rawMovementX!: any;
|
|
34
|
-
rawMovementY!: any;
|
|
35
|
-
movementX!: any;
|
|
36
|
-
movementY!: any;
|
|
37
|
-
x!: any;
|
|
38
|
-
y!: any;
|
|
39
|
-
isMouse!: any;
|
|
40
|
-
isDown!: any;
|
|
41
|
-
isUp!: any;
|
|
42
|
-
timeDown!: any;
|
|
43
|
-
timeUp!: any;
|
|
44
|
-
previousTapTime!: any;
|
|
45
|
-
totalTouches!: any;
|
|
46
|
-
msSinceLastClick!: any;
|
|
47
|
-
targetObject!: any;
|
|
48
|
-
interactiveCandidates!: any;
|
|
49
|
-
active!: any;
|
|
50
|
-
dirty!: any;
|
|
51
|
-
position!: any;
|
|
52
|
-
positionDown!: any;
|
|
53
|
-
positionUp!: any;
|
|
54
|
-
circle!: any;
|
|
55
|
-
_clickTrampolines!: any;
|
|
56
|
-
_trampolineTargetObject!: any;
|
|
13
|
+
game!: any;
|
|
14
|
+
id!: any;
|
|
15
|
+
type!: any;
|
|
16
|
+
exists!: any;
|
|
17
|
+
identifier!: any;
|
|
18
|
+
pointerId!: any;
|
|
19
|
+
pointerMode!: any;
|
|
20
|
+
target!: any;
|
|
21
|
+
button!: any;
|
|
22
|
+
_holdSent!: any;
|
|
23
|
+
_history!: any;
|
|
24
|
+
_nextDrop!: any;
|
|
25
|
+
_stateReset!: any;
|
|
26
|
+
withinGame!: any;
|
|
27
|
+
clientX!: any;
|
|
28
|
+
clientY!: any;
|
|
29
|
+
pageX!: any;
|
|
30
|
+
pageY!: any;
|
|
31
|
+
screenX!: any;
|
|
32
|
+
screenY!: any;
|
|
33
|
+
rawMovementX!: any;
|
|
34
|
+
rawMovementY!: any;
|
|
35
|
+
movementX!: any;
|
|
36
|
+
movementY!: any;
|
|
37
|
+
x!: any;
|
|
38
|
+
y!: any;
|
|
39
|
+
isMouse!: any;
|
|
40
|
+
isDown!: any;
|
|
41
|
+
isUp!: any;
|
|
42
|
+
timeDown!: any;
|
|
43
|
+
timeUp!: any;
|
|
44
|
+
previousTapTime!: any;
|
|
45
|
+
totalTouches!: any;
|
|
46
|
+
msSinceLastClick!: any;
|
|
47
|
+
targetObject!: any;
|
|
48
|
+
interactiveCandidates!: any;
|
|
49
|
+
active!: any;
|
|
50
|
+
dirty!: any;
|
|
51
|
+
position!: any;
|
|
52
|
+
positionDown!: any;
|
|
53
|
+
positionUp!: any;
|
|
54
|
+
circle!: any;
|
|
55
|
+
_clickTrampolines!: any;
|
|
56
|
+
_trampolineTargetObject!: any;
|
|
57
57
|
/**
|
|
58
58
|
* TBD.
|
|
59
59
|
* @param {import('./game.js').Game} game - TBD.
|
|
@@ -137,7 +137,7 @@ _trampolineTargetObject!: any;
|
|
|
137
137
|
* TBD.
|
|
138
138
|
* @param {MouseEvent|PointerEvent} event - TBD.
|
|
139
139
|
*/
|
|
140
|
-
updateButtons(event: any|PointerEvent) {
|
|
140
|
+
updateButtons(event: any | PointerEvent) {
|
|
141
141
|
if (event.type.toLowerCase().substr(-4) === 'down') {
|
|
142
142
|
this.isUp = false;
|
|
143
143
|
this.isDown = true;
|
|
@@ -241,7 +241,7 @@ _trampolineTargetObject!: any;
|
|
|
241
241
|
* @param {boolean} fromClick - TBD.
|
|
242
242
|
* @returns {Pointer} TBD.
|
|
243
243
|
*/
|
|
244
|
-
move(event: any|PointerEvent, fromClick: boolean = false) {
|
|
244
|
+
move(event: any | PointerEvent, fromClick: boolean = false) {
|
|
245
245
|
const input = this.game.input;
|
|
246
246
|
if (input.pollLocked) {
|
|
247
247
|
return null;
|
|
@@ -397,7 +397,7 @@ _trampolineTargetObject!: any;
|
|
|
397
397
|
* TBD.
|
|
398
398
|
* @param {MouseEvent|PointerEvent} event - TBD.
|
|
399
399
|
*/
|
|
400
|
-
leave(event: any|PointerEvent) {
|
|
400
|
+
leave(event: any | PointerEvent) {
|
|
401
401
|
this.withinGame = false;
|
|
402
402
|
this.move(event, false);
|
|
403
403
|
}
|
|
@@ -407,7 +407,7 @@ _trampolineTargetObject!: any;
|
|
|
407
407
|
* @param {MouseEvent|PointerEvent} event - TBD.
|
|
408
408
|
* @returns {Pointer} TBD.
|
|
409
409
|
*/
|
|
410
|
-
stop(event: any|PointerEvent) {
|
|
410
|
+
stop(event: any | PointerEvent) {
|
|
411
411
|
const input = this.game.input;
|
|
412
412
|
if (this._stateReset && this.withinGame) {
|
|
413
413
|
event.preventDefault();
|
|
@@ -5,6 +5,17 @@ import { Signal } from './signal.js';
|
|
|
5
5
|
|
|
6
6
|
const TEXTURE_ATLAS_JSON_HASH = 1;
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Describes a file entry managed by the Loader.
|
|
10
|
+
*/
|
|
11
|
+
export interface LoaderFile {
|
|
12
|
+
key: string;
|
|
13
|
+
type: string;
|
|
14
|
+
url: string;
|
|
15
|
+
error: boolean;
|
|
16
|
+
errorMessage: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
export class Loader {
|
|
9
20
|
game!: any;
|
|
10
21
|
cache!: any;
|
|
@@ -7,7 +7,10 @@ import { Rectangle } from '../geom/rectangle.js';
|
|
|
7
7
|
* @param {object} bitmapFontData - The bitmap font data to finalize.
|
|
8
8
|
* @returns {object} The finalized bitmap font data.
|
|
9
9
|
*/
|
|
10
|
-
export const finalizeBitmapFont = (
|
|
10
|
+
export const finalizeBitmapFont = (
|
|
11
|
+
baseTexture: import('../display/webgl/base_texture.js').BaseTexture,
|
|
12
|
+
bitmapFontData: any
|
|
13
|
+
) => {
|
|
11
14
|
Object.keys(bitmapFontData.chars).forEach((charCode) => {
|
|
12
15
|
const letter = bitmapFontData.chars[charCode];
|
|
13
16
|
letter.texture = new Texture(baseTexture, new Rectangle(letter.x, letter.y, letter.width, letter.height));
|
|
@@ -23,7 +26,12 @@ export const finalizeBitmapFont = (baseTexture: import('../display/webgl/base_te
|
|
|
23
26
|
* @param {number} ySpacing - Vertical spacing between characters.
|
|
24
27
|
* @returns {object} The parsed bitmap font data.
|
|
25
28
|
*/
|
|
26
|
-
export const xmlBitmapFont = (
|
|
29
|
+
export const xmlBitmapFont = (
|
|
30
|
+
xml: any,
|
|
31
|
+
baseTexture: import('../display/webgl/base_texture.js').BaseTexture,
|
|
32
|
+
xSpacing: number,
|
|
33
|
+
ySpacing: number
|
|
34
|
+
) => {
|
|
27
35
|
const data: any = {};
|
|
28
36
|
const info = xml.getElementsByTagName('info')[0];
|
|
29
37
|
const common = xml.getElementsByTagName('common')[0];
|
|
@@ -63,7 +71,12 @@ export const xmlBitmapFont = (xml: any, baseTexture: import('../display/webgl/ba
|
|
|
63
71
|
* @param {number} ySpacing - Vertical spacing between characters.
|
|
64
72
|
* @returns {object} The parsed bitmap font data.
|
|
65
73
|
*/
|
|
66
|
-
export const bitmapFont = (
|
|
74
|
+
export const bitmapFont = (
|
|
75
|
+
xml: any,
|
|
76
|
+
baseTexture: import('../display/webgl/base_texture.js').BaseTexture,
|
|
77
|
+
xSpacing: number,
|
|
78
|
+
ySpacing: number
|
|
79
|
+
) => {
|
|
67
80
|
return xmlBitmapFont(xml, baseTexture, xSpacing, ySpacing);
|
|
68
81
|
};
|
|
69
82
|
|
|
@@ -75,7 +88,12 @@ export const bitmapFont = (xml: any, baseTexture: import('../display/webgl/base_
|
|
|
75
88
|
* @param {number} ySpacing - Vertical spacing between characters.
|
|
76
89
|
* @returns {object} The parsed bitmap font data.
|
|
77
90
|
*/
|
|
78
|
-
export const jsonBitmapFont = (
|
|
91
|
+
export const jsonBitmapFont = (
|
|
92
|
+
json: any,
|
|
93
|
+
baseTexture: import('../display/webgl/base_texture.js').BaseTexture,
|
|
94
|
+
xSpacing: number,
|
|
95
|
+
ySpacing: number
|
|
96
|
+
) => {
|
|
79
97
|
const data = {
|
|
80
98
|
font: json.font.info._face,
|
|
81
99
|
size: Number.parseInt(json.font.info._size, 10),
|
package/src/phaser/core/scene.ts
CHANGED
|
@@ -45,7 +45,13 @@ export class Signal {
|
|
|
45
45
|
* @returns {SignalBinding} The binding for this listener.
|
|
46
46
|
* @throws {Error} If the listener is already registered with a different once setting.
|
|
47
47
|
*/
|
|
48
|
-
_registerListener(
|
|
48
|
+
_registerListener(
|
|
49
|
+
listener: Function,
|
|
50
|
+
isOnce: boolean = false,
|
|
51
|
+
listenerContext: any = null,
|
|
52
|
+
priority: number = 0,
|
|
53
|
+
args: any = null
|
|
54
|
+
) {
|
|
49
55
|
const prevIndex = this._indexOfListener(listener, listenerContext);
|
|
50
56
|
let binding;
|
|
51
57
|
if (prevIndex !== -1) {
|
|
@@ -18,7 +18,14 @@ export class SignalBinding {
|
|
|
18
18
|
* @param {number} priority - TBD.
|
|
19
19
|
* @param {...any} args - TBD.
|
|
20
20
|
*/
|
|
21
|
-
constructor(
|
|
21
|
+
constructor(
|
|
22
|
+
signal: import('./signal.js').Signal,
|
|
23
|
+
listener: Function,
|
|
24
|
+
isOnce: boolean = false,
|
|
25
|
+
listenerContext: any = null,
|
|
26
|
+
priority: number = 0,
|
|
27
|
+
args: any = null
|
|
28
|
+
) {
|
|
22
29
|
this._signal = signal;
|
|
23
30
|
this._listener = listener;
|
|
24
31
|
this._args = args;
|
package/src/phaser/core/sound.ts
CHANGED
|
@@ -56,7 +56,13 @@ export class Sound {
|
|
|
56
56
|
* @param {boolean} loop - Whether the sound should loop.
|
|
57
57
|
* @param {boolean} connect - Whether to connect to the master gain node.
|
|
58
58
|
*/
|
|
59
|
-
constructor(
|
|
59
|
+
constructor(
|
|
60
|
+
game: import('./game.js').Game,
|
|
61
|
+
key: string,
|
|
62
|
+
volume: number = 1,
|
|
63
|
+
loop: boolean = false,
|
|
64
|
+
connect: boolean = null
|
|
65
|
+
) {
|
|
60
66
|
// TODO
|
|
61
67
|
// https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Migrating_from_webkitAudioContext
|
|
62
68
|
if (!connect) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export class SoundSprite {
|
|
2
|
-
game!: any;
|
|
3
|
-
key!: any;
|
|
4
|
-
config!: any;
|
|
5
|
-
autoplayKey!: any;
|
|
6
|
-
autoplay!: any;
|
|
7
|
-
sounds!: any;
|
|
2
|
+
game!: any;
|
|
3
|
+
key!: any;
|
|
4
|
+
config!: any;
|
|
5
|
+
autoplayKey!: any;
|
|
6
|
+
autoplay!: any;
|
|
7
|
+
sounds!: any;
|
|
8
8
|
/**
|
|
9
9
|
* TBD.
|
|
10
10
|
* @param {import('./game.js').Game} game - TBD.
|
|
@@ -63,4 +63,4 @@ sounds!: any;
|
|
|
63
63
|
get(marker: string) {
|
|
64
64
|
return this.sounds[marker];
|
|
65
65
|
}
|
|
66
|
-
}
|
|
66
|
+
}
|
package/src/phaser/core/time.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { Timer } from './timer.js';
|
|
2
2
|
|
|
3
3
|
export class Time {
|
|
4
|
-
game!: any;
|
|
5
|
-
time!: any;
|
|
6
|
-
prevTime!: any;
|
|
7
|
-
now!: any;
|
|
8
|
-
elapsed!: any;
|
|
9
|
-
elapsedMS!: any;
|
|
10
|
-
desiredFpsMult!: any;
|
|
11
|
-
_desiredFps!: any;
|
|
12
|
-
suggestedFps!: any;
|
|
13
|
-
advancedTiming!: any;
|
|
14
|
-
frames!: any;
|
|
15
|
-
fps!: any;
|
|
16
|
-
fpsMin!: any;
|
|
17
|
-
fpsMax!: any;
|
|
18
|
-
msMin!: any;
|
|
19
|
-
msMax!: any;
|
|
20
|
-
pauseDuration!: any;
|
|
21
|
-
timeToCall!: any;
|
|
22
|
-
timeExpected!: any;
|
|
23
|
-
events!: any;
|
|
24
|
-
_frameCount!: any;
|
|
25
|
-
_elapsedAccumulator!: any;
|
|
26
|
-
_started!: any;
|
|
27
|
-
_timeLastSecond!: any;
|
|
28
|
-
_pauseStarted!: any;
|
|
29
|
-
_justResumed!: any;
|
|
30
|
-
_timers!: any;
|
|
4
|
+
game!: any;
|
|
5
|
+
time!: any;
|
|
6
|
+
prevTime!: any;
|
|
7
|
+
now!: any;
|
|
8
|
+
elapsed!: any;
|
|
9
|
+
elapsedMS!: any;
|
|
10
|
+
desiredFpsMult!: any;
|
|
11
|
+
_desiredFps!: any;
|
|
12
|
+
suggestedFps!: any;
|
|
13
|
+
advancedTiming!: any;
|
|
14
|
+
frames!: any;
|
|
15
|
+
fps!: any;
|
|
16
|
+
fpsMin!: any;
|
|
17
|
+
fpsMax!: any;
|
|
18
|
+
msMin!: any;
|
|
19
|
+
msMax!: any;
|
|
20
|
+
pauseDuration!: any;
|
|
21
|
+
timeToCall!: any;
|
|
22
|
+
timeExpected!: any;
|
|
23
|
+
events!: any;
|
|
24
|
+
_frameCount!: any;
|
|
25
|
+
_elapsedAccumulator!: any;
|
|
26
|
+
_started!: any;
|
|
27
|
+
_timeLastSecond!: any;
|
|
28
|
+
_pauseStarted!: any;
|
|
29
|
+
_justResumed!: any;
|
|
30
|
+
_timers!: any;
|
|
31
31
|
/**
|
|
32
32
|
* Creates a new Time instance.
|
|
33
33
|
* @param {import('./game.js').Game} game - Reference to the Phaser Game instance.
|
|
@@ -296,4 +296,4 @@ _timers!: any;
|
|
|
296
296
|
this._desiredFps = value;
|
|
297
297
|
this.desiredFpsMult = 1 / value;
|
|
298
298
|
}
|
|
299
|
-
}
|
|
299
|
+
}
|
package/src/phaser/core/tween.ts
CHANGED
|
@@ -33,7 +33,11 @@ export class Tween {
|
|
|
33
33
|
* @param {import('./game.js').Game} game - Reference to the Phaser Game instance.
|
|
34
34
|
* @param {import('./tween_manager.js').TweenManager} manager - Reference to the Tween Manager.
|
|
35
35
|
*/
|
|
36
|
-
constructor(
|
|
36
|
+
constructor(
|
|
37
|
+
target: import('../display/display_object.js').DisplayObject,
|
|
38
|
+
game: import('./game.js').Game,
|
|
39
|
+
manager: import('./tween_manager.js').TweenManager
|
|
40
|
+
) {
|
|
37
41
|
this.game = game;
|
|
38
42
|
this.target = target;
|
|
39
43
|
/** @type {import('./tween_manager.js').TweenManager} */
|
|
@@ -87,7 +91,15 @@ export class Tween {
|
|
|
87
91
|
* @param {boolean} yoyo - Whether to reverse the tween on repeat.
|
|
88
92
|
* @returns {Tween} This Tween object for chaining.
|
|
89
93
|
*/
|
|
90
|
-
to(
|
|
94
|
+
to(
|
|
95
|
+
properties: any,
|
|
96
|
+
duration: number = 1000,
|
|
97
|
+
ease: string | Function = 'Linear',
|
|
98
|
+
autoStart: boolean = false,
|
|
99
|
+
delay: number = 0,
|
|
100
|
+
repeat: number = 0,
|
|
101
|
+
yoyo: boolean = false
|
|
102
|
+
) {
|
|
91
103
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
92
104
|
ease = this.manager.easeMap[ease];
|
|
93
105
|
}
|
|
@@ -112,7 +124,15 @@ export class Tween {
|
|
|
112
124
|
* @param {boolean} yoyo - Whether to reverse the tween on repeat.
|
|
113
125
|
* @returns {Tween} This Tween object for chaining.
|
|
114
126
|
*/
|
|
115
|
-
from(
|
|
127
|
+
from(
|
|
128
|
+
properties: any,
|
|
129
|
+
duration: number = 1000,
|
|
130
|
+
ease: string | Function = 'Linear',
|
|
131
|
+
autoStart: boolean = false,
|
|
132
|
+
delay: number = 0,
|
|
133
|
+
repeat: number = 0,
|
|
134
|
+
yoyo: boolean = false
|
|
135
|
+
) {
|
|
116
136
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
117
137
|
ease = this.manager.easeMap[ease];
|
|
118
138
|
}
|
|
@@ -263,7 +283,7 @@ export class Tween {
|
|
|
263
283
|
* @param {number} index - The index in the timeline to apply easing to.
|
|
264
284
|
* @returns {Tween} This Tween object for chaining.
|
|
265
285
|
*/
|
|
266
|
-
easing(ease: string|Function, index: number) {
|
|
286
|
+
easing(ease: string | Function, index: number) {
|
|
267
287
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
268
288
|
ease = this.manager.easeMap[ease];
|
|
269
289
|
}
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
} from './tween_easing.js';
|
|
36
36
|
|
|
37
37
|
export class TweenManager {
|
|
38
|
-
game!: any;
|
|
39
|
-
_tweens!: any;
|
|
40
|
-
_add!: any;
|
|
41
|
-
easeMap!: any;
|
|
38
|
+
game!: any;
|
|
39
|
+
_tweens!: any;
|
|
40
|
+
_add!: any;
|
|
41
|
+
easeMap!: any;
|
|
42
42
|
/**
|
|
43
43
|
* Creates a new TweenManager instance.
|
|
44
44
|
* @param {import('./game.js').Game} game - The game instance this manager belongs to.
|
|
@@ -256,4 +256,4 @@ easeMap!: any;
|
|
|
256
256
|
this._tweens[i].resume(true);
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
}
|
|
259
|
+
}
|
|
@@ -38,7 +38,19 @@ export class Button extends Image {
|
|
|
38
38
|
* @param {string} upFrame - The frame identifier to use when the button is released.
|
|
39
39
|
* @param {string} disabledFrame - The frame identifier to use when the button is disabled.
|
|
40
40
|
*/
|
|
41
|
-
constructor(
|
|
41
|
+
constructor(
|
|
42
|
+
game: import('../core/game.js').Game,
|
|
43
|
+
x: number = 0,
|
|
44
|
+
y: number = 0,
|
|
45
|
+
key: string = null,
|
|
46
|
+
callback: Function = null,
|
|
47
|
+
callbackContext: any = null,
|
|
48
|
+
overFrame: string = null,
|
|
49
|
+
outFrame: string = null,
|
|
50
|
+
downFrame: string = null,
|
|
51
|
+
upFrame: string = null,
|
|
52
|
+
disabledFrame: string = null
|
|
53
|
+
) {
|
|
42
54
|
super(game, x, y, key, outFrame);
|
|
43
55
|
this.type = BUTTON;
|
|
44
56
|
this._onOverFrame = null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { create, removeByCanvas } from './pool.js';
|
|
2
2
|
|
|
3
3
|
export class CanvasBuffer {
|
|
4
|
-
width!: any;
|
|
5
|
-
height!: any;
|
|
6
|
-
canvas!: any;
|
|
7
|
-
context!: any;
|
|
4
|
+
width!: any;
|
|
5
|
+
height!: any;
|
|
6
|
+
canvas!: any;
|
|
7
|
+
context!: any;
|
|
8
8
|
/**
|
|
9
9
|
* Creates a new CanvasBuffer instance.
|
|
10
10
|
* @param {number} width - The width of the canvas buffer.
|
|
@@ -117,7 +117,15 @@ export const removeFromDOM = (canvas: HTMLCanvasElement) => {
|
|
|
117
117
|
* @param {number} skewY - The Y skew value.
|
|
118
118
|
* @returns {CanvasRenderingContext2D} The modified rendering context.
|
|
119
119
|
*/
|
|
120
|
-
export const setTransform = (
|
|
120
|
+
export const setTransform = (
|
|
121
|
+
context: CanvasRenderingContext2D,
|
|
122
|
+
translateX: number,
|
|
123
|
+
translateY: number,
|
|
124
|
+
scaleX: number,
|
|
125
|
+
scaleY: number,
|
|
126
|
+
skewX: number,
|
|
127
|
+
skewY: number
|
|
128
|
+
) => {
|
|
121
129
|
context.setTransform(scaleX, skewX, skewY, scaleY, translateX, translateY);
|
|
122
130
|
return context;
|
|
123
131
|
};
|