1#ifndef COMPONENTREFLECTION_H
2#define COMPONENTREFLECTION_H
5#include "../Thirdparty/thirdparty.h"
9#include <boost/describe.hpp>
10#include <boost/mp11.hpp>
13#include <unordered_map>
19 bool, int, float, double, std::string,
32 std::vector<ComponentFieldInfo>
fields;
48 bool hasComponent(entt::registry& registry, entt::entity entity,
const std::string& componentName)
const;
52 const std::string& componentName,
const std::string& fieldName)
const;
56 const std::string& componentName,
const std::string& fieldName,
60 void addComponent(entt::registry& registry, entt::entity entity,
const std::string& componentName)
const;
63 void removeComponent(entt::registry& registry, entt::entity entity,
const std::string& componentName)
const;
69 std::string
getComponentFieldType(
const std::string& componentName,
const std::string& fieldName)
const;
#define ENGINE_API
定义 EnginePCH.h:14
std::vector< std::string > getComponentFieldNames(const std::string &componentName) const
定义 ComponentReflection.cpp:99
std::vector< std::string > getRegisteredComponentNames() const
定义 ComponentReflection.cpp:126
ComponentValue getComponentField(entt::registry ®istry, entt::entity entity, const std::string &componentName, const std::string &fieldName) const
定义 ComponentReflection.cpp:31
void registerComponent(const std::string &name)
定义 ComponentReflection.cpp:135
const std::unordered_map< std::string, ComponentInfo > & getComponentInfos() const
定义 ComponentReflection.cpp:19
void addComponent(entt::registry ®istry, entt::entity entity, const std::string &componentName) const
定义 ComponentReflection.cpp:83
std::unordered_map< std::string, ComponentInfo > m_componentInfos
定义 ComponentReflection.h:75
bool hasComponent(entt::registry ®istry, entt::entity entity, const std::string &componentName) const
定义 ComponentReflection.cpp:23
~ComponentReflection()=default
std::string getComponentFieldType(const std::string &componentName, const std::string &fieldName) const
定义 ComponentReflection.cpp:111
ComponentReflection()
定义 ComponentReflection.cpp:7
void removeComponent(entt::registry ®istry, entt::entity entity, const std::string &componentName) const
定义 ComponentReflection.cpp:91
void setComponentField(entt::registry ®istry, entt::entity entity, const std::string &componentName, const std::string &fieldName, const ComponentValue &value) const
定义 ComponentReflection.cpp:56
std::variant< bool, int, float, double, std::string, FCT::Vec3 > ComponentValue
定义 ComponentReflection.h:18
定义 ComponentReflection.h:23
std::string type
定义 ComponentReflection.h:25
std::string name
定义 ComponentReflection.h:24
std::function< ComponentValue(void *)> getter
定义 ComponentReflection.h:26
std::function< void(void *, const ComponentValue &)> setter
定义 ComponentReflection.h:27
定义 ComponentReflection.h:30
std::string name
定义 ComponentReflection.h:31
std::function< void(entt::registry &, entt::entity)> removeComponent
定义 ComponentReflection.h:36
std::vector< ComponentFieldInfo > fields
定义 ComponentReflection.h:32
std::function< void(entt::registry &, entt::entity)> addComponent
定义 ComponentReflection.h:35
std::function< void *(entt::registry &, entt::entity)> getComponent
定义 ComponentReflection.h:34
std::function< bool(entt::registry &, entt::entity)> hasComponent
定义 ComponentReflection.h:33