diff options
-rw-r--r-- | editor/draw.cpp | 19 | ||||
-rw-r--r-- | editor/scenery-editor.cpp | 5 | ||||
-rw-r--r-- | editor/scenery-editor.hpp | 1 | ||||
-rw-r--r-- | editor/tile-editor.cpp | 5 | ||||
-rw-r--r-- | editor/tile-editor.hpp | 1 |
5 files changed, 24 insertions, 7 deletions
diff --git a/editor/draw.cpp b/editor/draw.cpp index 75444379..e0ddc743 100644 --- a/editor/draw.cpp +++ b/editor/draw.cpp @@ -22,13 +22,18 @@ void app::draw_cursor() mesh.draw(shader, {center, size, LINE_WIDTH}); }; - if (const auto* ed = _editor.current_tile_editor(); ed && ed->mode() == editor_mode::walls) - switch (ed->rotation()) - { - case editor_wall_rotation::N: draw(_wireframe_wall_n, TILE_SIZE); break; - case editor_wall_rotation::W: draw(_wireframe_wall_w, TILE_SIZE); break; - } - else + if (const auto* ed = _editor.current_tile_editor(); ed && ed->is_anything_selected()) + { + if (ed->mode() == editor_mode::walls) + switch (ed->rotation()) + { + case editor_wall_rotation::N: draw(_wireframe_wall_n, TILE_SIZE); break; + case editor_wall_rotation::W: draw(_wireframe_wall_w, TILE_SIZE); break; + } + else if (ed->mode() == editor_mode::floor) + draw(_wireframe_quad, TILE_SIZE2); + } + else if (const auto* ed = _editor.current_scenery_editor(); ed && ed->is_anything_selected()) draw(_wireframe_quad, TILE_SIZE2); } } diff --git a/editor/scenery-editor.cpp b/editor/scenery-editor.cpp index 612bfb78..dd7ca563 100644 --- a/editor/scenery-editor.cpp +++ b/editor/scenery-editor.cpp @@ -64,4 +64,9 @@ bool scenery_editor::is_item_selected(const scenery_& s) const return s.name == _selected.name && s.proto.atlas == _selected.proto.atlas; } +bool scenery_editor::is_anything_selected() const +{ + return _selected.proto.atlas != nullptr; +} + } // namespace floormat diff --git a/editor/scenery-editor.hpp b/editor/scenery-editor.hpp index 521353fa..f4d0868f 100644 --- a/editor/scenery-editor.hpp +++ b/editor/scenery-editor.hpp @@ -27,6 +27,7 @@ struct scenery_editor final const scenery_& get_selected(); bool is_atlas_selected(const std::shared_ptr<anim_atlas>& atlas) const; bool is_item_selected(const scenery_& s) const; + bool is_anything_selected() const; private: void load_atlases(); diff --git a/editor/tile-editor.cpp b/editor/tile-editor.cpp index d944f47f..d5743220 100644 --- a/editor/tile-editor.cpp +++ b/editor/tile-editor.cpp @@ -93,6 +93,11 @@ bool tile_editor::is_atlas_selected(const std::shared_ptr<const tile_atlas>& atl } } +bool tile_editor::is_anything_selected() const +{ + return _selection_mode != sel_none; +} + template<std::random_access_iterator T> void fisher_yates(T begin, T end) { diff --git a/editor/tile-editor.hpp b/editor/tile-editor.hpp index 4569bfee..5f2b00d6 100644 --- a/editor/tile-editor.hpp +++ b/editor/tile-editor.hpp @@ -53,6 +53,7 @@ public: bool is_tile_selected(const std::shared_ptr<const tile_atlas>& atlas, std::size_t variant) const; bool is_permutation_selected(const std::shared_ptr<const tile_atlas>& atlas) const; bool is_atlas_selected(const std::shared_ptr<const tile_atlas>& atlas) const; + bool is_anything_selected() const; tile_image_proto get_selected(); void place_tile(world& world, global_coords pos, const tile_image_proto& img); void toggle_rotation(); |