X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FFont.h;h=d435266e084d7476378996d19ce0451ca643bd29;hb=7582af9fc5f909ef38509c0421e9dbea3c005764;hp=70f451c2c864b6cdc8b5fd0a81a2f08f5137324c;hpb=c182086fbc039ec2b943b4d109597ccc481b7ba4;p=l2e.git diff --git a/src/graphics/Font.h b/src/graphics/Font.h index 70f451c..d435266 100644 --- a/src/graphics/Font.h +++ b/src/graphics/Font.h @@ -1,15 +1,8 @@ -/* - * 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 "../math/Vector.h" #include @@ -18,7 +11,10 @@ namespace graphics { class Font { public: - explicit Font(const Sprite *sprite, int colOffset = 0, int rowOffset = 0) + static const int TYPE_ID = 404; + +public: + explicit Font(const Sprite *sprite = 0, int colOffset = 0, int rowOffset = 0) : sprite(sprite), colOffset(colOffset), rowOffset(rowOffset) { } @@ -26,10 +22,23 @@ public: public: int CharWidth() const { return sprite->Width(); } int CharHeight() const { return sprite->Height(); } - void DrawChar(char c, SDL_Surface *dest, geometry::Point position) const; - void DrawString(const char *s, SDL_Surface *dest, geometry::Point position, int maxChars = 0) const; - void DrawDigit(int d, SDL_Surface *dest, geometry::Point position) const; - void DrawNumber(int n, SDL_Surface *dest, geometry::Point position, int digits = 0) const; + int StringWidth(const char *) const; + int StringHeight(const char *) const; + + void DrawChar(char c, SDL_Surface *dest, const math::Vector &position) const; + void DrawString(const char *s, SDL_Surface *dest, const math::Vector &position, int maxWidth = 0) const; + void DrawStringRight(const char *s, SDL_Surface *dest, const math::Vector &position, int maxWidth = 0) const; + void DrawDigit(int d, SDL_Surface *dest, const math::Vector &position) const; + void DrawNumber(int n, SDL_Surface *dest, const math::Vector &position, int digits = 0) const; + void DrawNumberRight(int n, SDL_Surface *dest, const math::Vector &position, int digits = 0) const; + +public: + void SetSprite(const Sprite *s) { sprite = s; } + void SetColOffset(int n) { colOffset = n; } + void SetRowOffset(int n) { rowOffset = n; } + + static void CreateTypeDescription(); + static void Construct(void *); private: const Sprite *sprite; @@ -40,4 +49,4 @@ private: } -#endif /* GRAPHICS_FONT_H_ */ +#endif