43 lines
519 B
C++
43 lines
519 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
//#include <utility.h>
|
|
|
|
using EntityIndex = uint16_t;
|
|
|
|
enum EntityTag : uint8_t
|
|
{
|
|
none,
|
|
|
|
tagCount
|
|
};
|
|
|
|
|
|
class EntityManager;
|
|
|
|
class Entity
|
|
{
|
|
private:
|
|
friend class EntityManager;
|
|
Entity();
|
|
|
|
public:
|
|
template<typename T>
|
|
bool hasComponent() const;
|
|
|
|
template<typename T>
|
|
T& getComponent() const;
|
|
|
|
template<typename T>
|
|
T& getComponent();
|
|
|
|
template<typename T>
|
|
void addComponent(const T&&);
|
|
|
|
EntityTag tag() const;
|
|
|
|
bool isAlive() const;
|
|
|
|
private:
|
|
EntityIndex m_id;
|
|
}; |