aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/crepe/facade/SDLContext.cpp3
-rw-r--r--src/crepe/facade/SDLContext.h5
2 files changed, 5 insertions, 3 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;
diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h
index fb09015..287ad5d 100644
--- a/src/crepe/facade/SDLContext.h
+++ b/src/crepe/facade/SDLContext.h
@@ -125,6 +125,7 @@ private:
* \param camera Reference to the Camera for view adjustments.
*/
void draw(const Sprite & sprite, const Transform & transform, const Camera & camera);
+
void draw_particle(const Sprite & sprite, const Vector2 & pos, const double & angle, const double & scale, const Camera & camera);
//! Clears the screen, preparing for a new frame.
@@ -134,10 +135,10 @@ private:
void present_screen();
/**
- * \brief Sets the current camera for rendering.
+ * \brief sets the background of the camera (will be adjusted in future PR)
* \param camera Reference to the Camera object.
*/
- void camera(const Camera & camera);
+ void set_camera(const Camera & camera);
private:
/**