Fix window resizing issue
This commit is contained in:
@@ -149,8 +149,7 @@ namespace OpenVulkano::GLFW
|
||||
|
||||
void WindowGLFW::SetSize(uint32_t width, uint32_t height)
|
||||
{
|
||||
windowConfig.size.x = width;
|
||||
windowConfig.size.y = height;
|
||||
currentSize = { width, height };
|
||||
if (window)
|
||||
{
|
||||
glfwSetWindowSize(window, width, height);
|
||||
@@ -169,9 +168,9 @@ namespace OpenVulkano::GLFW
|
||||
|
||||
Math::Vector2ui WindowGLFW::GetSize()
|
||||
{
|
||||
Math::Vector2i size;
|
||||
glfwGetWindowSize(window, &size.x, &size.y);
|
||||
return size;
|
||||
if (currentSize.x == 0 || currentSize.y == 0)
|
||||
glfwGetWindowSize(window, reinterpret_cast<int*>(¤tSize.x), reinterpret_cast<int*>(¤tSize.y));
|
||||
return currentSize;
|
||||
}
|
||||
|
||||
Math::Vector2i WindowGLFW::GetPosition()
|
||||
@@ -269,6 +268,11 @@ namespace OpenVulkano::GLFW
|
||||
void WindowGLFW::OnResize(const uint32_t newWidth, const uint32_t newHeight)
|
||||
{
|
||||
Logger::WINDOW->debug("Window (id: {0}) resized (width: {1}, height: {2})", GetWindowId(), newWidth, newHeight);
|
||||
currentSize = { newWidth, newHeight };
|
||||
if (GetWindowMode() == WINDOWED || GetWindowMode() == BORDERLESS)
|
||||
{
|
||||
windowConfig.size = currentSize;
|
||||
}
|
||||
handler->OnWindowResize(this, newWidth, newHeight);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace OpenVulkano::GLFW
|
||||
InputProviderGLFW& inputProvider;
|
||||
GLFWwindow* window = nullptr;
|
||||
IWindowHandler* handler = nullptr;
|
||||
Math::Vector2ui currentSize = {};
|
||||
|
||||
public:
|
||||
WindowGLFW(InputProviderGLFW& inputProvider);
|
||||
|
||||
Reference in New Issue
Block a user