Changeset 7450 in orxonox.OLD for trunk/src/lib/graphics/text_engine/text.h
- Timestamp:
- Apr 29, 2006, 9:38:44 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/text.h
r7355 r7450 8 8 9 9 #include "element_2d.h" 10 11 #include "glincl.h"12 10 13 11 #define TEXT_ALIGN_LEFT E2D_ALIGN_LEFT … … 21 19 #define TEXT_DEFAULT_SIZE 20 //!< default size of the Text 22 20 23 24 21 // FORWARD DECLARATION 25 22 class Font; 26 23 struct SDL_Surface; 27 28 //! A Struct to handel Texture Coordinates for quads29 struct TexCoord30 {31 float minU; //!< The minimum U-Coordinate32 float maxU; //!< The maximum U-Coordinate33 float minV; //!< The minimum V-Coordinate34 float maxV; //!< The maximum V-Coordinate35 };36 24 37 25 //! Represents one textElement. … … 42 30 virtual ~Text(); 43 31 32 // SETUP 44 33 void setFont(const std::string& fontFile, unsigned int renderSize); 34 void setText(const std::string& text); 35 /** @param blending the blending intensity to set (between 0.0 and 1.0) */ 36 inline void setBlending(float blending) { this->blending = blending; }; 37 /** @param r red @param g green @param b blue @brief sets the Color of the Text to render (values in [0-1]) */ 38 void setColor(float r, float g, float b) { this->color = Vector(r, g, b); }; 39 /** @param size the Size of the Text @brief sets the Size of the Font */ 40 inline void setSize(float size) { this->setSizeY2D(size); }; 45 41 46 void setText(const std::string& text); 47 42 /// RETRIEVE 43 /** @returns the pointer to the stored Font (not changeable) */ 44 inline const Font* const getFont() const { return this->font; }; 48 45 /** @returns the String this Text displays */ 49 46 inline const std::string& getText() const { return this->text; }; 50 /** @param blending the blending intensity to set (between 0.0 and 1.0) */ 51 inline void setBlending(float blending) { this->blending = blending; }; 52 /** sets the Color of the Text to render (values in [0-1]) @param r red @param g green @param b blue */ 53 void setColor(float r, float g, float b) { this->color = Vector(r, g, b); }; 54 /** sets the Size of the Font */ 55 void setSize(float size) { this->setSizeY2D(size); }; 47 /** @returns the Blending Value [0 invisible 1.0 full visible */ 48 inline float getBlending() const { return this->blending; }; 49 /** @returns: a Vector(r,g,b) @brief: retrieve a Vector holding the Color of the Text */ 50 inline const Vector& getColor() const { return this->color; }; 56 51 /** @returns the Size of the Text */ 57 // void getSize(float &x, float& y) const { return this->size; };52 inline float getSize() const { return this->getSizeY2D(); }; 58 53 59 54 virtual void draw() const; … … 61 56 void debug() const; 62 57 63 // helpers. 64 static GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord); 65 static int powerOfTwo(int input); 66 58 protected: 59 virtual void setupTextWidth(); 67 60 private: 68 61 Font* font; //!< Font of this text
Note: See TracChangeset
for help on using the changeset viewer.