How do I pause on unfocus in NW.js?

Get help using Construct 2

Post » Wed Dec 02, 2015 2:37 am

So, I'm aware that unfocusing a tab in a browser will cause the game to suspend (effectively pausing anything happening on screen). But what about NW.js?

I tried exporting my game to NW.js and testing this, but it doesn't seem to suspend when I unfocus from the window. Is this expected behavior? I notice that if I turn on the "Pause on unfocus" option when previewing in NW.js, it DOES suspend.
B
14
S
2
Posts: 73
Reputation: 794

Post » Thu Dec 03, 2015 3:31 pm

Image

Maybe this will work for you?
B
8
S
1
Posts: 34
Reputation: 599

Post » Thu Dec 03, 2015 3:32 pm

@donkeyspaceman <- forgot to tag you
B
8
S
1
Posts: 34
Reputation: 599

Post » Thu Dec 03, 2015 3:41 pm

Pause on unfocus

If set to Yes, the preview will pause when the browser window loses focus, e.g. when switching back to work in Construct 2. This can be useful for certain workflows such as using continuous preview. If set to No the preview will continue to run even without focus, but note switching to another browser tab or minimising the browser window will still pause (as it does with published projects).

Although the explanation in the manual isn't really clear about it, this setting is only meant for the preview.
In the editor it is mentioned in the description:

During preview only,whether to pause the game when browser loses focus.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Dec 03, 2015 3:44 pm

@littlestain Have to say I see you in every thread :) Nice to see you're helping out a lot!
B
8
S
1
Posts: 34
Reputation: 599

Post » Thu Dec 03, 2015 3:47 pm

MalizaGames wrote:@littlestain Have to say I see you in every thread :) Nice to see you're helping out a lot!


Just my way of keeping the mind active while taking breaks from my work.
Why not use it to help others?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Dec 03, 2015 3:52 pm

@littlestain Exactly I've been using Construct 2 and I've been on a massive dry spell for game ideas lately so I've just been browsing and helping as much as I can.
B
8
S
1
Posts: 34
Reputation: 599

Post » Sun Dec 06, 2015 4:59 pm

MalizaGames wrote:Image

Maybe this will work for you?


It doesn't. I've tried exactly that solution. I don't think NW.js considers the executable window losing focus to be the same as a browser windows losing focus.

LittleStain wrote:Pause on unfocus

If set to Yes, the preview will pause when the browser window loses focus, e.g. when switching back to work in Construct 2. This can be useful for certain workflows such as using continuous preview. If set to No the preview will continue to run even without focus, but note switching to another browser tab or minimising the browser window will still pause (as it does with published projects).

Although the explanation in the manual isn't really clear about it, this setting is only meant for the preview.
In the editor it is mentioned in the description:

During preview only,whether to pause the game when browser loses focus.


Right, I understand that. I know that feature is of zero use. But when exporting, a browser game will always pause when unfocused and an executable will NEVER pause when unfocused. This is my issue, I'd like the NW.js build to work the same as the HTML5 export.

Sorry if my original post was unclear.
B
14
S
2
Posts: 73
Reputation: 794

Post » Sun Dec 06, 2015 10:31 pm

I get what you mean now. But honestly why can't you just pause the game.. I mean if we're talking about a game here then why can't you just hit esc then that pauses the game. When you come back into the game and hit resume it just resumes. I don't see why that can't just be a work around?
B
8
S
1
Posts: 34
Reputation: 599

Post » Sun Dec 06, 2015 10:38 pm

http://www.filedropper.com/pause <- Run that you'll see what I mean then look at the event sheet.
B
8
S
1
Posts: 34
Reputation: 599

Next

Return to How do I....?

Who is online

Users browsing this forum: leena222, tatogame and 18 guests