summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-02-01 15:24:19 +0500
committerilotterytea <iltsu@alright.party>2025-02-01 15:24:19 +0500
commit0c7c29d669c16c3821b19d00a9319f3eba5cf05d (patch)
treea7c6967e8a91f3de21baf3f18c11428b1fdf5be7 /src
parent60583043074f01992f2c5b19ec9faf5fb0f69572 (diff)
feat: update view on resize
Diffstat (limited to 'src')
-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();
}