1// SuperTux
2// Copyright (C) 2018 Nir <goproducti@gmail.com>
3//
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.
8//
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.
13//
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/>.
16
17#ifndef HEADER_SUPERTUX_SCRIPTING_TEXT_ARRAY_HPP
18#define HEADER_SUPERTUX_SCRIPTING_TEXT_ARRAY_HPP
19
20#ifndef SCRIPTING_API
21#include <string>
22
23#include "scripting/game_object.hpp"
24
25class TextArrayObject;
26#endif
27
28
29namespace scripting {
30
31/**
32 * A text array intended for scripts with narration
33 */
34class TextArray final
35#ifndef SCRIPTING_API
36 : public GameObject<::TextArrayObject>
37#endif
38{
39#ifndef SCRIPTING_API
40public:
41 using GameObject::GameObject;
42
43private:
44 TextArray(const TextArray&) = delete;
45 TextArray& operator=(const TextArray&) = delete;
46#endif
47
48public:
49 /*
50 * The text array api.
51 * @see: text_array_object.hpp
52 */
53 void clear();
54 void add_text(const std::string& text);
55 void add_text_duration(const std::string& text, float duration);
56 void set_text_index(int index_);
57 void set_keep_visible(bool keep_visible_);
58 void set_fade_transition(bool fade_transition);
59 void set_fade_time(float fadetime);
60 void set_done(bool done);
61 void set_auto(bool is_auto);
62 void next_text();
63 void prev_text();
64
65 /*
66 * Text object api related
67 * @see: text_object.hpp
68 */
69 void set_text(const std::string& text);
70 void set_font(const std::string& fontname);
71 void fade_in(float fadetime);
72 void fade_out(float fadetime);
73 void set_visible(bool visible);
74 void set_centered(bool centered);
75 void set_pos(float x, float y);
76 float get_pos_x() const;
77 float get_pos_y() const;
78 void set_anchor_point(int anchor);
79 int get_anchor_point() const;
80};
81
82} // namespace scripting
83
84#endif
85
86/* EOF */
87