How can i resize my parent gui object?

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
Jorik
Posts: 44
Joined: Tue Dec 08, 2009 4:47 pm

How can i resize my parent gui object?

Post by Jorik »

Hi,

i tried several ways to resize my parent gui element always automatically to window size, but i found no way at all.

with:

Code: Select all

IGUIElement *testroot = testGUIEnvironment->addImage (vector2d<s32>() etc...);
i cant give the image more than 2 parameters, and i have no way to say: (0,0,width,height);

Code: Select all

draw2dImage();
has the abillity to give 4 parameter, but i cant define it as my parent element, because its a void and i cant save it in IGUIElement and define a name for the object.

It has also the disatvante, that a picture created with draw2dImage(), is displayed repeadingly when it gets stretched.
So i dont see the picture bigger, i see the picture several times.


Can anbody tell me a way to stretch a IGUIElement Picture?
CiRiuS2
Posts: 14
Joined: Mon Oct 26, 2009 12:14 am
Location: Spain

Post by CiRiuS2 »

Code: Select all

IGUIImage *image = gui->addImage(...);
image->setScaleImage(true);
image->setMaxSize(dimension2du(maxX,maxY));
image->setMinSize(dimension2du(minX,minY));
You should read the documentation...
CuteAlien
Admin
Posts: 10021
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Well, actually it might be not so easy. With setScaleImage(true) you make sure the image has the same size as the gui-element. But when you talk about resizing the main-window then the problem is that the gui-elements do not resize with that automatically. You have to poll the main-window size and then set the gui-elements correspondingly. But you can use one parent-element which you scale to the main-window size and then all child-elements _can_ scale automatically. That behavior depends on the settings of setAlignment and setMaxSize, setMinSize.
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
Jorik
Posts: 44
Joined: Tue Dec 08, 2009 4:47 pm

Post by Jorik »

Ok, now its working thank you.
Post Reply