feat: add new fancy reflection
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
#include <destrum/Serialization/Reflect.h>
|
||||
|
||||
PrintComponent::PrintComponent(GameObject& parent) : Component(parent, "PrintComponent")
|
||||
{
|
||||
}
|
||||
@@ -15,20 +17,7 @@ void PrintComponent::Update(float dt)
|
||||
spdlog::debug(m_message);
|
||||
}
|
||||
|
||||
void PrintComponent::ImGuiInspector()
|
||||
void PrintComponent::Reflect(FieldVisitor& v)
|
||||
{
|
||||
Component::ImGuiInspector();
|
||||
}
|
||||
|
||||
nlohmann::json PrintComponent::Serialize() const
|
||||
{
|
||||
return {{"message", m_message}};
|
||||
}
|
||||
|
||||
void PrintComponent::Deserialize(const nlohmann::json& basic_jsons)
|
||||
{
|
||||
if (basic_jsons.contains("message"))
|
||||
{
|
||||
m_message = basic_jsons.at("message").get<std::string>();
|
||||
}
|
||||
v.Field("message", m_message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user