17 #ifndef HEADER_SUPERTUX_OBJECT_TEXT_ARRAY_OBJECT_HPP 18 #define HEADER_SUPERTUX_OBJECT_TEXT_ARRAY_OBJECT_HPP 20 #include "supertux/game_object.hpp" 24 #include "supertux/timer.hpp" 25 #include "object/text_object.hpp" 26 #include "object/text_array_item.hpp" 28 typedef size_t ta_index;
43 static void register_class(ssq::VM& vm);
50 virtual void update(
float dt_sec)
override;
54 static std::string class_name() {
return "text-array"; }
55 virtual std::string get_class_name()
const override {
return class_name(); }
56 virtual std::string get_exposed_class_name()
const override {
return "TextArrayObject"; }
57 static std::string display_name() {
return _(
"Text array"); }
61 virtual const std::string get_icon_path()
const override {
62 return "images/engine/editor/textarray.png";
75 void add_text(
const std::string& text);
137 void set_text(
const std::string& text);
138 void set_font(
const std::string& fontname);
139 void fade_in(
float fadetime);
140 void fade_out(
float fadetime);
141 void grow_in(
float fadetime);
142 void grow_out(
float fadetime);
143 void set_visible(
bool visible);
144 void set_centered(
bool centered);
145 void set_pos(
float x,
float y);
148 void set_anchor_point(
int anchor);
149 int get_anchor_point()
const;
150 void set_anchor_offset(
float x,
float y);
151 float get_wrap_width()
const;
152 void set_wrap_width(
float width);
153 void set_front_fill_color(
float red,
float green,
float blue,
float alpha);
154 void set_back_fill_color(
float red,
float green,
float blue,
float alpha);
155 void set_text_color(
float red,
float green,
float blue,
float alpha);
156 void set_roundness(
float roundness);
173 void override_properties();
176 void reset_automation();
180 void handle_input_requests();
185 bool should_fade()
const;
204 bool m_fade_transition;
208 std::vector<std::unique_ptr<TextArrayItem> > m_texts;
209 ta_index m_curTextIndex;
210 ta_index m_lastTextIndex;
void set_auto(bool is_auto)
If set, lets the text array automatically go through all text objects.
Definition: text_array_object.cpp:151
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: text_array_object.cpp:190
An array of text objects, intended for narration.
Definition: text_array_object.hpp:40
void add_text_duration(const std::string &text, float duration)
Adds a text object with a specific text and duration at the end of the stack.
Definition: text_array_object.cpp:53
void set_fade_time(float fadetime)
Sets the fade-in and fade-out time.
Definition: text_array_object.cpp:72
TextArrayItem * get_last_text_item() const
Gets the last text item.
Definition: text_array_object.cpp:139
void set_text_index(ta_index index)
Sets the current text object by its index.
Definition: text_array_object.cpp:65
void clear()
Clears all text objects from the stack.
Definition: text_array_object.cpp:40
TextArrayItem * get_text_item(ta_index index) const
Gets the text item at a certain index.
Definition: text_array_object.cpp:122
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
void next_text()
If available, goes to the next text object in the stack.
Definition: text_array_object.cpp:78
void set_done(bool done)
Definition: text_array_object.cpp:145
Definition: text_array_item.hpp:17
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it's state.
Definition: text_array_object.cpp:158
virtual GameObjectClasses get_class_types() const
List notable classes in inheritance hierarchy of class.
Definition: game_object.cpp:113
void add_text(const std::string &text)
Adds a text object with a specific text at the end of the stack.
Definition: text_array_object.cpp:47
void set_keep_visible(bool keep_visible)
Definition: text_array_object.cpp:110
TextArrayItem * get_current_text_item() const
Gets the current text item.
Definition: text_array_object.cpp:133
A helper structure to list all the type_indexes of the classes in the type hierarchy of a given class...
Definition: game_object.hpp:57
void prev_text()
If available, goes to the previous text object in the stack.
Definition: text_array_object.cpp:95
Simple timer designed to be used in the update functions of objects.
Definition: timer.hpp:24
void set_fade_transition(bool fade_transition)
Definition: text_array_object.cpp:116
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: text_array_object.hpp:59
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user's locale.
Definition: text_array_object.hpp:58
virtual bool is_saveable() const override
Indicates if the object will be saved.
Definition: text_array_object.hpp:52
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42