Added inverse functions for speed. Might be usefull for someone that wants to make...
[supertux.git] / src / text.h
1 //
2 // C Interface: text
3 //
4 // Description: 
5 //
6 //
7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2004
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12
13 #ifndef SUPERTUX_TEXT_H
14 #define SUPERTUX_TEXT_H
15
16 #include "texture.h"
17
18
19 /* Kinds of texts. */
20 enum {
21    TEXT_TEXT,
22    TEXT_NUM
23 };
24
25 enum TextHAlign {
26    A_LEFT,
27    A_HMIDDLE,
28    A_RIGHT,
29 };
30
31 enum TextVAlign {
32    A_TOP,
33    A_VMIDDLE,
34    A_BOTTOM,
35 };
36
37 /* Text type */
38 class Text
39 {
40  public:
41   Surface* chars;
42   Surface* shadow_chars;
43   int kind;
44   int w;
45   int h;
46  public:
47   Text(const std::string& file, int kind, int w, int h);
48   ~Text();
49
50   void draw(const char* text, int x, int y, int shadowsize = 1, int update = NO_UPDATE);
51   void draw_chars(Surface* pchars, const char* text, int x, int y, int update = NO_UPDATE);
52   void drawf(const char* text, int x, int y, TextHAlign halign, TextVAlign valign, int shadowsize, int update = NO_UPDATE);
53   void draw_align(const char* text, int x, int y, TextHAlign halign, TextVAlign valign, int shadowsize = 1, int update = NO_UPDATE);
54   void erasetext(const char * text, int x, int y, Surface* surf, int update, int shadowsize);
55   void erasecenteredtext(const char * text, int y, Surface* surf, int update, int shadowsize);
56 };
57
58 #endif /*SUPERTUX_TEXT_H*/
59