aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Camera.h
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-02 20:02:14 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-02 20:02:14 +0100
commita84ca09e97d466643f022acfffcf4c6a77f42052 (patch)
treef375067b4250f468eb3b57d968efa3417f0f521d /src/crepe/api/Camera.h
parent135af8b0e0eaf8a5a5b7e1a42bfb20bb14ec97e5 (diff)
making struct constructors
Diffstat (limited to 'src/crepe/api/Camera.h')
-rw-r--r--src/crepe/api/Camera.h37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/crepe/api/Camera.h b/src/crepe/api/Camera.h
index 2d8fa48..e466d36 100644
--- a/src/crepe/api/Camera.h
+++ b/src/crepe/api/Camera.h
@@ -14,32 +14,35 @@ namespace crepe {
* position, and zoom level. It controls what part of the game world is visible on the screen.
*/
class Camera : public Component {
+public:
+ struct Data {
+ //! Background color of the camera view.
+ const Color bg_color;
+
+ //! screen the display size in pixels ( output resolution )
+ const ivec2 screen;
+
+ //! viewport is the area of the world visible through the camera (in world units)
+ const vec2 viewport_size;
+
+ //! Zoom level of the camera view.
+ double zoom;
+
+ //! offset postion from the game object transform component
+ vec2 offset;
+ };
public:
/**
* \brief Constructs a Camera with the specified ID and background color.
* \param id Unique identifier for the camera component.
- * \param bg_color Background color for the camera view.
+ * \param ctx the camera component data
*/
- Camera(game_object_id_t id, const Color & bg_color, const ivec2 & screen,
- const vec2 & viewport_size, const double & zoom, const vec2 & offset = {0, 0});
+ Camera(game_object_id_t id, const Data & ctx);
~Camera(); // dbg_trace only
public:
- //! Background color of the camera view.
- const Color bg_color;
-
- //! offset postion from the game object transform component
- vec2 offset;
-
- //! screen the display size in pixels ( output resolution )
- const ivec2 screen;
-
- //! viewport is the area of the world visible through the camera (in world units)
- const vec2 viewport_size;
-
- //! Zoom level of the camera view.
- const double zoom;
+ Camera::Data data;
public:
/**