Simple 2D RPG made in C++ and SFML
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.
|
|
|
#ifndef ENTITYMANAGER
|
|
|
|
#define ENTITYMANAGER
|
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "camera.h"
|
|
|
|
#include "entity.h"
|
|
|
|
|
|
|
|
typedef void CollisionUpdateEvent(Entity* entityA, Entity* entityB);
|
|
|
|
|
|
|
|
class EntityManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EntityManager();
|
|
|
|
void SetCollisionMethod(CollisionUpdateEvent collisionsEvent);
|
|
|
|
void AddEntity(std::string name, Entity *entity);
|
|
|
|
Entity* Get(std::string name);
|
|
|
|
void Update();
|
|
|
|
void Render(sf::RenderWindow *window, Camera *camera);
|
|
|
|
~EntityManager();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unordered_map<std::string, Entity*> entities;
|
|
|
|
CollisionUpdateEvent* collisionsEvent;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ENTITYMANAGER
|
|
|
|
|