Page 1 of 2

Feature Request: Pause on unfocus apart from preview.

PostPosted: Sat Mar 05, 2016 7:13 pm
by Quicksand
I'm wondering why the project setting "Pause on unfocus" is specified as only available during preview? I'd like to have that feature as part of my exported NW.JS app.

Maybe there's another way of achieving the same thing? Any way to do that by editing the code itself? I think I found the relevant part in the preview.js script but I have no idea how to get it into my exported game's data.

Re: Feature Request: Pause on unfocus apart from preview.

PostPosted: Sat Mar 05, 2016 11:27 pm
by glerikud
There was a discussion about this before and (if I remember correctly) there's a browser limitation that prevents the HTML5 apps from doing that kind of stuff. Someone correct me if I'm wrong.

Re: Feature Request: Pause on unfocus apart from preview.

PostPosted: Sun Mar 06, 2016 12:39 am
by Quicksand
I worked on the problem today and I got the feature working by simply changing the part of the code that disables it when not in preview mode (in preview.js). But I'm still left wondering if there's a good reason why it was disabled in the first place. Can't be that it doesn't work, glerikud, since it does now (for NW.JS at least).

Re: Feature Request: Pause on unfocus apart from preview.

PostPosted: Sun Mar 06, 2016 8:53 am
by glerikud
Thanks for the heads up, now I know it's possible. Hopefully someone will clear it up why it's not included.

Re: Feature Request: Pause on unfocus apart from preview.

PostPosted: Tue Mar 08, 2016 12:08 am
by Quicksand
@Ashley could you explain why the feature was restricted? I'll be releasing my game soon and I don't want to keep that in if it causes known issues.

Re: Feature Request: Pause on unfocus apart from preview.

PostPosted: Tue Mar 08, 2016 1:10 pm
by Ashley
It's designed to stop the game running while you go back to edit it further in Construct 2. Why would you want that after publishing?

Re: Feature Request: Pause on unfocus apart from preview.

PostPosted: Tue Mar 08, 2016 1:57 pm
by glerikud
Ashley wrote:It's designed to stop the game running while you go back to edit it further in Construct 2. Why would you want that after publishing?

While I'm fine without this feature, I can see situations when it becomes useful. For ex. the player plays the game and someone just texted her on Facebook and she wants to reply. In this case the player won't have to find an implemented pause feature (if there's any).

Re: Feature Request: Pause on unfocus apart from preview.

PostPosted: Tue Mar 08, 2016 6:00 pm
by Quicksand
Ashley wrote:It's designed to stop the game running while you go back to edit it further in Construct 2. Why would you want that after publishing?


Because people tend to multi-task on computers and so its nice to have the game automatically pause events and especially sound when one clicks on a different window.

Thanks for the info.

Re: Feature Request: Pause on unfocus apart from preview.

PostPosted: Tue Mar 08, 2016 9:20 pm
by TheRealDannyyy
Quicksand wrote:
Ashley wrote:It's designed to stop the game running while you go back to edit it further in Construct 2. Why would you want that after publishing?


Because people tend to multi-task on computers and so its nice to have the game automatically pause events and especially sound when one clicks on a different window.

Thanks for the info.

What about timescaling?
Check if the game is out of focus, when it is just set it to 0.
The browser plugin has all the conditions you need for that. :)

Re: Feature Request: Pause on unfocus apart from preview.

PostPosted: Wed Mar 09, 2016 4:44 am
by Quicksand
TheRealDannyyy wrote:
Quicksand wrote:
Ashley wrote:It's designed to stop the game running while you go back to edit it further in Construct 2. Why would you want that after publishing?


Because people tend to multi-task on computers and so its nice to have the game automatically pause events and especially sound when one clicks on a different window.

Thanks for the info.

What about timescaling?
Check if the game is out of focus, when it is just set it to 0.
The browser plugin has all the conditions you need for that. :)


I tried that but it doesn't seem to work when NW.JS is used as the ersatz browser. Unless I just had it set up wrong.

Anyway modifying the runtime code myself worked, its just not the most convenient way of going about this.