aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/RenderSystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/system/RenderSystem.cpp')
-rw-r--r--src/crepe/system/RenderSystem.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp
index 11c20f5..82257c4 100644
--- a/src/crepe/system/RenderSystem.cpp
+++ b/src/crepe/system/RenderSystem.cpp
@@ -1,6 +1,7 @@
#include <algorithm>
#include <cassert>
#include <functional>
+#include <stdexcept>
#include <vector>
#include "../ComponentManager.h"
@@ -20,6 +21,8 @@ void RenderSystem::update_camera() {
std::vector<std::reference_wrapper<Camera>> cameras = mgr.get_components_by_type<Camera>();
+ if (cameras.size() == 0) throw std::runtime_error("No cameras in current scene");
+
for (Camera & cam : cameras) {
SDLContext::get_instance().camera(cam);
this->curr_cam_ref = &cam;
@@ -27,8 +30,8 @@ void RenderSystem::update_camera() {
}
bool sorting_comparison(const Sprite & a, const Sprite & b) {
- if (a.sorting_in_layer > b.sorting_in_layer) return true;
- if (a.sorting_in_layer == b.sorting_in_layer) return a.order_in_layer > b.order_in_layer;
+ if (a.sorting_in_layer < b.sorting_in_layer) return true;
+ if (a.sorting_in_layer == b.sorting_in_layer) return a.order_in_layer < b.order_in_layer;
return false;
}