Changeset 4840 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jul 12, 2005, 3:32:37 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/render2D/element_2d.cc
r4839 r4840 17 17 18 18 #include "element_2d.h" 19 #include "render_2d.h" 19 20 20 21 using namespace std; … … 29 30 this->setClassID(CL_ELEMENT_2D, "Element2D"); 30 31 32 Render2D::getInstance()->registerElement2D(this); 31 33 } 32 34 … … 37 39 { 38 40 // delete what has to be deleted here 41 Render2D::getInstance()->unregisterElement2D(this); 39 42 } -
orxonox/trunk/src/lib/graphics/render2D/element_2d.h
r4839 r4840 18 18 E2D_BOTTOM, //!< Will be rendered on the bottom Layer 19 19 E2D_BELOW_ALL //!< Will be rendered below the 3D-scene. @todo make this work. 20 } E2DDepth;20 } E2DLayer; 21 21 22 22 //! A class for ... … … 28 28 29 29 30 void setPosition(int xCoord, int yCoord); 31 void setLayer(E2DLayer layer); 32 33 34 virtual void draw() const = NULL; 35 30 36 private: 31 bool bDraw;37 bool visible; 32 38 int position2D[2]; //!< X-coord, Y-Coord 33 E2D Depth depth;39 E2DLayer layer; 34 40 35 41 }; -
orxonox/trunk/src/lib/graphics/render2D/render_2d.cc
r4839 r4840 18 18 #include "render_2d.h" 19 19 20 #include "graphics_engine.h" 21 #include "class_list.h" 22 #include "list.h" 23 #include "element_2d.h" 24 20 25 using namespace std; 21 26 … … 30 35 this->setName("Render2D"); 31 36 37 this->element2DList = new tList<Element2D>(); 32 38 } 33 39 … … 38 44 39 45 /** 40 @briefstandard deconstructor46 * standard deconstructor 41 47 */ 42 48 Render2D::~Render2D () 43 49 { 50 delete this->element2DList; 51 44 52 Render2D::singletonRef = NULL; 45 53 } 54 55 56 /** 57 * registers a 2D-element to the 2D-Renderer 58 * @param element2D the element to registers 59 */ 60 void Render2D::registerElement2D(Element2D* element2D) 61 { 62 this->element2DList->add(element2D); 63 } 64 65 /** 66 * unregisters a 2D-element from the 2D-Renderer 67 * @param element2D The element to unregister 68 */ 69 void Render2D::unregisterElement2D(Element2D* element2D) 70 { 71 this->element2DList->remove(element2D); 72 } -
orxonox/trunk/src/lib/graphics/render2D/render_2d.h
r4839 r4840 10 10 11 11 // FORWARD DEFINITION 12 template <class T> class tList; 13 class Element2D; 12 14 13 15 //! A default singleton class. … … 15 17 16 18 public: 17 virtual ~Render2D( void);19 virtual ~Render2D(); 18 20 /** @returns a Pointer to the only object of this Class */ 19 inline static Render2D* getInstance(void) { if (!singletonRef) singletonRef = new Render2D(); return singletonRef; }; 21 inline static Render2D* getInstance() { if (!singletonRef) singletonRef = new Render2D(); return singletonRef; }; 22 23 24 void draw() const; 25 26 void registerElement2D(Element2D* element2D); 27 void unregisterElement2D(Element2D* element2D); 20 28 21 29 private: 22 Render2D(void); 23 static Render2D* singletonRef; 30 Render2D(); 31 static Render2D* singletonRef; //!< Reference to this class. 32 33 tList<Element2D>* element2DList; //!< List of all valid 2D-elements. 24 34 }; 25 35 -
orxonox/trunk/src/lib/lang/class_list.cc
r4836 r4840 107 107 tmp = tmp->next; 108 108 } 109 } 110 111 tList<BaseObject>* ClassList::getList(long classID) 112 { 113 if(unlikely(ClassList::first == NULL)) 114 return NULL; 115 else 116 { 117 ClassList* tmpCL = ClassList::first; 118 while (likely(tmpCL != NULL)) 119 { 120 if (unlikely(tmpCL->classID == classID)) 121 return tmpCL->objectList; 122 tmpCL = tmpCL->next; 123 } 124 } 125 return NULL; 126 109 127 } 110 128 -
orxonox/trunk/src/lib/lang/class_list.h
r4836 r4840 35 35 36 36 // STATIC FUNCTIONS 37 static void addToClassList(BaseObject* objectPointer, const long& classID, const char* className);38 static void removeFromClassList(BaseObject* objectPointer);37 static void addToClassList(BaseObject* objectPointer, const long& classID, const char* className); 38 static void removeFromClassList(BaseObject* objectPointer); 39 39 40 static BaseObject* getObject(const char* name, long classID = CL_NULL); 41 static bool exists(BaseObject* object, long classID = CL_NULL); 40 static tList<BaseObject>* getList(long classID = CL_NULL); 41 static BaseObject* getObject(const char* name, long classID = CL_NULL); 42 static bool exists(BaseObject* object, long classID = CL_NULL); 42 43 43 44 static void debug(unsigned int debugLevel = 0);
Note: See TracChangeset
for help on using the changeset viewer.