Grindstone Game Engine
v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
ComponentReflection.hpp
1
#pragma once
2
3
#include <string>
4
#include <vector>
5
#include <iostream>
6
7
#include "TypeResolver.hpp"
8
#include "DefaultResolver.hpp"
9
#include "TypeDescriptorStruct.hpp"
10
#include "TypeDescriptorAsset.hpp"
11
#include "TypeDescriptorVector.hpp"
12
#include "PrintReflectionData.hpp"
13
14
namespace
Grindstone::Reflection {
15
#define REFLECT(name) \
16
public: \
17
friend struct Grindstone::Reflection::DefaultResolver; \
18
static Grindstone::Reflection::TypeDescriptor_Struct reflectionInfo; \
19
static void InitializeReflection(Grindstone::Reflection::TypeDescriptor_Struct*); \
20
static const char* GetComponentName() { return name; };
21
22
#define REFLECT_STRUCT_BEGIN(type) \
23
Grindstone::Reflection::TypeDescriptor_Struct type::reflectionInfo{type::InitializeReflection}; \
24
void type::InitializeReflection(Grindstone::Reflection::TypeDescriptor_Struct* typeDesc) { \
25
using T = type; \
26
typeDesc->name = #type; \
27
typeDesc->size = sizeof(T); \
28
typeDesc->category = { "", {
29
30
#define REFLECT_STRUCT_MEMBER_D(name, displayName, storedName, mods, callback) \
31
{#name, Grindstone::Reflection::ParseDisplayName(displayName, #name), Grindstone::Reflection::ParseStoredName(storedName, #name), offsetof(T, name), mods, Grindstone::Reflection::TypeResolver<decltype(T::name)>::Get(), callback},
32
33
#define REFLECT_STRUCT_MEMBER(name) REFLECT_STRUCT_MEMBER_D(name, "", "", Grindstone::Reflection::Metadata::SaveSetAndView, nullptr)
34
35
#define REFLECT_NO_SUBCAT() }, {}
36
#define REFLECT_SUBCATS_START() }, {
37
#define REFLECT_SUBCATS_END() }}
38
39
#define REFLECT_SUBCAT_START(name) { name, {
40
#define REFLECT_SUBCAT_END() },
41
42
#define REFLECT_STRUCT_END() }; \
43
}
44
45
}
sources
code
EngineCore
Reflection
ComponentReflection.hpp
Generated by
1.12.0