Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Maximizing the display in code?

This thread is locked; no one can reply to it. rss feed Print
Maximizing the display in code?
jmasterx
Member #11,410
October 2009

I have run into a small issue. When the user goes from full screen back to windowed or starts the game, I want to set it back to how they had it previously. I can set the window position, and size, but I see no way to change it to a maximized state. The best I can do is set it to a comfortable window size. Is there a way to do this in code or plans to add this in the future?

Thanks

Elias
Member #358
May 2000

I'm all for a way to do this. I can probably implement it for X11. My favorite API would be al_set_display_flag(display, ALLEGRO_MAXIMIZED, true/false) to maximize/un-maximize the window and (al_get_display_flags(display) & ALLEGRO_MAXIMIZED) to check whether it is currently maximized.

--
"Either help out or stop whining" - Evert

jmasterx
Member #11,410
October 2009

On Windows:

SendMessage(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);

for isMaximized:
You can use the USER API GetWindowPlacement to obtain the current status of
a given window -- the showCmd field of the returned WINDOWPLACEMENT structure
should be equal to SW_MAXIMIZE (3) if the window is maximized.

It could also be added as a new display flag since it looks cleaner if the window is first shown with the correct state.

On OSX the concept does not seem to exist, best is the zoom button thing:
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html

Trent Gamblin
Member #261
April 2000
avatar

Is the zooming thing the same as the new fullscreening ability in Lion? Where windows that support it have a fullscreen button on the right side of the title bar? When you use that the menubar autohides at the top.

Go to: