X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ftextscroller.hpp;h=604af08941aee0f306ee8b38decab29f66f3f510;hb=9bc1e444b1961c5399ab9ce06542c4de7c7a0ec5;hp=1bdefbf93f6f891e3896eded951d8777b6e084c1;hpb=1486ceaaf9dd7a9d2d7e3654550b9a2768df2a56;p=supertux.git diff --git a/src/textscroller.hpp b/src/textscroller.hpp index 1bdefbf93..604af0894 100644 --- a/src/textscroller.hpp +++ b/src/textscroller.hpp @@ -1,7 +1,7 @@ // $Id$ -// +// // SuperTux -// Copyright (C) 2005 Matthias Braun +// Copyright (C) 2006 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -26,10 +26,33 @@ #include #include "screen.hpp" +#include "video/font.hpp" class DrawingContext; class Surface; +/** + * 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 */ class InfoBox @@ -46,7 +69,7 @@ public: private: size_t firstline; - std::vector lines; + std::vector lines; std::map images; Surface* arrow_scrollup; Surface* arrow_scrolldown; @@ -67,8 +90,7 @@ private: float speed; std::string music; std::auto_ptr background; - std::vector lines; - std::map images; + std::vector lines; float scroll; };