How do I grab the desktop resolution for Irrlicht?

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
Mequa
Posts: 13
Joined: Fri Jul 07, 2006 7:39 pm

How do I grab the desktop resolution for Irrlicht?

Post by Mequa »

I am looking to make my game automatically start in full-screen mode at the same screen resolution as the desktop (1440x900 on my machine, variable on others).

On Windows, after including the Windows API, this can be used to create an fullscreen Irrlicht device at the Windows desktop resolution (assuming a 32-bit display, D3D9, plus a receiver object):
> IrrlichtDevice *device = createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)), 32, true, false, true, &receiver);

However, I am wondering if this can be done from within Irrlicht without invoking the Windows API?
If so, how is this done?

I also need to grab the desktop resolution for the Linux version of my game (I'm using Ubuntu 8.10).
I successfully ported it from Windows and got it working under Ubuntu, however it lacks this important feature.

If Irrlicht is not able to detect the desktop resolution, can anyone recommend a (small and tight) API which provide this functionality under Linux (especially Ubuntu) AND is usable with Irrlicht?

An example of how this may be done would be particularly helpful here.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Mequa
Posts: 13
Joined: Fri Jul 07, 2006 7:39 pm

Post by Mequa »

Thanks for the help.
If I may post the solution to my own question, I got it working the following way (Irrlicht 1.5):

> IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL);
> core::dimension2d<s32> deskres = nulldevice->getVideoModeList()->getDesktopResolution();
> nulldevice -> drop();
> IrrlichtDevice *device = createDevice(video::EDT_DIRECT3D9, deskres, 32, true, false, true, &receiver);

Is this the best way to do this?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

at least it's what I suggested... :lol:
and I think it's the easiest way... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply