Changeset 4856 in orxonox.OLD for orxonox/trunk/src/lib/graphics/render2D
- Timestamp:
- Jul 14, 2005, 12:15:38 AM (19 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/render2D
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/render2D/element_2d.cc
r4847 r4856 48 48 this->setClassID(CL_ELEMENT_2D, "Element2D"); 49 49 50 this->setPosition2D(0,0); 51 this->setAlignment(E2D_ALIGN_CENTER); 52 50 53 Render2D::getInstance()->registerElement2D(this); 51 52 54 } 53 55 … … 58 60 void Element2D::positioning() 59 61 { 60 // setting the Position of this ELEM2D. 61 if (this->bindNode) 62 63 // setting the Position of this 2D-Element. 64 if (this->alignment == E2D_ALIGN_SCREEN_CENTER) 65 { 66 absPos2D.x = GraphicsEngine::getInstance()->getResolutionX()/2 + this->relPos2D[0]; 67 absPos2D.y = GraphicsEngine::getInstance()->getResolutionY()/2 + this->relPos2D[1]; 68 absPos2D.depth = 0; 69 } 70 else if (this->bindNode) 62 71 { 63 72 GLdouble projectPos[3]; -
orxonox/trunk/src/lib/graphics/render2D/element_2d.h
r4850 r4856 26 26 typedef enum 27 27 { 28 E2D_ALIGN_NONE ,29 E2D_ALIGN_LEFT ,30 E2D_ALIGN_RIGHT ,31 E2D_ALIGN_CENTER ,32 E2D_ALIGN_SCREEN_CENTER 28 E2D_ALIGN_NONE = 0, 29 E2D_ALIGN_LEFT = 1, 30 E2D_ALIGN_RIGHT = 2, 31 E2D_ALIGN_CENTER = 4, 32 E2D_ALIGN_SCREEN_CENTER = 8 33 33 } E2D_ALIGNMENT; 34 34 … … 39 39 float y; //!< The y-coordinate. 40 40 float depth; //!< The distance from the viewing plane. 41 42 41 }; 43 42 … … 49 48 virtual ~Element2D(); 50 49 51 void setPosition2D(int xCoord, int yCoord); 52 void setLayer(E2DLayer layer); 50 /** @param xCoord the xCoordinate @param yCoord the y-Coordinate. These coordinates are Relative */ 51 inline void setPosition2D(int xCoord, int yCoord) { this->relPos2D[0] = xCoord; this->relPos2D[1] = yCoord; }; 52 /** this returns the Absolute Position on the screen set by positioning in the tick-phase */ 53 inline const Position2D& getPosition2D() { return this->absPos2D; }; 54 /** @param alignment the new Alignment of the 2D-Element */ 55 inline void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; }; 56 /** @param layer the Layer this is drawn on */ 57 inline void setLayer(E2DLayer layer) { this->layer = layer; }; 53 58 /** @param visible true if the Element should be visible false otherwise (will not be rendered) */ 54 59 inline void setVisibility(bool visible) { this->visible = visible; }; 55 60 /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */ 56 //inline void setBindNode(const PNode* bindNode) { this->bindNode = bindNode; };61 inline void setBindNode(const PNode* bindNode) { this->bindNode = bindNode; }; 57 62 58 63 /** @returns the visibility state */ … … 68 73 protected: 69 74 const PNode* bindNode; //!< a node over which to display this 2D-element 75 int relPos2D[2]; //!< X-coord, Y-Coord (relative to the Coordinates of the alignment if given.) 76 Position2D absPos2D; //!< The absolute position of the 2D-Element. 77 78 E2D_ALIGNMENT alignment; //!< How the Element is aligned around its Position 79 70 80 private: 71 81 bool visible; 72 int relPos2D[2]; //!< X-coord, Y-Coord (relative to the Coordinates of the alignment if given.)73 Position2D absPos2D; //!< The absolute position of the 2D-Element.74 82 E2DLayer layer; 75 83 76 E2D_ALIGNMENT alignment; //!< How the Element is aligned around its Position77 84 }; 78 85
Note: See TracChangeset
for help on using the changeset viewer.