X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FFont.h;h=272b09fa857144e7e9acb6c9a6df824f9e162cf9;hb=a3ba4dc677ad7c92eeb78b20b642241563605c9d;hp=8b365252c79fdb966ef1b287850557808d0aad26;hpb=679b9e39c7680fd46482589f37f0a225032103b7;p=l2e.git diff --git a/src/graphics/Font.h b/src/graphics/Font.h index 8b36525..272b09f 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/Vector.h" +#include "../math/Vector.h" #include @@ -17,6 +10,9 @@ namespace graphics { class Font { +public: + 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,15 @@ public: public: int CharWidth() const { return sprite->Width(); } int CharHeight() const { return sprite->Height(); } - void DrawChar(char c, SDL_Surface *dest, const geometry::Vector &position) const; - void DrawString(const char *s, SDL_Surface *dest, const geometry::Vector &position, int maxChars = 0) const; - void DrawDigit(int d, SDL_Surface *dest, const geometry::Vector &position) const; - void DrawNumber(int n, SDL_Surface *dest, const geometry::Vector &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; } @@ -37,6 +38,7 @@ public: void SetRowOffset(int n) { rowOffset = n; } static void CreateTypeDescription(); + static void Construct(void *); private: const Sprite *sprite;