Exit fullscreen with Esc instead of F11

Discussion and feedback on Construct 2

Post » Wed Oct 09, 2013 9:12 pm

So on the game I'm working on, pressing the Esc key pauses the game and brings the menu (resume, options, quit...), just like in many games on PC.

I wanted to mess with the Browser plugin fullscreen feature. When the player click the Start button in the main menu, I request fullscreen. Works fine and all, except when I press the Esc key to pause my game, the browser exists fullscreen. Weird, I thought the fullscreen toggle key was F11. Plus I remember reading in the manual that Construct prevented the default browser behavior when you assigned an action to a shortcut key.

But then I realized, the default fullscreen key is indeed F11, at least in chrome and firefox. If you press F11 or go to fullscreen using the browser's menu, it does say "press F11 to exit fullscreen" and pressing Esc does not cancel fullscreen. It's only when you request fullscreen through Construct (or more generally javascript I imagine) that Esc becomes the key to exit fullscreen. And since it's not the original default key for fullscreen, having an event assigned to that key in construct does not prevent from leaving fullscreen.

So, is it that a bug or is it like this by design?
B
12
S
5
G
2
Posts: 132
Reputation: 2,627

Post » Thu Oct 10, 2013 2:03 am

I have the same problem! I didn't realize this before and it caught me by surprise! The day after tomorrow I present my graduation project (made with construct) and I hopped that I would make a robust menu in the time that I have left...

If this is by design then it's very counter-intuitive, ESC is the default menu key in every game I have ever played!
Pressing ESC to call the menu, then go full screen and then use some resume button is the only thing that I can think of as a workaround, but it's a terrible one, muscle memory alone makes me hit ESC all the time!

If it's a limitation then this is a serious one!

I hope that it's a bug and it will be fixed by @Ashley soon.       
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Thu Oct 10, 2013 10:23 am

I did some research and it is not Construct related, it's just how the browser fullscreen feature works, when you request fullscreen with javascript, Esc becomes the exit key.

Construct would have to check if the browser is in fullscreen mode and then, in that case only, prevent the default event from happening when you have an "on Esc key pressed" condition. But it might not be possible for some security reason.OlivierC2013-10-10 10:24:24
B
12
S
5
G
2
Posts: 132
Reputation: 2,627

Post » Thu Oct 10, 2013 12:25 pm

Construct 2 prevents the default action for any key you have an event for. So if you have 'On ESC pressed', it will prevent the default action for escape. I think that browser makers want to ensure users always have a way to exit fullscreen mode, so that a web page cannot lock you in to fullscreen made with no way to get out, so perhaps that key cannot have its default behavior prevented. I suppose you should just change your menu key to something other than escape...
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,228

Post » Thu Oct 10, 2013 12:32 pm

Thanks for the feedback. That's what I thought, that for security reason it cannot be overridden.
I'd rather keep the pause bind to the esc key, it's more natural. I can live without fullscreen in web browser.
B
12
S
5
G
2
Posts: 132
Reputation: 2,627


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests