From 2141477c69d379b02ca52e0df9171834b37aadd7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 22 Nov 2022 21:03:49 +0100 Subject: scenery work --- editor/draw.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'editor/draw.cpp') diff --git a/editor/draw.cpp b/editor/draw.cpp index 9915a93e..17be7aeb 100644 --- a/editor/draw.cpp +++ b/editor/draw.cpp @@ -35,21 +35,21 @@ void app::draw_cursor() void app::draw() { - draw_cursor(); + if (_editor.current_tile_editor()) + draw_cursor(); draw_ui(); render_menu(); } -clickable_scenery* app::find_clickable_scenery() +clickable_scenery* app::find_clickable_scenery(Vector2i pixel_) { + clickable_scenery* item = nullptr; if (cursor.tile) { - float depth = -2; - clickable_scenery* item = nullptr; + float depth = -1; auto array = M->clickable_scenery(); - const auto pixel = Vector2ui(*cursor.pixel); + const auto pixel = Vector2ui(pixel_); for (clickable_scenery& c : array) - { if (c.depth > depth && c.dest.contains(pixel)) { const auto pos = pixel - c.dest.min() + c.src.min(); @@ -62,10 +62,8 @@ clickable_scenery* app::find_clickable_scenery() item = &c; } } - } - return item; } - return nullptr; + return item; } } // namespace floormat -- cgit v1.2.3