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