SDL_ttf++
C++wrapperfortheSDL_ttflibrary.
|
00001 00021 #ifndef SDL_TTF_GLYPH_H 00022 #define SDL_TTF_GLYPH_H 00023 00024 #include <stdexcept> 00025 00026 #include <SDL_ttf.h> 00027 00028 namespace sdl { 00029 namespace ttf { 00030 using namespace std; 00031 00036 struct Glyph { 00045 template<class Font> 00046 Glyph (const Font& font, char c) 00047 : minx_ (), maxx_ (), miny_ (), maxy_ (), advance_ () { 00048 if (!TTF_GlyphMetrics (*font, c, &minx_, &maxx_, &miny_, &maxy_, &advance_)) 00049 throw runtime_error (TTF_GetError ()); 00050 }; 00051 00057 int minx () const { return minx_; }; 00058 00064 int maxx () const { return maxx_; }; 00065 00071 int miny () const { return miny_; }; 00072 00078 int maxy () const { return maxy_; }; 00079 00085 int advance () const { return advance_; }; 00086 00087 private: 00091 int minx_; 00092 00096 int maxx_; 00097 00101 int miny_; 00102 00106 int maxy_; 00107 00111 int advance_; 00112 }; //Glyph 00113 }; //ttf 00114 }; //sdl 00115 00116 #endif //SDL_TTF_GLYPH_H 00117