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'
This commit is contained in:
Light 2021-07-14 00:18:34 +04:30
parent 57616d755c
commit aaf1bbfe74

View file

@ -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()