Set a button position with irrlicht

246 Views Asked by At

I'm trying to make a GUI and I want to create some buttons. I can create my button with

irr::gui::IGUIButton *newGameButton = gui->addButton(irr::core::rect<irr::s32>(200, 110, 600, 200), 0, -1, L"NEW GAME");

If I want to draw an image I can set my position but I can't do it with a button.

->draw2DImage(image,
                 irr::core::position2d<irr::s32>(145,30),
                 irr::core::rect<irr::s32>(0,0,500,180),
                 0,
                 irr::video::SColor (255,255,255,255),
                 true);

Here can i set the position with an image! I read the documents and tutorial but i can't find it.

1

There are 1 best solutions below

0
MartinVeronneau On

To change a button's position programmatically, you can do the following :

newGameButton->setRelativePosition( rect<s32>( 210, 110, 610, 200 ));

... for example, this will draw the button 10 pixels more on the right.