#include "texture.h"
-/* Text type */
-typedef struct text_type
- {
- texture_type chars[78];
- }
-text_type;
+/* Kinds of texts. */
enum {
+ TEXT_TEXT,
+ TEXT_NUM
+};
+
+enum TextHAlign {
A_LEFT,
A_HMIDDLE,
A_RIGHT,
+};
+
+enum TextVAlign {
A_TOP,
A_VMIDDLE,
A_BOTTOM,
- A_NONE
};
-void text_load(text_type* ptext, char* file);
-void text_draw(text_type* ptext, char* text, int x, int y, int shadowsize, int update);
-void text_drawf(text_type* ptext, char* text, int x, int y, int halign, int valign, int shadowsize, int update);
-void text_free(text_type* ptext);
+/* Text type */
+class Text
+{
+ public:
+ Surface* chars;
+ Surface* shadow_chars;
+ int kind;
+ int w;
+ int h;
+ public:
+ Text(const std::string& file, int kind, int w, int h);
+ ~Text();
+
+ void draw(const char* text, int x, int y, int shadowsize, int update = NO_UPDATE);
+ void draw_chars(Surface* pchars, const char* text, int x, int y, int update = NO_UPDATE);
+ void drawf(const char* text, int x, int y, TextHAlign halign, TextVAlign valign, int shadowsize, int update = NO_UPDATE);
+ void draw_align(const char* text, int x, int y, TextHAlign halign, TextVAlign valign, int shadowsize, int update = NO_UPDATE);
+ void erasetext(const char * text, int x, int y, Surface* surf, int update, int shadowsize);
+ void erasecenteredtext(const char * text, int y, Surface* surf, int update, int shadowsize);
+};
#endif /*SUPERTUX_TEXT_H*/