hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/ui/ui_layer.cpp
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-22 06:45:33 +0200
committerhachem <im@hachem.wtf>2026-09-22 06:45:33 +0200
commit32ee3d9f57b37723ee97c3b798be6968f98df1b1 (patch)
tree10838a06f522a48f64645e2d31c3d72eb1a58643 /src/ui/ui_layer.cpp
parente321beb543311dcb591942ec42464e38cbeae0f0 (diff)
fix: windows support
Diffstat (limited to 'src/ui/ui_layer.cpp')
-rw-r--r--src/ui/ui_layer.cpp13
1 files changed, 10 insertions, 3 deletions
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);