41 lines
1.4 KiB
C++
41 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <Core/Common/EnumUtils.h>
|
|
#include <Engine/Class.h>
|
|
|
|
struct Class;
|
|
using DerivedType = void*;
|
|
using EntityID = uint64_t;
|
|
|
|
// clang-format off
|
|
#define ENTITY_TYPE_LIST(X) X(Inert),
|
|
|
|
#define AS_ENUM(name) name
|
|
enum class Entity_Type : uint8
|
|
{
|
|
ENTITY_TYPE_LIST(AS_ENUM)
|
|
Count
|
|
};
|
|
#undef AS_ENUM
|
|
|
|
extern const char* kEntity_type_names[];
|
|
extern const Class* kEntity_type_class_ptr[];
|
|
|
|
#define ENTITY(kind) ToUnderlying(Entity_Type::kind)
|
|
// clang-format on
|
|
|
|
struct Entity;
|
|
|
|
#define DECLARE_ENTITY() \
|
|
Entity* base; \
|
|
DECLARE_CLASS()
|
|
|
|
#define DEFINE_ENTITY_VERSIONED(entity, version) \
|
|
constexpr Class entityKind##entity = \
|
|
MakeClass(ConstString(#entity), (uint8)Entity_Type::entity, (version), &class_kind_Entity, sizeof(entity), \
|
|
alignof(entity), (&initialize_thunk<entity>), (&serialize_thunk<entity>)); \
|
|
Class* entity::kind = const_cast<Class*>(&entityKind##entity);
|
|
|
|
// Note: Needed by every classes see define above
|
|
extern const Class class_kind_Entity;
|