summaryrefslogtreecommitdiffhomepage
path: root/editor/imgui-inspect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/imgui-inspect.cpp')
-rw-r--r--editor/imgui-inspect.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/editor/imgui-inspect.cpp b/editor/imgui-inspect.cpp
new file mode 100644
index 00000000..d776e032
--- /dev/null
+++ b/editor/imgui-inspect.cpp
@@ -0,0 +1,35 @@
+#include "app.hpp"
+#include "inspect.hpp"
+#include "main/clickable.hpp"
+#include "floormat/main.hpp"
+#include "src/world.hpp"
+#include "imgui-raii.hpp"
+
+namespace floormat {
+
+using namespace floormat::imgui;
+
+void app::draw_inspector()
+{
+ auto b = push_id("inspector");
+ auto& w = M->world();
+ if (cursor.pixel)
+ if (const auto* sc = find_clickable_scenery(cursor.pixel))
+ inspected_scenery = {InPlaceInit, sc->chunk, sc->pos};
+ if (inspected_scenery)
+ {
+ auto [c, t] = w[*inspected_scenery];
+ if (auto s = t.scenery())
+ {
+ char buf[32]; std::snprintf(buf, sizeof buf, "i_0x%p", (void*)&s);
+ auto b = push_id(buf);
+ auto dpi = M->dpi_scale();
+ ImGui::SetNextWindowSize({300*dpi[0], 0});
+ auto b2 = begin_window("inspector"_s);
+ if (entities::inspect_type(s))
+ c.mark_scenery_modified();
+ }
+ }
+}
+
+} // namespace floormat