summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0ac1b21..3eb444c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,6 +30,15 @@ int main() {
ImGui::SFML::ProcessEvent(window, e);
}
+ // (cv pasted from
+ // https://www.sfml-dev.org/tutorials/3.0/graphics/view/#showing-more-when-the-window-is-resized)
+ // catch the resize events
+ if (const auto* resized = event->getIf<sf::Event::Resized>()) {
+ // update the view to the new size of the window
+ sf::FloatRect visibleArea({0.f, 0.f}, sf::Vector2f(resized->size));
+ window.setView(sf::View(visibleArea));
+ }
+
if (event->is<sf::Event::Closed>()) {
window.close();
}