Changeset 9718 in orxonox.OLD for branches/new_class_id/src/lib/graphics/text_engine
- Timestamp:
- Sep 1, 2006, 11:56:54 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/graphics/text_engine
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/text_engine/font.cc
r9715 r9718 139 139 } 140 140 141 FontData Pointer Font::defaultFontData(NULL);141 FontData::Pointer Font::defaultFontData(NULL); 142 142 143 143 /** … … 147 147 { 148 148 // temporarily create a Font. 149 Font::defaultFontData = FontData Pointer(new FontData);149 Font::defaultFontData = FontData::Pointer(new FontData); 150 150 // apply the Data. 151 151 Font::defaultFontData = Font(font_xpm).data; … … 160 160 bool Font::loadFontFromTTF(const std::string& fontFile, unsigned int renderSize) 161 161 { 162 this->data = FontData Pointer (new FontData());162 this->data = FontData::Pointer (new FontData()); 163 163 bool retVal = this->data->loadFontFromTTF(fontFile, renderSize); 164 164 if (!retVal) … … 175 175 bool Font::loadFontFromSDL_Surface(SDL_Surface* surface) 176 176 { 177 this->data = FontData Pointer (new FontData());177 this->data = FontData::Pointer (new FontData()); 178 178 bool retVal = this->data->loadFontFromSDL_Surface(surface); 179 179 if (!retVal) … … 197 197 198 198 199 void Font::setTexture(const TextureData Pointer& texDataPointer)199 void Font::setTexture(const TextureData::Pointer& texDataPointer) 200 200 { 201 201 this->setDiffuseMap(texDataPointer); -
branches/new_class_id/src/lib/graphics/text_engine/font.h
r9715 r9718 20 20 { 21 21 ObjectListDeclaration(Font); 22 22 public: 23 typedef FontData::Glyph Glyph; 23 24 public: 24 25 Font(); … … 40 41 41 42 /** @returns a Pointer to the Array of Glyphs */ 42 inline Glyph**getGlyphArray() const { return this->data->getGlyphArray(); };43 inline const Glyph* const * const getGlyphArray() const { return this->data->getGlyphArray(); }; 43 44 44 45 inline int getMaxHeight() const { return data->getMaxHeight(); }; … … 55 56 static void initDefaultFont(); 56 57 57 void setTexture(const TextureData Pointer& texDataPointer);58 void setTexture(const TextureData::Pointer& texDataPointer); 58 59 59 60 private: 60 FontData Pointerdata; //!< A Data-Pointer to a Font.61 FontData::Pointer data; //!< A Data-Pointer to a Font. 61 62 62 static FontData PointerdefaultFontData; //!< a default font, that is used, if other fonts were unable to be loaded.63 static FontData::Pointer defaultFontData; //!< a default font, that is used, if other fonts were unable to be loaded. 63 64 }; 64 65 -
branches/new_class_id/src/lib/graphics/text_engine/font_data.h
r8768 r9718 26 26 #define FONT_DEFAULT_RENDER_SIZE 50 //!< At what Resolution to render fonts. 27 27 28 class FontData 29 { 30 31 32 public: 33 28 34 //! A struct for handling glyphs 29 35 /** 30 36 * a Glyph is one letter of a certain font 31 37 */ 32 struct Glyph33 {38 struct Glyph 39 { 34 40 // Glyph-specific (size and so on) 35 Uint16 character; //!< The character36 float minX; //!< The minimum distance from the origin in X37 float maxX; //!< The maximum distance from the origin in X38 float minY; //!< The minimum distance from the origin in Y39 float maxY; //!< The maximum distance from the origin in Y40 float width; //!< The width of the Glyph41 float height; //!< The height of the Glyph42 float bearingX; //!< How much is right of the Origin43 float bearingY; //!< How much is above the Origin44 float advance; //!< How big a Glyph would be in monospace-mode41 Uint16 character; //!< The character 42 float minX; //!< The minimum distance from the origin in X 43 float maxX; //!< The maximum distance from the origin in X 44 float minY; //!< The minimum distance from the origin in Y 45 float maxY; //!< The maximum distance from the origin in Y 46 float width; //!< The width of the Glyph 47 float height; //!< The height of the Glyph 48 float bearingX; //!< How much is right of the Origin 49 float bearingY; //!< How much is above the Origin 50 float advance; //!< How big a Glyph would be in monospace-mode 45 51 46 GLfloat texCoord[4]; //!< Texture coordinates: 0:left, 1:right, 2: top, 3: bottom.47 };52 GLfloat texCoord[4]; //!< Texture coordinates: 0:left, 1:right, 2: top, 3: bottom. 53 }; 48 54 49 50 class FontData 51 { 55 typedef CountPointer<FontData> Pointer; 52 56 public: 53 57 FontData(); … … 61 65 62 66 /** @returns a Pointer to the Array of Glyphs */ 63 inline Glyph**getGlyphArray() const { return this->glyphArray; };67 inline const Glyph* const * const getGlyphArray() const { return this->glyphArray; }; 64 68 65 69 int getMaxHeight() const { return maxHeight; }; … … 68 72 69 73 /** @returns the Texture-Data of this FontData */ 70 const TextureData Pointer& textureData() const { return texData; };74 const TextureData::Pointer& textureData() const { return texData; }; 71 75 72 76 bool rebuild() { return texData->rebuild(); }; … … 91 95 int maxDescent; //!< Max Desent of the Font. 92 96 93 TextureData Pointer texData;97 TextureData::Pointer texData; 94 98 }; 95 99 96 typedef CountPointer<FontData> FontDataPointer;97 98 100 #endif /* _FONT_DATA_H */ -
branches/new_class_id/src/lib/graphics/text_engine/limited_width_text.cc
r9715 r9718 76 76 glRotatef(this->getAbsDir2D(), 0, 0, 1); 77 77 78 Glyph* tmpGlyph;78 const Font::Glyph* tmpGlyph; 79 79 float posX = 0.0f; 80 80 glBegin(GL_QUADS); -
branches/new_class_id/src/lib/graphics/text_engine/multi_line_text.cc
r9715 r9718 80 80 glRotatef(this->getAbsDir2D(), 0, 0, 1); 81 81 82 Glyph* tmpGlyph;82 const Font::Glyph* tmpGlyph; 83 83 float posX = 0.0f; 84 84 float posY = 0.0f; -
branches/new_class_id/src/lib/graphics/text_engine/text.cc
r9715 r9718 235 235 glRotatef(this->getAbsDir2D(), 0, 0, 1); 236 236 237 Glyph* tmpGlyph;237 const Font::Glyph* tmpGlyph; 238 238 float posX = 0.0f; 239 239 glBegin(GL_QUADS);
Note: See TracChangeset
for help on using the changeset viewer.