1 #ifndef GRAPHICS_FONT_H_
2 #define GRAPHICS_FONT_H_
5 #include "../math/Vector.h"
14 static const int TYPE_ID = 404;
17 explicit Font(const Sprite *sprite = 0, int colOffset = 0, int rowOffset = 0)
18 : sprite(sprite), colOffset(colOffset), rowOffset(rowOffset) {
23 int CharWidth() const { return sprite->Width(); }
24 int CharHeight() const { return sprite->Height(); }
25 int StringWidth(const char *) const;
26 int StringHeight(const char *) const;
28 void DrawChar(char c, SDL_Surface *dest, const math::Vector<int> &position) const;
29 void DrawString(const char *s, SDL_Surface *dest, const math::Vector<int> &position, int maxWidth = 0) const;
30 void DrawStringRight(const char *s, SDL_Surface *dest, const math::Vector<int> &position, int maxWidth = 0) const;
31 void DrawDigit(int d, SDL_Surface *dest, const math::Vector<int> &position) const;
32 void DrawNumber(int n, SDL_Surface *dest, const math::Vector<int> &position, int digits = 0) const;
33 void DrawNumberRight(int n, SDL_Surface *dest, const math::Vector<int> &position, int digits = 0) const;
36 void SetSprite(const Sprite *s) { sprite = s; }
37 void SetColOffset(int n) { colOffset = n; }
38 void SetRowOffset(int n) { rowOffset = n; }
40 static void CreateTypeDescription();
41 static void Construct(void *);