From 1dbba700feaa36217ab6f2f9cb1b6324ad0162a2 Mon Sep 17 00:00:00 2001 From: maelle Date: Thu, 24 Mar 2016 08:44:40 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20la=20cam=C3=A9ra=20?= =?UTF-8?q?quand=20la=20fen=C3=AAtre=20est=20redimensionn=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/engine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/engine.cpp b/src/engine.cpp index 39bc5df..dae2997 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -36,6 +36,12 @@ void Engine::start() { if (event.type == sf::Event::KeyReleased) { state.keys[event.key.code] = false; } + // lorsque la fenêtre est redimensionnée par l'utilisateur + if (event.type == sf::Event::Resized){ + // mise à jour de la caméra en fonction de la taille de la fenêtre + sf::FloatRect visibleArea(0, 0, event.size.width, event.size.height); + window.setView(sf::View(visibleArea)); + } } float frame = clock.restart().asSeconds();