Set GUI alignment to center

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.

Set GUI alignment to center

Postby aeronmike » Sat Aug 04, 2012 10:39 pm

Hey

My app creates a window and a child button.

I want to center the window according to the resolution AND the child button centered according to the window resolution.

How would I do that?
Is that any function within Irrlicht that let me do such thing?

Thanks.
aeronmike
 
Posts: 44
Joined: Thu May 24, 2012 5:00 am

Re: Set GUI alignment to center

Postby CuteAlien » Sat Aug 04, 2012 11:45 pm

You can make sure that gui-elements are aligned when their parents are resized with the setAlignment function.
So you can create the gui in one resolution and for example set a gui-element with that size as parent which does draw nothing (for example a IGUIWindow without titlebar and removed buttons or a IGUIStaticText without border and text). Now when you resize that parent it's childs will all align correctly - for example to the center.

You can not center the application window itself, at least not with Irrlicht functions. You can use platform API functions for that.
IRC: #irrlicht on irc.freenode.net
My patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Games with Irrlicht: http://www.irrgheist.com/
News: http://www.reddit.com/r/irrlicht/
User avatar
CuteAlien
Admin
 
Posts: 5364
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Set GUI alignment to center

Postby aeronmike » Tue Aug 07, 2012 9:54 pm

Thanks.
My app has a fixed resolution, so I just had to calculate the positioning of the Irrlitch window against the internal resolution.
Simple math. That worked. :)
aeronmike
 
Posts: 44
Joined: Thu May 24, 2012 5:00 am


Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 1 guest