4 * Created on: Aug 8, 2012
8 #ifndef GRAPHICS_FONT_H_
9 #define GRAPHICS_FONT_H_
12 #include "../geometry/Vector.h"
21 static const int TYPE_ID = 404;
24 explicit Font(const Sprite *sprite = 0, int colOffset = 0, int rowOffset = 0)
25 : sprite(sprite), colOffset(colOffset), rowOffset(rowOffset) {
30 int CharWidth() const { return sprite->Width(); }
31 int CharHeight() const { return sprite->Height(); }
32 void DrawChar(char c, SDL_Surface *dest, const geometry::Vector<int> &position) const;
33 void DrawString(const char *s, SDL_Surface *dest, const geometry::Vector<int> &position, int maxChars = 0) const;
34 void DrawStringRight(const char *s, SDL_Surface *dest, const geometry::Vector<int> &position, int maxChars = 0) const;
35 void DrawDigit(int d, SDL_Surface *dest, const geometry::Vector<int> &position) const;
36 void DrawNumber(int n, SDL_Surface *dest, const geometry::Vector<int> &position, int digits = 0) const;
37 void DrawNumberRight(int n, SDL_Surface *dest, const geometry::Vector<int> &position, int digits = 0) const;
40 void SetSprite(const Sprite *s) { sprite = s; }
41 void SetColOffset(int n) { colOffset = n; }
42 void SetRowOffset(int n) { rowOffset = n; }
44 static void CreateTypeDescription();
45 static void Construct(void *);
56 #endif /* GRAPHICS_FONT_H_ */