From fe12270d62b94931834b7605136ea6c9f951d9fc Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Tue, 8 Oct 2013 22:59:53 +0200 Subject: [PATCH] Fixed window size not correctly updated when changed through Window::setSize (#474) --- include/SFML/Window/Window.hpp | 2 +- src/SFML/Window/Window.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp index 21bb2c55..89ebc937 100644 --- a/include/SFML/Window/Window.hpp +++ b/include/SFML/Window/Window.hpp @@ -274,7 +274,7 @@ public : /// \see getSize /// //////////////////////////////////////////////////////////// - void setSize(const Vector2u size); + void setSize(const Vector2u& size); //////////////////////////////////////////////////////////// /// \brief Change the title of the window diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index 0970c986..658c7ff4 100644 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp @@ -231,10 +231,19 @@ Vector2u Window::getSize() const //////////////////////////////////////////////////////////// -void Window::setSize(const Vector2u size) +void Window::setSize(const Vector2u& size) { if (m_impl) + { m_impl->setSize(size); + + // Cache the new size + m_size.x = size.x; + m_size.y = size.y; + + // Notify the derived class + onResize(); + } }