Changeset 5381 in orxonox.OLD for branches/2d-recalc/src/lib/graphics/render2D/element_2d.h
- Timestamp:
- Oct 15, 2005, 7:13:23 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2d-recalc/src/lib/graphics/render2D/element_2d.h
r5380 r5381 2 2 * @file element_2d.h 3 3 * Definition of the 2D elements rendered on top through the GraphicsEngine 4 * 5 * @todo reimplement it, so it looks just like PNode. 6 */ 4 */ 7 5 8 6 #ifndef _ELEMENT_2D_H … … 37 35 E2D_ALIGN_RIGHT = 2, 38 36 E2D_ALIGN_CENTER = 4, 39 E2D_ALIGN_SCREEN_CENTER = 8 37 E2D_ALIGN_SCREEN_CENTER = 8, 40 38 } E2D_ALIGNMENT; 41 39 … … 98 96 inline bool isActive() { return this->active; }; 99 97 100 98 ///////////// 99 // SCALING // 100 ///////////// 101 101 inline void setSize2D(float x, float y) { this->sizeX = x, this->sizeY = y; }; 102 102 void setSize2Dpx(int x, int y); … … 110 110 int getSizeY2Dpx() const; 111 111 112 // LIKE PNODE 113 public: 112 // PNODE-STYLE-behavioral 113 public: 114 ///////////////// 115 // COORDINATES // 116 ///////////////// 117 // RELATIVE // 114 118 void setRelCoor2D (const Vector& relCoord); 115 void setRelCoor2D (float x, float y, float dontCare = 1.0); 119 /** @param x x-coordinate. @param y y-coordinate. @param z z-coordinate. @see void PNode::setRelCoor2D (const Vector& absCoord) */ 120 void setRelCoor2D (float x, float y, float dontCare = 1.0) { this->setRelCoor2D(Vector(x, y, dontCare)); }; 116 121 void setRelCoor2Dpx (int x, int y); 122 inline void setRelCoor2Dpx (const Vector& relCoordpx) { this->setRelCoor2D(relCoordpx.x, relCoordpx.y); }; 117 123 void setRelCoorSoft2D (const Vector& relCoordSoft, float bias = 1.0); 118 void setRelCoorSoft2D (float x, float y, float dontCare = 1.0, float bias = 1.0); 124 /** set relative coordinates smoothely @param x x-relative coordinates to its parent 125 * @param y y-relative coordinates to its parent @param z z-relative coordinates to its parent 126 * @see void PNode::setRelCoorSoft (const Vector&, float) */ 127 void setRelCoorSoft2D (float x, float y, float dontCare = 1.0, float bias = 1.0) { this->setRelCoorSoft2D(Vector(x,y, dontCare), bias); }; 119 128 void setRelCoorSoft2Dpx (int x, int y, float bias = 1.0); 120 129 /** @returns the relative position */ … … 122 131 /** @returns the Relative Coordinate Destination */ 123 132 inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; }; 124 const Vector& getRelCoor2Dpx() const; 133 Vector getRelCoor2Dpx() const; 134 // ABSOLUTE // 125 135 void setAbsCoor2D (const Vector& absCoord); 126 void setAbsCoor2D (float x, float y, float depth = 1.0); 136 /** @param x x-coordinate. @param y y-coordinate. @param z z-coordinate. @see void PNode::setAbsCoor2D (const Vector& absCoord) */ 137 void setAbsCoor2D (float x, float y, float depth = 1.0) { this->setAbsCoor2D(Vector(x, y, depth)); }; 127 138 void setAbsCoor2Dpx (int x, int y); 128 139 /** @returns the absolute position */ 129 140 inline const Vector& getAbsCoor2D () const { return this->absCoordinate; }; 130 const Vector&getAbsCoor2Dpx () const;141 Vector getAbsCoor2Dpx () const; 131 142 132 143 void shiftCoor2D (const Vector& shift); 133 144 void shiftCoor2Dpx (int x, int y); 134 145 146 /** @returns the Speed of the Node */ 147 inline float getSpeed() const { return 0; }; 148 /** @returns the Velocity of the Node */ 149 inline const Vector& getVelocity() const { return this->velocity; }; 150 151 //////////////// 152 // DIRECTIONS // 153 //////////////// 154 // RELATIVE // 135 155 void setRelDir2D (float relDir); 136 156 void setRelDirSoft2D(float relDirSoft, float bias = 1.0); … … 139 159 /** @returns the Relative Directional Destination */ 140 160 inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; }; 161 // ABSOLUTE // 141 162 void setAbsDir2D (float absDir); 142 163 /** @returns the absolute Direction */ 143 164 inline float getAbsDir2D () const { return this->absDirection; }; 144 165 void shiftDir2D (float shiftDir); 145 146 /** @returns the Speed of the Node */ 147 inline float getSpeed() const { return 0; }; 148 /** @returns the Velocity of the Node */ 149 inline const Vector& getVelocity() const { return this->velocity; }; 150 151 166 /////////////// 167 // PARENTING // 168 /////////////// 152 169 void addChild2D (Element2D* child, int parentingMode = E2D_PARENT_NONE); 153 170 void addChild2D (const char* childName); … … 169 186 int getParentMode2D() const { return this->parentMode; }; 170 187 188 189 ////////////// 190 // HANDLING // 191 ////////////// 171 192 void update2D (float dt); 172 193 … … 192 213 private: 193 214 const PNode* bindNode; //!< a node over which to display this 2D-element 215 bool coordinateType; //!< true if type is [0-1],[0-1]-style, false if type is [0-ResolutionX][0-ResolutionY]-style. 216 194 217 float sizeX; //!< The size of the rendered item in x-direction 195 218 float sizeY; //!< The size of the rendered Item in y-direction … … 212 235 Vector lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 213 236 float prevRelDirection; //!< The last Relative Direciton from the last update-Cycle. 214 // float lastAbsDirection;215 237 216 238 Vector velocity; //!< Saves the velocity.
Note: See TracChangeset
for help on using the changeset viewer.