How to inherit a GUI element?

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
benjani13
Posts: 25
Joined: Sat Aug 07, 2010 8:12 pm

How to inherit a GUI element?

Post by benjani13 »

Hi, I'd like to create an inventory for my game, by creating an inventoryWindow class, who derives from the IGUIWindow class. But I don't know how to create my own window inheriting of IGUIWindow.

I tried this:

Code: Select all

class InventoryWindow : public irr::gui::IGUIWindow
{
   /*
   **
   ** code
   **
   */
};
But when I create an instance, the compiler said that the class is abstract, and effectively there are some functions in IGUIWindow who are pure virtual and I don't know how to implement these functions.

So what is the method to implement my own window who derived from IGUIWindow? Thanks.
hilnius
Posts: 33
Joined: Tue Jun 29, 2010 9:55 pm

Post by hilnius »

hi

You just have to implement needed functions, which one causes you problems ?
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

What you want to do is probably to derive from CGUIWindow. CGUIWindow derives from IGUIWindow, so to get a fully working window(while deriving from IGUIWindow) you need to implement everything that CGUIWindow implements, plus your extras.
The easiest solution would liekly be to copy the source from CGUIWindow (\source\Irrlight\CGUIWindow.*), give the class a different name and add your own extras.
benjani13
Posts: 25
Joined: Sat Aug 07, 2010 8:12 pm

Post by benjani13 »

Luben wrote:What you want to do is probably to derive from CGUIWindow. CGUIWindow derives from IGUIWindow, so to get a fully working window(while deriving from IGUIWindow) you need to implement everything that CGUIWindow implements, plus your extras.
The easiest solution would liekly be to copy the source from CGUIWindow (\source\Irrlight\CGUIWindow.*), give the class a different name and add your own extras.
I saw the CGUIWindow but I was not sure if it was a good solution.
So thank you, I do that :)
Post Reply