diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/components.hpp | 21 | ||||
-rw-r--r-- | include/events.hpp | 9 | ||||
-rw-r--r-- | include/world.hpp | 3 |
3 files changed, 29 insertions, 4 deletions
diff --git a/include/components.hpp b/include/components.hpp index 507aa33..f2e040d 100644 --- a/include/components.hpp +++ b/include/components.hpp @@ -12,6 +12,7 @@ #include <entityx/entityx.h> #include <common.hpp> #include <texture.hpp> +#include <events.hpp> /** * @struct Position @@ -229,25 +230,37 @@ struct Visible { float z; /**< The value along the z axis the entity will be drawn on */ }; +struct Dialog { + Dialog(int idx = 0) + : index(idx) {} + + int index; +}; + /** * SYSTEMS */ class MovementSystem : public entityx::System<MovementSystem> { -private: public: void update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt) override; }; class PhysicsSystem : public entityx::System<PhysicsSystem> { -private: public: - void update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt); + void update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt) override; }; + class RenderSystem : public entityx::System<RenderSystem> { -private: public: void update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt) override; }; +class DialogSystem : public entityx::System<DialogSystem>, public entityx::Receiver<DialogSystem> { +public: + void configure(entityx::EventManager&); + void receive(const MouseClickEvent&); + void update(entityx::EntityManager&, entityx::EventManager&, entityx::TimeDelta) override; +}; + #endif //COMPONENTS_HPP diff --git a/include/events.hpp b/include/events.hpp index 6a9bd8c..8a09638 100644 --- a/include/events.hpp +++ b/include/events.hpp @@ -8,6 +8,7 @@ #include <SDL2/SDL.h> #include <string> +#include <common.hpp> class World; @@ -18,6 +19,14 @@ struct MouseScrollEvent { int scrollDistance; }; +struct MouseClickEvent { + MouseClickEvent(vec2 pos, int b) + : position(pos), button(b) {} + + vec2 position; + int button; +}; + struct KeyDownEvent { KeyDownEvent(SDL_Keycode kc = 0) : keycode(kc) {} diff --git a/include/world.hpp b/include/world.hpp index 421031c..8d88e5a 100644 --- a/include/world.hpp +++ b/include/world.hpp @@ -144,6 +144,9 @@ public: ev.subscribe<BGMToggleEvent>(*this); } + inline XMLDocument* getXML(void) + { return &xmlDoc; } + inline float getWidth(void) const { return world.startX * -2.0f; } |