Changeset 4458 in orxonox.OLD for orxonox/trunk/src/lib/graphics/text_engine.h
- Timestamp:
- Jun 1, 2005, 11:51:44 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/text_engine.h
r3845 r4458 60 60 struct TexCoord 61 61 { 62 float minU;//!< The minimum U-Coordinate63 float maxU;//!< The maximum U-Coordinate64 float minV;//!< The minimum V-Coordinate65 float maxV;//!< The maximum V-Coordinate62 float minU; //!< The minimum U-Coordinate 63 float maxU; //!< The maximum U-Coordinate 64 float minV; //!< The minimum V-Coordinate 65 float maxV; //!< The maximum V-Coordinate 66 66 }; 67 67 … … 73 73 { 74 74 // Glyph-specific (size and so on) 75 Uint16 character;//!< The character76 int minX;//!< The minimum distance from the origin in X77 int maxX;//!< The maximum distance from the origin in X78 int minY;//!< The minimum distance from the origin in Y79 int maxY;//!< The maximum distance from the origin in Y80 int width;//!< The width of the Glyph81 int height;//!< The height of the Glyph82 int bearingX;//!< How much is right of the Origin83 int bearingY;//!< How much is above the Origin84 int advance;//!< How big a Glyph would be in monospace-mode75 Uint16 character; //!< The character 76 int minX; //!< The minimum distance from the origin in X 77 int maxX; //!< The maximum distance from the origin in X 78 int minY; //!< The minimum distance from the origin in Y 79 int maxY; //!< The maximum distance from the origin in Y 80 int width; //!< The width of the Glyph 81 int height; //!< The height of the Glyph 82 int bearingX; //!< How much is right of the Origin 83 int bearingY; //!< How much is above the Origin 84 int advance; //!< How big a Glyph would be in monospace-mode 85 85 86 86 // OpenGL-specific 87 87 // TexCoord texCoord; //!< A Texture Coordinate for this glyph. 88 GLuint displayList; 88 GLuint displayList; //!< DiplayList to render this Glyph. 89 89 }; 90 90 … … 110 110 // Static Text 111 111 void setColor(Uint8 r, Uint8 g, Uint8 b); 112 void setStyle(char* renderStyle);113 112 114 113 void createTexture(); … … 120 119 private: 121 120 Text(Font* font, int type = TEXT_DYNAMIC); 122 123 Font* font; 124 125 int type; //!< The type of this Font. 126 char* text; //!< The text to display 127 SDL_Color color; //!< The color of the font. 128 TEXT_ALIGNMENT alignment; //!< The aignment of the text. 129 float blending; //!< The blending intensity. 121 122 static GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord); 123 static int powerOfTwo(int input); 124 125 private: 126 Font* font; //!< Font of this text 127 128 int type; //!< The type of this Font. 129 char* text; //!< The text to display 130 SDL_Color color; //!< The color of the font. 131 TEXT_ALIGNMENT alignment; //!< The aignment of the text. 132 float blending; //!< The blending intensity. 133 130 134 // placement in openGL 131 GLuint texture;//!< A GL-texture to hold the text132 TexCoord texCoord;//!< Texture-coordinates \todo fix this to have a struct133 SDL_Rect posSize;//!< An SDL-Rectangle representing the position and size of the Text on the screen.134 135 PNode* bindNode;//!< A node the Text is bind to. (if NULL thr node will not be bound to anything.)135 GLuint texture; //!< A GL-texture to hold the text 136 TexCoord texCoord; //!< Texture-coordinates \todo fix this to have a struct 137 SDL_Rect posSize; //!< An SDL-Rectangle representing the position and size of the Text on the screen. 138 139 PNode* bindNode; //!< A node the Text is bind to. (if NULL thr node will not be bound to anything.) 136 140 }; 137 141 … … 143 147 { 144 148 friend class Text; 149 145 150 public: 146 Font(const char* fontFile, unsigned int fontSize = FONT_DEFAULT_SIZE, 147 Uint8 r = FONT_DEFAULT_COLOR_R, Uint8 g = FONT_DEFAULT_COLOR_G, Uint8 b = FONT_DEFAULT_COLOR_B); 151 Font(const char* fontFile, 152 unsigned int fontSize = FONT_DEFAULT_SIZE, 153 Uint8 r = FONT_DEFAULT_COLOR_R, 154 Uint8 g = FONT_DEFAULT_COLOR_G, 155 Uint8 b = FONT_DEFAULT_COLOR_B); 156 148 157 virtual ~Font(); 149 158 … … 152 161 void setSize(unsigned int fontSize); 153 162 void setFastColor(Uint8 r, Uint8 g, Uint8 b); 154 void setStyle(char* renderStyle); 155 156 inline Glyph** getGlyphArray(void) {return glyphArray;} 157 inline GLuint getFastTextureID(void) {return fastTextureID;} 158 159 160 private: 161 // general purpose 162 GLdouble projMat[16]; //!< The Projection Matrix 163 164 // information about the Font 165 TTF_Font* font; //!< The font we use for this. 166 char* fontFile; //!< The fontfile from whitch the font was loaded. 167 unsigned int fontSize; //!< The size of the font in pixels. each Font has one size. 168 int renderStyle; //!< The Renderstyle 169 170 Glyph** glyphArray; //!< An Array of all the Glyphs stored in the Array of Glyphs. 171 GLuint fastTextureID; //!< The fast textureID. 172 SDL_Color fastColor; //!< A Color for the fast Texture. 173 174 tList<Text>* textList; 175 163 void setStyle(const char* renderStyle); 164 165 /** \returns a Pointer to the Array of Glyphs */ 166 inline Glyph** getGlyphArray(void) const {return glyphArray;} 167 /** \returns the texture to the fast-texture */ 168 inline GLuint getFastTextureID(void) const {return fastTextureID;} 169 170 private: 176 171 int getMaxHeight(void); 177 172 int getMaxAscent(void); … … 186 181 void debug(void); 187 182 188 }; 189 GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord); 190 int powerOfTwo(int input); 191 183 private: 184 // general purpose 185 GLdouble projMat[16]; //!< The Projection Matrix 186 187 // information about the Font 188 TTF_Font* font; //!< The font we use for this. 189 char* fontFile; //!< The fontfile from whitch the font was loaded. 190 unsigned int fontSize; //!< The size of the font in pixels. each Font has one size. 191 int renderStyle; //!< The Renderstyle 192 193 Glyph** glyphArray; //!< An Array of all the Glyphs stored in the Array of Glyphs. 194 GLuint fastTextureID; //!< The fast textureID. 195 SDL_Color fastColor; //!< A Color for the fast Texture. 196 197 tList<Text>* textList; //!< A list of texts this Font is mapped to. 198 }; 192 199 193 200 /////////////////// … … 224 231 static bool checkVersion(void); 225 232 226 233 private: 227 234 // tList<Font>* fontList; 228 tList<Text>* textList;235 tList<Text>* textList; //!< a list of all texts of the textEngine 229 236 230 237 };
Note: See TracChangeset
for help on using the changeset viewer.