aboutsummaryrefslogtreecommitdiff
path: root/src/ui/ui_layer.cpp
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-22 06:57:16 +0200
committerhachem <im@hachem.wtf>2026-09-22 06:57:16 +0200
commitd7c1ced08d5d78fcb239550404db4e67d4357a19 (patch)
tree9c0e218b096d138075cbf6a48e2562d33a8f94ed /src/ui/ui_layer.cpp
parent270eda6f558c972ec86ad0580f1d3d18afc83a94 (diff)
fix: windows supportHEADmain
Diffstat (limited to 'src/ui/ui_layer.cpp')
-rw-r--r--src/ui/ui_layer.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ui/ui_layer.cpp b/src/ui/ui_layer.cpp
index 90ddb7c..a65000e 100644
--- a/src/ui/ui_layer.cpp
+++ b/src/ui/ui_layer.cpp
@@ -140,7 +140,7 @@ namespace Donut
// the theme: soft-rounded cards on a near-black ground, 1px borders for edges,
// and the accent reserved for "this is live / selected" — slider grabs, checks,
// the active tab's underline, the one primary button per panel.
- 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;
@@ -216,6 +216,9 @@ namespace Donut
c[ImGuiCol_TableRowBgAlt] = ImVec4(1.0f, 1.0f, 1.0f, 0.025f);
c[ImGuiCol_TextSelectedBg] = amber_dim;
c[ImGuiCol_DragDropTarget] = kAmberHi;
+
+ // everything above is in 1x pixels; a 200% desktop wants it all doubled.
+ if (dpi_scale != 1.0f) { s.ScaleAllSizes(dpi_scale); s.FontScaleDpi = dpi_scale; }
}
// inspector row: label in a fixed left column, the control fills the rest.
@@ -262,8 +265,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);
@@ -329,7 +333,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(); // the Properties panel draws the scene gizmo
@@ -991,7 +995,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);