Page 1 of 1

Detect screen(s) resolution(s)

Posted: Sun Jul 26, 2009 9:13 pm
by returnofdanny
My end goal is to make an irrlicht game that has the capability to run in multiple monitors.

Currently I initialize my device like this

Code: Select all

IrrlichtDevice *device = createDevice(video::EDT_OPENGL, core::dimension2d<s32 > (3840, 1080), 32, true, false, false, &receiver);
Which opens the game in full screen and spans across both of my monitors, which is great. However this obviously will only work for me.

How do I go about setting up my game so that it might detect the user's resolution, and spawn a game window accross all monitors? Will I have to actually create a window for each monitor?

btw, I am currently developing in a windows environment, I would like to make the game cross platform. But I have a feeling that what I am trying to do might mean I need to implement the resolution detection, and window spawning code differently for each platform, so if I must use a windows only for now I am ok with that, I'll have to figure out how to adapt for other platforms later on.

edit: to clarify, I want all monitors to be apart of the same "game screen" ie, make it as if the game was running on one large funny shaped screen, So sprites on the left screen need to be the same size as the ones on the left, I'm not planning to use the secondary screen as a minimap or anything like that.

Any assistance on the matter would be great,

thanks

Posted: Mon Jul 27, 2009 7:41 am
by JP
Create the device initially with a null driver (it's one of the enums you can pass in instead of OGL). Then you can use the functions available to detect the screen resolution that's currently being used. I forget exactly what the functions are but I'm sure you can find them by searching the docs (something to do with desktop resolution i'm sure!)

Then you close down the device with the null driver and then recreate with your newly found resolution and other desired parameters.

Posted: Tue Jul 28, 2009 6:39 am
by bobyBola
if you are using windows, u can use WinAPI like this

Code: Select all

DEVMODE lastDM;
DISPLAY_DEVICE userDev;
userDev.cb = sizeof(DISPLAY_DEVICE);
EnumDisplayDevices(NULL,0,&userDev,NULL);
lastDM.dmSize = sizeof(DEVMODE);
EnumDisplaySettingsEx(userDev.DeviceName,ENUM_REGISTRY_SETTINGS,&lastDM,EDS_RAWMODE);
int screenWidth = lastDM.dmPelsWidth;
int screenHeight = lastDM.dmPelsHeight;
remember to include <windows'h>
this could be done before u start irrlicht CreateDevice

Posted: Tue Jul 28, 2009 7:30 am
by t0rt0r0
cross platform :

Code: Select all


// engine is a null device
irr::video::IVideoModeList *videoList = engine->getVideoModeList() ;

for (int i = 0 ; i < videoList->getVideoModeCount() ; i++)
{
       //videoList->getVideoModeResolution(i).Height ;
       //videoList->getVideoModeResolution(i).Width ;
       //videoList->getVideoModeDepth(i) ;
}