]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Font.h
pass point as reference in graphics Draw functions
[l2e.git] / src / graphics / Font.h
1 /*
2  * Font.h
3  *
4  *  Created on: Aug 8, 2012
5  *      Author: holy
6  */
7
8 #ifndef GRAPHICS_FONT_H_
9 #define GRAPHICS_FONT_H_
10
11 #include "Sprite.h"
12 #include "../geometry/Point.h"
13
14 #include <SDL.h>
15
16 namespace graphics {
17
18 class Font {
19
20 public:
21         explicit Font(const Sprite *sprite, int colOffset = 0, int rowOffset = 0)
22         : sprite(sprite), colOffset(colOffset), rowOffset(rowOffset) {
23
24         }
25
26 public:
27         int CharWidth() const { return sprite->Width(); }
28         int CharHeight() const { return sprite->Height(); }
29         void DrawChar(char c, SDL_Surface *dest, const geometry::Point<int> &position) const;
30         void DrawString(const char *s, SDL_Surface *dest, const geometry::Point<int> &position, int maxChars = 0) const;
31         void DrawDigit(int d, SDL_Surface *dest, const geometry::Point<int> &position) const;
32         void DrawNumber(int n, SDL_Surface *dest, const geometry::Point<int> &position, int digits = 0) const;
33
34 private:
35         const Sprite *sprite;
36         int colOffset;
37         int rowOffset;
38
39 };
40
41 }
42
43 #endif /* GRAPHICS_FONT_H_ */