17 #ifndef HEADER_SUPERTUX_OBJECT_SPOTLIGHT_HPP 18 #define HEADER_SUPERTUX_OBJECT_SPOTLIGHT_HPP 20 #include "sprite/sprite_ptr.hpp" 21 #include "supertux/moving_object.hpp" 22 #include "video/color.hpp" 35 static void register_class(ssq::VM& vm);
38 enum class Direction {
44 static Direction Direction_from_string(
const std::string& s);
45 static std::string Direction_to_string(Direction dir);
51 virtual void update(
float dt_sec)
override;
56 static std::string class_name() {
return "spotlight"; }
57 virtual std::string get_class_name()
const override {
return class_name(); }
58 virtual std::string get_exposed_class_name()
const override {
return "Spotlight"; }
59 static std::string display_name() {
return _(
"Spotlight"); }
65 virtual int get_layer()
const override {
return m_layer; }
109 void ease_angle(
float angle,
float time,
const std::string& easing);
132 void ease_speed(
float speed,
float time,
const std::string& easing);
163 void ease_color_rgba(
float r,
float g,
float b,
float a,
float time,
const std::string& easing);
165 void ease_angle(
float time,
float target, EasingMode ease = EasingMode::EaseNone);
166 void ease_speed(
float time,
float target, EasingMode ease = EasingMode::EaseNone);
167 void ease_color(
float time,
Color target, EasingMode ease = EasingMode::EaseNone);
179 SpritePtr m_lightcone;
190 Direction m_direction;
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user's locale.
Definition: spotlight.hpp:60
void set_direction(const std::string &direction)
Sets the direction of the spotlight.
Definition: spotlight.cpp:189
bool is_enabled()
Definition: spotlight.cpp:183
void ease_angle(float angle, float time, const std::string &easing)
Fades the angle of the spotlight in ""time"" seconds, with easing.
Definition: spotlight.cpp:225
void ease_color_rgba(float r, float g, float b, float a, float time, const std::string &easing)
Fades the spotlight to a new RGBA color in ""time"" seconds, with easing.
Definition: spotlight.cpp:243
virtual HitResponse collision(GameObject &other, const CollisionHit &hit_) override
this function is called when the object collided with any other object
Definition: spotlight.cpp:171
void fade_angle(float angle, float time)
Fades the angle of the spotlight in ""time"" seconds.
Definition: spotlight.cpp:219
Definition: object_settings.hpp:39
void set_color_rgba(float r, float g, float b, float a)
Sets the RGBA color of the spotlight.
Definition: spotlight.cpp:231
void fade_color_rgba(float r, float g, float b, float a, float time)
Fades the spotlight to a new RGBA color in ""time"" seconds.
Definition: spotlight.cpp:237
A ""Spotlight"" that was given a name can be controlled by scripts.
Definition: spotlight.hpp:32
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: spotlight.hpp:61
Base class for all dynamic/moving game objects.
Definition: moving_object.hpp:35
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it's state.
Definition: spotlight.cpp:119
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: moving_object.hpp:49
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: spotlight.cpp:142
void set_enabled(bool enabled)
Definition: spotlight.cpp:177
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
Definition: reader_mapping.hpp:32
void set_angle(float angle)
Definition: spotlight.cpp:213
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
void fade_speed(float speed, float time)
Fades the speed of the spotlight in ""time"" seconds.
Definition: spotlight.cpp:201
void ease_speed(float speed, float time, const std::string &easing)
Fades the speed of the spotlight in ""time"" seconds, with easing.
Definition: spotlight.cpp:207
This class collects data about a collision.
Definition: collision_hit.hpp:44
void set_speed(float speed)
Definition: spotlight.cpp:195