Dependency position
THIS ISSUE ──► ComponentReflectionRegistry (#649)
└──► Register built-in components (#650)
(no dependencies — start immediately, parallel with #647)
This is the start of Track B. No dependencies. Work it in parallel with #647.
Why
These three data structures are the vocabulary of the reflection system. Every other issue in this track depends on them. They are pure type definitions — no logic, no external dependencies beyond <cstdint>.
Work
Create two new header files:
ZEngine/ZEngine/ECS/Reflection/FieldType.h
#pragma once
#include <cstdint>
namespace ZEngine::ECS {
enum class FieldType : uint8_t {
Bool,
Int8, Int16, Int32, Int64,
UInt8, UInt16, UInt32, UInt64,
Float, Double,
Vec2f, Vec3f, Vec4f,
Quatf,
Mat4f,
EntityID, // display as "Entity #N (gen M)"
AssetUUID, // look up asset name via AssetRegistry
String, // fixed char[N] buffer
Enum, // dropdown; requires EnumValues array
Struct, // nested sub-fields
};
}
ZEngine/ZEngine/ECS/Reflection/ComponentMeta.h
#pragma once
#include <ZEngine/ECS/Reflection/FieldType.h>
#include <ZEngine/ECS/ComponentTypeID.h>
#include <cstdint>
namespace ZEngine::ECS {
struct EnumValue {
const char* Name = nullptr;
int64_t Value = 0;
};
struct FieldDescriptor {
const char* Name = nullptr;
FieldType Type = FieldType::Float;
uint32_t Offset = 0; // offsetof(Component, field)
uint32_t Size = 0; // sizeof(field)
float Min = -1e9f;
float Max = 1e9f;
uint32_t StringCap = 0; // for FieldType::String
const EnumValue* EnumValues = nullptr;
uint32_t EnumCount = 0;
const FieldDescriptor* SubFields = nullptr; // for FieldType::Struct
uint32_t SubCount = 0;
bool Hidden = false;
bool ReadOnly = false;
const char* Tooltip = nullptr;
};
struct ComponentMeta {
ComponentTypeID TypeID = 0;
const char* TypeName = nullptr;
uint32_t Size = 0;
uint32_t Align = 0;
const FieldDescriptor* Fields = nullptr;
uint32_t FieldCount = 0;
const char* Category = "General";
const char* Tooltip = nullptr;
};
}
Acceptance criteria
- Both headers compile cleanly with no external dependencies beyond
ComponentTypeID.h
- No
.cpp file needed — these are pure data structures
FieldDescriptor::Offset and Size are populated using offsetof() and sizeof() at the registration call sites (not here)
Dependency position
This is the start of Track B. No dependencies. Work it in parallel with #647.
Why
These three data structures are the vocabulary of the reflection system. Every other issue in this track depends on them. They are pure type definitions — no logic, no external dependencies beyond
<cstdint>.Work
Create two new header files:
ZEngine/ZEngine/ECS/Reflection/FieldType.hZEngine/ZEngine/ECS/Reflection/ComponentMeta.hAcceptance criteria
ComponentTypeID.h.cppfile needed — these are pure data structuresFieldDescriptor::OffsetandSizeare populated usingoffsetof()andsizeof()at the registration call sites (not here)