@vpmedia/phaser 1.0.41 → 1.1.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/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/game.js +2 -55
- package/src/phaser/core/time.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/phaser",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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/game.js
CHANGED
|
@@ -55,14 +55,6 @@ export default class {
|
|
|
55
55
|
this.onResume = new Signal();
|
|
56
56
|
this.onBoot = new Signal();
|
|
57
57
|
this.isPaused = false;
|
|
58
|
-
this.currentUpdateID = 0;
|
|
59
|
-
this.updatesThisFrame = 1;
|
|
60
|
-
this._deltaTime = 0;
|
|
61
|
-
this._lastCount = 0;
|
|
62
|
-
this._spiraling = 0;
|
|
63
|
-
this.isKickStart = true;
|
|
64
|
-
this.fpsProblemNotifier = new Signal();
|
|
65
|
-
this._nextFpsNotification = 0;
|
|
66
58
|
this.parseConfig(gameConfig);
|
|
67
59
|
checkOS(this.device);
|
|
68
60
|
if (document.readyState === 'complete') {
|
|
@@ -99,7 +91,6 @@ export default class {
|
|
|
99
91
|
this.input.boot();
|
|
100
92
|
this.sound.boot();
|
|
101
93
|
this.state.boot();
|
|
102
|
-
this.isKickStart = true;
|
|
103
94
|
if (window.focus) {
|
|
104
95
|
window.focus();
|
|
105
96
|
}
|
|
@@ -243,53 +234,9 @@ export default class {
|
|
|
243
234
|
|
|
244
235
|
update(time) {
|
|
245
236
|
this.time.update(time);
|
|
246
|
-
if (this.isKickStart) {
|
|
247
|
-
this.updateLogic(this.time.desiredFpsMult);
|
|
248
|
-
this.renderer.render(this.stage);
|
|
249
|
-
this.isKickStart = false;
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
if (!this.config.forceSingleUpdate && this._spiraling > 1) {
|
|
253
|
-
if (this.time.time > this._nextFpsNotification) {
|
|
254
|
-
this._nextFpsNotification = this.time.time + 10000;
|
|
255
|
-
this.fpsProblemNotifier.dispatch();
|
|
256
|
-
}
|
|
257
|
-
this._deltaTime = 0;
|
|
258
|
-
this._spiraling = 0;
|
|
259
|
-
this.renderer.render(this.stage);
|
|
260
|
-
} else {
|
|
261
|
-
const slowStep = this.time.slowMotion * 1000.0 / this.time.desiredFps;
|
|
262
|
-
this._deltaTime += Math.max(Math.min(slowStep * 3, this.time.elapsed), 0);
|
|
263
|
-
let count = 0;
|
|
264
|
-
this.updatesThisFrame = Math.floor(this._deltaTime / slowStep);
|
|
265
|
-
if (this.config.forceSingleUpdate) {
|
|
266
|
-
this.updatesThisFrame = Math.min(1, this.updatesThisFrame);
|
|
267
|
-
}
|
|
268
|
-
while (this._deltaTime >= slowStep) {
|
|
269
|
-
this._deltaTime -= slowStep;
|
|
270
|
-
this.currentUpdateID = count;
|
|
271
|
-
this.updateLogic(this.time.desiredFpsMult);
|
|
272
|
-
count += 1;
|
|
273
|
-
if (this.config.forceSingleUpdate && count === 1) {
|
|
274
|
-
break;
|
|
275
|
-
} else {
|
|
276
|
-
this.time.refresh();
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
if (count > this._lastCount) {
|
|
280
|
-
this._spiraling += 1;
|
|
281
|
-
} else if (count < this._lastCount) {
|
|
282
|
-
this._spiraling = 0;
|
|
283
|
-
}
|
|
284
|
-
this._lastCount = count;
|
|
285
|
-
this.renderer.render(this.stage);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
updateLogic(timeStep) {
|
|
290
237
|
if (!this.isPaused) {
|
|
291
238
|
this.scale.preUpdate();
|
|
292
|
-
this.state.preUpdate(
|
|
239
|
+
this.state.preUpdate();
|
|
293
240
|
this.stage.preUpdate();
|
|
294
241
|
this.state.update();
|
|
295
242
|
this.stage.update();
|
|
@@ -298,11 +245,11 @@ export default class {
|
|
|
298
245
|
this.input.update();
|
|
299
246
|
this.stage.postUpdate();
|
|
300
247
|
} else {
|
|
301
|
-
// Scaling and device orientation changes are still reflected when paused.
|
|
302
248
|
this.scale.pauseUpdate();
|
|
303
249
|
this.state.pauseUpdate();
|
|
304
250
|
}
|
|
305
251
|
this.stage.updateTransform();
|
|
252
|
+
this.renderer.render(this.stage);
|
|
306
253
|
}
|
|
307
254
|
|
|
308
255
|
destroy() {
|