@vpmedia/phaser 1.11.0 → 1.12.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 +8 -5
- package/src/phaser/core/animation.js +9 -6
- package/src/phaser/core/animation_manager.js +14 -4
- package/src/phaser/core/animation_parser.js +24 -3
- package/src/phaser/core/array_set.js +1 -3
- package/src/phaser/core/cache.js +6 -6
- package/src/phaser/core/device.js +0 -2
- package/src/phaser/core/device_util.js +21 -6
- package/src/phaser/core/dom.js +34 -25
- package/src/phaser/core/event_manager.js +45 -17
- package/src/phaser/core/factory.js +26 -4
- package/src/phaser/core/frame.js +0 -2
- package/src/phaser/core/frame_data.js +0 -2
- package/src/phaser/core/game.js +8 -6
- package/src/phaser/core/input.js +17 -9
- package/src/phaser/core/input_handler.js +100 -26
- package/src/phaser/core/input_mouse.js +10 -14
- package/src/phaser/core/input_mspointer.js +10 -9
- package/src/phaser/core/input_pointer.js +58 -17
- package/src/phaser/core/input_touch.js +6 -8
- package/src/phaser/core/loader.js +168 -51
- package/src/phaser/core/loader_parser.js +4 -1
- package/src/phaser/core/raf.js +0 -2
- package/src/phaser/core/scale_manager.js +69 -25
- package/src/phaser/core/scene.js +0 -2
- package/src/phaser/core/scene_manager.js +6 -3
- package/src/phaser/core/signal.js +15 -8
- package/src/phaser/core/signal_binding.js +10 -5
- package/src/phaser/core/sound.js +20 -11
- package/src/phaser/core/sound_manager.js +56 -20
- package/src/phaser/core/sound_sprite.js +32 -32
- package/src/phaser/core/stage.js +0 -3
- package/src/phaser/core/time.js +0 -2
- package/src/phaser/core/timer.js +24 -7
- package/src/phaser/core/timer_event.js +0 -2
- package/src/phaser/core/tween.js +32 -8
- package/src/phaser/core/tween_data.js +15 -7
- package/src/phaser/core/tween_easing.js +24 -20
- package/src/phaser/core/tween_manager.js +31 -13
- package/src/phaser/core/world.js +0 -2
- package/src/phaser/display/bitmap_text.js +8 -9
- package/src/phaser/display/button.js +16 -4
- package/src/phaser/display/canvas/buffer.js +0 -2
- package/src/phaser/display/canvas/graphics.js +21 -9
- package/src/phaser/display/canvas/masker.js +1 -1
- package/src/phaser/display/canvas/renderer.js +39 -19
- package/src/phaser/display/canvas/tinter.js +43 -6
- package/src/phaser/display/canvas/util.js +1 -1
- package/src/phaser/display/display_object.js +33 -19
- package/src/phaser/display/graphics.js +52 -27
- package/src/phaser/display/graphics_data.js +0 -2
- package/src/phaser/display/graphics_data_util.js +9 -1
- package/src/phaser/display/group.js +1 -4
- package/src/phaser/display/image.js +2 -4
- package/src/phaser/display/sprite_batch.js +0 -2
- package/src/phaser/display/sprite_util.js +46 -11
- package/src/phaser/display/text.js +77 -26
- package/src/phaser/display/webgl/abstract_filter.js +0 -2
- package/src/phaser/display/webgl/base_texture.js +5 -3
- package/src/phaser/display/webgl/blend_manager.js +0 -2
- package/src/phaser/display/webgl/earcut.js +63 -22
- package/src/phaser/display/webgl/earcut_node.js +0 -2
- package/src/phaser/display/webgl/fast_sprite_batch.js +47 -46
- package/src/phaser/display/webgl/filter_manager.js +0 -2
- package/src/phaser/display/webgl/filter_texture.js +16 -5
- package/src/phaser/display/webgl/graphics.js +38 -16
- package/src/phaser/display/webgl/graphics_data.js +0 -2
- package/src/phaser/display/webgl/mask_manager.js +10 -2
- package/src/phaser/display/webgl/render_texture.js +14 -5
- package/src/phaser/display/webgl/renderer.js +39 -7
- package/src/phaser/display/webgl/shader/complex.js +0 -2
- package/src/phaser/display/webgl/shader/fast.js +8 -3
- package/src/phaser/display/webgl/shader/normal.js +42 -14
- package/src/phaser/display/webgl/shader/primitive.js +0 -2
- package/src/phaser/display/webgl/shader/strip.js +0 -2
- package/src/phaser/display/webgl/shader_manager.js +0 -2
- package/src/phaser/display/webgl/sprite_batch.js +13 -14
- package/src/phaser/display/webgl/stencil_manager.js +18 -20
- package/src/phaser/display/webgl/texture.js +10 -7
- package/src/phaser/display/webgl/util.js +1 -2
- package/src/phaser/geom/circle.js +15 -7
- package/src/phaser/geom/ellipse.js +13 -6
- package/src/phaser/geom/line.js +19 -10
- package/src/phaser/geom/matrix.js +0 -2
- package/src/phaser/geom/point.js +9 -11
- package/src/phaser/geom/polygon.js +9 -5
- package/src/phaser/geom/rectangle.js +44 -10
- package/src/phaser/geom/rounded_rectangle.js +0 -2
- package/src/phaser/geom/util/circle.js +3 -3
- package/src/phaser/geom/util/ellipse.js +3 -3
- package/src/phaser/geom/util/line.js +16 -13
- package/src/phaser/geom/util/point.js +1 -1
- package/src/phaser/geom/util/rectangle.js +17 -7
- package/src/phaser/util/math.js +37 -23
- package/tsconfig.json +110 -0
- package/types/index.d.ts +22 -0
- package/types/index.d.ts.map +1 -0
- package/types/phaser/core/animation.d.ts +55 -0
- package/types/phaser/core/animation.d.ts.map +1 -0
- package/types/phaser/core/animation_manager.d.ts +35 -0
- package/types/phaser/core/animation_manager.d.ts.map +1 -0
- package/types/phaser/core/animation_parser.d.ts +20 -0
- package/types/phaser/core/animation_parser.d.ts.map +1 -0
- package/types/phaser/core/array_set.d.ts +23 -0
- package/types/phaser/core/array_set.d.ts.map +1 -0
- package/types/phaser/core/cache.d.ts +106 -0
- package/types/phaser/core/cache.d.ts.map +1 -0
- package/types/phaser/core/const.d.ts +81 -0
- package/types/phaser/core/const.d.ts.map +1 -0
- package/types/phaser/core/device.d.ts +36 -0
- package/types/phaser/core/device.d.ts.map +1 -0
- package/types/phaser/core/device_util.d.ts +48 -0
- package/types/phaser/core/device_util.d.ts.map +1 -0
- package/types/phaser/core/dom.d.ts +63 -0
- package/types/phaser/core/dom.d.ts.map +1 -0
- package/types/phaser/core/event_manager.d.ts +53 -0
- package/types/phaser/core/event_manager.d.ts.map +1 -0
- package/types/phaser/core/factory.d.ts +12 -0
- package/types/phaser/core/factory.d.ts.map +1 -0
- package/types/phaser/core/frame.d.ts +30 -0
- package/types/phaser/core/frame.d.ts.map +1 -0
- package/types/phaser/core/frame_data.d.ts +14 -0
- package/types/phaser/core/frame_data.d.ts.map +1 -0
- package/types/phaser/core/frame_util.d.ts +15 -0
- package/types/phaser/core/frame_util.d.ts.map +1 -0
- package/types/phaser/core/game.d.ts +57 -0
- package/types/phaser/core/game.d.ts.map +1 -0
- package/types/phaser/core/input.d.ts +92 -0
- package/types/phaser/core/input.d.ts.map +1 -0
- package/types/phaser/core/input_handler.d.ts +111 -0
- package/types/phaser/core/input_handler.d.ts.map +1 -0
- package/types/phaser/core/input_mouse.d.ts +39 -0
- package/types/phaser/core/input_mouse.d.ts.map +1 -0
- package/types/phaser/core/input_mspointer.d.ts +34 -0
- package/types/phaser/core/input_mspointer.d.ts.map +1 -0
- package/types/phaser/core/input_pointer.d.ts +68 -0
- package/types/phaser/core/input_pointer.d.ts.map +1 -0
- package/types/phaser/core/input_touch.d.ts +37 -0
- package/types/phaser/core/input_touch.d.ts.map +1 -0
- package/types/phaser/core/loader.d.ts +94 -0
- package/types/phaser/core/loader.d.ts.map +1 -0
- package/types/phaser/core/loader_parser.d.ts +35 -0
- package/types/phaser/core/loader_parser.d.ts.map +1 -0
- package/types/phaser/core/raf.d.ts +15 -0
- package/types/phaser/core/raf.d.ts.map +1 -0
- package/types/phaser/core/scale_manager.d.ts +137 -0
- package/types/phaser/core/scale_manager.d.ts.map +1 -0
- package/types/phaser/core/scene.d.ts +17 -0
- package/types/phaser/core/scene.d.ts.map +1 -0
- package/types/phaser/core/scene_manager.d.ts +39 -0
- package/types/phaser/core/scene_manager.d.ts.map +1 -0
- package/types/phaser/core/signal.d.ts +25 -0
- package/types/phaser/core/signal.d.ts.map +1 -0
- package/types/phaser/core/signal_binding.d.ts +26 -0
- package/types/phaser/core/signal_binding.d.ts.map +1 -0
- package/types/phaser/core/sound.d.ts +72 -0
- package/types/phaser/core/sound.d.ts.map +1 -0
- package/types/phaser/core/sound_manager.d.ts +50 -0
- package/types/phaser/core/sound_manager.d.ts.map +1 -0
- package/types/phaser/core/sound_sprite.d.ts +18 -0
- package/types/phaser/core/sound_sprite.d.ts.map +1 -0
- package/types/phaser/core/stage.d.ts +23 -0
- package/types/phaser/core/stage.d.ts.map +1 -0
- package/types/phaser/core/time.d.ts +49 -0
- package/types/phaser/core/time.d.ts.map +1 -0
- package/types/phaser/core/timer.d.ts +49 -0
- package/types/phaser/core/timer.d.ts.map +1 -0
- package/types/phaser/core/timer_event.d.ts +18 -0
- package/types/phaser/core/timer_event.d.ts.map +1 -0
- package/types/phaser/core/tween.d.ts +52 -0
- package/types/phaser/core/tween.d.ts.map +1 -0
- package/types/phaser/core/tween_data.d.ts +37 -0
- package/types/phaser/core/tween_data.d.ts.map +1 -0
- package/types/phaser/core/tween_easing.d.ts +192 -0
- package/types/phaser/core/tween_easing.d.ts.map +1 -0
- package/types/phaser/core/tween_manager.d.ts +94 -0
- package/types/phaser/core/tween_manager.d.ts.map +1 -0
- package/types/phaser/core/world.d.ts +6 -0
- package/types/phaser/core/world.d.ts.map +1 -0
- package/types/phaser/display/bitmap_text.d.ts +48 -0
- package/types/phaser/display/bitmap_text.d.ts.map +1 -0
- package/types/phaser/display/button.d.ts +33 -0
- package/types/phaser/display/button.d.ts.map +1 -0
- package/types/phaser/display/canvas/buffer.d.ts +11 -0
- package/types/phaser/display/canvas/buffer.d.ts.map +1 -0
- package/types/phaser/display/canvas/graphics.d.ts +18 -0
- package/types/phaser/display/canvas/graphics.d.ts.map +1 -0
- package/types/phaser/display/canvas/masker.d.ts +12 -0
- package/types/phaser/display/canvas/masker.d.ts.map +1 -0
- package/types/phaser/display/canvas/pool.d.ts +45 -0
- package/types/phaser/display/canvas/pool.d.ts.map +1 -0
- package/types/phaser/display/canvas/renderer.d.ts +28 -0
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -0
- package/types/phaser/display/canvas/tinter.d.ts +36 -0
- package/types/phaser/display/canvas/tinter.d.ts.map +1 -0
- package/types/phaser/display/canvas/util.d.ts +70 -0
- package/types/phaser/display/canvas/util.d.ts.map +1 -0
- package/types/phaser/display/display_object.d.ts +83 -0
- package/types/phaser/display/display_object.d.ts.map +1 -0
- package/types/phaser/display/graphics.d.ts +53 -0
- package/types/phaser/display/graphics.d.ts.map +1 -0
- package/types/phaser/display/graphics_data.d.ts +15 -0
- package/types/phaser/display/graphics_data.d.ts.map +1 -0
- package/types/phaser/display/graphics_data_util.d.ts +7 -0
- package/types/phaser/display/graphics_data_util.d.ts.map +1 -0
- package/types/phaser/display/group.d.ts +41 -0
- package/types/phaser/display/group.d.ts.map +1 -0
- package/types/phaser/display/image.d.ts +43 -0
- package/types/phaser/display/image.d.ts.map +1 -0
- package/types/phaser/display/sprite_batch.d.ts +6 -0
- package/types/phaser/display/sprite_batch.d.ts.map +1 -0
- package/types/phaser/display/sprite_util.d.ts +35 -0
- package/types/phaser/display/sprite_util.d.ts.map +1 -0
- package/types/phaser/display/text.d.ts +116 -0
- package/types/phaser/display/text.d.ts.map +1 -0
- package/types/phaser/display/webgl/abstract_filter.d.ts +17 -0
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -0
- package/types/phaser/display/webgl/base_texture.d.ts +20 -0
- package/types/phaser/display/webgl/base_texture.d.ts.map +1 -0
- package/types/phaser/display/webgl/blend_manager.d.ts +14 -0
- package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -0
- package/types/phaser/display/webgl/earcut.d.ts +215 -0
- package/types/phaser/display/webgl/earcut.d.ts.map +1 -0
- package/types/phaser/display/webgl/earcut_node.d.ts +19 -0
- package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -0
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +34 -0
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -0
- package/types/phaser/display/webgl/filter_manager.d.ts +21 -0
- package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -0
- package/types/phaser/display/webgl/filter_texture.d.ts +13 -0
- package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -0
- package/types/phaser/display/webgl/graphics.d.ts +80 -0
- package/types/phaser/display/webgl/graphics.d.ts.map +1 -0
- package/types/phaser/display/webgl/graphics_data.d.ts +23 -0
- package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -0
- package/types/phaser/display/webgl/mask_manager.d.ts +13 -0
- package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -0
- package/types/phaser/display/webgl/render_texture.d.ts +25 -0
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -0
- package/types/phaser/display/webgl/renderer.d.ts +44 -0
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader/complex.d.ts +22 -0
- package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader/fast.d.ts +25 -0
- package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader/normal.d.ts +25 -0
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader/primitive.d.ts +21 -0
- package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader/strip.d.ts +22 -0
- package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader_manager.d.ts +24 -0
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -0
- package/types/phaser/display/webgl/sprite_batch.d.ts +36 -0
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -0
- package/types/phaser/display/webgl/stencil_manager.d.ts +12 -0
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -0
- package/types/phaser/display/webgl/texture.d.ts +30 -0
- package/types/phaser/display/webgl/texture.d.ts.map +1 -0
- package/types/phaser/display/webgl/texture_util.d.ts +15 -0
- package/types/phaser/display/webgl/texture_util.d.ts.map +1 -0
- package/types/phaser/display/webgl/util.d.ts +41 -0
- package/types/phaser/display/webgl/util.d.ts.map +1 -0
- package/types/phaser/geom/circle.d.ts +39 -0
- package/types/phaser/geom/circle.d.ts.map +1 -0
- package/types/phaser/geom/ellipse.d.ts +18 -0
- package/types/phaser/geom/ellipse.d.ts.map +1 -0
- package/types/phaser/geom/line.d.ts +37 -0
- package/types/phaser/geom/line.d.ts.map +1 -0
- package/types/phaser/geom/matrix.d.ts +25 -0
- package/types/phaser/geom/matrix.d.ts.map +1 -0
- package/types/phaser/geom/point.d.ts +37 -0
- package/types/phaser/geom/point.d.ts.map +1 -0
- package/types/phaser/geom/polygon.d.ts +17 -0
- package/types/phaser/geom/polygon.d.ts.map +1 -0
- package/types/phaser/geom/rectangle.d.ts +63 -0
- package/types/phaser/geom/rectangle.d.ts.map +1 -0
- package/types/phaser/geom/rounded_rectangle.d.ts +12 -0
- package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -0
- package/types/phaser/geom/util/circle.d.ts +55 -0
- package/types/phaser/geom/util/circle.d.ts.map +1 -0
- package/types/phaser/geom/util/ellipse.d.ts +21 -0
- package/types/phaser/geom/util/ellipse.d.ts.map +1 -0
- package/types/phaser/geom/util/line.d.ts +42 -0
- package/types/phaser/geom/util/line.d.ts.map +1 -0
- package/types/phaser/geom/util/matrix.d.ts +20 -0
- package/types/phaser/geom/util/matrix.d.ts.map +1 -0
- package/types/phaser/geom/util/point.d.ts +157 -0
- package/types/phaser/geom/util/point.d.ts.map +1 -0
- package/types/phaser/geom/util/polygon.d.ts +15 -0
- package/types/phaser/geom/util/polygon.d.ts.map +1 -0
- package/types/phaser/geom/util/rectangle.d.ts +124 -0
- package/types/phaser/geom/util/rectangle.d.ts.map +1 -0
- package/types/phaser/geom/util/rounded_rectangle.d.ts +15 -0
- package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -0
- package/types/phaser/util/math.d.ts +162 -0
- package/types/phaser/util/math.d.ts.map +1 -0
|
@@ -10,7 +10,6 @@ import { canPlayAudio } from './device_util';
|
|
|
10
10
|
const TEXTURE_ATLAS_JSON_HASH = 1;
|
|
11
11
|
|
|
12
12
|
export default class {
|
|
13
|
-
|
|
14
13
|
constructor(game) {
|
|
15
14
|
this.game = game;
|
|
16
15
|
this.cache = game.cache;
|
|
@@ -122,7 +121,14 @@ export default class {
|
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
|
|
125
|
-
addToFileList(
|
|
124
|
+
addToFileList(
|
|
125
|
+
type,
|
|
126
|
+
key = '',
|
|
127
|
+
url = null,
|
|
128
|
+
properties = null,
|
|
129
|
+
overwrite = false,
|
|
130
|
+
extension = null
|
|
131
|
+
) {
|
|
126
132
|
if (key === undefined || key === '') {
|
|
127
133
|
console.warn('Loader: Invalid or no key given of type ' + type);
|
|
128
134
|
return this;
|
|
@@ -184,7 +190,7 @@ export default class {
|
|
|
184
190
|
loading: false,
|
|
185
191
|
loaded: false,
|
|
186
192
|
error: false,
|
|
187
|
-
callbackContext: callbackContext
|
|
193
|
+
callbackContext: callbackContext,
|
|
188
194
|
};
|
|
189
195
|
if (data) {
|
|
190
196
|
if (typeof data === 'string') {
|
|
@@ -234,7 +240,14 @@ export default class {
|
|
|
234
240
|
}
|
|
235
241
|
|
|
236
242
|
spritesheet(key, url, frameWidth, frameHeight, frameMax = -1, margin = 0, spacing = 0) {
|
|
237
|
-
return this.addToFileList(
|
|
243
|
+
return this.addToFileList(
|
|
244
|
+
'spritesheet',
|
|
245
|
+
key,
|
|
246
|
+
url,
|
|
247
|
+
{ frameWidth, frameHeight, frameMax, margin, spacing },
|
|
248
|
+
false,
|
|
249
|
+
'.png'
|
|
250
|
+
);
|
|
238
251
|
}
|
|
239
252
|
|
|
240
253
|
audio(key, urls, autoDecode = true) {
|
|
@@ -263,7 +276,14 @@ export default class {
|
|
|
263
276
|
return this;
|
|
264
277
|
}
|
|
265
278
|
|
|
266
|
-
bitmapFont(
|
|
279
|
+
bitmapFont(
|
|
280
|
+
key,
|
|
281
|
+
textureURL = null,
|
|
282
|
+
atlasURL = null,
|
|
283
|
+
atlasData = null,
|
|
284
|
+
xSpacing = 0,
|
|
285
|
+
ySpacing = 0
|
|
286
|
+
) {
|
|
267
287
|
if (textureURL === undefined || textureURL === null) {
|
|
268
288
|
textureURL = key + '.png';
|
|
269
289
|
}
|
|
@@ -285,7 +305,13 @@ export default class {
|
|
|
285
305
|
if (!xml && !json) {
|
|
286
306
|
throw new Error('Loader. Invalid Bitmap Font atlas given');
|
|
287
307
|
}
|
|
288
|
-
this.addToFileList('bitmapfont', key, textureURL, {
|
|
308
|
+
this.addToFileList('bitmapfont', key, textureURL, {
|
|
309
|
+
atlasURL: null,
|
|
310
|
+
atlasData: json || xml,
|
|
311
|
+
atlasType: json ? 'json' : 'xml',
|
|
312
|
+
xSpacing,
|
|
313
|
+
ySpacing,
|
|
314
|
+
});
|
|
289
315
|
}
|
|
290
316
|
return this;
|
|
291
317
|
}
|
|
@@ -368,11 +394,22 @@ export default class {
|
|
|
368
394
|
}
|
|
369
395
|
if (file.type !== 'packfile') {
|
|
370
396
|
this._loadedFileCount += 1;
|
|
371
|
-
this.onFileComplete.dispatch(
|
|
397
|
+
this.onFileComplete.dispatch(
|
|
398
|
+
this.progress,
|
|
399
|
+
file.key,
|
|
400
|
+
!file.error,
|
|
401
|
+
this._loadedFileCount,
|
|
402
|
+
this._totalFileCount
|
|
403
|
+
);
|
|
372
404
|
} else if (file.type === 'packfile' && file.error) {
|
|
373
405
|
// Non-error pack files are handled when processing the file queue
|
|
374
406
|
this._loadedPackCount += 1;
|
|
375
|
-
this.onPackComplete.dispatch(
|
|
407
|
+
this.onPackComplete.dispatch(
|
|
408
|
+
file.key,
|
|
409
|
+
!file.error,
|
|
410
|
+
this._loadedPackCount,
|
|
411
|
+
this._totalPackCount
|
|
412
|
+
);
|
|
376
413
|
}
|
|
377
414
|
}
|
|
378
415
|
}
|
|
@@ -386,7 +423,12 @@ export default class {
|
|
|
386
423
|
// Processing the pack / adds more files
|
|
387
424
|
this.processPack(file);
|
|
388
425
|
this._loadedPackCount += 1;
|
|
389
|
-
this.onPackComplete.dispatch(
|
|
426
|
+
this.onPackComplete.dispatch(
|
|
427
|
+
file.key,
|
|
428
|
+
!file.error,
|
|
429
|
+
this._loadedPackCount,
|
|
430
|
+
this._totalPackCount
|
|
431
|
+
);
|
|
390
432
|
}
|
|
391
433
|
if (file.loaded || file.error) {
|
|
392
434
|
// Item at the start of file list finished, can skip it in future
|
|
@@ -417,7 +459,10 @@ export default class {
|
|
|
417
459
|
}
|
|
418
460
|
// Stop looking if queue full - or if syncblocked and there are no more packs.
|
|
419
461
|
// (As only packs can be loaded around a syncblock)
|
|
420
|
-
if (
|
|
462
|
+
if (
|
|
463
|
+
this._flightQueue.length >= inflightLimit ||
|
|
464
|
+
(syncblock && this._loadedPackCount === this._totalPackCount)
|
|
465
|
+
) {
|
|
421
466
|
break;
|
|
422
467
|
}
|
|
423
468
|
}
|
|
@@ -477,35 +522,56 @@ export default class {
|
|
|
477
522
|
for (let i = 0; i < packDataCompat.length; i += 1) {
|
|
478
523
|
const file = packDataCompat[i];
|
|
479
524
|
switch (file.type) {
|
|
480
|
-
case
|
|
525
|
+
case 'image':
|
|
481
526
|
this.image(file.key, file.url, file.overwrite);
|
|
482
527
|
break;
|
|
483
|
-
case
|
|
528
|
+
case 'text':
|
|
484
529
|
this.text(file.key, file.url, file.overwrite);
|
|
485
530
|
break;
|
|
486
|
-
case
|
|
531
|
+
case 'json':
|
|
487
532
|
this.json(file.key, file.url, file.overwrite);
|
|
488
533
|
break;
|
|
489
|
-
case
|
|
534
|
+
case 'xml':
|
|
490
535
|
this.xml(file.key, file.url, file.overwrite);
|
|
491
536
|
break;
|
|
492
|
-
case
|
|
493
|
-
this.spritesheet(
|
|
537
|
+
case 'spritesheet':
|
|
538
|
+
this.spritesheet(
|
|
539
|
+
file.key,
|
|
540
|
+
file.url,
|
|
541
|
+
file.frameWidth,
|
|
542
|
+
file.frameHeight,
|
|
543
|
+
file.frameMax,
|
|
544
|
+
file.margin,
|
|
545
|
+
file.spacing
|
|
546
|
+
);
|
|
494
547
|
break;
|
|
495
|
-
case
|
|
548
|
+
case 'audio':
|
|
496
549
|
this.audio(file.key, file.urls ? file.urls : file.url);
|
|
497
550
|
break;
|
|
498
|
-
case
|
|
551
|
+
case 'audiosprite':
|
|
499
552
|
this.audioSprite(file.key, file.urls ? file.urls : file.url, file.jsonURL, file.jsonData);
|
|
500
553
|
break;
|
|
501
|
-
case
|
|
554
|
+
case 'audioSprite':
|
|
502
555
|
this.audioSprite(file.key, file.audioURL, file.jsonURL, file.jsonData);
|
|
503
556
|
break;
|
|
504
|
-
case
|
|
505
|
-
this.bitmapFont(
|
|
557
|
+
case 'bitmapFont':
|
|
558
|
+
this.bitmapFont(
|
|
559
|
+
file.key,
|
|
560
|
+
file.textureURL,
|
|
561
|
+
file.fontDataURL ? file.fontDataURL : file.atlasURL,
|
|
562
|
+
file.atlasData,
|
|
563
|
+
file.xSpacing,
|
|
564
|
+
file.ySpacing
|
|
565
|
+
);
|
|
506
566
|
break;
|
|
507
|
-
case
|
|
508
|
-
this.atlas(
|
|
567
|
+
case 'atlas':
|
|
568
|
+
this.atlas(
|
|
569
|
+
file.key,
|
|
570
|
+
file.textureURL,
|
|
571
|
+
file.atlasURL,
|
|
572
|
+
file.atlasData,
|
|
573
|
+
TEXTURE_ATLAS_JSON_HASH
|
|
574
|
+
);
|
|
509
575
|
break;
|
|
510
576
|
}
|
|
511
577
|
}
|
|
@@ -537,7 +603,11 @@ export default class {
|
|
|
537
603
|
if (file.url) {
|
|
538
604
|
this.xhrLoad(file, this.transformUrl(file.url, file), 'arraybuffer', this.fileComplete);
|
|
539
605
|
} else {
|
|
540
|
-
this.fileError(
|
|
606
|
+
this.fileError(
|
|
607
|
+
file,
|
|
608
|
+
null,
|
|
609
|
+
'No supported audio URL specified or device does not have audio playback support'
|
|
610
|
+
);
|
|
541
611
|
}
|
|
542
612
|
break;
|
|
543
613
|
case 'json':
|
|
@@ -572,7 +642,7 @@ export default class {
|
|
|
572
642
|
};
|
|
573
643
|
file.data.onerror = () => {
|
|
574
644
|
if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
|
|
575
|
-
file.numRetry = !file.numRetry ? 1 : file.numRetry += 1;
|
|
645
|
+
file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
|
|
576
646
|
scope.loadImageTag(file);
|
|
577
647
|
} else if (file.data.onload) {
|
|
578
648
|
file.data.onload = null;
|
|
@@ -598,9 +668,10 @@ export default class {
|
|
|
598
668
|
onerror = onerror || this.fileError;
|
|
599
669
|
xhr.onload = () => {
|
|
600
670
|
try {
|
|
601
|
-
if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) {
|
|
671
|
+
if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) {
|
|
672
|
+
// Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
|
|
602
673
|
if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
|
|
603
|
-
file.numRetry = !file.numRetry ? 1 : file.numRetry += 1;
|
|
674
|
+
file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
|
|
604
675
|
scope.xhrLoad(file, url, type, onload, onerror);
|
|
605
676
|
return null;
|
|
606
677
|
} else {
|
|
@@ -621,7 +692,7 @@ export default class {
|
|
|
621
692
|
};
|
|
622
693
|
xhr.onerror = () => {
|
|
623
694
|
if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
|
|
624
|
-
file.numRetry = !file.numRetry ? 1 : file.numRetry += 1;
|
|
695
|
+
file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
|
|
625
696
|
scope.xhrLoad(file, url, type, onload, onerror);
|
|
626
697
|
} else {
|
|
627
698
|
try {
|
|
@@ -702,7 +773,16 @@ export default class {
|
|
|
702
773
|
this.cache.addImage(file.key, file.url, file.data);
|
|
703
774
|
break;
|
|
704
775
|
case 'spritesheet':
|
|
705
|
-
this.cache.addSpriteSheet(
|
|
776
|
+
this.cache.addSpriteSheet(
|
|
777
|
+
file.key,
|
|
778
|
+
file.url,
|
|
779
|
+
file.data,
|
|
780
|
+
file.frameWidth,
|
|
781
|
+
file.frameHeight,
|
|
782
|
+
file.frameMax,
|
|
783
|
+
file.margin,
|
|
784
|
+
file.spacing
|
|
785
|
+
);
|
|
706
786
|
break;
|
|
707
787
|
case 'textureatlas':
|
|
708
788
|
if (file.atlasURL == null) {
|
|
@@ -710,7 +790,12 @@ export default class {
|
|
|
710
790
|
} else {
|
|
711
791
|
loadNext = false;
|
|
712
792
|
if (file.format === TEXTURE_ATLAS_JSON_HASH) {
|
|
713
|
-
this.xhrLoad(
|
|
793
|
+
this.xhrLoad(
|
|
794
|
+
file,
|
|
795
|
+
this.transformUrl(file.atlasURL, file),
|
|
796
|
+
'text',
|
|
797
|
+
this.jsonLoadComplete
|
|
798
|
+
);
|
|
714
799
|
} else {
|
|
715
800
|
throw new Error('Invalid Texture Atlas format: ' + file.format);
|
|
716
801
|
}
|
|
@@ -718,26 +803,39 @@ export default class {
|
|
|
718
803
|
break;
|
|
719
804
|
case 'bitmapfont':
|
|
720
805
|
if (!file.atlasURL) {
|
|
721
|
-
this.cache.addBitmapFont(
|
|
806
|
+
this.cache.addBitmapFont(
|
|
807
|
+
file.key,
|
|
808
|
+
file.url,
|
|
809
|
+
file.data,
|
|
810
|
+
file.atlasData,
|
|
811
|
+
file.atlasType,
|
|
812
|
+
file.xSpacing,
|
|
813
|
+
file.ySpacing
|
|
814
|
+
);
|
|
722
815
|
} else {
|
|
723
816
|
// Load the XML before carrying on with the next file
|
|
724
817
|
loadNext = false;
|
|
725
|
-
this.xhrLoad(
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
818
|
+
this.xhrLoad(
|
|
819
|
+
file,
|
|
820
|
+
this.transformUrl(file.atlasURL, file),
|
|
821
|
+
'text',
|
|
822
|
+
(bitmapFontFile, bitmapFontXhr) => {
|
|
823
|
+
let json;
|
|
824
|
+
try {
|
|
825
|
+
// Try to parse as JSON, if it fails, then it's hopefully XML
|
|
826
|
+
json = JSON.parse(bitmapFontXhr.responseText);
|
|
827
|
+
} catch (e) {
|
|
828
|
+
// pass
|
|
829
|
+
}
|
|
830
|
+
if (json) {
|
|
831
|
+
bitmapFontFile.atlasType = 'json';
|
|
832
|
+
this.jsonLoadComplete(bitmapFontFile, bitmapFontXhr);
|
|
833
|
+
} else {
|
|
834
|
+
bitmapFontFile.atlasType = 'xml';
|
|
835
|
+
this.xmlLoadComplete(bitmapFontFile, bitmapFontXhr);
|
|
836
|
+
}
|
|
732
837
|
}
|
|
733
|
-
|
|
734
|
-
bitmapFontFile.atlasType = 'json';
|
|
735
|
-
this.jsonLoadComplete(bitmapFontFile, bitmapFontXhr);
|
|
736
|
-
} else {
|
|
737
|
-
bitmapFontFile.atlasType = 'xml';
|
|
738
|
-
this.xmlLoadComplete(bitmapFontFile, bitmapFontXhr);
|
|
739
|
-
}
|
|
740
|
-
});
|
|
838
|
+
);
|
|
741
839
|
}
|
|
742
840
|
break;
|
|
743
841
|
case 'audio':
|
|
@@ -763,7 +861,15 @@ export default class {
|
|
|
763
861
|
jsonLoadComplete(file, xhr) {
|
|
764
862
|
const data = JSON.parse(xhr.responseText);
|
|
765
863
|
if (file.type === 'bitmapfont') {
|
|
766
|
-
this.cache.addBitmapFont(
|
|
864
|
+
this.cache.addBitmapFont(
|
|
865
|
+
file.key,
|
|
866
|
+
file.url,
|
|
867
|
+
file.data,
|
|
868
|
+
data,
|
|
869
|
+
file.atlasType,
|
|
870
|
+
file.xSpacing,
|
|
871
|
+
file.ySpacing
|
|
872
|
+
);
|
|
767
873
|
} else if (file.type === 'json') {
|
|
768
874
|
this.cache.addJSON(file.key, file.url, data);
|
|
769
875
|
} else {
|
|
@@ -788,7 +894,15 @@ export default class {
|
|
|
788
894
|
return;
|
|
789
895
|
}
|
|
790
896
|
if (file.type === 'bitmapfont') {
|
|
791
|
-
this.cache.addBitmapFont(
|
|
897
|
+
this.cache.addBitmapFont(
|
|
898
|
+
file.key,
|
|
899
|
+
file.url,
|
|
900
|
+
file.data,
|
|
901
|
+
xml,
|
|
902
|
+
file.atlasType,
|
|
903
|
+
file.xSpacing,
|
|
904
|
+
file.ySpacing
|
|
905
|
+
);
|
|
792
906
|
} else if (file.type === 'textureatlas') {
|
|
793
907
|
this.cache.addTextureAtlas(file.key, file.url, file.data, xml, file.format);
|
|
794
908
|
} else if (file.type === 'xml') {
|
|
@@ -821,9 +935,13 @@ export default class {
|
|
|
821
935
|
updateProgress() {
|
|
822
936
|
if (this.preloadSprite) {
|
|
823
937
|
if (this.preloadSprite.direction === 0) {
|
|
824
|
-
this.preloadSprite.rect.width = Math.floor(
|
|
938
|
+
this.preloadSprite.rect.width = Math.floor(
|
|
939
|
+
(this.preloadSprite.width / 100) * this.progress
|
|
940
|
+
);
|
|
825
941
|
} else {
|
|
826
|
-
this.preloadSprite.rect.height = Math.floor(
|
|
942
|
+
this.preloadSprite.rect.height = Math.floor(
|
|
943
|
+
(this.preloadSprite.height / 100) * this.progress
|
|
944
|
+
);
|
|
827
945
|
}
|
|
828
946
|
if (this.preloadSprite.sprite) {
|
|
829
947
|
this.preloadSprite.sprite.updateCrop();
|
|
@@ -865,5 +983,4 @@ export default class {
|
|
|
865
983
|
get progress() {
|
|
866
984
|
return Math.round(this.progressFloat);
|
|
867
985
|
}
|
|
868
|
-
|
|
869
986
|
}
|
|
@@ -15,7 +15,10 @@ import Rectangle from '../geom/rectangle';
|
|
|
15
15
|
export function finalizeBitmapFont(baseTexture, bitmapFontData) {
|
|
16
16
|
Object.keys(bitmapFontData.chars).forEach((charCode) => {
|
|
17
17
|
const letter = bitmapFontData.chars[charCode];
|
|
18
|
-
letter.texture = new Texture(
|
|
18
|
+
letter.texture = new Texture(
|
|
19
|
+
baseTexture,
|
|
20
|
+
new Rectangle(letter.x, letter.y, letter.width, letter.height)
|
|
21
|
+
);
|
|
19
22
|
});
|
|
20
23
|
return bitmapFontData;
|
|
21
24
|
}
|
package/src/phaser/core/raf.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
5
5
|
*/
|
|
6
6
|
export default class {
|
|
7
|
-
|
|
8
7
|
constructor(game) {
|
|
9
8
|
this.game = game;
|
|
10
9
|
this.rafId = 0;
|
|
@@ -23,5 +22,4 @@ export default class {
|
|
|
23
22
|
this.game.update(rafTime);
|
|
24
23
|
this.rafId = requestAnimationFrame(this.updateBinded);
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
}
|
|
@@ -7,10 +7,16 @@ import Signal from './signal';
|
|
|
7
7
|
import DOM from './dom';
|
|
8
8
|
import Point from '../geom/point';
|
|
9
9
|
import Rectangle from '../geom/rectangle';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
SCALE_OFF,
|
|
12
|
+
SCALE_RESIZE,
|
|
13
|
+
SCALE_EXACT_FIT,
|
|
14
|
+
SCALE_USER,
|
|
15
|
+
SCALE_SHOW_ALL,
|
|
16
|
+
RENDER_CANVAS,
|
|
17
|
+
} from './const';
|
|
11
18
|
|
|
12
19
|
export default class {
|
|
13
|
-
|
|
14
20
|
constructor(game, width, height) {
|
|
15
21
|
this.game = game;
|
|
16
22
|
this.dom = new DOM(game.device);
|
|
@@ -102,14 +108,14 @@ export default class {
|
|
|
102
108
|
}
|
|
103
109
|
// Configure event listeners
|
|
104
110
|
const scope = this;
|
|
105
|
-
this._orientationChange = event => scope.orientationChange(event);
|
|
106
|
-
this._windowResize = event => scope.windowResize(event);
|
|
111
|
+
this._orientationChange = (event) => scope.orientationChange(event);
|
|
112
|
+
this._windowResize = (event) => scope.windowResize(event);
|
|
107
113
|
// This does not appear to be on the standards track
|
|
108
114
|
window.addEventListener('orientationchange', this._orientationChange, false);
|
|
109
115
|
window.addEventListener('resize', this._windowResize, false);
|
|
110
116
|
if (this.compatibility.supportsFullScreen) {
|
|
111
|
-
this._fullScreenChange = event => scope.fullScreenChange(event);
|
|
112
|
-
this._fullScreenError = event => scope.fullScreenError(event);
|
|
117
|
+
this._fullScreenChange = (event) => scope.fullScreenChange(event);
|
|
118
|
+
this._fullScreenError = (event) => scope.fullScreenError(event);
|
|
113
119
|
document.addEventListener('webkitfullscreenchange', this._fullScreenChange, false);
|
|
114
120
|
document.addEventListener('mozfullscreenchange', this._fullScreenChange, false);
|
|
115
121
|
document.addEventListener('MSFullscreenChange', this._fullScreenChange, false);
|
|
@@ -225,7 +231,12 @@ export default class {
|
|
|
225
231
|
}
|
|
226
232
|
|
|
227
233
|
signalSizeChange() {
|
|
228
|
-
if (
|
|
234
|
+
if (
|
|
235
|
+
this.width !== this._lastReportedCanvasSize.width ||
|
|
236
|
+
this.height !== this._lastReportedCanvasSize.height ||
|
|
237
|
+
this.game.width !== this._lastReportedGameSize.width ||
|
|
238
|
+
this.game.height !== this._lastReportedGameSize.height
|
|
239
|
+
) {
|
|
229
240
|
const width = this.width;
|
|
230
241
|
const height = this.height;
|
|
231
242
|
this._lastReportedCanvasSize.setTo(0, 0, width, height);
|
|
@@ -251,7 +262,7 @@ export default class {
|
|
|
251
262
|
}
|
|
252
263
|
|
|
253
264
|
preUpdate() {
|
|
254
|
-
if (this.game.time.time <
|
|
265
|
+
if (this.game.time.time < this._lastUpdate + this._updateThrottle) {
|
|
255
266
|
return;
|
|
256
267
|
}
|
|
257
268
|
const prevThrottle = this._updateThrottle;
|
|
@@ -335,7 +346,8 @@ export default class {
|
|
|
335
346
|
const previousOrientation = this.screenOrientation;
|
|
336
347
|
const previouslyIncorrect = this.incorrectOrientation;
|
|
337
348
|
this.screenOrientation = this.dom.getScreenOrientation(this.compatibility.orientationFallback);
|
|
338
|
-
this.incorrectOrientation =
|
|
349
|
+
this.incorrectOrientation =
|
|
350
|
+
(this.forceLandscape && !this.isLandscape) || (this.forcePortrait && !this.isPortrait);
|
|
339
351
|
const changed = previousOrientation !== this.screenOrientation;
|
|
340
352
|
const correctnessChanged = previouslyIncorrect !== this.incorrectOrientation;
|
|
341
353
|
if (correctnessChanged) {
|
|
@@ -390,10 +402,13 @@ export default class {
|
|
|
390
402
|
this.width = this.game.width;
|
|
391
403
|
this.height = this.game.height;
|
|
392
404
|
} else if (scaleMode === SCALE_USER) {
|
|
393
|
-
this.width =
|
|
394
|
-
this.height =
|
|
405
|
+
this.width = this.game.width * this._userScaleFactor.x - this._userScaleTrim.x;
|
|
406
|
+
this.height = this.game.height * this._userScaleFactor.y - this._userScaleTrim.y;
|
|
395
407
|
}
|
|
396
|
-
if (
|
|
408
|
+
if (
|
|
409
|
+
!this.compatibility.canExpandParent &&
|
|
410
|
+
(scaleMode === SCALE_SHOW_ALL || scaleMode === SCALE_USER)
|
|
411
|
+
) {
|
|
397
412
|
const bounds = this.getParentBounds(this._tempBounds);
|
|
398
413
|
this.width = Math.min(this.width, bounds.width);
|
|
399
414
|
this.height = Math.min(this.height, bounds.height);
|
|
@@ -414,8 +429,15 @@ export default class {
|
|
|
414
429
|
} else {
|
|
415
430
|
// Ref. http://msdn.microsoft.com/en-us/library/hh781509(v=vs.85).aspx for getBoundingClientRect
|
|
416
431
|
const clientRect = parentNode.getBoundingClientRect();
|
|
417
|
-
const parentRect =
|
|
418
|
-
|
|
432
|
+
const parentRect = parentNode.offsetParent
|
|
433
|
+
? parentNode.offsetParent.getBoundingClientRect()
|
|
434
|
+
: parentNode.getBoundingClientRect();
|
|
435
|
+
bounds.setTo(
|
|
436
|
+
clientRect.left - parentRect.left,
|
|
437
|
+
clientRect.top - parentRect.top,
|
|
438
|
+
clientRect.width,
|
|
439
|
+
clientRect.height
|
|
440
|
+
);
|
|
419
441
|
const wc = this.windowConstraints;
|
|
420
442
|
if (wc.right) {
|
|
421
443
|
const windowBounds = wc.right === 'layout' ? layoutBounds : visualBounds;
|
|
@@ -426,7 +448,12 @@ export default class {
|
|
|
426
448
|
bounds.bottom = Math.min(bounds.bottom, windowBounds.height);
|
|
427
449
|
}
|
|
428
450
|
}
|
|
429
|
-
bounds.setTo(
|
|
451
|
+
bounds.setTo(
|
|
452
|
+
Math.round(bounds.x),
|
|
453
|
+
Math.round(bounds.y),
|
|
454
|
+
Math.round(bounds.width),
|
|
455
|
+
Math.round(bounds.height)
|
|
456
|
+
);
|
|
430
457
|
return bounds;
|
|
431
458
|
}
|
|
432
459
|
|
|
@@ -440,7 +467,7 @@ export default class {
|
|
|
440
467
|
const canvasBounds = canvas.getBoundingClientRect();
|
|
441
468
|
if (this.width < parentBounds.width && !this.incorrectOrientation) {
|
|
442
469
|
const currentEdge = canvasBounds.left - parentBounds.x;
|
|
443
|
-
let targetEdge =
|
|
470
|
+
let targetEdge = parentBounds.width / 2 - this.width / 2;
|
|
444
471
|
targetEdge = Math.max(targetEdge, 0);
|
|
445
472
|
const offset = targetEdge - currentEdge;
|
|
446
473
|
margin.left = Math.round(offset);
|
|
@@ -457,7 +484,7 @@ export default class {
|
|
|
457
484
|
const canvasBounds = canvas.getBoundingClientRect();
|
|
458
485
|
if (this.height < parentBounds.height && !this.incorrectOrientation) {
|
|
459
486
|
const currentEdge = canvasBounds.top - parentBounds.y;
|
|
460
|
-
let targetEdge =
|
|
487
|
+
let targetEdge = parentBounds.height / 2 - this.height / 2;
|
|
461
488
|
targetEdge = Math.max(targetEdge, 0);
|
|
462
489
|
const offset = targetEdge - currentEdge;
|
|
463
490
|
margin.top = Math.round(offset);
|
|
@@ -482,7 +509,10 @@ export default class {
|
|
|
482
509
|
reflowCanvas() {
|
|
483
510
|
if (!this.incorrectOrientation) {
|
|
484
511
|
this.width = Math.max(this.minWidth || 0, Math.min(this.maxWidth || this.width, this.width));
|
|
485
|
-
this.height = Math.max(
|
|
512
|
+
this.height = Math.max(
|
|
513
|
+
this.minHeight || 0,
|
|
514
|
+
Math.min(this.maxHeight || this.height, this.height)
|
|
515
|
+
);
|
|
486
516
|
}
|
|
487
517
|
this.resetCanvas();
|
|
488
518
|
if (!this.compatibility.noMargins) {
|
|
@@ -530,9 +560,9 @@ export default class {
|
|
|
530
560
|
const height = bounds.height;
|
|
531
561
|
let multiplier;
|
|
532
562
|
if (expanding) {
|
|
533
|
-
multiplier = Math.max(
|
|
563
|
+
multiplier = Math.max(height / this.game.height, width / this.game.width);
|
|
534
564
|
} else {
|
|
535
|
-
multiplier = Math.min(
|
|
565
|
+
multiplier = Math.min(height / this.game.height, width / this.game.width);
|
|
536
566
|
}
|
|
537
567
|
this.width = Math.round(this.game.width * multiplier);
|
|
538
568
|
this.height = Math.round(this.game.height * multiplier);
|
|
@@ -576,8 +606,15 @@ export default class {
|
|
|
576
606
|
}
|
|
577
607
|
if (this.compatibility.clickTrampoline === 'when-not-mouse') {
|
|
578
608
|
const input = this.game.input;
|
|
579
|
-
if (
|
|
580
|
-
input.activePointer
|
|
609
|
+
if (
|
|
610
|
+
input.activePointer &&
|
|
611
|
+
input.activePointer !== input.mousePointer &&
|
|
612
|
+
(allowTrampoline || allowTrampoline !== false)
|
|
613
|
+
) {
|
|
614
|
+
input.activePointer.addClickTrampoline('startFullScreen', this.startFullScreen, this, [
|
|
615
|
+
antialias,
|
|
616
|
+
false,
|
|
617
|
+
]);
|
|
581
618
|
return false;
|
|
582
619
|
}
|
|
583
620
|
}
|
|
@@ -698,7 +735,10 @@ export default class {
|
|
|
698
735
|
}
|
|
699
736
|
|
|
700
737
|
get boundingParent() {
|
|
701
|
-
if (
|
|
738
|
+
if (
|
|
739
|
+
this.parentIsWindow ||
|
|
740
|
+
(this.isFullScreen && this.hasPhaserSetFullScreen && !this._createdFullScreenTarget)
|
|
741
|
+
) {
|
|
702
742
|
return null;
|
|
703
743
|
}
|
|
704
744
|
const parentNode = this.game.canvas && this.game.canvas.parentNode;
|
|
@@ -752,7 +792,12 @@ export default class {
|
|
|
752
792
|
}
|
|
753
793
|
|
|
754
794
|
get isFullScreen() {
|
|
755
|
-
return !!(
|
|
795
|
+
return !!(
|
|
796
|
+
document.fullscreenElement ||
|
|
797
|
+
document.webkitFullscreenElement ||
|
|
798
|
+
document.mozFullScreenElement ||
|
|
799
|
+
document.msFullscreenElement
|
|
800
|
+
);
|
|
756
801
|
}
|
|
757
802
|
|
|
758
803
|
get isPortrait() {
|
|
@@ -770,5 +815,4 @@ export default class {
|
|
|
770
815
|
get isGameLandscape() {
|
|
771
816
|
return this.width > this.height;
|
|
772
817
|
}
|
|
773
|
-
|
|
774
818
|
}
|
package/src/phaser/core/scene.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
5
5
|
*/
|
|
6
6
|
export default class {
|
|
7
|
-
|
|
8
7
|
constructor() {
|
|
9
8
|
this.game = null;
|
|
10
9
|
this.key = '';
|
|
@@ -37,5 +36,4 @@ export default class {
|
|
|
37
36
|
shutdown() {
|
|
38
37
|
// inherit
|
|
39
38
|
}
|
|
40
|
-
|
|
41
39
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import Scene from './scene';
|
|
7
7
|
|
|
8
8
|
export default class {
|
|
9
|
-
|
|
10
9
|
constructor(game, pendingState) {
|
|
11
10
|
this.game = game;
|
|
12
11
|
this.states = {};
|
|
@@ -141,7 +140,12 @@ export default class {
|
|
|
141
140
|
|
|
142
141
|
checkState(key) {
|
|
143
142
|
if (this.states[key]) {
|
|
144
|
-
if (
|
|
143
|
+
if (
|
|
144
|
+
this.states[key].preload ||
|
|
145
|
+
this.states[key].create ||
|
|
146
|
+
this.states[key].update ||
|
|
147
|
+
this.states[key].render
|
|
148
|
+
) {
|
|
145
149
|
return true;
|
|
146
150
|
}
|
|
147
151
|
return false;
|
|
@@ -235,5 +239,4 @@ export default class {
|
|
|
235
239
|
get created() {
|
|
236
240
|
return this._created;
|
|
237
241
|
}
|
|
238
|
-
|
|
239
242
|
}
|