]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Font.h
added simple font implementation
[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 digitsCol = 0, int digitsRow = 0) : sprite(sprite), digitsCol(digitsCol), digitsRow(digitsRow) { }
22
23 public:
24         int CharWidth() const { return sprite->Width(); }
25         int CharHeight() const { return sprite->Height(); }
26         void DrawDigit(int digit, SDL_Surface *dest, geometry::Point<int> position) const;
27         void DrawNumber(int number, SDL_Surface *dest, geometry::Point<int> position, int digits = 0) const;
28
29 private:
30         const Sprite *sprite;
31         int digitsCol;
32         int digitsRow;
33
34 };
35
36 }
37
38 #endif /* GRAPHICS_FONT_H_ */