]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Font.h
removed stupid file headers that eclipse put in
[l2e.git] / src / graphics / Font.h
1 #ifndef GRAPHICS_FONT_H_
2 #define GRAPHICS_FONT_H_
3
4 #include "Sprite.h"
5 #include "../geometry/Vector.h"
6
7 #include <SDL.h>
8
9 namespace graphics {
10
11 class Font {
12
13 public:
14         static const int TYPE_ID = 404;
15
16 public:
17         explicit Font(const Sprite *sprite = 0, int colOffset = 0, int rowOffset = 0)
18         : sprite(sprite), colOffset(colOffset), rowOffset(rowOffset) {
19
20         }
21
22 public:
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;
27
28         void DrawChar(char c, SDL_Surface *dest, const geometry::Vector<int> &position) const;
29         void DrawString(const char *s, SDL_Surface *dest, const geometry::Vector<int> &position, int maxWidth = 0) const;
30         void DrawStringRight(const char *s, SDL_Surface *dest, const geometry::Vector<int> &position, int maxWidth = 0) const;
31         void DrawDigit(int d, SDL_Surface *dest, const geometry::Vector<int> &position) const;
32         void DrawNumber(int n, SDL_Surface *dest, const geometry::Vector<int> &position, int digits = 0) const;
33         void DrawNumberRight(int n, SDL_Surface *dest, const geometry::Vector<int> &position, int digits = 0) const;
34
35 public:
36         void SetSprite(const Sprite *s) { sprite = s; }
37         void SetColOffset(int n) { colOffset = n; }
38         void SetRowOffset(int n) { rowOffset = n; }
39
40         static void CreateTypeDescription();
41         static void Construct(void *);
42
43 private:
44         const Sprite *sprite;
45         int colOffset;
46         int rowOffset;
47
48 };
49
50 }
51
52 #endif /* GRAPHICS_FONT_H_ */