Update window api, add content scale for glfw window

This commit is contained in:
Georg Hagen
2024-12-12 23:28:12 +01:00
parent 955bf6570d
commit c2993ae56c
3 changed files with 36 additions and 27 deletions

View File

@@ -52,10 +52,15 @@ namespace OpenVulkano::GLFW
void WindowGLFW::Create()
{
glfwWindowHint(GLFW_RESIZABLE, windowConfig.resizeable);
glfwWindowHint(GLFW_DECORATED, (~windowConfig.windowMode) & 1);
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, windowConfig.transparentFrameBuffer);
//TODO handle full screen resolutions
window = glfwCreateWindow(windowConfig.size.x, windowConfig.size.y, windowConfig.title.c_str(), GetTargetMonitor(), nullptr);
if (!window) return;
float scaleX, scaleY;
glfwGetWindowContentScale(window, &scaleX, &scaleY);
contentScale = std::max(scaleX, scaleY);
glfwSetWindowUserPointer(window, this);
RegisterCallbacks();
}
@@ -114,7 +119,7 @@ namespace OpenVulkano::GLFW
throw WindowInitFailedException("Failed to initialize window");
}
if (renderApi != RenderAPI::Vulkan) MakeCurrentThread();
Logger::WINDOW->info("GLFW Window created (id: {0})", GetWindowId());
Logger::WINDOW->info("GLFW Window created (id: {0}) with scale {}", GetWindowId(), contentScale);
}
void WindowGLFW::Close()