X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftextscroller.hpp;h=ede1e6bbf05765b80075b90bd28177765b8bb215;hb=dd71f2011901da40efa6bd4519c215253283acbd;hp=905055e41facff0e2260355e6d7f162aeba0b53a;hpb=07ddaed2a657e4d2a3d038fed223fc5827159caf;p=supertux.git diff --git a/src/textscroller.hpp b/src/textscroller.hpp index 905055e41..ede1e6bbf 100644 --- a/src/textscroller.hpp +++ b/src/textscroller.hpp @@ -24,11 +24,40 @@ #include #include #include +#include #include "screen.hpp" +#include "math/vector.hpp" +#include "math/rect.hpp" +#include "video/color.hpp" class DrawingContext; class Surface; +class Font; + +/** + * Helper class for InfoBox: Represents a line of text + */ +class InfoBoxLine +{ +public: + enum LineType { NORMAL, NORMAL_LEFT, SMALL, HEADING, REFERENCE, IMAGE}; + + InfoBoxLine(char format_char, const std::string& text); + ~InfoBoxLine(); + + void draw(DrawingContext& context, const Rect& bbox, int layer); + float get_height(); + + static const std::vector split(const std::string& text, float width); + +private: + InfoBoxLine::LineType lineType; + Font* font; + Color color; + std::string text; + Surface* image; +}; /** This class is displaying a box with information text inside the game */ @@ -43,15 +72,18 @@ 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; }; +/** + * Screen that displays intro text, extro text, etc. + */ class TextScroller : public Screen { public: @@ -62,15 +94,18 @@ public: void draw(DrawingContext& context); void update(float elapsed_time); + static Color small_color; + static Color heading_color; + static Color reference_color; + static Color normal_color; private: float defaultspeed; float speed; std::string music; std::auto_ptr background; - std::vector lines; - std::map images; + std::vector lines; float scroll; + bool fading; }; #endif -