aboutsummaryrefslogtreecommitdiff
path: root/src/crepe
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe')
-rw-r--r--src/crepe/api/Color.h4
-rw-r--r--src/crepe/system/RenderSystem.cpp7
2 files changed, 7 insertions, 4 deletions
diff --git a/src/crepe/api/Color.h b/src/crepe/api/Color.h
index aa47bf4..c207ba7 100644
--- a/src/crepe/api/Color.h
+++ b/src/crepe/api/Color.h
@@ -21,13 +21,13 @@ public:
static const Color & get_yellow();
static const Color & get_black();
-private:
- // TODO: why are these private!?
+public:
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
+private:
static Color white;
static Color red;
static Color green;
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;
}