summaryrefslogtreecommitdiff
path: root/src/render.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-13 19:53:52 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-12-13 19:53:52 +0100
commit9be73e14dceb2c4c84ffe7a5a3a635613a27420e (patch)
treed83bb121887d2898ecb69232a8ac4bc8b7b14128 /src/render.cpp
parent868c3ce7659b1042f27b15774976dd20a0be3f77 (diff)
Render layers.
Diffstat (limited to 'src/render.cpp')
-rw-r--r--src/render.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/render.cpp b/src/render.cpp
index b80dcbd..2c8f7a4 100644
--- a/src/render.cpp
+++ b/src/render.cpp
@@ -135,8 +135,13 @@ void state_t::render(game::state_t *game)
ents = game->world.get_render_entities(bbox);
ents.sort(
[](const world::entity_t *x, const world::entity_t *y) -> bool
- {
- return x->render_bounds[1][1] < y->render_bounds[1][1];
+ {
+ if (x->render_layer < y->render_layer)
+ return true;
+ else if (x->render_layer > y->render_layer)
+ return false;
+ else
+ return x->render_bounds[1][1] < y->render_bounds[1][1];
});
for (world::entity_t *ent : ents) {