diff options
Diffstat (limited to 'src/main/headers')
-rw-r--r-- | src/main/headers/Scene.hpp | 14 | ||||
-rw-r--r-- | src/main/headers/Tile.hpp | 11 | ||||
-rw-r--r-- | src/main/headers/WorldScene.hpp | 4 |
3 files changed, 22 insertions, 7 deletions
diff --git a/src/main/headers/Scene.hpp b/src/main/headers/Scene.hpp index 19a32dd..2183d63 100644 --- a/src/main/headers/Scene.hpp +++ b/src/main/headers/Scene.hpp @@ -6,22 +6,26 @@ class Scene { public: - constexpr static float MAX_ZOOM = 10; - constexpr static float MIN_ZOOM = .1; + enum Type + { + WORLD, MENU + }; + + const Type type; + + Scene() = delete; virtual void render() = 0; virtual void resize(const sf::Event::SizeEvent &size) = 0; virtual void click(const sf::Event::MouseButtonEvent &click) {} virtual void keyPress(const sf::Event::KeyEvent &event) {} - virtual void zoom(float factor) {} - virtual void pan(int dx, int dy) {}; protected: float _zoom = 1; sf::RenderWindow &_window; - Scene(sf::RenderWindow &window) : _window(window) {} + Scene(sf::RenderWindow &window, Type _type) : type(_type), _window(window) {} }; #endif diff --git a/src/main/headers/Tile.hpp b/src/main/headers/Tile.hpp index 7292fde..919badc 100644 --- a/src/main/headers/Tile.hpp +++ b/src/main/headers/Tile.hpp @@ -1,6 +1,8 @@ #ifndef TILE_HPP #define TILE_HPP +#include "Actor.hpp" + struct Tile { enum Type @@ -12,6 +14,15 @@ struct Tile const int x, y; Tile(Type _type, int _x, int _y) : type(_type), x(_x), y(_y) {} + + Actor* actor() { return _actor; } + bool actor(Actor *actor); + + void clearActor() { _actor = nullptr; } + +private: + Actor *_actor = nullptr; + }; #endif diff --git a/src/main/headers/WorldScene.hpp b/src/main/headers/WorldScene.hpp index 09f3120..ec12930 100644 --- a/src/main/headers/WorldScene.hpp +++ b/src/main/headers/WorldScene.hpp @@ -10,8 +10,8 @@ class WorldScene : public Scene { public: - constexpr static int ZOOM_MIN = 1; - constexpr static int ZOOM_MAX = 100; + constexpr static float MAX_ZOOM = 10; + constexpr static float MIN_ZOOM = 1/2.0; constexpr static int DEFAULT_TILE_SIZE_PX = 20; WorldScene(sf::RenderWindow &window); |