ComposedObject.cpp

00001 #include "ComposedObject.h"
00002 
00003 ComposedObject::ComposedObject ()
00004 {
00005         first_component = NULL;
00006 }
00007 
00008 ComposedObject::~ComposedObject ()
00009 {
00010         // do nothing
00011 }
00012 
00013 void ComposedObject::AddObject (RawObject * obj)
00014 {
00015         ComponentElem * current_component;
00016 
00017         if (first_component == NULL)
00018         {
00019                 first_component = new ComponentElem ();
00020                 first_component->next = NULL;
00021                 first_component->object = obj;
00022         }
00023         else
00024         {
00025                 current_component = first_component;
00026                 while (current_component->next != NULL) current_component = current_component->next;
00027 
00028                 current_component->next = new ComponentElem ();
00029                 current_component = current_component->next;
00030                 current_component->next = NULL;
00031                 current_component->object = obj;
00032         }
00033 }
00034 
00035 void ComposedObject::Draw ()
00036 {
00037         ComponentElem * current_component;
00038 
00039         glColor4fv (color);
00040 
00041         current_component = first_component;
00042         while (current_component != NULL)
00043         {
00044                 current_component->object->Draw ();
00045                 current_component = current_component->next;
00046         }
00047 }

Generated on Sun Jul 2 13:20:39 2006 for Demo by  doxygen 1.4.6-NO