X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftextscroller.hpp;h=ede1e6bbf05765b80075b90bd28177765b8bb215;hb=1142f65fdd5ccc3309a3da31fb1a0e7d5d0829fe;hp=604af08941aee0f306ee8b38decab29f66f3f510;hpb=2536976bee590a6028443c6fe6032ca00450866f;p=supertux.git diff --git a/src/textscroller.hpp b/src/textscroller.hpp index 604af0894..ede1e6bbf 100644 --- a/src/textscroller.hpp +++ b/src/textscroller.hpp @@ -24,33 +24,39 @@ #include #include #include +#include #include "screen.hpp" -#include "video/font.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 { -private: +public: 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); + void draw(DrawingContext& context, const Rect& bbox, int layer); float get_height(); - static const std::vector split(const std::string& text, int line_length); + 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 @@ -66,7 +72,7 @@ public: void scrollup(); void pagedown(); void pageup(); - + private: size_t firstline; std::vector lines; @@ -75,6 +81,9 @@ private: Surface* arrow_scrolldown; }; +/** + * Screen that displays intro text, extro text, etc. + */ class TextScroller : public Screen { public: @@ -85,6 +94,10 @@ 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; @@ -92,7 +105,7 @@ private: std::auto_ptr background; std::vector lines; float scroll; + bool fading; }; #endif -