@vpmedia/phaser 1.0.12 → 1.0.13
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/dist/phaser.cjs +1 -1
- package/dist/phaser.cjs.LICENSE.txt +1 -1
- package/dist/phaser.cjs.map +1 -1
- package/dist/phaser.js +1 -1
- package/dist/phaser.js.LICENSE.txt +1 -1
- package/dist/phaser.js.map +1 -1
- package/package.json +1 -1
- package/src/phaser/core/const.js +0 -1
- package/src/phaser/core/device.js +0 -7
- package/src/phaser/core/device_util.js +7 -33
- package/src/phaser/core/game.js +11 -16
- package/src/phaser/core/scale_manager.js +0 -10
- package/src/phaser/core/sound.js +1 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/phaser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
|
|
5
5
|
"author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
|
|
6
6
|
"license": "MIT",
|
package/src/phaser/core/const.js
CHANGED
|
@@ -58,7 +58,6 @@ export const BLEND_LUMINOSITY = 16;
|
|
|
58
58
|
export const RENDER_AUTO = 0;
|
|
59
59
|
export const RENDER_CANVAS = 1;
|
|
60
60
|
export const RENDER_WEBGL = 2;
|
|
61
|
-
export const RENDER_HEADLESS = 3;
|
|
62
61
|
// pointer modes
|
|
63
62
|
export const POINTER_CURSOR = 1;
|
|
64
63
|
export const POINTER_CONTACT = 2;
|
|
@@ -10,8 +10,6 @@ export default class {
|
|
|
10
10
|
this.deviceReadyAt = 0;
|
|
11
11
|
this.desktop = false;
|
|
12
12
|
this.iOS = false;
|
|
13
|
-
this.iOSVersion = 0;
|
|
14
|
-
this.node = false;
|
|
15
13
|
this.android = false;
|
|
16
14
|
this.chromeOS = false;
|
|
17
15
|
this.linux = false;
|
|
@@ -24,14 +22,9 @@ export default class {
|
|
|
24
22
|
this.mspointer = false;
|
|
25
23
|
this.wheelEvent = null;
|
|
26
24
|
this.chrome = false;
|
|
27
|
-
this.chromeVersion = 0;
|
|
28
25
|
this.firefox = false;
|
|
29
|
-
this.firefoxVersion = 0;
|
|
30
26
|
this.edge = false;
|
|
31
|
-
this.mobileSafari = false;
|
|
32
27
|
this.safari = false;
|
|
33
|
-
this.safariVersion = 0;
|
|
34
|
-
this.webApp = false;
|
|
35
28
|
this.silk = false;
|
|
36
29
|
this.ogg = false;
|
|
37
30
|
this.opus = false;
|
|
@@ -60,12 +60,12 @@ export function checkOS(device) {
|
|
|
60
60
|
device.chromeOS = true;
|
|
61
61
|
} else if (/iP[ao]d|iPhone/i.test(ua)) {
|
|
62
62
|
device.iOS = true;
|
|
63
|
-
|
|
64
|
-
device.
|
|
65
|
-
} else if (/Linux/.test(ua)) {
|
|
66
|
-
device.linux = true;
|
|
63
|
+
} else if (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1) {
|
|
64
|
+
device.iOS = true;
|
|
67
65
|
} else if (/Mac OS/.test(ua)) {
|
|
68
66
|
device.macOS = true;
|
|
67
|
+
} else if (/Linux/.test(ua)) {
|
|
68
|
+
device.linux = true;
|
|
69
69
|
} else if (/Windows/.test(ua)) {
|
|
70
70
|
device.windows = true;
|
|
71
71
|
}
|
|
@@ -80,12 +80,8 @@ export function checkOS(device) {
|
|
|
80
80
|
if (device.windows || device.macOS || (device.linux && !silk) || device.chromeOS) {
|
|
81
81
|
device.desktop = true;
|
|
82
82
|
}
|
|
83
|
-
//
|
|
84
|
-
if (device.windowsPhone || ((/Windows NT/i.test(ua)) && (/Touch/i.test(ua)))) {
|
|
85
|
-
device.desktop = false;
|
|
86
|
-
}
|
|
87
|
-
// VPMedia Special override
|
|
88
|
-
if (window.location.pathname.indexOf('/mobile/') > -1) {
|
|
83
|
+
// iOS / Windows Phone / Tablet reset
|
|
84
|
+
if (device.android || device.iOS || device.windowsPhone || ((/Windows NT/i.test(ua)) && (/Touch/i.test(ua)))) {
|
|
89
85
|
device.desktop = false;
|
|
90
86
|
}
|
|
91
87
|
}
|
|
@@ -171,29 +167,15 @@ export function checkBrowser(device) {
|
|
|
171
167
|
device.edge = true;
|
|
172
168
|
} else if (/Chrome\/(\d+)/.test(ua) && !device.windowsPhone) {
|
|
173
169
|
device.chrome = true;
|
|
174
|
-
device.chromeVersion = parseInt(RegExp.$1, 10);
|
|
175
170
|
} else if (/Firefox\D+(\d+)/.test(ua)) {
|
|
176
171
|
device.firefox = true;
|
|
177
|
-
device.firefoxVersion = parseInt(RegExp.$1, 10);
|
|
178
|
-
} else if (/AppleWebKit/.test(ua) && device.iOS) {
|
|
179
|
-
device.mobileSafari = true;
|
|
180
172
|
} else if (/Safari\/(\d+)/.test(ua) && !device.windowsPhone) {
|
|
181
173
|
device.safari = true;
|
|
182
|
-
if (/Version\/(\d+)\./.test(ua)) {
|
|
183
|
-
device.safariVersion = parseInt(RegExp.$1, 10);
|
|
184
|
-
}
|
|
185
174
|
}
|
|
186
175
|
// Silk gets its own if clause because its ua also contains 'Safari'
|
|
187
176
|
if (/Silk/.test(ua)) {
|
|
188
177
|
device.silk = true;
|
|
189
178
|
}
|
|
190
|
-
// WebApp mode in iOS
|
|
191
|
-
if (navigator.standalone) {
|
|
192
|
-
device.webApp = true;
|
|
193
|
-
}
|
|
194
|
-
if (typeof process !== 'undefined' && typeof require !== 'undefined') {
|
|
195
|
-
device.node = true;
|
|
196
|
-
}
|
|
197
179
|
}
|
|
198
180
|
|
|
199
181
|
/**
|
|
@@ -257,16 +239,8 @@ export function checkAudio(device) {
|
|
|
257
239
|
device.webm = true;
|
|
258
240
|
}
|
|
259
241
|
if (audioElement.canPlayType('audio/mp4;codecs="ec-3"') !== '') {
|
|
260
|
-
if (device.edge) {
|
|
242
|
+
if (device.edge || device.safari) {
|
|
261
243
|
device.dolby = true;
|
|
262
|
-
} else if (device.safari && device.safariVersion >= 9) {
|
|
263
|
-
if (/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)) {
|
|
264
|
-
const major = parseInt(RegExp.$1, 10);
|
|
265
|
-
const minor = parseInt(RegExp.$2, 10);
|
|
266
|
-
if ((major === 10 && minor >= 11) || major > 10) {
|
|
267
|
-
device.dolby = true;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
244
|
}
|
|
271
245
|
}
|
|
272
246
|
}
|
package/src/phaser/core/game.js
CHANGED
|
@@ -20,7 +20,7 @@ import Time from './time';
|
|
|
20
20
|
import TweenManager from './tween_manager';
|
|
21
21
|
import World from './world';
|
|
22
22
|
import Stage from './stage';
|
|
23
|
-
import { RENDER_AUTO, RENDER_WEBGL
|
|
23
|
+
import { RENDER_AUTO, RENDER_WEBGL } from './const';
|
|
24
24
|
import { create, removeFromDOM, addToDOM, setTouchAction } from '../display/canvas/util';
|
|
25
25
|
import { initialize, checkOS } from './device_util';
|
|
26
26
|
|
|
@@ -143,14 +143,14 @@ export default class {
|
|
|
143
143
|
isWebGlReady = true;
|
|
144
144
|
} catch (e) {
|
|
145
145
|
isWebGlReady = false;
|
|
146
|
-
const
|
|
146
|
+
const tags = {};
|
|
147
147
|
if (window.PhaserRegistry?.GL_PROGRAM_INFO_LOG) {
|
|
148
|
-
|
|
148
|
+
tags.gl_program_log = window.PhaserRegistry.GL_PROGRAM_INFO_LOG;
|
|
149
149
|
}
|
|
150
150
|
if (window.PhaserRegistry?.GL_SHADER_INFO_LOG) {
|
|
151
|
-
|
|
151
|
+
tags.gl_shader_log = window.PhaserRegistry.GL_SHADER_INFO_LOG;
|
|
152
152
|
}
|
|
153
|
-
this.exceptionHandler(e,
|
|
153
|
+
this.exceptionHandler(e, tags);
|
|
154
154
|
}
|
|
155
155
|
/*
|
|
156
156
|
this.renderer = new WebGLRenderer(this);
|
|
@@ -175,11 +175,9 @@ export default class {
|
|
|
175
175
|
this.renderer = new CanvasRenderer(this);
|
|
176
176
|
this.context = this.renderer.context;
|
|
177
177
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
setTouchAction(this.canvas);
|
|
182
|
-
}
|
|
178
|
+
this.stage.smoothed = this.config.antialias;
|
|
179
|
+
addToDOM(this.canvas, this.parent, false);
|
|
180
|
+
setTouchAction(this.canvas);
|
|
183
181
|
}
|
|
184
182
|
|
|
185
183
|
parseConfigElement(config, key, defaultValue) {
|
|
@@ -216,7 +214,7 @@ export default class {
|
|
|
216
214
|
// Clear the Canvas each frame before rendering the display list.
|
|
217
215
|
// You can set this to `false` to gain some performance if your game always contains a background that completely fills the display.
|
|
218
216
|
this.parseConfigElement(config, 'clearBeforeRender', true);
|
|
219
|
-
// The Renderer this game will use. Either PowerGamer.Const.RENDER_AUTO, PowerGamer.Const.RENDER_CANVAS, PowerGamer.Const.RENDER_WEBGL
|
|
217
|
+
// The Renderer this game will use. Either PowerGamer.Const.RENDER_AUTO, PowerGamer.Const.RENDER_CANVAS, PowerGamer.Const.RENDER_WEBGL
|
|
220
218
|
this.parseConfigElement(config, 'renderType', RENDER_AUTO);
|
|
221
219
|
// Force audio disabled
|
|
222
220
|
this.parseConfigElement(config, 'isForceDisabledAudio', false);
|
|
@@ -226,8 +224,8 @@ export default class {
|
|
|
226
224
|
if (config.exceptionHandler) {
|
|
227
225
|
this.exceptionHandler = config.exceptionHandler;
|
|
228
226
|
} else {
|
|
229
|
-
this.exceptionHandler = (e,
|
|
230
|
-
console.error(e,
|
|
227
|
+
this.exceptionHandler = (e, tags) => {
|
|
228
|
+
console.error(e, tags);
|
|
231
229
|
};
|
|
232
230
|
}
|
|
233
231
|
if (config.parent) {
|
|
@@ -346,9 +344,6 @@ export default class {
|
|
|
346
344
|
return;
|
|
347
345
|
}
|
|
348
346
|
this.state.preRender(elapsedTime);
|
|
349
|
-
if (this.config.renderType === RENDER_HEADLESS) {
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
347
|
this.renderer.render(this.stage);
|
|
353
348
|
this.state.render(elapsedTime);
|
|
354
349
|
}
|
|
@@ -95,16 +95,6 @@ export default class {
|
|
|
95
95
|
// Configure device-dependent compatibility
|
|
96
96
|
const compat = this.compatibility;
|
|
97
97
|
compat.supportsFullScreen = this.game.device.fullscreen;
|
|
98
|
-
// We can't do anything about the status bars in iPads, web apps or desktops
|
|
99
|
-
/*
|
|
100
|
-
if (!this.game.device.iPad && !this.game.device.webApp && !this.game.device.desktop) {
|
|
101
|
-
if (this.game.device.android && !this.game.device.chrome) {
|
|
102
|
-
compat.scrollTo = new Point(0, 1);
|
|
103
|
-
} else {
|
|
104
|
-
compat.scrollTo = new Point(0, 0);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
*/
|
|
108
98
|
if (this.game.device.desktop) {
|
|
109
99
|
compat.orientationFallback = 'screen';
|
|
110
100
|
compat.clickTrampoline = 'when-not-mouse';
|
package/src/phaser/core/sound.js
CHANGED
|
@@ -355,12 +355,7 @@ export default class {
|
|
|
355
355
|
this._sound.noteGrainOn(0, p, duration);
|
|
356
356
|
// this._sound.noteOn(0); // the zero is vitally important, crashes iOS6 without it
|
|
357
357
|
} else if (this.loop && this.game.device.chrome) {
|
|
358
|
-
|
|
359
|
-
if (this.game.device.chromeVersion === 42) {
|
|
360
|
-
this._sound.start(0);
|
|
361
|
-
} else {
|
|
362
|
-
this._sound.start(0, p);
|
|
363
|
-
}
|
|
358
|
+
this._sound.start(0, p);
|
|
364
359
|
} else {
|
|
365
360
|
this._sound.start(0, p, duration);
|
|
366
361
|
}
|