Peoplemon  0.1.0
Peoplemon 3 game source documentation
EntityMoved.hpp
Go to the documentation of this file.
1 #ifndef CORE_EVENTS_ENTITYMOVED_HPP
2 #define CORE_EVENTS_ENTITYMOVED_HPP
3 
4 #include <BLIB/ECS/Entity.hpp>
5 #include <BLIB/Tilemap/Position.hpp>
6 #include <SFML/System/Vector2.hpp>
7 
8 namespace core
9 {
10 namespace event
11 {
18 struct EntityMoved {
20  const bl::ecs::Entity entity;
21 
23  const bl::tmap::Position previousPosition;
24 
26  const bl::tmap::Position& position;
27 
29  const bool running;
30 
38  EntityMoved(bl::ecs::Entity entity, const bl::tmap::Position& oldPos,
39  const bl::tmap::Position& pos, bool running = false)
40  : entity(entity)
41  , previousPosition(oldPos)
42  , position(pos)
43  , running(running) {}
44 };
45 
54  const bl::ecs::Entity entity;
55 
57  const bl::tmap::Position& position;
58 
65  EntityMoveFinished(bl::ecs::Entity entity, const bl::tmap::Position& position)
66  : entity(entity)
67  , position(position) {}
68 };
69 
76 struct EntityRotated {
78  const bl::ecs::Entity entity;
79 
81  const bl::tmap::Direction faceDir;
82 
84  const bl::tmap::Direction origDir;
85 
93  EntityRotated(bl::ecs::Entity e, bl::tmap::Direction dir, bl::tmap::Direction og)
94  : entity(e)
95  , faceDir(dir)
96  , origDir(og) {}
97 };
98 
99 } // namespace event
100 } // namespace core
101 
102 #endif
Core classes and functionality for both the editor and game.
Fired after an entity begins moving from one position to another.
Definition: EntityMoved.hpp:18
const bl::tmap::Position previousPosition
The previous position of the entity.
Definition: EntityMoved.hpp:23
const bl::tmap::Position & position
The current position of the entity.
Definition: EntityMoved.hpp:26
EntityMoved(bl::ecs::Entity entity, const bl::tmap::Position &oldPos, const bl::tmap::Position &pos, bool running=false)
Construct a new EntityMoved event.
Definition: EntityMoved.hpp:38
const bl::ecs::Entity entity
The entity that moved.
Definition: EntityMoved.hpp:20
const bool running
Whether or not the entity is running.
Definition: EntityMoved.hpp:29
Fired when an entity completes a move from one tile to another.
Definition: EntityMoved.hpp:52
EntityMoveFinished(bl::ecs::Entity entity, const bl::tmap::Position &position)
Construct a new Entity Move Finished event.
Definition: EntityMoved.hpp:65
const bl::ecs::Entity entity
The entity that moved.
Definition: EntityMoved.hpp:54
const bl::tmap::Position & position
The current position of the entity.
Definition: EntityMoved.hpp:57
Fired when an entity rotates without moving.
Definition: EntityMoved.hpp:76
const bl::tmap::Direction origDir
The direction the entity was facing.
Definition: EntityMoved.hpp:84
EntityRotated(bl::ecs::Entity e, bl::tmap::Direction dir, bl::tmap::Direction og)
Construct a new Entity Rotated event.
Definition: EntityMoved.hpp:93
const bl::tmap::Direction faceDir
The direction the entity is now facing.
Definition: EntityMoved.hpp:81
const bl::ecs::Entity entity
The entity that rotated.
Definition: EntityMoved.hpp:78