device size

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
circusdan
Posts: 32
Joined: Thu Jun 02, 2011 10:05 pm
Location: United States

device size

Post by circusdan »

Is there any way to determine the size of the device created so that i can adjust my GUI when the window is resized? Thanks
KP84
Posts: 44
Joined: Thu Feb 24, 2011 5:08 am

Post by KP84 »

If you tried the apropriate tutorial for it you would be on your way already :wink:

Code: Select all

// if you think real code is always interresting, read this line again
circusdan
Posts: 32
Joined: Thu Jun 02, 2011 10:05 pm
Location: United States

Post by circusdan »

The only relevant tutorial was the GUI one which was pretty vague, and didnt mention anything about what im trying to do
KP84
Posts: 44
Joined: Thu Feb 24, 2011 5:08 am

Post by KP84 »

circusdan wrote:The only relevant tutorial was the GUI one which was pretty vague, and didnt mention anything about what im trying to do
What are you trying, as you're being pretty vaque yourself.

Assuming (tutorial 5) you want to resize all your IGUI... components, I believe you should trigger or catch this EGDT_WINDOW_RESTORE message. At least that sounds logical too me as the device gets lost if you go out of from fullscreen. Because I don't see a message for sizing I think it will be triggered on resize too. Maybe the EET_USER_EVENT is interresting too.

However, if you meant the tutorial 14, basically it's the same but you need to learn the Win32 API. There you should concentrate on WM_SIZE. That you can catch in the switch and the size is either passed into the wParam OR (not and) the lParam. The HIWORD(wParam) and LOWORD(wParam) you can extract the new width and height.

Code: Select all

// if you think real code is always interresting, read this line again
nathanf534
Posts: 199
Joined: Tue Dec 09, 2008 2:55 am

Post by nathanf534 »

I assume you mean you want the size of the window?

http://irrlicht.sourceforge.net/docu/cl ... river.html
getScreenSize()
while(signatureEmpty){cout<<wittyComment();}
circusdan
Posts: 32
Joined: Thu Jun 02, 2011 10:05 pm
Location: United States

Post by circusdan »

Thanks, i didnt realize thats what tutorial 14 was about. I was getting a huge headache over it so thanks
circusdan
Posts: 32
Joined: Thu Jun 02, 2011 10:05 pm
Location: United States

Post by circusdan »

Im having trouble getting getScreenSize() to work. I called it as IVideoDriver::getScreenSize(), and included IVideoDriver.h, but it says illegal call of non-static member function. I'm not quite sure what I'm doing wrong here
circusdan
Posts: 32
Joined: Thu Jun 02, 2011 10:05 pm
Location: United States

Post by circusdan »

I think i just figured it out, i used:
screenSize = device->getVideoDriver()->getScreenSize();

It didnt give me any errors so im gonna run with that
circusdan
Posts: 32
Joined: Thu Jun 02, 2011 10:05 pm
Location: United States

Post by circusdan »

I got the size thing working, but how do i repaint the GUI when the window is resized, ive tried beginning and ending the scene in the loop , but it doesnt redraw it to rescale
CuteAlien
Admin
Posts: 9718
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

The usual trick is to put one gui-element with your default-size as parent. It can be invisible (for example a static-text without borders and background drawing). When the main-windows changes the size you resize this element with setRelativePosition. All it's childs will then be resized as well according to their alignment settings (you can change those with setAlignment).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply