From aaf1bbfe746f3a51cdc4644c67d8b8bf2153dc15 Mon Sep 17 00:00:00 2001 From: Light Date: Wed, 14 Jul 2021 00:18:34 +0430 Subject: [PATCH] WindowResizeEvent | FlushScene - 'Renderer' now receives 'WindowResizedEvent' and handle the 'Framebuffer' and viewport stuff - Added 'Renderer' now uses the new 'FlushScene' function to flush when the mapped vertex buffer is filled - The viewport is now set by 'RenderCommand' via the 'Renderer' rather than the 'GraphicsConntext' - 'Window' no longer sends 'WindowResizedEvent' to 'GraphicsContext' - 'GraphicsContext' no longer receives 'OnWindowResize' events - Note: Sending events should be done by the 'Application' - Note: Excuse the double commit, forgot to commit 'wWindow.cpp' --- Engine/src/Platform/OS/Windows/wWindow.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Engine/src/Platform/OS/Windows/wWindow.cpp b/Engine/src/Platform/OS/Windows/wWindow.cpp index 0a1dc7e..74cf5fb 100644 --- a/Engine/src/Platform/OS/Windows/wWindow.cpp +++ b/Engine/src/Platform/OS/Windows/wWindow.cpp @@ -86,11 +86,16 @@ namespace Light { // resized case EventType::WindowResized: - m_GraphicsContext->OnWindowResize((const WindowResizedEvent&)event); + OnWindowResize((const WindowResizedEvent&)event); break; } } + void wWindow::OnWindowResize(const WindowResizedEvent& event) + { + m_Properties.size = event.GetSize(); + } + void wWindow::SetTitle(const std::string& title) { m_Properties.title = title; @@ -107,10 +112,8 @@ namespace Light { void wWindow::SetSize(const glm::uvec2& size, bool additive /* = false */) { - m_Properties.size.x = size.x == 0u ? m_Properties.size.x : additive ? m_Properties.size.x + size.x : size.x; - m_Properties.size.y = size.y == 0u ? m_Properties.size.y : additive ? m_Properties.size.y + size.y : size.y; - - glfwSetWindowSize(m_Handle, m_Properties.size.x, m_Properties.size.y); + glfwSetWindowSize(m_Handle, size.x == 0u ? m_Properties.size.x : additive ? m_Properties.size.x + size.x : size.x, + size.y == 0u ? m_Properties.size.y : additive ? m_Properties.size.y + size.y : size.y); } void wWindow::BindGlfwEvents()