conversion to c by gemini 4 argon
This commit is contained in:
1 parent
b70e2d21d2
commit
f9356f9ba7
369 files changed
+18074
-107634
No files matched your search
+26
-24
@@ -1,46 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/EnumUtils.h>
|
||||
#include <Engine/Class.h>
|
||||
|
||||
struct Class;
|
||||
using DerivedType = void*;
|
||||
using EntityID = uint64_t;
|
||||
typedef void* DerivedType;
|
||||
typedef uint64 EntityID;
|
||||
|
||||
constexpr uint8 kInvalid_user_id = 0U;
|
||||
constexpr EntityID kInvalid_entity_id = 0ULL;
|
||||
|
||||
constexpr EntityID kEntityID_user_id_shift = 56ULL;
|
||||
constexpr EntityID kEntityID_user_id_mask = 0xFF00'0000'0000'0000ULL;
|
||||
#define kInvalid_user_id ((uint8)0U)
|
||||
#define kInvalid_entity_id ((EntityID)0ULL)
|
||||
#define kEntityID_user_id_shift ((EntityID)56ULL)
|
||||
#define kEntityID_user_id_mask ((EntityID)0xFF00000000000000ULL)
|
||||
|
||||
// clang-format off
|
||||
#define ENTITY_TYPE_LIST(X) X(Inert),
|
||||
|
||||
#define AS_ENUM(name) name
|
||||
enum class Entity_Type : uint8
|
||||
typedef uint8 Entity_Type;
|
||||
#define AS_ENUM(name) Entity_Type_##name
|
||||
enum
|
||||
{
|
||||
ENTITY_TYPE_LIST(AS_ENUM)
|
||||
Count
|
||||
Entity_Type_Count
|
||||
};
|
||||
#undef AS_ENUM
|
||||
|
||||
extern const char* kEntity_type_names[];
|
||||
extern const char* kEntity_type_names[];
|
||||
extern const Class* kEntity_type_class_ptr[];
|
||||
|
||||
#define ENTITY(kind) ToUnderlying(Entity_Type::kind)
|
||||
#define ENTITY(kind) ((uint8)Entity_Type_##kind)
|
||||
// clang-format on
|
||||
|
||||
struct Entity;
|
||||
typedef struct Entity Entity;
|
||||
|
||||
#define DECLARE_ENTITY() \
|
||||
Entity* base; \
|
||||
DECLARE_CLASS()
|
||||
#define DECLARE_ENTITY() Entity* base;
|
||||
|
||||
#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);
|
||||
#define DEFINE_ENTITY_VERSIONED(entity, version_num) \
|
||||
const Class class_kind_##entity = { \
|
||||
.Name = ConstString(#entity), \
|
||||
.kind = (uint8)Entity_Type_##entity, \
|
||||
.version = (version_num), \
|
||||
.base_class = &class_kind_Entity, \
|
||||
.initialize_fct = init_##entity, \
|
||||
.serialize_fct = serialize_##entity, \
|
||||
.size_of = sizeof(entity), \
|
||||
.alignment = AlignOf(entity) \
|
||||
};
|
||||
|
||||
// Note: Needed by every classes see define above
|
||||
// Note: Needed by every entity class (see define above)
|
||||
extern const Class class_kind_Entity;
|
||||
Reference in new issue
Block a user