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.
Set GUI alignment to center
Re: Set GUI alignment to center
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.
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.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Set GUI alignment to center
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.
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.