Skip to content

Commit

Permalink
Workaround for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
iaomw authored and hyv1001 committed Apr 9, 2022
1 parent fa6270e commit e5d43bc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions engine/source/runtime/function/render/source/surface_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ using namespace Pilot;

void window_content_scale_callback(GLFWwindow* window, float x_scale, float y_scale)
{
float font_scale = fmax(1.0f, fmax(x_scale, y_scale));
#if defined(__MACH__)
float font_scale = fmax(1.0f, fmax(x_scale, y_scale));
ImGui::GetIO().FontGlobalScale = 1.0f / font_scale;
#endif
}

int SurfaceUI::initialize(SurfaceRHI* rhi, PilotRenderer* prenderer, std::shared_ptr<SurfaceIO> pio)
Expand Down Expand Up @@ -59,8 +61,8 @@ int SurfaceUI::initialize(SurfaceRHI* rhi, PilotRenderer* prenderer, std::shared
init_info.MinImageCount = rhi->m_vulkan_manager->m_max_frames_in_flight;
init_info.ImageCount = rhi->m_vulkan_manager->m_max_frames_in_flight;
ImGui_ImplVulkan_Init(&init_info, rhi->m_vulkan_manager->getLightingPass());
ImGui::GetIO().FontGlobalScale = 1.0f / font_scale;

window_content_scale_callback(pio->m_window, x_scale, y_scale);
glfwSetWindowContentScaleCallback(pio->m_window, window_content_scale_callback);

// fonts upload
Expand Down

0 comments on commit e5d43bc

Please sign in to comment.