Changeset 3769 in orxonox.OLD for orxonox/branches/textEngine/src/lib/graphics/font/text_engine.h
- Timestamp:
- Apr 9, 2005, 10:32:18 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/lib/graphics/font/text_engine.h
r3768 r3769 93 93 { 94 94 public: 95 Text( void);95 Text(Font* font, int type = TEXT_DYNAMIC); 96 96 ~Text(void); 97 97 … … 101 101 void setText(const char* text); 102 102 void setPosition(int x, int y); 103 104 // Static Text 105 void setColor(Uint8 r, Uint8 g, Uint8 b); 106 void setStyle(char* renderStyle); 107 void createTexture(); 108 109 // Dynamic Text 110 111 103 112 104 113 virtual void draw(void); … … 113 122 GLuint texture; //!< A GL-texture to hold the text 114 123 TexCoord texCoord; //!< Texture-coordinates \todo fix this to have a struct 115 SDL_Rect posSize; //!< An SDL-Rectangle representing the position and size of the Text on the screen.124 SDL_Rect posSize; //!< An SDL-Rectangle representing the position and size of the Text on the screen. 116 125 117 126 PNode* bindNode; //!< A node the Text is bind to. (if NULL thr node will not be bound to anything.) … … 124 133 class Font 125 134 { 135 friend class Text; 126 136 public: 127 137 Font(const char* fontFile, unsigned int fontSize = FONT_DEFAULT_SIZE, … … 132 142 bool setFont(const char* fontFile); 133 143 void setSize(unsigned int fontSize); 134 void set Color(Uint8 r, Uint8 g, Uint8 b);144 void setFastColor(Uint8 r, Uint8 g, Uint8 b); 135 145 void setStyle(char* renderStyle); 136 146 137 147 inline Glyph** getGlyphArray(void) {return glyphArray;} 138 148 inline GLuint getFastTextureID(void) {return fastTextureID;} 139 void createTexture(void);140 149 141 150 … … 148 157 char* fontFile; //!< The fontfile from whitch the font was loaded. 149 158 unsigned int fontSize; //!< The size of the font in pixels. each Font has one size. 150 int renderStyle; //!< The Renderstyle159 int renderStyle; //!< The Renderstyle 151 160 152 161 Glyph** glyphArray; //!< An Array of all the Glyphs stored in the Array of Glyphs. 153 162 GLuint fastTextureID; //!< The fast textureID. 163 SDL_Color fastColor; //!< A Color for the fast Texture. 154 164 155 165 tList<Text>* textList; 156 Text* currentText;157 166 158 167 int getMaxHeight(void); … … 166 175 167 176 GLuint createFastTexture(); 168 GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord);169 177 170 178 void initGlyphs(Uint16 from, Uint16 count); 171 179 int findOptimalFastTextureSize(void); 172 static int powerOfTwo(int input);173 180 174 181 void debug(void); 175 182 176 183 }; 184 GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord); 185 int powerOfTwo(int input); 177 186 178 187 … … 187 196 virtual ~TextEngine(void); 188 197 198 Text* createText(const char* fontFile, 199 unsigned int fontSize = FONT_DEFAULT_SIZE, 200 Uint8 r = FONT_DEFAULT_COLOR_R, 201 Uint8 g = FONT_DEFAULT_COLOR_G, 202 Uint8 b = FONT_DEFAULT_COLOR_B); 203 204 void draw(void); 205 206 private: 207 TextEngine(void); 208 static TextEngine* singletonRef; 209 189 210 // general 190 211 static void enableFonts(void); … … 192 213 static bool checkVersion(void); 193 214 194 private: 195 TextEngine(void); 196 static TextEngine* singletonRef; 197 198 tList<Font>* fontList; 215 216 // tList<Font>* fontList; 217 tList<Text>* textList; 199 218 200 219 };
Note: See TracChangeset
for help on using the changeset viewer.