Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Fullscreen and windowed - Is it my app or an Allegro bug?

This thread is locked; no one can reply to it. rss feed Print
Fullscreen and windowed - Is it my app or an Allegro bug?
Lucas Dalmasso
Member #20,839
August 2021

Hi, im programming an app that needs switching to full screen and back to windowed mode in real time for Windows.
The thing is the allegro menu. When i switch to full screen (not fullscreen windowed) mode all is ok, but when go back to windowed the menu dissapears. This is due i have to destroy the display and create a new one. So i attach my "menu" to the window, but sometimes the window shows the menu and sometimes doesn't.

I have tried al_destroy_menu() and reassign it with al_build_menu() and al_set_display_menu() but no luck, the program frezees.

Any idea why this could be hapenning?

Thxs in advance.

DanielH
Member #934
January 2001
avatar

Not sure you can. In full screen mode, your client area becomes the desktop.

Lucas Dalmasso
Member #20,839
August 2021

But i don't get it. How to do that? Sorry my knoob knowladge.

DanielH
Member #934
January 2001
avatar

It's not a bug. That's how fullscreen works.

{"name":"613364","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/2\/92eff01e684eeae02f281dc9eb73fab5.png","w":549,"h":440,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/2\/92eff01e684eeae02f281dc9eb73fab5"}613364

In windowed-mode, you have 2 parts:
1. The client area (the red part)
2. The Parent window (everything else, including the menu bar)

In fullscreen-mode, the client area fills the entire viewing area. Hence, no menu bar.

AceBlkwell
Member #13,038
July 2011
avatar

Lucas,

Sound like what I normally discover with my questions, “You can’t get there from here.”

If I understand correctly, you start in window mode which includes menus. At some point you go to Fullscreen where you lose the menus due to fullscreen not needing them. I think that’s what Daniel is saying. When you revert back to window mode, the menus no long available.

If this is the case, maybe you could treat the screen modes independently. Opt 1 (default) is Windowed. Opt 2 is Fullscreen. If you need to revert back to Opt 1 you would basically restart like it was first time through. Any shared data between the two modes could be placed in a set of variables such as a structure or array of bool flags etc.

And if I have total misunderstood, then…. Nevermind - Emily Litella (Gilda Radner SNL)

Lucas Dalmasso
Member #20,839
August 2021

Yeah, i was doing bad. So i have to put as you say in a separate thing my vars.
The thing is: im reconstruting nearly everything when i a go back to windowed mode.
The only thing is sound, since im generating sound in realtime (while the app is running) i encounter with sound glitches. I have tried destroying the sound and reconstruct it but no luck.

torhu
Member #2,727
September 2002
avatar

I have a game that can switch between windowed and fullscreen modes. It doesn't use menus or audio streaming, so it just pauses timers before doing the switch. After the switch it restarts the timers, redraws the screen, flushes the event qeueue, and clears the state of the controls before continuing. Same as the pause mode, except it doesn't wait for the user to do anyting before continuing.

It sounds like you would also need to pause the audio stream with al_set_audio_stream_playing, then restart the audio stream before continuing the game loop. And something similar with the menu, but I have no experience with that.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I have tried al_destroy_menu() and reassign it with al_build_menu() and al_set_display_menu() but no luck, the program frezees.

Try destroying the menu before destroying the display, and then if you can't attach a new menu to a window, that is a bug. File an issue on Github.

Lucas Dalmasso
Member #20,839
August 2021

"Try destroying the menu before destroying the display, and then if you can't attach a new menu to a window, that is a bug. File an issue on Github."

Yes, what you say works in Windows but not linux. When i add ALLEGRO_GTX_TOPLEVEL to "al_create_display()" the app closes with an "exception. core dumped".
There is no way to go back in linux from fullscreen to windowed and attach again the menu.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: