X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftextscroller.hpp;h=b232b18956f9a8d88e9e5a134ba35e594263db11;hb=accd4212a21bdce9ab9ad9e802d949a1828e2987;hp=b9c534c8e58061eeeb55a7c8dcef58d1b38d1433;hpb=54e868d71846a48c7f49f370a1bc05bf944e9181;p=supertux.git diff --git a/src/textscroller.hpp b/src/textscroller.hpp index b9c534c8e..b232b1895 100644 --- a/src/textscroller.hpp +++ b/src/textscroller.hpp @@ -24,33 +24,37 @@ #include #include #include +#include #include "screen.hpp" -#include "video/font.hpp" +#include "math/vector.hpp" +#include "math/rect.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; + std::string text; + Surface* image; }; /** This class is displaying a box with information text inside the game @@ -66,7 +70,7 @@ public: void scrollup(); void pagedown(); void pageup(); - + private: size_t firstline; std::vector lines; @@ -75,6 +79,9 @@ private: Surface* arrow_scrolldown; }; +/** + * Screen that displays intro text, extro text, etc. + */ class TextScroller : public Screen { public: @@ -96,4 +103,3 @@ private: }; #endif -