Detect screen(s) resolution(s)

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
returnofdanny
Posts: 1
Joined: Sun Jul 26, 2009 9:02 pm

Detect screen(s) resolution(s)

Post 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
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
bobyBola
Posts: 28
Joined: Wed Jan 07, 2009 5:02 am
Location: Indonesia

Post 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
hai adik2 semua mari kita belajar sambil bermain bersama saya si BOBBY BOLA di edugames bermacam pelajaran bisa didapat ad berhitung menggambar mewarnai tidak ketinggalan dapat belajar nyanyi juga belajar huruf angka & logika bersama BOBBY BOLA semua bisa
t0rt0r0
Posts: 76
Joined: Fri May 22, 2009 11:02 am

Post 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) ;
}

Post Reply