diff options
| author | ilotterytea <iltsu@alright.party> | 2025-02-02 01:02:51 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-02-02 01:02:51 +0500 |
| commit | 4d6e94ad9b905df16c0c67ea9043395a1f19400a (patch) | |
| tree | 8bbcabad05d352049cccdd2089112d2f6b6e76d5 /src/editor.hpp | |
| parent | 51760ea4a4bdff7ff22d8baf18af8032b7a9256f (diff) | |
feat: camera movement and zoom
Diffstat (limited to 'src/editor.hpp')
| -rw-r--r-- | src/editor.hpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/editor.hpp b/src/editor.hpp index 666694f..13f9cac 100644 --- a/src/editor.hpp +++ b/src/editor.hpp @@ -2,6 +2,7 @@ #include <SFML/Graphics/RenderWindow.hpp> #include <SFML/Graphics/Texture.hpp> +#include <SFML/System/Vector2.hpp> #include <SFML/Window/Event.hpp> #include <memory> #include <optional> @@ -22,15 +23,21 @@ namespace silly::editor { Editor(Tileset &tileset, TileFloor &floor) : tileset(tileset), floor(floor) {} - void update(const sf::RenderWindow &window); - void update(const sf::Event &event); + void update(sf::RenderWindow &window); + void update(const sf::Event &event, sf::RenderWindow &window); void render(const sf::RenderWindow &window); + const float get_zoom() const; private: Tileset &tileset; TileFloor &floor; float rotation; + // need for world movement and zoom + sf::Vector2f lastMousePosition; + float zoom = 1.0f; + bool isDragging = false; + std::optional<std::shared_ptr<TilesetTile>> selectedTile; std::optional<NewTileState> newTileState; }; |
