From 17b4275fae1f6c5642156c73784622772d235c42 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 20 Oct 2016 20:16:21 -0500 Subject: playersystem, move cat --- include/engine.hpp | 2 +- include/player.hpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 include/player.hpp (limited to 'include') diff --git a/include/engine.hpp b/include/engine.hpp index e564691..d4b1e34 100644 --- a/include/engine.hpp +++ b/include/engine.hpp @@ -51,7 +51,7 @@ namespace game { inline void endGame(void) { events.emit(); } - + extern SpriteLoader sprite_l; } diff --git a/include/player.hpp b/include/player.hpp new file mode 100644 index 0000000..430173f --- /dev/null +++ b/include/player.hpp @@ -0,0 +1,32 @@ +#ifndef PLAYER_HPP_ +#define PLAYER_HPP_ + +#include + +#include + +class PlayerSystem : public entityx::System, public entityx::Receiver { +private: + entityx::Entity::Id pid; + + bool moveLeft; + bool moveRight; + + float speed; + +public: + PlayerSystem(void) + : moveLeft(false), moveRight(false), speed(1.0f) {} + + void configure(entityx::EventManager&); + + void update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt) override; + + void receive(const KeyUpEvent&); + void receive(const KeyDownEvent&); + + inline void setPlayer(const entityx::Entity& e) + { pid = e.id(); } +}; + +#endif // PLAYER_HPP_ -- cgit v1.2.3