17 #ifndef HEADER_SUPERTUX_OBJECT_CAMERA_HPP 18 #define HEADER_SUPERTUX_OBJECT_CAMERA_HPP 23 #include "math/size.hpp" 24 #include "math/vector.hpp" 25 #include "object/path_object.hpp" 26 #include "scripting/camera.hpp" 27 #include "squirrel/exposed_object.hpp" 28 #include "supertux/game_object.hpp" 29 #include "supertux/timer.hpp" 43 NORMAL, MANUAL, AUTOSCROLL, SCROLLTO
49 enum class LookaheadMode {
54 Camera(
const std::string& name);
60 virtual void update(
float dt_sec)
override;
66 virtual std::string get_class()
const override {
return "camera"; }
67 virtual std::string get_display_name()
const override {
return _(
"Camera"); }
70 virtual void after_editor_set()
override;
72 virtual const std::string get_icon_path()
const override {
return "images/engine/editor/camera.png"; }
83 void set_translation(
const Vector& translation) { m_translation = translation; }
86 void shake(
float duration,
float x,
float y);
91 void move(
const int dx,
const int dy);
99 void set_mode(Mode mode_) { m_mode = mode_; }
103 void update_scroll_normal(
float dt_sec);
104 void update_scroll_autoscroll(
float dt_sec);
105 void update_scroll_to(
float dt_sec);
106 void keep_in_bounds(
Vector& vector);
118 LookaheadMode m_lookahead_mode;
122 Vector m_cached_translation;
127 float m_shakedepth_x;
128 float m_shakedepth_y;
133 float m_scroll_to_pos;
136 std::unique_ptr<CameraConfig> m_config;
A walker that travels along a path.
Definition: path_walker.hpp:29
virtual bool is_singleton() const override
If true only a single object of this type is allowed in a given GameObjectManager.
Definition: camera.hpp:63
Simple two dimensional vector.
Definition: vector.hpp:24
virtual bool is_saveable() const override
Indicates if the object will be saved.
Definition: camera.cpp:686
Vector get_center() const
get the coordinates of the point directly in the center of this camera
Definition: camera.cpp:672
This class binds a certain GameObject class to a scripting class.
Definition: exposed_object.hpp:45
Definition: object_settings.hpp:35
Base class for all the things that make up Levels' Sectors.
Definition: game_object.hpp:46
Definition: camera.cpp:38
virtual void draw(DrawingContext &) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: camera.cpp:278
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it's state.
Definition: camera.cpp:285
const Vector & get_translation() const
return camera position
Definition: camera.cpp:236
A class for all objects that contain / make use of a path.
Definition: path_object.hpp:28
void scroll_to(const Vector &goal, float scrolltime)
scroll the upper left edge of the camera in scrolltime seconds to the position goal ...
Definition: camera.cpp:264
Simple timer designed to be used in the update functions of objects.
Definition: timer.hpp:24
Definition: camera.hpp:36
Definition: reader_mapping.hpp:31
void reset(const Vector &tuxpos)
reset camera position
Definition: camera.cpp:242
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42