Skip to content

Commit 7ff4e51

Browse files
committed
Time.reset does a removeAll on any Timers.
Device no longer things a Windows Phone or Windows Tablet are desktop devices (thanks wombatbuddy, fixes phaserjs#506)
1 parent 664d5b3 commit 7ff4e51

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ New features:
131131
* Group.sendToBottom(child) is the handy opposite of Group.bringToTop()
132132
* Group.moveUp(child) will move a child up the display list, swapping with the child above it.
133133
* Group.moveDown(child) will move a child down the display list, swapping with the child below it.
134+
* Device.windowsPhone is now tested for.
134135

135136

136137
Updates:
@@ -192,6 +193,7 @@ Bug Fixes:
192193
* Calling destroy while in an Input Event callback now works for either the parent Group or the calling object itself.
193194
* Loader.replaceInFileList wouldn't over-write the previous entry correctly, which caused the Loader.image overwrite parameter to fail (thanks basoko, fixes #493)
194195
* If the game was set to NO_SCALE and you swapped orientation, it would pause and resize, then fail to resize when you swapped back (thanks starnut, fixes #258)
196+
* Device no longer things a Windows Phone or Windows Tablet are desktop devices (thanks wombatbuddy, fixes #506)
195197

196198

197199
TO DO:

src/system/Device.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ Phaser.Device = function (game) {
8181
*/
8282
this.windows = false;
8383

84+
/**
85+
* @property {boolean} windowsPhone - Is running on a Windows Phone?
86+
* @default
87+
*/
88+
this.windowsPhone = false;
89+
8490
// Features
8591

8692
/**
@@ -398,13 +404,24 @@ Phaser.Device.prototype = {
398404
else if (/Windows/.test(ua))
399405
{
400406
this.windows = true;
407+
408+
if (/Windows Phone/i.test(ua))
409+
{
410+
this.windowsPhone = true;
411+
}
401412
}
402413

403414
if (this.windows || this.macOS || (this.linux && this.silk === false))
404415
{
405416
this.desktop = true;
406417
}
407418

419+
// Windows Phone / Table reset
420+
if (this.windowsPhone || ((/Windows NT/i.test(ua)) && (/Touch/i.test(ua))))
421+
{
422+
this.desktop = false;
423+
}
424+
408425
},
409426

410427
/**

src/time/Time.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,15 @@ Phaser.Time.prototype = {
362362
},
363363

364364
/**
365-
* Resets the private _started value to now.
365+
* Resets the private _started value to now and removes all currently running Timers.
366366
*
367367
* @method Phaser.Time#reset
368368
*/
369369
reset: function () {
370+
370371
this._started = this.now;
372+
this.removeAll();
373+
371374
}
372375

373376
};

0 commit comments

Comments
 (0)