You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
688 B
31 lines
688 B
3 months ago
|
#pragma once
|
||
|
#include <vector>
|
||
|
#include <unordered_map>
|
||
|
#include "map.hpp"
|
||
|
#include "dinkyecs.hpp"
|
||
3 months ago
|
#include "point.hpp"
|
||
3 months ago
|
|
||
3 months ago
|
typedef std::vector<DinkyECS::Entity> EntityList;
|
||
3 months ago
|
|
||
3 months ago
|
typedef std::unordered_map<Point, DinkyECS::Entity, PointHash> PointEntityMap;
|
||
3 months ago
|
|
||
3 months ago
|
struct FoundEntities {
|
||
|
bool found;
|
||
|
EntityList nearby;
|
||
|
};
|
||
|
|
||
2 weeks ago
|
class SpatialMap {
|
||
3 months ago
|
public:
|
||
2 weeks ago
|
SpatialMap() {}
|
||
3 months ago
|
|
||
|
void insert(Point pos, DinkyECS::Entity obj);
|
||
|
void move(Point from, Point to, DinkyECS::Entity ent);
|
||
|
void remove(Point pos);
|
||
3 months ago
|
bool occupied(Point pos) const;
|
||
2 months ago
|
DinkyECS::Entity get(Point at) const;
|
||
3 months ago
|
FoundEntities neighbors(Point position, bool diag=false) const;
|
||
3 months ago
|
|
||
|
private:
|
||
3 months ago
|
PointEntityMap table;
|
||
3 months ago
|
};
|