Drawing Individual GUI Elements

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
remark
Posts: 14
Joined: Wed May 28, 2014 5:02 am

Drawing Individual GUI Elements

Post by remark »

Hi, I am trying to draw individual GUI buttons instead of using device->getGUIEnvironment()->drawAll(), but I can't seem to get it to work, I'm not sure if I am supposed to do button.draw(),button->draw(),button::draw() or draw(button), as all have their own errors and I cant find a example anywhere.
Any help would be great, thanks!
Ovan
Posts: 70
Joined: Thu Dec 18, 2008 12:41 am
Contact:

Re: Drawing Individual GUI Elements

Post by Ovan »

http://irrlicht.sourceforge.net/docu/cl ... ement.html

post your code, but this should be:
element->draw();
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Drawing Individual GUI Elements

Post by CuteAlien »

Maybe also describe _why_ you would want to do that. I can't really think of many situations where it would make sense to call them individually. So you might be misunderstanding something else and don't even need to do 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
remark
Posts: 14
Joined: Wed May 28, 2014 5:02 am

Re: Drawing Individual GUI Elements

Post by remark »

Sorry I wasnt clear enough before, I want to only draw some buttons instead of all of them, mostly because the buttons play a little animation of the camera moving from point A to B, but sometimes there is a wall in the way, so I dont want the user to be able to hit the button to go straight if there is a wall in front of them, so I would make the button invisible/un draw it.

As for the code itself, taking another look at it, I think I messed up by linking the button with the GUI enviroment

Code: Select all

env ->addButton(rect<s32>(400,360,500,360 + 32), 0,GUI_ID_Forward_Arrow_X,L"Go Forward",L"Go");
I have been trying to create a IGUIButton, but can't find a example of how to do it anywhere without setting a parent, a quick example should send me on my way =D
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Drawing Individual GUI Elements

Post by CuteAlien »

Yeah, passing 0 set's the guienvironment as parent.

But you can use the setVisible function of gui-elements to hide/show them.
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