重新启用自动DPI感知,并提供get_dpi_scale()函数
This commit is contained in:
parent
84fcabdd55
commit
329ba6af41
@ -67,6 +67,10 @@ void shutdown_imgui() {
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
float get_dpi_scale() {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
void run_imgui() {
|
||||
init_imgui();
|
||||
|
||||
|
@ -9,6 +9,7 @@ extern bool imgui_new_frame();
|
||||
extern void draw_imgui(float delta_time);
|
||||
extern void render_imgui();
|
||||
extern void shutdown_imgui();
|
||||
extern float get_dpi_scale();
|
||||
|
||||
extern void tick_imgui(float delta_time);
|
||||
|
||||
|
@ -27,7 +27,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
// Main code
|
||||
int init_imgui() {
|
||||
// Create application window
|
||||
// ImGui_ImplWin32_EnableDpiAwareness();
|
||||
ImGui_ImplWin32_EnableDpiAwareness();
|
||||
wc = { sizeof(wc), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(nullptr), nullptr, nullptr, nullptr, nullptr, L"Arona", nullptr };
|
||||
::RegisterClassExW(&wc);
|
||||
std::string window_title = get_window_title();
|
||||
@ -133,6 +133,10 @@ void shutdown_imgui() {
|
||||
::UnregisterClassW(wc.lpszClassName, wc.hInstance);
|
||||
}
|
||||
|
||||
float get_dpi_scale() {
|
||||
return ImGui_ImplWin32_GetDpiScaleForHwnd(hwnd);
|
||||
}
|
||||
|
||||
void run_imgui() {
|
||||
init_imgui();
|
||||
while (true) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user