Page 1 of 1

Creating Custom GUI Elements

Posted: Sat Feb 20, 2010 4:42 pm
by pwierz
Is there a tutorial on how to make a basic custom GUI element? I have been trying by creating a class that inherits from IGUIElement and then I only overrode the constructor and draw functions but I can't get it to even enter the draw function. Am I missing some sort of registration step or is that handled in the IGUIElement constructor (which is called from my constructor). My goal is to make a scrollbar that looks a little prettier. Is there anywhere that has a "here is the minimum you need to get it to work" doc I can start from? Thanks.

Posted: Sat Feb 20, 2010 5:33 pm
by CuteAlien
Basically every irrlicht gui-element can be used as example. Also the GUIEditor in the tools folder does use a few custom gui-elements. To make sure an element gets drawn it must be registered to the guienvironment. Which means - it needs to either to be a child of IGUIEnvironment or a child of one of it's childs.

Posted: Sat Feb 20, 2010 8:15 pm
by pwierz
That was the "gotcha" I was missing. I was using CGUIScrollBar as a model and it just passes the parent variable along to its inherited class but when I looked at some of custom elements in the tools, they were passing along the rootGUIElement to the inherited class if parent was not set. Now it works. Thanks for the pointer.