summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-02-02 01:02:51 +0500
committerilotterytea <iltsu@alright.party>2025-02-02 01:02:51 +0500
commit4d6e94ad9b905df16c0c67ea9043395a1f19400a (patch)
tree8bbcabad05d352049cccdd2089112d2f6b6e76d5 /src/main.cpp
parent51760ea4a4bdff7ff22d8baf18af8032b7a9256f (diff)
feat: camera movement and zoom
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d889b0c..084671a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -36,7 +36,7 @@ int main() {
if (event.has_value()) {
sf::Event e = event.value();
ImGui::SFML::ProcessEvent(window, e);
- editor.update(e);
+ editor.update(e, window);
}
// (cv pasted from
@@ -45,7 +45,10 @@ int main() {
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));
+ sf::View view(visibleArea);
+ view.setCenter(window.getView().getCenter());
+ view.zoom(editor.get_zoom());
+ window.setView(view);
}
if (event->is<sf::Event::Closed>()) {