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 <Common/HashedString.hpp>
8
9
#include "TypeResolver.hpp"
10
#include "DefaultResolver.hpp"
11
#include "TypeDescriptorStruct.hpp"
12
#include "TypeDescriptorAsset.hpp"
13
#include "TypeDescriptorArray.hpp"
14
#include "TypeDescriptorVector.hpp"
15
#include "PrintReflectionData.hpp"
16
17
namespace
Grindstone::Reflection {
18
#define REFLECT(name) \
19
public: \
20
friend struct Grindstone::Reflection::DefaultResolver; \
21
static Grindstone::Reflection::TypeDescriptor_Struct reflectionInfo; \
22
static void InitializeReflection(Grindstone::Reflection::TypeDescriptor_Struct*); \
23
static Grindstone::ConstHashedString GetComponentHashString() { return Grindstone::ConstHashedString( name ); }; \
24
static const char* GetComponentName() { return name; };
25
26
#define REFLECT_STRUCT_BEGIN(type) \
27
Grindstone::Reflection::TypeDescriptor_Struct type::reflectionInfo{type::InitializeReflection}; \
28
void type::InitializeReflection(Grindstone::Reflection::TypeDescriptor_Struct* typeDesc) { \
29
using T = type; \
30
typeDesc->name = #type; \
31
typeDesc->size = sizeof(T); \
32
typeDesc->category = { "", {
33
34
#define REFLECT_STRUCT_MEMBER_D(name, displayName, storedName, mods, callback) \
35
{#name, Grindstone::Reflection::ParseDisplayName(displayName, #name), Grindstone::Reflection::ParseStoredName(storedName, #name), offsetof(T, name), mods, Grindstone::Reflection::TypeResolver<decltype(T::name)>::Get(), callback},
36
37
#define REFLECT_STRUCT_MEMBER(name) REFLECT_STRUCT_MEMBER_D(name, "", "", Grindstone::Reflection::Metadata::SaveSetAndView, nullptr)
38
39
#define REFLECT_NO_SUBCAT() }, {}
40
#define REFLECT_SUBCATS_START() }, {
41
#define REFLECT_SUBCATS_END() }}
42
43
#define REFLECT_SUBCAT_START(name) { name, {
44
#define REFLECT_SUBCAT_END() },
45
46
#define REFLECT_STRUCT_END() }; \
47
}
48
49
}
sources
code
EngineCore
Reflection
ComponentReflection.hpp
Generated by
1.13.2