2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef HEADER_SUPERTUX_SUPERTUX_TEXTSCROLLER_HPP
18 #define HEADER_SUPERTUX_SUPERTUX_TEXTSCROLLER_HPP
23 #include "supertux/screen.hpp"
24 #include "video/color.hpp"
31 * Helper class for InfoBox: Represents a line of text
36 enum LineType { NORMAL, NORMAL_LEFT, SMALL, HEADING, REFERENCE, IMAGE};
38 InfoBoxLine(char format_char, const std::string& text);
41 void draw(DrawingContext& context, const Rect& bbox, int layer);
44 static const std::vector<InfoBoxLine*> split(const std::string& text, float width);
47 InfoBoxLine::LineType lineType;
54 InfoBoxLine(const InfoBoxLine&);
55 InfoBoxLine& operator=(const InfoBoxLine&);
58 /** This class is displaying a box with information text inside the game
63 InfoBox(const std::string& text);
66 void draw(DrawingContext& context);
74 std::vector<InfoBoxLine*> lines;
75 std::map<std::string, Surface*> images;
76 Surface* arrow_scrollup;
77 Surface* arrow_scrolldown;
80 InfoBox(const InfoBox&);
81 InfoBox& operator=(const InfoBox&);
85 * Screen that displays intro text, extro text, etc.
87 class TextScroller : public Screen
90 TextScroller(const std::string& file);
91 virtual ~TextScroller();
94 void draw(DrawingContext& context);
95 void update(float elapsed_time);
97 static Color small_color;
98 static Color heading_color;
99 static Color reference_color;
100 static Color normal_color;
106 std::auto_ptr<Surface> background;
107 std::vector<InfoBoxLine*> lines;
112 TextScroller(const TextScroller&);
113 TextScroller& operator=(const TextScroller&);