17 #ifndef HEADER_SUPERTUX_OBJECT_GRADIENT_HPP 18 #define HEADER_SUPERTUX_OBJECT_GRADIENT_HPP 20 #include "supertux/game_object.hpp" 21 #include "video/drawing_context.hpp" 34 static void register_class(ssq::VM& vm);
41 virtual void update(
float dt_sec)
override;
46 static std::string class_name() {
return "gradient"; }
47 virtual std::string get_class_name()
const override {
return class_name(); }
48 virtual std::string get_exposed_class_name()
const override {
return "Gradient"; }
49 static std::string display_name() {
return _(
"Gradient"); }
53 virtual const std::string get_icon_path()
const override {
54 return "images/engine/editor/gradient.png";
59 virtual void on_flip(
float height)
override;
61 void set_gradient(
const Color& top,
const Color& bottom);
62 void fade_gradient(
const Color& top,
const Color& bottom,
float time);
63 Color get_gradient_top()
const {
return m_gradient_top; }
64 Color get_gradient_bottom()
const {
return m_gradient_bottom; }
66 GradientDirection get_direction()
const {
return m_gradient_direction; }
67 std::string get_direction_string()
const;
68 void set_direction(
const GradientDirection& direction);
70 void set_layer(
int layer) { m_layer = layer; }
71 int get_layer()
const {
return m_layer; }
78 void set_direction(
const std::string& direction);
79 #ifdef DOXYGEN_SCRIPTING 85 std::string get_direction()
const;
94 void set_color1(
float red,
float green,
float blue);
102 void set_color2(
float red,
float green,
float blue);
113 void set_colors(
float red1,
float green1,
float blue1,
float red2,
float green2,
float blue2);
122 void fade_color1(
float red,
float green,
float blue,
float time);
131 void fade_color2(
float red,
float green,
float blue,
float time);
143 void fade_colors(
float red1,
float green1,
float blue1,
float red2,
float green2,
float blue2,
float time);
152 Color m_gradient_top;
153 Color m_gradient_bottom;
154 GradientDirection m_gradient_direction;
156 DrawingTarget m_target;
158 Color m_start_gradient_top;
159 Color m_start_gradient_bottom;
160 Color m_fade_gradient_top;
161 Color m_fade_gradient_bottom;
162 float m_fade_total_time;
virtual void on_flip(float height) override
When level is flipped vertically.
Definition: gradient.cpp:322
void fade_colors(float red1, float green1, float blue1, float red2, float green2, float blue2, float time)
Fade both gradient colors to specified new colors in ""time"" seconds.
Definition: gradient.cpp:276
void set_color2(float red, float green, float blue)
Set bottom gradient color.
Definition: gradient.cpp:252
A ""Gradient"" that was given a name can be controlled by scripts.
Definition: gradient.hpp:31
Definition: object_settings.hpp:39
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: gradient.hpp:51
void fade_color1(float red, float green, float blue, float time)
Fade the top gradient color to a specified new color in ""time"" seconds.
Definition: gradient.cpp:264
virtual bool is_saveable() const override
Indicates if the object will be saved.
Definition: gradient.cpp:315
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
void swap_colors()
Swap top and bottom gradient colors.
Definition: gradient.cpp:282
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: gradient.cpp:288
virtual GameObjectClasses get_class_types() const
List notable classes in inheritance hierarchy of class.
Definition: game_object.cpp:113
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 fade_color2(float red, float green, float blue, float time)
Fade the bottom gradient color to a specified new color in ""time"" seconds.
Definition: gradient.cpp:270
Definition: reader_mapping.hpp:32
void set_color1(float red, float green, float blue)
Set top gradient color.
Definition: gradient.cpp:246
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
void set_colors(float red1, float green1, float blue1, float red2, float green2, float blue2)
Set both gradient colors.
Definition: gradient.cpp:258
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it's state.
Definition: gradient.cpp:133
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user's locale.
Definition: gradient.hpp:50