diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-27 10:35:06 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-27 10:35:06 +0100 |
commit | 368aeba5bcfafe445b3af5748f3798aa75003bf2 (patch) | |
tree | 7c15a1354b349e6d9207340fcecbc86038513f5d /src/crepe/api | |
parent | c5d1b46ba804eaabdb4fc2f4f4295292032def65 (diff) |
implemented feedback on PR40 and made camera sizes ivec2
Diffstat (limited to 'src/crepe/api')
-rw-r--r-- | src/crepe/api/Camera.h | 11 | ||||
-rw-r--r-- | src/crepe/api/Config.h | 2 | ||||
-rw-r--r-- | src/crepe/api/Sprite.cpp | 3 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/crepe/api/Camera.h b/src/crepe/api/Camera.h index ec94c44..151e5d9 100644 --- a/src/crepe/api/Camera.h +++ b/src/crepe/api/Camera.h @@ -2,8 +2,6 @@ #include "Color.h" #include "Component.h" - -#include "api/Config.h" #include "types.h" namespace crepe { @@ -31,17 +29,18 @@ public: Color bg_color; //! pos The position of the camera in world units - vec2 pos = Config::get_instance().win_set.pos; + vec2 pos = {0,0}; //! screen the display size in pixels ( output resolution ) - vec2 screen = Config::get_instance().win_set.def_size; + ivec2 screen = {1080,720}; //! viewport is the area of the world visible through the camera (in world units) - vec2 viewport = Config::get_instance().win_set.def_size; + //vec2 viewport = {1000, 2000}; + ivec2 viewport = {500, 1000}; //! scale scaling factor from world units to pixel coordinates //! Zoom level of the camera view. - double zoom = Config::get_instance().win_set.zoom; + double zoom = 1.0f; public: /** diff --git a/src/crepe/api/Config.h b/src/crepe/api/Config.h index 6de93f0..2723461 100644 --- a/src/crepe/api/Config.h +++ b/src/crepe/api/Config.h @@ -66,7 +66,7 @@ public: //! default window settings struct { //TODO make this constexpr because this will never change - vec2 def_size = {1080, 720}; + ivec2 def_size = {1080, 720}; vec2 pos = {0, 0}; float zoom = 1.0f; } win_set; diff --git a/src/crepe/api/Sprite.cpp b/src/crepe/api/Sprite.cpp index c219dd0..27f219c 100644 --- a/src/crepe/api/Sprite.cpp +++ b/src/crepe/api/Sprite.cpp @@ -1,3 +1,4 @@ +#include <cmath> #include <memory> #include "../util/Log.h" @@ -16,7 +17,7 @@ Sprite::Sprite(game_object_id_t id, const shared_ptr<Texture> image, const Color color(color), flip(flip), sprite_image(image), - aspect_ratio(sprite_image->get_width() / sprite_image->get_height()) { + aspect_ratio(static_cast<double>(sprite_image->get_width()) / sprite_image->get_height()) { dbg_trace(); this->sprite_rect.w = sprite_image->get_width(); |