Full screen a game with one button and exit full screen with a different button?

I’m wanting my game to enter full screen whenever the player clicks to maximize the window. And I want them to be able to exit full screen by pressing escape. This process should be infinitely repeatable.

This is the closest I came to getting it to work, but once you try escaping full screen a second time, the final condition and action keep triggering and refusing to let the window leave full screen.

Seems like there may be a simple solution but I spent hours the other day trying to work around this problem to no avail, hopefully someone has a better idea?

You need to make BOOLEAN variable and toggle it with escape NOT checking window state

That’s an interesting method! But I don’t want to use the same button to handle toggling between full screen and not full screen. I really need it to be two completely separate inputs involving maximize and escape.

But you are using same key there so i assumed that is your goal?

If you wanna have 2 different buttons you do not need to check anything else than these buttons being pressed
DO NOT check if its full screen or not

Simply

Condition
F4 is pressed
Trigger once

Action
Activate full screen YES

And another one
Condition
Escape is pressed
Trigger once

Action
Activate full screen NO

Thanks for the ideas! I’ve tried concepts like that, and in almost all circumstances you’d be correct. But in my specific case, since I’m using maximize, I think GDevelop gets real confused about the state of the game window and repeatedly keeps triggering itself in order to reach full screen.

Thankfully, I’ve done a bit of tinkering and FINALLY found a way around this. I’ll need to implement a scene timer that gives the code a little bit of buffer room. This way, the toolbar shows up when the player hits escape, but if the player doesn’t interact with it for a couple seconds, the game returns to full screen.

So I’m gonna take this one as being SOLVED!

1 Like