Added codegen to register components, and started reworking lua
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#include <functional>
|
||||
#include <ostream>
|
||||
#pragma once
|
||||
#include "ecs.h"
|
||||
|
||||
@@ -57,6 +59,17 @@ namespace ecs::serial {
|
||||
internal::functions.insert({ComponentID::id<T>, {func1, func2, func3}});
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void register_component_custom(std::function<void(std::ostream&, ecs::Component*)> func1, std::function<void(std::istream&, Component*)> func2) {
|
||||
auto func3 = [] () -> Component* {
|
||||
return new T();
|
||||
};
|
||||
|
||||
internal::functions.insert({ComponentID::id<T>, {func1, func2, func3}});
|
||||
}
|
||||
|
||||
void serialize(std::ostream& os, Entity* entity);
|
||||
void deserialize(std::istream& is, Manager& manager);
|
||||
|
||||
void serialize_ids(std::ostream& os);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user