diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-27 14:10:01 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-27 14:10:01 +0200 |
commit | 06f7a92711c114df01745d40accba15b10d2f720 (patch) | |
tree | b96b310ebc086b5d19330f8160761c761bb06f60 | |
parent | f8b9bed570735f5c11faa2e66da28e4e4236845d (diff) |
some random cleanup
-rw-r--r-- | editor/editor.cpp | 1 | ||||
-rw-r--r-- | editor/imgui-raii.hpp | 17 |
2 files changed, 8 insertions, 10 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp index ea48eb00..b3e3aec6 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -160,7 +160,6 @@ void tile_editor::place_tile(world& world, global_coords pos, tile_image& img) case editor_mode::select: break; case editor_mode::floor: { - const auto& [c, t] = world[pos]; t.ground_image = { atlas, variant }; break; } diff --git a/editor/imgui-raii.hpp b/editor/imgui-raii.hpp index afae29d6..ab317095 100644 --- a/editor/imgui-raii.hpp +++ b/editor/imgui-raii.hpp @@ -23,8 +23,7 @@ struct raii_wrapper final F dtor = nullptr; }; -[[nodiscard]] static inline raii_wrapper begin_window(Containers::StringView name = {}, - ImGuiWindowFlags_ flags = ImGuiWindowFlags_None) +[[nodiscard]] [[maybe_unused]] static inline raii_wrapper begin_window(Containers::StringView name = {}, ImGuiWindowFlags_ flags = ImGuiWindowFlags_None) { if (name.isEmpty()) name = "floormat editor"; @@ -34,14 +33,14 @@ struct raii_wrapper final return {}; } -[[nodiscard]] static inline raii_wrapper begin_main_menu() +[[nodiscard]] [[maybe_unused]] static inline raii_wrapper begin_main_menu() { if (ImGui::BeginMainMenuBar()) return {&ImGui::EndMainMenuBar}; else return {}; } -[[nodiscard]] static inline raii_wrapper begin_menu(Containers::StringView name, bool enabled = true) +[[nodiscard]] [[maybe_unused]] static inline raii_wrapper begin_menu(Containers::StringView name, bool enabled = true) { if (ImGui::BeginMenu(name.data(), enabled)) return {&ImGui::EndMenu}; @@ -49,7 +48,7 @@ struct raii_wrapper final return {}; } -[[nodiscard]] static inline raii_wrapper begin_list_box(Containers::StringView name, ImVec2 size = {}) +[[nodiscard]] [[maybe_unused]] static inline raii_wrapper begin_list_box(Containers::StringView name, ImVec2 size = {}) { if (ImGui::BeginListBox(name.data(), size)) return {&ImGui::EndListBox}; @@ -57,7 +56,7 @@ struct raii_wrapper final return {}; } -[[nodiscard]] static inline raii_wrapper tree_node(Containers::StringView name, ImGuiTreeNodeFlags_ flags = ImGuiTreeNodeFlags_None) +[[nodiscard]] [[maybe_unused]] static inline raii_wrapper tree_node(Containers::StringView name, ImGuiTreeNodeFlags_ flags = ImGuiTreeNodeFlags_None) { if (ImGui::TreeNodeEx(name.data(), flags)) return {&ImGui::TreePop}; @@ -65,19 +64,19 @@ struct raii_wrapper final return {}; } -[[nodiscard]] static inline raii_wrapper push_style_var(ImGuiStyleVar_ var, Vector2 value) +[[nodiscard]] [[maybe_unused]] static inline raii_wrapper push_style_var(ImGuiStyleVar_ var, Vector2 value) { ImGui::PushStyleVar(var, {value[0], value[1]}); return {[]{ ImGui::PopStyleVar(); }}; } -[[nodiscard]] static inline raii_wrapper push_style_var(ImGuiStyleVar_ var, float value) +[[nodiscard]] [[maybe_unused]] static inline raii_wrapper push_style_var(ImGuiStyleVar_ var, float value) { ImGui::PushStyleVar(var, value); return {[]{ ImGui::PopStyleVar(); }}; } -[[nodiscard]] static inline raii_wrapper push_style_color(ImGuiCol_ var, const Color4& value) +[[nodiscard]] [[maybe_unused]] static inline raii_wrapper push_style_color(ImGuiCol_ var, const Color4& value) { ImGui::PushStyleColor(var, {value[0], value[1], value[2], value[3]}); return {[]{ ImGui::PopStyleColor(); }}; |