1 #ifndef CORE_SYSTEMS_POSITION_HPP
2 #define CORE_SYSTEMS_POSITION_HPP
4 #include <BLIB/Containers/Grid.hpp>
5 #include <BLIB/ECS.hpp>
6 #include <BLIB/Engine/System.hpp>
7 #include <BLIB/Events.hpp>
8 #include <BLIB/Tilemap/Position.hpp>
11 #include <unordered_map>
27 :
public bl::engine::System
28 ,
public bl::event::Listener<event::EntityMoved, bl::ecs::event::ComponentAdded<bl::tmap::Position>,
29 bl::ecs::event::ComponentRemoved<bl::tmap::Position>,
51 bl::ecs::Entity
getEntity(
const bl::tmap::Position& pos)
const;
59 bool spaceFree(
const bl::tmap::Position& position)
const;
70 bl::ecs::Entity
search(
const bl::tmap::Position& start, bl::tmap::Direction dir,
87 std::vector<bl::ctr::Vector2D<bl::ecs::Entity>> entityMap;
90 virtual void observe(
const bl::ecs::event::ComponentAdded<bl::tmap::Position>& event)
override;
92 const bl::ecs::event::ComponentRemoved<bl::tmap::Position>& event)
override;
95 virtual void init(bl::engine::Engine&)
override;
96 virtual void update(std::mutex&,
float,
float,
float,
float)
override;
98 bl::ecs::Entity& get(
const bl::tmap::Position& pos);
Core classes and functionality for both the editor and game.
Fired after an entity begins moving from one position to another.
Fired right before a map is entered. Use this event for initializing data structures that depend on m...
The primary entity positioning system. Handles determining which entities get updated as well as trac...
Position(Systems &owner)
Construct the Position system.
virtual ~Position()=default
Destroy the Position system.
bl::ecs::Entity search(const bl::tmap::Position &start, bl::tmap::Direction dir, unsigned int range)
Searches for an entity from the starting position in the given direction for the given number of spac...
void editorPushLevel()
Called by the editor when a level is added.
bl::ecs::Entity getEntity(const bl::tmap::Position &pos) const
Returns the entity at the given position or InvalidEntity if not found.
void editorPopLevel()
Called by the editor when a level is removed.
bool spaceFree(const bl::tmap::Position &position) const
Returns whether or not a tile is currently occupied.
Owns all primary systems and a reference to the engine.