forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added in Game.focusLoss and focusGain methods and onBlur and onFocus …
…signals to listen for. Made small time related fix and tested on iOS6 and iOS7 home screen button + lock button and all working fine.
- Loading branch information
1 parent
84741f0
commit 1966bfc
Showing
8 changed files
with
197 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { create: create, render: render }); | ||
|
||
var log = ''; | ||
var t; | ||
|
||
function create() { | ||
|
||
log += 'game started at ' + this.time.now + '\n'; | ||
// log += 'pagehide? ' + window['onpagehide'] + '\n'; | ||
// log += 'blur? ' + window['blur'] + '\n'; | ||
|
||
console.log('game started at ' + this.time.now); | ||
|
||
game.stage.backgroundColor = '#2d2d2d'; | ||
|
||
game.onPause.add(onGamePause, this); | ||
game.onResume.add(onGameResume, this); | ||
|
||
t = game.add.text(32, 32, log, { font: '14px Arial', fill: '#ffffff' }); | ||
|
||
// window.unload = function() { console.log('unload'); }; | ||
|
||
} | ||
|
||
function onGamePause(event) { | ||
|
||
log += 'game paused at ' + this.time.now + '\n'; | ||
log += 'event ' + event.type + '\n'; | ||
|
||
console.log('game paused at ' + this.time.now); | ||
|
||
} | ||
|
||
function onGameResume(event) { | ||
|
||
log += 'game un-paused at ' + this.time.now + '\n'; | ||
log += 'was paused for ' + game.time.pauseDuration + '\n'; | ||
log += 'event ' + event.type + '\n'; | ||
|
||
console.log('game un-paused at ' + this.time.now); | ||
console.log('was paused for ' + game.time.pauseDuration); | ||
|
||
} | ||
|
||
function render() { | ||
|
||
// console.log('tick'); | ||
|
||
t.text = log; | ||
|
||
game.debug.text('now: ' + game.time.now, 500, 32); | ||
|
||
// game.debug.text(log, 32, 64); | ||
// game.debug.text('paused: ' + game.paused, 32, 64); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.