Exit fullscreen with Esc instead of F11

0 favourites
  • 5 posts
  • 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?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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...

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)