diff options
author | Nao Pross <naopross@thearcway.org> | 2018-02-16 21:10:24 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-02-16 21:10:24 +0100 |
commit | 1010d0d526ad7419449f19ac4db42d63f7731540 (patch) | |
tree | e037bc5f4f30ffc5324cccc9a3b018f7937c2bab /src/main/headers | |
parent | Add RangedWeapon, MeleeWeapon (diff) | |
download | Subconscious-old-1010d0d526ad7419449f19ac4db42d63f7731540.tar.gz Subconscious-old-1010d0d526ad7419449f19ac4db42d63f7731540.zip |
Add basic widget implementation (not usable) and configure cmake
Diffstat (limited to '')
-rw-r--r-- | src/main/headers/Scene.hpp | 5 | ||||
-rw-r--r-- | src/main/headers/Widget.hpp | 23 | ||||
-rw-r--r-- | src/main/headers/WorldScene.hpp | 5 | ||||
-rw-r--r-- | src/main/headers/config.h | 0 | ||||
-rw-r--r-- | src/main/headers/config.h.in | 0 |
5 files changed, 30 insertions, 3 deletions
diff --git a/src/main/headers/Scene.hpp b/src/main/headers/Scene.hpp index 2d720a9..0e121e9 100644 --- a/src/main/headers/Scene.hpp +++ b/src/main/headers/Scene.hpp @@ -1,7 +1,10 @@ #ifndef SCENE_HPP #define SCENE_HPP +#include "Widget.hpp" + #include <SFML/Graphics.hpp> +#include <vector> class Scene { @@ -15,7 +18,7 @@ public: virtual void keyPress(const sf::Event::KeyEvent &event) {} protected: - float _zoom = 1; + std::vector<Widget> widgets; sf::RenderWindow &_window; Scene(sf::RenderWindow &window) : _window(window) {} diff --git a/src/main/headers/Widget.hpp b/src/main/headers/Widget.hpp new file mode 100644 index 0000000..53543fc --- /dev/null +++ b/src/main/headers/Widget.hpp @@ -0,0 +1,23 @@ +#ifndef WIDGET_HPP +#define WIDGET_HPP + +#include <SFML/Graphics.hpp> + +struct Widget +{ +public: + int x; + int y; + unsigned width; + unsigned height; + + Widget() = delete; + virtual void render(); + +protected: + sf::RenderWindow &_window; + + Widget(sf::RenderWindow &window) : _window(window) {} +}; + +#endif diff --git a/src/main/headers/WorldScene.hpp b/src/main/headers/WorldScene.hpp index d21d885..2835842 100644 --- a/src/main/headers/WorldScene.hpp +++ b/src/main/headers/WorldScene.hpp @@ -23,9 +23,10 @@ public: virtual void pan(int dx, int dy); private: - Map map; - + float _zoom = 1; unsigned _tileSize; + + Map _map; }; #endif diff --git a/src/main/headers/config.h b/src/main/headers/config.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/main/headers/config.h diff --git a/src/main/headers/config.h.in b/src/main/headers/config.h.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/main/headers/config.h.in |