Switching to full screen mode

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
markanderson
Posts: 30
Joined: Thu Mar 16, 2006 6:21 pm

Switching to full screen mode

Post by markanderson »

Hello All -

I've setup a window using createDevice() and populated the area with nodes. But I'd like to offer users the ability to switch to full screen mode.

I know the initial createDevice() call can be set to go full screen, but if I've started with a standard window - can anyone tell me how to switch between window and full screen?

Thanks,

Mark.
PsycoDad
Posts: 36
Joined: Mon Jan 09, 2006 8:30 am
Location: Munich/Germany

idear

Post by PsycoDad »

Have you think about to create two devices and switch them with a botton, or you set variables for the windowsize and change them by a event.

only brainstorming, i don`t know how to do it in code.
Wer andern eine Bratwurst brät, der hat ein Bratwurstbratgerät!
Robert Y.
Posts: 212
Joined: Sun Jan 28, 2007 11:23 pm

Post by Robert Y. »

Hi all,

again a question noone seems to have found an answer for: is it possible to change the device from windowed to fullscreen and vice versa?

This would really helpful, as the NVidia stereo drivers only work in full-screen mode, but I don't want my project to be full screen all the time.

The only way I now can think of is to close the device and open a new one, but that means all other stuff has to be reinitialized and all models reloaded, which is really a nightmare. Isn't there a simpler way to do this?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

no, unfortunately you need to restart the device, probably for the same reasons why you have to restart most commercial games after changing the screen size
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Robert Y.
Posts: 212
Joined: Sun Jan 28, 2007 11:23 pm

Post by Robert Y. »

bitplane wrote:no, unfortunately you need to restart the device, probably for the same reasons why you have to restart most commercial games after changing the screen size
A lot of DirectX examples can be switched from window to full screen, so it should be possible. I wonder if there is a quick hack, for instance similar to resizing the window with Driver->OnResize();
Athlon_Jedi
Posts: 156
Joined: Wed Jul 21, 2004 4:29 am
Location: Mishawaka, In

maybe with a state manager?

Post by Athlon_Jedi »

i havent tried it but if you implement a game state manager ( not the same as a game manager) you may be able to keep track of the state of the "window" and use an event reciever or function set up in a switch statement to accomplish it. dont quote me on that though as i havent tried it myself yet.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

hmm maybe it would be possible then. i think you need to destroy the window and recreate it though, and deal with working around this in irrDeviceWin32.
then we'd need similar code for irrDeviceLinux and irrDeviceMacOSX, so this is unlikely to change for the moment. if you can provide a fix for the windows device and post the code, and someone else can fix it for linux and osx, then it would almost certainly be added to the engine
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

how does the irrlicht demo works then? i rememberd that it also changes its device,
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

it drops one device and opens a new one
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

The first device it creates is a software device. So, when the device is dropped [device->drop()] there's no hardware state to clean up.
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

What if we build it like a sort of closewindow() when its called is removes the window and sets himself as waiting, so when you want to close only the window it sets himself with closewindow instead of closedevice()?

Code: Select all

//! notifies the device that it should close itself
void CIrrDeviceWin32::closeDevice()
{
	this->waiting_for_new_window = false;
	DestroyWindow(HWnd); 	//PostQuitMessage(0);
}

Code: Select all

//! notifies the window that it should close itself and still stays running
void CIrrDeviceWin32::closeWindow()
{
	//set waiting on next
	this->waiting_for_new_window = true;
	DestroyWindow(HWnd); 	//PostQuitMessage(0);
}
i think this is the idea but wrong code used :oops:
Post Reply