diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-08 09:04:14 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-08 09:04:14 +0200 |
commit | 22f1e92d16dbf7986977c323c0a2985fead88bfd (patch) | |
tree | 0fb1d9de02e3f187eb40f3bfe4763e25c283b45a /editor/imgui-misc.cpp | |
parent | 3e5b43638dac74a88918fecc139b4533bd1c0643 (diff) |
a
Diffstat (limited to 'editor/imgui-misc.cpp')
-rw-r--r-- | editor/imgui-misc.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/editor/imgui-misc.cpp b/editor/imgui-misc.cpp index 82320244..9acd906e 100644 --- a/editor/imgui-misc.cpp +++ b/editor/imgui-misc.cpp @@ -48,4 +48,24 @@ void app::draw_tile_under_cursor() {window_size[0]*.5f - size.x/2, 3*dpi[1]}, (unsigned)-1, buf); } +void app::draw_z_level() +{ + if (_z_level == 0) + return; + + if (cursor.pixel && cursor.tile && !cursor.in_imgui) + { + const auto dpi = M->dpi_scale(); + const auto offset = Vector2(4, -3) * dpi; + char buf[32]; + ImDrawList& draw = *ImGui::GetForegroundDrawList(); + snformat(buf, " +{:d}"_cf, _z_level); + const auto font_size = ImGui::GetCurrentContext()->FontSize+3; + auto shadow_offset = Vector2(1, 1)/* * dpi */; + auto px = Vector2(*cursor.pixel) + offset, px2 = px + shadow_offset; + draw.AddText(nullptr, font_size, {px2[0], px2[1]}, ImGui::ColorConvertFloat4ToU32({0, 0, 0, 1}), buf); + draw.AddText(nullptr, font_size, {px[0], px[1]}, ImGui::ColorConvertFloat4ToU32({1, 0, 1, 1}), buf); + } +} + } // namespace floormat |