From 32ee3d9f57b37723ee97c3b798be6968f98df1b1 Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 22 Sep 2026 06:45:33 +0200 Subject: fix: windows support --- src/ui/ui_layer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/ui/ui_layer.cpp') diff --git a/src/ui/ui_layer.cpp b/src/ui/ui_layer.cpp index 69e2e41..6cbdc9d 100644 --- a/src/ui/ui_layer.cpp +++ b/src/ui/ui_layer.cpp @@ -121,7 +121,7 @@ namespace Donut out->append("\n"); } - static auto apply_donut_style() -> void + static auto apply_donut_style(float dpi_scale) -> void { ImGuiStyle& s = ImGui::GetStyle(); s.WindowRounding = 8.0f; s.ChildRounding = 6.0f; s.FrameRounding = 6.0f; @@ -197,6 +197,8 @@ namespace Donut c[ImGuiCol_TableRowBgAlt] = ImVec4(1.0f, 1.0f, 1.0f, 0.025f); c[ImGuiCol_TextSelectedBg] = amber_dim; c[ImGuiCol_DragDropTarget] = kAmberHi; + + if (dpi_scale != 1.0f) { s.ScaleAllSizes(dpi_scale); s.FontScaleDpi = dpi_scale; } } static auto prop(const char* label, float column = 116.0f) -> void @@ -238,8 +240,9 @@ namespace Donut } } - auto UILayer::init() -> void + auto UILayer::init(float dpi_scale) -> void { + m_dpi_scale = dpi_scale; ImGuiIO& io = ImGui::GetIO(); m_font_body = io.Fonts->AddFontFromFileTTF("assets/fonts/inter/static/Inter_18pt-Regular.ttf", kBodySize); m_font_heading = io.Fonts->AddFontFromFileTTF("assets/fonts/inter/static/Inter_18pt-SemiBold.ttf", kHeadSize); @@ -302,7 +305,7 @@ namespace Donut auto UILayer::draw(const UIContext& ctx) -> View { static bool styled = false; - if (!styled) { apply_donut_style(); styled = true; } + if (!styled) { apply_donut_style(m_dpi_scale); styled = true; } ImGuizmo::BeginFrame(); @@ -909,7 +912,11 @@ namespace Donut }; char buf[64]; row("Device", ctx.device_name.empty() ? "GPU" : ctx.device_name.c_str()); +#ifdef __APPLE__ row("API", RendererAPI::get_api() == RendererAPI::API::Vulkan ? "Vulkan (MoltenVK)" : "OpenGL 4.1"); +#else + row("API", RendererAPI::get_api() == RendererAPI::API::Vulkan ? "Vulkan" : "OpenGL"); +#endif row("Workspace", tab.label); std::snprintf(buf, sizeof(buf), "%.0f x %.0f", io.DisplaySize.x * io.DisplayFramebufferScale.x, io.DisplaySize.y * io.DisplayFramebufferScale.y); -- cgit v1.3