create own GUI elements

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
WhiteMike
Posts: 1
Joined: Sat Dec 08, 2007 11:01 pm

create own GUI elements

Post by WhiteMike »

Hello all,


I wanted to know, if there is a possibility to create one's own GUI elements in the irrlicht engine.

I have searched for tutorials or some other help but haven't find anything.

So, I would be glad, if someone could help me.


WhiteMike
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

You can do this by subclassing IGUIElement and override the methods you need.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
Luke Dean
Posts: 9
Joined: Tue Dec 11, 2007 5:59 am

Post by Luke Dean »

I've been working on this idea too.
Here's an example from the FAQs forum.

http://irrlicht.sourceforge.net/phpBB2/ ... php?t=8252
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Yes it it possible and its fairly easy. You just need to inherite from IGUIElement or some of the IGUI elements like IGUIButton for example.

Your code should look like:

Code: Select all

class CustomGUIelement : public gui::IGUIElement
{
... then overwrite all virtual IGUIElement functions and add your own
};
To create your element:

Code: Select all

CustomGUIelement  *element = new CustomGUIelement (guienv, guienv->getRootGUIElement(), 0, core::rect<s32>(0,0,160,10));
element->drop();
Post Reply