Creating Custom 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
pwierz
Posts: 59
Joined: Sun Aug 20, 2006 3:32 pm

Creating Custom GUI Elements

Post 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.
CuteAlien
Admin
Posts: 9721
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post 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.
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
pwierz
Posts: 59
Joined: Sun Aug 20, 2006 3:32 pm

Post 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.
Post Reply