support for centered text in scripts
[supertux.git] / src / object / text_object.hpp
1 #ifndef __TEXTOBJECT_H__
2 #define __TEXTOBJECT_H__
3
4 #include "game_object.hpp"
5 #include "scripting/text.hpp"
6
7 class Font;
8
9 /** A text object intended for scripts that want to tell a story */
10 class TextObject : public GameObject, public Scripting::Text
11 {
12 public:
13   TextObject();
14   virtual ~TextObject();
15
16   void set_text(const std::string& text);
17   void set_font(const std::string& name);
18   void fade_in(float fadetime);
19   void fade_out(float fadetime);
20   void set_visible(bool visible);
21   void set_centered(bool centered);
22   bool is_visible();
23
24   void draw(DrawingContext& context);
25   void update(float elapsed_time);
26
27 private:
28   Font* font;
29   std::string text;
30   float fading;
31   float fadetime;
32   bool visible;
33   bool centered;
34 };
35
36 #endif
37