X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftextscroller.hpp;h=5198eb9222fd29cebaf58d46c04876a58cd42662;hb=d4b281559d45406a5d07cf04d89142cdeb90b114;hp=905055e41facff0e2260355e6d7f162aeba0b53a;hpb=07ddaed2a657e4d2a3d038fed223fc5827159caf;p=supertux.git diff --git a/src/textscroller.hpp b/src/textscroller.hpp index 905055e41..5198eb922 100644 --- a/src/textscroller.hpp +++ b/src/textscroller.hpp @@ -26,9 +26,33 @@ #include #include "screen.hpp" +#include "math/vector.hpp" class DrawingContext; class Surface; +class Font; + +/** + * Helper class for InfoBox: Represents a line of text + */ +class InfoBoxLine +{ +private: + enum LineType { NORMAL, NORMAL_LEFT, SMALL, HEADING, REFERENCE, IMAGE}; + LineType lineType; + Font* font; + std::string text; + Surface* image; + +public: + InfoBoxLine(char format_char, const std::string& text); + ~InfoBoxLine(); + + void draw(DrawingContext& context, const Vector& position, int layer); + float get_height(); + + static const std::vector split(const std::string& text, int line_length); +}; /** This class is displaying a box with information text inside the game */ @@ -43,10 +67,10 @@ public: void scrollup(); void pagedown(); void pageup(); - + private: size_t firstline; - std::vector lines; + std::vector lines; std::map images; Surface* arrow_scrollup; Surface* arrow_scrolldown; @@ -67,10 +91,9 @@ private: float speed; std::string music; std::auto_ptr background; - std::vector lines; - std::map images; + std::vector lines; float scroll; + bool fading; }; #endif -