Changeset 4597 in orxonox.OLD for orxonox/trunk/src/lib/graphics/text_engine.h
- Timestamp:
- Jun 11, 2005, 12:55:48 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/text_engine.h
r4536 r4597 1 /*! 1 /*! 2 2 \file text_engine.h 3 3 \brief Definition of textEngine, the Font and the Text … … 30 30 31 31 //! An enumerator for the text alignment. 32 enum TEXT_ALIGNMENT { TEXT_ALIGN_LEFT, 33 TEXT_ALIGN_RIGHT, 34 TEXT_ALIGN_CENTER, 35 TEXT_ALIGN_SCREEN_CENTER }; 32 enum TEXT_ALIGNMENT 33 { 34 TEXT_ALIGN_LEFT, 35 TEXT_ALIGN_RIGHT, 36 TEXT_ALIGN_CENTER, 37 TEXT_ALIGN_SCREEN_CENTER 38 }; 36 39 37 40 /* some default values */ 38 41 #define FONT_DEFAULT_SIZE 50 //!< default size of the Text 39 #define FONT_DEFAULT_TEXT 42 #define FONT_DEFAULT_TEXT "orxonox 1234567890" //!< default text to display 40 43 #define FONT_DEFAULT_COLOR_R 255 //!< default red part (color) of the text 41 44 #define FONT_DEFAULT_COLOR_G 255 //!< default red green (color) of the text … … 86 89 int bearingY; //!< How much is above the Origin 87 90 int advance; //!< How big a Glyph would be in monospace-mode 88 91 89 92 // OpenGL-specific 90 93 // TexCoord texCoord; //!< A Texture Coordinate for this glyph. … … 117 120 118 121 void draw(void) const; 119 122 120 123 void debug(void) const; 121 124 122 125 private: 123 126 Text(Font* font, int type = TEXT_DYNAMIC); 124 127 125 128 static GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord); 126 129 static int powerOfTwo(int input); … … 139 142 TexCoord texCoord; //!< Texture-coordinates \todo fix this to have a struct 140 143 SDL_Rect posSize; //!< An SDL-Rectangle representing the position and size of the Text on the screen. 141 144 142 145 PNode* bindNode; //!< A node the Text is bind to. (if NULL thr node will not be bound to anything.) 143 146 }; … … 147 150 //////////// 148 151 //! A class to handle a Font of a certain ttf-File, Size and Color. 149 class Font 152 class Font : public BaseObject 150 153 { 151 154 friend class Text; … … 170 173 /** \returns the texture to the fast-texture */ 171 174 inline GLuint getFastTextureID(void) const {return fastTextureID;} 172 175 173 176 private: 174 177 int getMaxHeight(void); … … 193 196 unsigned int fontSize; //!< The size of the font in pixels. each Font has one size. 194 197 int renderStyle; //!< The Renderstyle 195 198 196 199 Glyph** glyphArray; //!< An Array of all the Glyphs stored in the Array of Glyphs. 197 200 GLuint fastTextureID; //!< The fast textureID. … … 205 208 /////////////////// 206 209 //! A singleton Class that operates as a Handler for generating and rendering Text in 2D 207 class TextEngine : public BaseObject 210 class TextEngine : public BaseObject 208 211 { 209 212 public: … … 213 216 214 217 Text* createText(const char* fontFile, 215 216 217 218 219 220 218 unsigned int fontSize = FONT_DEFAULT_SIZE, 219 int textType = TEXT_DYNAMIC, 220 Uint8 r = FONT_DEFAULT_COLOR_R, 221 Uint8 g = FONT_DEFAULT_COLOR_G, 222 Uint8 b = FONT_DEFAULT_COLOR_B); 223 221 224 void deleteText(Text* text); 222 225 void flush(void); 223 226 224 227 void draw(void) const; 225 228 226 229 void debug(void) const; 227 230
Note: See TracChangeset
for help on using the changeset viewer.