aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/SDLContext.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-20 13:25:44 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-20 13:25:44 +0100
commit158022890cb9abd308a6a445588cc2fca8d84e67 (patch)
treed682733dce1bb1240a64b5f8f20ea5af7b03432c /src/crepe/facade/SDLContext.cpp
parent52e84ca0a81210cd1dc61e096c228586649c9bfc (diff)
implementing feedback
Diffstat (limited to 'src/crepe/facade/SDLContext.cpp')
-rw-r--r--src/crepe/facade/SDLContext.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp
index 8131df2..eacb10a 100644
--- a/src/crepe/facade/SDLContext.cpp
+++ b/src/crepe/facade/SDLContext.cpp
@@ -149,7 +149,7 @@ void SDLContext::draw(const Sprite & sprite, const Transform & transform, const
&dstrect, transform.rotation, NULL, render_flip);
}
-void SDLContext::camera(const Camera & cam) {
+void SDLContext::set_camera(const Camera & cam) {
this->viewport.w = static_cast<int>(cam.aspect_width);
this->viewport.h = static_cast<int>(cam.aspect_height);
this->viewport.x = static_cast<int>(cam.x) - (this->viewport.w / 2);
@@ -167,6 +167,7 @@ SDLContext::texture_from_path(const std::string & path) {
SDL_Surface * tmp = IMG_Load(path.c_str());
if (tmp == nullptr) {
tmp = IMG_Load("../asset/texture/ERROR.png");
+ if (tmp == nullptr) throw runtime_error("cannot load image");
}
std::unique_ptr<SDL_Surface, std::function<void(SDL_Surface *)>> img_surface;