diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-28 05:16:35 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-28 05:29:34 +0200 |
commit | 9de8761ec5c31453bb88f88cfacb348a8348d17f (patch) | |
tree | d782bf4534e299f73ee1d874dc3d3a969c082475 /editor | |
parent | ccbf628602e1093bd4d29312113b7dc18ec918b0 (diff) |
w
Diffstat (limited to 'editor')
-rw-r--r-- | editor/tests/hole-test.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/editor/tests/hole-test.cpp b/editor/tests/hole-test.cpp index 6cb60449..60c75dcf 100644 --- a/editor/tests/hole-test.cpp +++ b/editor/tests/hole-test.cpp @@ -49,27 +49,33 @@ void hole_test::draw_overlay(app& a) void hole_test::draw_ui(app& a, float menu_bar_height) { const auto& m = a.main(); - const auto size_x = ImGui::GetWindowSize().x; - const auto window_size = ImVec2{size_x, size_x}; + const auto width = Math::min(ImGui::GetWindowSize().x, 400.f); + const auto window_size = ImVec2{width, width}; + const auto bgcolor = ImGui::ColorConvertFloat4ToU32({0, 0, 0, 1}); + const auto& style = ImGui::GetStyle(); //const auto dpi = m.dpi_scale(); constexpr auto igcf = ImGuiChildFlags_None; - constexpr auto igwf = ImGuiWindowFlags_NoDecoration; + constexpr auto igwf = 0;//ImGuiWindowFlags_NoDecoration; + constexpr auto imdf = ImDrawFlags_None; + char buf[32]; ImGui::NewLine(); - char buf[32]; - - ImGui::LabelText("##test-area", "Test area"); + //ImGui::LabelText("##test-area", "Test area"); + //ImGui::NewLine(); - ImGui::NewLine(); + ImGui::SetNextWindowSize({width, width}); if (auto b1 = imgui::begin_child("Test area"_s, window_size, igcf, igwf)) { const auto& win = *ImGui::GetCurrentWindow(); ImDrawList& draw = *win.DrawList; + draw.AddRectFilled({win.Pos.x, win.Pos.y}, {win.Pos.x+width-1, win.Pos.y+width-1}, bgcolor, 0, imdf); } - ImGui::NewLine(); + //ImGui::NewLine(); + + const auto label_width = ImGui::CalcTextSize("MMMMMMMMM").x; - const auto label_width = ImGui::CalcTextSize("MMMM").x; + ImGui::Indent(style.FramePadding.x); label_left("width", buf, label_width); ImGui::NewLine(); @@ -85,6 +91,8 @@ void hole_test::draw_ui(app& a, float menu_bar_height) label_left("z", buf, label_width); ImGui::NewLine(); + + ImGui::Unindent(style.FramePadding.x); } void hole_test::update_pre(app& a, const Ns& dt) |