The next little game in the series where I make a fancy rogue game.
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.
 
 
 
 
 
 
roguish/collider.hpp

25 lines
618 B

#pragma once
#include <vector>
#include <unordered_map>
#include "map.hpp"
#include "dinkyecs.hpp"
#include "point.hpp"
#include <tuple>
typedef std::vector<DinkyECS::Entity> EntityList;
typedef std::unordered_map<Point, DinkyECS::Entity, PointHash> PointEntityMap;
class spatial_map {
public:
spatial_map() {}
void insert(Point pos, DinkyECS::Entity obj);
void move(Point from, Point to, DinkyECS::Entity ent);
void remove(Point pos);
bool occupied(Point pos) const;
std::tuple<bool, EntityList> neighbors(Point position, bool diag=false) const;
private:
PointEntityMap table;
};