Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window currently in focus plus events #23

Closed
BenjaminHarding opened this issue Mar 25, 2014 · 1 comment
Closed

Window currently in focus plus events #23

BenjaminHarding opened this issue Mar 25, 2014 · 1 comment
Milestone

Comments

@BenjaminHarding
Copy link
Contributor

Investigate having some events for when a window that a kiwi game resides on goes out of focus/comes into focus. Then can look at pausing the update loop/game timer/e.t.c.

@BenjaminHarding
Copy link
Contributor Author

You can now add events for blur, focus, and visibility by accessing the appropriate Signals on the Stage. Also you get the visibility state of the game by accessing the visibility property on the Stage.

  //Signals
  this.game.stage.onFocus.add( this.inFocus, this );
  this.game.stage.onBlur.add( this.notInFocus, this );
  this.game.stage.onVisibilityChange.add( this.visiblityChanged, this );

  //....

  if( this.game.stage.visibility ) {
    //Resume game logic
  } else {
    //Pause the game
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant