Jump to content


Photo

Checking window minimization (help)


  • Please log in to reply
2 replies to this topic

#1 jak2027

jak2027

    GMC Member

  • New Member
  • 16 posts
  • Version:Unknown

Posted 19 January 2012 - 04:55 AM

Hello Everybody! I have been playing with the .js extensions in GameMaker HTML5 and I have currently run into trouble on a project: Checking if a window is minimized. I have been playing around with diffrent methods for checking the focus of the HTML5 game in java script but I have had no luck getting a javascript extension working in gamemaker 100% correct with it. I am still working on it myself but I thought i'd throw it out to the community for ideas.

Do any of you have input on how one could write a javascript extension for GMHTML5 that would simply return a true or false value on whether or not the game window has focus or not? For you to get an idea, a simple use for such an extension would be to activate a games pause screen automatically if the game window has lost focus.
  • 0

#2 JacksonYarr

JacksonYarr

    GMC Member

  • GMC Member
  • 248 posts
  • Version:GM:Studio

Posted 19 January 2012 - 02:58 PM

Greetings,

I've whipped up a small extension that can check whether or not the window has lost focus. This check includes not only minimizing, but detecting if the user switches tabs, or if a different program jumps in front of the browser.

View Example | Download Check Focus

Certainly a good idea to pause the game when the window loses focus, adds that extra bit of polish.

- JacksonYarr
  • 1

#3 jak2027

jak2027

    GMC Member

  • New Member
  • 16 posts
  • Version:Unknown

Posted 20 January 2012 - 12:50 AM

Greetings,

I've whipped up a small extension that can check whether or not the window has lost focus. This check includes not only minimizing, but detecting if the user switches tabs, or if a different program jumps in front of the browser.

View Example | Download Check Focus

Certainly a good idea to pause the game when the window loses focus, adds that extra bit of polish.

- JacksonYarr


Very nice! I just made one using JQuery inside the app, but I like your extension much better as it doesn't require the external script! Thank you very much
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users