@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
|
@@ -20,8 +20,8 @@ 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.
|
|
24
|
-
* @param group - TBD.
|
|
23
|
+
* @param {string} frame - 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) {
|
|
@@ -46,9 +46,9 @@ 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.
|
|
51
|
-
* @param group - TBD.
|
|
49
|
+
* @param {string} text - TBD.
|
|
50
|
+
* @param {object} style - 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.
|
|
66
|
-
* @param overFrame - TBD.
|
|
67
|
-
* @param outFrame - TBD.
|
|
68
|
-
* @param downFrame - TBD.
|
|
69
|
-
* @param upFrame - TBD.
|
|
70
|
-
* @param group - TBD.
|
|
64
|
+
* @param {Function} callback - TBD.
|
|
65
|
+
* @param {object} callbackContext - TBD.
|
|
66
|
+
* @param {string} overFrame - TBD.
|
|
67
|
+
* @param {string} outFrame - TBD.
|
|
68
|
+
* @param {string} downFrame - TBD.
|
|
69
|
+
* @param {string} upFrame - 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) {
|
|
@@ -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.
|
|
99
|
-
* @param group - TBD.
|
|
100
|
-
* @param align - TBD.
|
|
96
|
+
* @param {string} font - TBD.
|
|
97
|
+
* @param {string} text - TBD.
|
|
98
|
+
* @param {number} size - TBD.
|
|
99
|
+
* @param {Group} group - 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') {
|
package/src/phaser/core/game.js
CHANGED
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;
|
|
@@ -12,8 +12,8 @@ import { Game } from './game';
|
|
|
12
12
|
class WheelEventProxy {
|
|
13
13
|
/**
|
|
14
14
|
* TBD.
|
|
15
|
-
* @param scaleFactor
|
|
16
|
-
* @param deltaMode
|
|
15
|
+
* @param scaleFactor - TBD.
|
|
16
|
+
* @param deltaMode - TBD.
|
|
17
17
|
*/
|
|
18
18
|
constructor(scaleFactor, deltaMode) {
|
|
19
19
|
this._scaleFactor = scaleFactor;
|
|
@@ -25,7 +25,8 @@ class WheelEventProxy {
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* TBD.
|
|
28
|
-
* @param event
|
|
28
|
+
* @param {WheelEvent} event - TBD.
|
|
29
|
+
* @returns {WheelEventProxy} TBD.
|
|
29
30
|
*/
|
|
30
31
|
bindEvent(event) {
|
|
31
32
|
// TODO
|
|
@@ -54,6 +55,7 @@ class WheelEventProxy {
|
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* TBD.
|
|
58
|
+
* @returns {number} TBD.
|
|
57
59
|
*/
|
|
58
60
|
get deltaY() {
|
|
59
61
|
return this._scaleFactor * (this.originalEvent.wheelDelta || this.originalEvent.detail) || 0;
|
|
@@ -61,6 +63,7 @@ class WheelEventProxy {
|
|
|
61
63
|
|
|
62
64
|
/**
|
|
63
65
|
* TBD.
|
|
66
|
+
* @returns {number} TBD.
|
|
64
67
|
*/
|
|
65
68
|
get deltaX() {
|
|
66
69
|
return this._scaleFactor * this.originalEvent.wheelDeltaX || 0;
|
|
@@ -81,6 +84,7 @@ export class Mouse {
|
|
|
81
84
|
this.mouseOutCallback = null;
|
|
82
85
|
this.mouseOverCallback = null;
|
|
83
86
|
this.mouseWheelCallback = null;
|
|
87
|
+
this.mouseMoveCallback = null;
|
|
84
88
|
this.capture = false;
|
|
85
89
|
this.button = -1;
|
|
86
90
|
this.wheelDelta = 0;
|
|
@@ -152,7 +156,7 @@ export class Mouse {
|
|
|
152
156
|
|
|
153
157
|
/**
|
|
154
158
|
* TBD.
|
|
155
|
-
* @param event
|
|
159
|
+
* @param {MouseEvent} event - TBD.
|
|
156
160
|
*/
|
|
157
161
|
onMouseDown(event) {
|
|
158
162
|
this.event = event;
|
|
@@ -169,7 +173,7 @@ export class Mouse {
|
|
|
169
173
|
|
|
170
174
|
/**
|
|
171
175
|
* TBD.
|
|
172
|
-
* @param event
|
|
176
|
+
* @param {MouseEvent} event - TBD.
|
|
173
177
|
*/
|
|
174
178
|
onMouseMove(event) {
|
|
175
179
|
this.event = event;
|
|
@@ -186,7 +190,7 @@ export class Mouse {
|
|
|
186
190
|
|
|
187
191
|
/**
|
|
188
192
|
* TBD.
|
|
189
|
-
* @param event
|
|
193
|
+
* @param {MouseEvent} event - TBD.
|
|
190
194
|
*/
|
|
191
195
|
onMouseUp(event) {
|
|
192
196
|
this.event = event;
|
|
@@ -203,7 +207,7 @@ export class Mouse {
|
|
|
203
207
|
|
|
204
208
|
/**
|
|
205
209
|
* TBD.
|
|
206
|
-
* @param event
|
|
210
|
+
* @param {MouseEvent} event - TBD.
|
|
207
211
|
*/
|
|
208
212
|
onMouseUpGlobal(event) {
|
|
209
213
|
if (!this.input.mousePointer.withinGame) {
|
|
@@ -217,7 +221,7 @@ export class Mouse {
|
|
|
217
221
|
|
|
218
222
|
/**
|
|
219
223
|
* TBD.
|
|
220
|
-
* @param event
|
|
224
|
+
* @param {MouseEvent} event - TBD.
|
|
221
225
|
*/
|
|
222
226
|
onMouseOutGlobal(event) {
|
|
223
227
|
this.event = event;
|
|
@@ -236,7 +240,7 @@ export class Mouse {
|
|
|
236
240
|
|
|
237
241
|
/**
|
|
238
242
|
* TBD.
|
|
239
|
-
* @param event
|
|
243
|
+
* @param {MouseEvent} event - TBD.
|
|
240
244
|
*/
|
|
241
245
|
onMouseOut(event) {
|
|
242
246
|
this.event = event;
|
|
@@ -256,7 +260,7 @@ export class Mouse {
|
|
|
256
260
|
|
|
257
261
|
/**
|
|
258
262
|
* TBD.
|
|
259
|
-
* @param event
|
|
263
|
+
* @param {MouseEvent} event - TBD.
|
|
260
264
|
*/
|
|
261
265
|
onMouseOver(event) {
|
|
262
266
|
this.event = event;
|
|
@@ -269,7 +273,7 @@ export class Mouse {
|
|
|
269
273
|
|
|
270
274
|
/**
|
|
271
275
|
* TBD.
|
|
272
|
-
* @param event
|
|
276
|
+
* @param {WheelEvent} event - TBD.
|
|
273
277
|
*/
|
|
274
278
|
onMouseWheel(event) {
|
|
275
279
|
if (this._wheelEvent) {
|
|
@@ -286,7 +290,7 @@ export class Mouse {
|
|
|
286
290
|
|
|
287
291
|
/**
|
|
288
292
|
* TBD.
|
|
289
|
-
* @param event
|
|
293
|
+
* @param {MouseEvent} event - TBD.
|
|
290
294
|
*/
|
|
291
295
|
eventPreventDefault(event) {
|
|
292
296
|
if (this.capture) {
|
|
@@ -83,7 +83,7 @@ export class MSPointer {
|
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* TBD.
|
|
86
|
-
* @param event
|
|
86
|
+
* @param {PointerEvent} event - TBD.
|
|
87
87
|
*/
|
|
88
88
|
onPointerDown(event) {
|
|
89
89
|
this.event = event;
|
|
@@ -104,7 +104,7 @@ export class MSPointer {
|
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* TBD.
|
|
107
|
-
* @param event
|
|
107
|
+
* @param {PointerEvent} event - TBD.
|
|
108
108
|
*/
|
|
109
109
|
onPointerMove(event) {
|
|
110
110
|
this.event = event;
|
|
@@ -125,7 +125,7 @@ export class MSPointer {
|
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
127
|
* TBD.
|
|
128
|
-
* @param event
|
|
128
|
+
* @param {PointerEvent} event - TBD.
|
|
129
129
|
*/
|
|
130
130
|
onPointerUp(event) {
|
|
131
131
|
this.event = event;
|
|
@@ -146,7 +146,7 @@ export class MSPointer {
|
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* TBD.
|
|
149
|
-
* @param event
|
|
149
|
+
* @param {PointerEvent} event - TBD.
|
|
150
150
|
*/
|
|
151
151
|
onPointerUpGlobal(event) {
|
|
152
152
|
if ((event.pointerType === 'mouse' || event.pointerType === 0x00000004) && !this.input.mousePointer.withinGame) {
|
|
@@ -161,7 +161,7 @@ export class MSPointer {
|
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* TBD.
|
|
164
|
-
* @param event
|
|
164
|
+
* @param {PointerEvent} event - TBD.
|
|
165
165
|
*/
|
|
166
166
|
onPointerOut(event) {
|
|
167
167
|
this.event = event;
|
|
@@ -193,7 +193,7 @@ export class MSPointer {
|
|
|
193
193
|
|
|
194
194
|
/**
|
|
195
195
|
* TBD.
|
|
196
|
-
* @param event
|
|
196
|
+
* @param {PointerEvent} event - TBD.
|
|
197
197
|
*/
|
|
198
198
|
onPointerOver(event) {
|
|
199
199
|
this.event = event;
|
|
@@ -213,7 +213,7 @@ export class MSPointer {
|
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
215
|
* TBD.
|
|
216
|
-
* @param event
|
|
216
|
+
* @param {Event} event - TBD.
|
|
217
217
|
*/
|
|
218
218
|
eventPreventDefault(event) {
|
|
219
219
|
if (this.capture) {
|
|
@@ -14,8 +14,8 @@ export class Pointer {
|
|
|
14
14
|
/**
|
|
15
15
|
* TBD.
|
|
16
16
|
* @param {Game} game - TBD.
|
|
17
|
-
* @param id
|
|
18
|
-
* @param pointerMode
|
|
17
|
+
* @param {number} id - TBD.
|
|
18
|
+
* @param {number} pointerMode - TBD.
|
|
19
19
|
*/
|
|
20
20
|
constructor(game, id, pointerMode) {
|
|
21
21
|
this.game = game;
|
|
@@ -74,7 +74,7 @@ export class Pointer {
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* TBD.
|
|
77
|
-
* @param event
|
|
77
|
+
* @param {MouseEvent|PointerEvent} event - TBD.
|
|
78
78
|
*/
|
|
79
79
|
updateButtons(event) {
|
|
80
80
|
if (event.type.toLowerCase().substr(-4) === 'down') {
|
|
@@ -88,7 +88,8 @@ export class Pointer {
|
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* TBD.
|
|
91
|
-
* @param event
|
|
91
|
+
* @param {PointerEvent} event - TBD.
|
|
92
|
+
* @returns {Pointer} TBD.
|
|
92
93
|
*/
|
|
93
94
|
start(event) {
|
|
94
95
|
const input = this.game.input;
|
|
@@ -175,8 +176,9 @@ export class Pointer {
|
|
|
175
176
|
|
|
176
177
|
/**
|
|
177
178
|
* TBD.
|
|
178
|
-
* @param event
|
|
179
|
-
* @param fromClick
|
|
179
|
+
* @param {MouseEvent|PointerEvent} event - TBD.
|
|
180
|
+
* @param {boolean} fromClick - TBD.
|
|
181
|
+
* @returns {Pointer} TBD.
|
|
180
182
|
*/
|
|
181
183
|
move(event, fromClick = false) {
|
|
182
184
|
const input = this.game.input;
|
|
@@ -238,7 +240,8 @@ export class Pointer {
|
|
|
238
240
|
|
|
239
241
|
/**
|
|
240
242
|
* TBD.
|
|
241
|
-
* @param fromClick
|
|
243
|
+
* @param {boolean} fromClick - TBD.
|
|
244
|
+
* @returns {boolean} TBD.
|
|
242
245
|
*/
|
|
243
246
|
processInteractiveObjects(fromClick = false) {
|
|
244
247
|
// Work out which object is on the top
|
|
@@ -299,8 +302,8 @@ export class Pointer {
|
|
|
299
302
|
|
|
300
303
|
/**
|
|
301
304
|
* TBD.
|
|
302
|
-
* @param newTarget
|
|
303
|
-
* @param silent
|
|
305
|
+
* @param newTarget - TBD.
|
|
306
|
+
* @param {boolean} silent - TBD.
|
|
304
307
|
*/
|
|
305
308
|
swapTarget(newTarget, silent = false) {
|
|
306
309
|
// Now we know the top-most item (if any) we can process it
|
|
@@ -331,7 +334,7 @@ export class Pointer {
|
|
|
331
334
|
|
|
332
335
|
/**
|
|
333
336
|
* TBD.
|
|
334
|
-
* @param event
|
|
337
|
+
* @param {MouseEvent|PointerEvent} event - TBD.
|
|
335
338
|
*/
|
|
336
339
|
leave(event) {
|
|
337
340
|
this.withinGame = false;
|
|
@@ -340,7 +343,8 @@ export class Pointer {
|
|
|
340
343
|
|
|
341
344
|
/**
|
|
342
345
|
* TBD.
|
|
343
|
-
* @param event
|
|
346
|
+
* @param {MouseEvent|PointerEvent} event - TBD.
|
|
347
|
+
* @returns {Pointer} TBD.
|
|
344
348
|
*/
|
|
345
349
|
stop(event) {
|
|
346
350
|
const input = this.game.input;
|
|
@@ -395,7 +399,8 @@ export class Pointer {
|
|
|
395
399
|
|
|
396
400
|
/**
|
|
397
401
|
* TBD.
|
|
398
|
-
* @param duration - TBD.
|
|
402
|
+
* @param {number} duration - TBD.
|
|
403
|
+
* @returns {boolean} TBD.
|
|
399
404
|
*/
|
|
400
405
|
justPressed(duration) {
|
|
401
406
|
duration = duration || this.game.input.justPressedRate;
|
|
@@ -404,7 +409,8 @@ export class Pointer {
|
|
|
404
409
|
|
|
405
410
|
/**
|
|
406
411
|
* TBD.
|
|
407
|
-
* @param duration - TBD.
|
|
412
|
+
* @param {number} duration - TBD.
|
|
413
|
+
* @returns {boolean} TBD.
|
|
408
414
|
*/
|
|
409
415
|
justReleased(duration) {
|
|
410
416
|
duration = duration || this.game.input.justReleasedRate;
|
|
@@ -413,10 +419,10 @@ export class Pointer {
|
|
|
413
419
|
|
|
414
420
|
/**
|
|
415
421
|
* TBD.
|
|
416
|
-
* @param name
|
|
417
|
-
* @param callback - TBD.
|
|
418
|
-
* @param callbackContext
|
|
419
|
-
* @param callbackArgs
|
|
422
|
+
* @param {string} name - TBD.
|
|
423
|
+
* @param {Function} callback - TBD.
|
|
424
|
+
* @param {object} callbackContext - TBD.
|
|
425
|
+
* @param {...any} callbackArgs - TBD.
|
|
420
426
|
*/
|
|
421
427
|
addClickTrampoline(name, callback, callbackContext, callbackArgs) {
|
|
422
428
|
if (!this.isDown) {
|
|
@@ -488,6 +494,7 @@ export class Pointer {
|
|
|
488
494
|
|
|
489
495
|
/**
|
|
490
496
|
* TBD.
|
|
497
|
+
* @returns {number} TBD.
|
|
491
498
|
*/
|
|
492
499
|
get duration() {
|
|
493
500
|
if (this.isUp) {
|
|
@@ -498,6 +505,7 @@ export class Pointer {
|
|
|
498
505
|
|
|
499
506
|
/**
|
|
500
507
|
* TBD.
|
|
508
|
+
* @returns {number} TBD.
|
|
501
509
|
*/
|
|
502
510
|
get worldX() {
|
|
503
511
|
return this.x;
|
|
@@ -505,6 +513,7 @@ export class Pointer {
|
|
|
505
513
|
|
|
506
514
|
/**
|
|
507
515
|
* TBD.
|
|
516
|
+
* @returns {number} TBD.
|
|
508
517
|
*/
|
|
509
518
|
get worldY() {
|
|
510
519
|
return this.y;
|
|
@@ -75,7 +75,7 @@ export class Touch {
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* TBD.
|
|
78
|
-
* @param event
|
|
78
|
+
* @param {TouchEvent} event - TBD.
|
|
79
79
|
*/
|
|
80
80
|
onTouchStart(event) {
|
|
81
81
|
this.event = event;
|
|
@@ -96,7 +96,7 @@ export class Touch {
|
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* TBD.
|
|
99
|
-
* @param event
|
|
99
|
+
* @param {TouchEvent} event - TBD.
|
|
100
100
|
*/
|
|
101
101
|
onTouchCancel(event) {
|
|
102
102
|
this.event = event;
|
|
@@ -116,7 +116,7 @@ export class Touch {
|
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* TBD.
|
|
119
|
-
* @param event
|
|
119
|
+
* @param {TouchEvent} event - TBD.
|
|
120
120
|
*/
|
|
121
121
|
onTouchEnter(event) {
|
|
122
122
|
this.event = event;
|
|
@@ -131,7 +131,7 @@ export class Touch {
|
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* TBD.
|
|
134
|
-
* @param event
|
|
134
|
+
* @param {TouchEvent} event - TBD.
|
|
135
135
|
*/
|
|
136
136
|
onTouchLeave(event) {
|
|
137
137
|
this.event = event;
|
|
@@ -143,7 +143,7 @@ export class Touch {
|
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* TBD.
|
|
146
|
-
* @param event
|
|
146
|
+
* @param {TouchEvent} event - TBD.
|
|
147
147
|
*/
|
|
148
148
|
onTouchMove(event) {
|
|
149
149
|
this.event = event;
|
|
@@ -158,7 +158,7 @@ export class Touch {
|
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
160
|
* TBD.
|
|
161
|
-
* @param event
|
|
161
|
+
* @param {TouchEvent} event - TBD.
|
|
162
162
|
*/
|
|
163
163
|
onTouchEnd(event) {
|
|
164
164
|
this.event = event;
|
|
@@ -176,7 +176,7 @@ export class Touch {
|
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
178
|
* TBD.
|
|
179
|
-
* @param event
|
|
179
|
+
* @param {TouchEvent} event - TBD.
|
|
180
180
|
*/
|
|
181
181
|
eventPreventDefault(event) {
|
|
182
182
|
if (this.preventDefault) {
|