summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-01 17:41:55 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-01 17:41:55 +0100
commit601c42ae7c7df2adbff931ff4ac30ba39499da69 (patch)
treee7045157d63d7f730ffc78ac6e55639759aa02ce /editor
parenta8bfe471a46659b3050db1d4ad174b8e6b5cc4de (diff)
editor gui stuff
Diffstat (limited to 'editor')
-rw-r--r--editor/editor.cpp5
-rw-r--r--editor/editor.hpp1
-rw-r--r--editor/imgui.cpp13
3 files changed, 15 insertions, 4 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index 011cdc18..bb1948cc 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -230,6 +230,11 @@ auto tile_editor::check_snap(int mods) const -> snap_mode
}
}
+bool tile_editor::can_rotate() const
+{
+ return _mode == editor_mode::walls;
+}
+
editor::editor()
{
}
diff --git a/editor/editor.hpp b/editor/editor.hpp
index 5bf84803..4d6b48df 100644
--- a/editor/editor.hpp
+++ b/editor/editor.hpp
@@ -72,6 +72,7 @@ public:
void toggle_rotation();
void set_rotation(editor_wall_rotation r);
snap_mode check_snap(int mods) const;
+ bool can_rotate() const;
};
struct editor final
diff --git a/editor/imgui.cpp b/editor/imgui.cpp
index fb879317..ae974b06 100644
--- a/editor/imgui.cpp
+++ b/editor/imgui.cpp
@@ -52,16 +52,21 @@ float app::draw_main_menu()
}
if (auto b = begin_menu("Mode"))
{
- bool b_none = false, b_floor = false, b_walls = false;
+ const bool can_rotate = _editor.current() ? _editor.current()->can_rotate() : false;
+ bool b_none = false, b_floor = false, b_walls = false, b_rotate = false;
ImGui::MenuItem("Select", "1", &b_none);
ImGui::MenuItem("Floor", "2", &b_floor);
ImGui::MenuItem("Walls", "3", &b_walls);
+ ImGui::Separator();
+ ImGui::MenuItem("Rotate", "R", &b_rotate, can_rotate);
if (b_none)
- keys[key_mode_none] = true;
+ do_key(key_mode_none);
else if (b_floor)
- keys[key_mode_floor] = true;
+ do_key(key_mode_floor);
else if (b_walls)
- keys[key_mode_walls] = true;
+ do_key(key_mode_walls);
+ if (b_rotate)
+ do_key(key_rotate_tile);
}
main_menu_height = ImGui::GetContentRegionMax().y;