OpenGL game programing: typeid
Hi ppl...
At this time I''m making a GUI (graphic user interface) using the Cnode and Cobject from the book explanations.
Therefor, I''ve done the CGUI_base class witch is the base of all, and the CGUI_mover for mover objects, the CGUI_dialog for dialogs and I''m making more tha that!!!
In fact, when the mouse clicks on a button for example, the button will tell his parant (for example an CGUI_dialog conteining it) that we has clicke and, therefor, the dialog willl tell his parent (problably the root) the he has been clicked (and then I can see how as focus and that).
the problem is that the root of all GUI is inside in another structure, and the root of GUI will try to send a message to his parent that don''t understand that.
i''ve been reading this:
typeid(*parent) != typeid(CGUI_base)
it tells if the parent is of type CGUI_base, but, I want to know if parent is derived by CGUI_base. In that case, if the parent is a Centitie or a Cworld, the message isn''t propagued, but, if the parent is a CGUI_base, a CGUI_button or another thing ancestral of CGUI_base, the message should be transmited.
How can I check if and object as in his ancestral a CGUI_base (that is the ancestral of all GUI objects)
Filami
Techno Grooves
Techno Grooves
I think it would be like this: (not at my home computer to test it)
// Website // Google // GameDev // NeHe // MSDN // OpenGL Extensions //
if(dynamic_cast<CGUI_Base *>(object)) /* object is a CGUI_Base */
// Website // Google // GameDev // NeHe // MSDN // OpenGL Extensions //
~neoztar "Any lock can be picked with a big enough hammer"my website | opengl extensions | try here firstguru of the week | msdn library | c++ faq lite
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement