i'm still going with the Irrlicht engine for porting my software. However i'm running into an issue here.
as i understand to make new gui objects, the best way is to put cguiimage.cpp and cguiimage.h in the project folder, rename them and name the constructors something else.
then for adding it you call new CGUIYourComponent and add it to the gui->GetRootSceneNode().
Now the entire GUI is pretty dynamic and the objects are found trough an internal name (backbutton/downarrow). So in the CGUIElement.h i've added a name string and a getter and setter. Now i would need a function in the eguienvironment that returns an element based on a name and a type:
Code: Select all
IGUIElement* FindElement(stringw _name, EGUI_ELEMENT_TYPE _type)
{
// iterate trough all elements
if (element(i).GetName() == _name) && (element(i).GetType() == _type)
return element(i)
}
}
- how would i return a different type? is it safe to dynamic_cast them automatically to the type they are (for example CGUIMyElement)?
- is this functionality somehow already built in to the gui or is there a better way?
greetings
elFuz