From ed10ef9ede3d397672239c3b3dbe42cc6fbe56b4 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 28 Oct 2016 09:18:53 -0400 Subject: npc dialog --- include/components.hpp | 21 +++++++++++++++++---- include/events.hpp | 9 +++++++++ include/world.hpp | 3 +++ 3 files changed, 29 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/components.hpp b/include/components.hpp index 1195337..474a0eb 100644 --- a/include/components.hpp +++ b/include/components.hpp @@ -12,6 +12,7 @@ #include #include #include +#include /** * @struct Position @@ -220,25 +221,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 { -private: public: void update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt) override; }; class PhysicsSystem : public entityx::System { -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 { -private: public: void update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt) override; }; +class DialogSystem : public entityx::System, public entityx::Receiver { +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 #include +#include 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(*this); } + inline XMLDocument* getXML(void) + { return &xmlDoc; } + inline float getWidth(void) const { return world.startX * -2.0f; } -- cgit v1.2.3