diff options
-rw-r--r-- | src/render.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/render.cpp b/src/render.cpp index c3266ef..96153f9 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -200,6 +200,16 @@ rectf_t state_t::window_in_world_space(void) return window_bounds(window); } +bool entity_order(const world::entity_t *x, const world::entity_t *y) +{ + 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]; +} + void state_t::render(game::state_t *game) { rectf_t bounds; @@ -212,22 +222,9 @@ void state_t::render(game::state_t *game) sectors[1] = world::sector_index_at(bounds[1]); ents = game->world.get_render_entities(bounds); - ents.sort( - [](const world::entity_t *x, const world::entity_t *y) -> bool - { - return x->render_bounds[1][1] < y->render_bounds[1][1]; - // FIXME: bring render layers back - /* - 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];*/ - }); + ents.sort(entity_order); ent = ents.begin(); - for (world::coord_t sy = sectors[0][1]; sy <= sectors[1][1]; sy++) for (world::coord_t ty = 0; ty < SECTOR_SIZE; ty++) for (world::coord_t sx = sectors[0][0]; sx <= sectors[1][0]; sx++) { |