]> git.localhorst.tv Git - l2e.git/blobdiff - src/graphics/Font.h
added simple font implementation
[l2e.git] / src / graphics / Font.h
diff --git a/src/graphics/Font.h b/src/graphics/Font.h
new file mode 100644 (file)
index 0000000..0294d25
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Font.h
+ *
+ *  Created on: Aug 8, 2012
+ *      Author: holy
+ */
+
+#ifndef GRAPHICS_FONT_H_
+#define GRAPHICS_FONT_H_
+
+#include "Sprite.h"
+#include "../geometry/Point.h"
+
+#include <SDL.h>
+
+namespace graphics {
+
+class Font {
+
+public:
+       explicit Font(const Sprite *sprite, int digitsCol = 0, int digitsRow = 0) : sprite(sprite), digitsCol(digitsCol), digitsRow(digitsRow) { }
+
+public:
+       int CharWidth() const { return sprite->Width(); }
+       int CharHeight() const { return sprite->Height(); }
+       void DrawDigit(int digit, SDL_Surface *dest, geometry::Point<int> position) const;
+       void DrawNumber(int number, SDL_Surface *dest, geometry::Point<int> position, int digits = 0) const;
+
+private:
+       const Sprite *sprite;
+       int digitsCol;
+       int digitsRow;
+
+};
+
+}
+
+#endif /* GRAPHICS_FONT_H_ */