toggle fullscreen / window mode

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
morlok
Posts: 4
Joined: Fri Jan 02, 2004 11:33 pm

toggle fullscreen / window mode

Post by morlok »

please help!!!

Is it possible to switch from Windowed mode to fullscreen AT RUN TIME??
and how?

it's a very usefull feature (ex: alt-Enter toggle fullscreen/window)
but il doesn't seem to be very easy to implement with that engine... :-(
qwe
Posts: 112
Joined: Sun Dec 28, 2003 12:54 am
Location: Oregon, USA

Post by qwe »

you should be able to do this with an event receiver: just close the device when alt-enter is pressed, and immediately create a new, windowed device.

of course, this may affect other things within the engine as well :roll:
morlok
Posts: 4
Joined: Fri Jan 02, 2004 11:33 pm

Post by morlok »

yes it works ;-)

thanks!
qwe
Posts: 112
Joined: Sun Dec 28, 2003 12:54 am
Location: Oregon, USA

Post by qwe »

just remember to save the state of the game before dropping the device :wink:
tewe76
Posts: 42
Joined: Wed Jan 21, 2009 10:56 am
Location: Spain
Contact:

Post by tewe76 »

Come back to life, my creature!!! :P
A very old thread, i know, but i've exactly the same question:
is there a way to toggle windowed/fullscreen on runtime?
Answer on 2004: just close the device and immediately create a new, windowed device.
Answer on 2009, with IrrLicht 1.5? There's no automatic method to toggle without losing the scene?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, that's not possible.
tewe76
Posts: 42
Joined: Wed Jan 21, 2009 10:56 am
Location: Spain
Contact:

Post by tewe76 »

OMG! Were you spying me?!!! :shock: Answered in seconds! :wink:

I've a question, then: if i close the device, do i have to reload the meshes, textures, etc?
Spkka
Posts: 32
Joined: Fri Jan 02, 2009 8:30 am

Post by Spkka »

just remember to save the state of the game before dropping the device Wink
tewe76
Posts: 42
Joined: Wed Jan 21, 2009 10:56 am
Location: Spain
Contact:

Post by tewe76 »

Yes, i've read that, but i were not sure if "the state of the game" were meshes and so, or only your own logic and variables. I suppose you have to reload everything, just as you had restarted the application. Thanks.
Spkka
Posts: 32
Joined: Fri Jan 02, 2009 8:30 am

Post by Spkka »

It depends of course "when" you decide to switch fullscreen/windowed mode. If its in the middle of the game you still want your character to be on the same place etc imo.

I still need to implement it myself so it would be nice if you post your solution on the forum for others to read maybe ;)
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

For sure you already noticed that most of the games which offer you fullscreen/windowed mode switch will tell you that you need to restart application for changes to take place. That is not bad solution ...or compromise better say.

You can also offer setting screen on application start where user can change settings like that and do some other things as well (open manual/help, visit webpage, view version and so on). This will have device of its own which will close after play/continue/start button is clicked. Then application device will be created based on settings selected.
tewe76
Posts: 42
Joined: Wed Jan 21, 2009 10:56 am
Location: Spain
Contact:

Post by tewe76 »

You can also offer setting screen on application start where user can change settings like that
Yes, i'm probably going that way. In fact, that was my first idea :wink:
burningreggae
Posts: 66
Joined: Wed Oct 04, 2006 2:07 pm

Post by burningreggae »

The new example 21. Quake3Explorer does exactly that. It opens and closes a Device and saves/reload the game state. It even provides a GUI for changing the ScreenResolution.!
burningreggae
tewe76
Posts: 42
Joined: Wed Jan 21, 2009 10:56 am
Location: Spain
Contact:

Post by tewe76 »

The new example 21. Quake3Explorer does exactly that. It opens and closes a Device and saves/reload the game state. It even provides a GUI for changing the ScreenResolution.!
Don't f*ck! (spanish expression, don't know if it exists in english :wink: )
That's cool, i'll take a look on it 8)
The only thing left, then, is to detect ALT+TAB or similar. Or is there a solution for that? Maybe "device->isWindowActive" or "device->isWindowFocused" have something to do? I really don't understand well the diference...
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

I was able to do it one way on 1.4. It should work again in 1.5.

I opened my main device on the "null" device. You will see nothing opening (no window or display).

In your code then you open another device (GL or DX) then you draw your scene on that device.

You have to take care after to close ALL devices, because the application will still be running even if you closed the display.
Post Reply