testbed: meta setup function proto
This commit is contained in:
2
TODO
2
TODO
@@ -35,3 +35,5 @@ TODO:
|
||||
* meta non-const allow_cast overloads: (const int &) to (int &) is not allowed, but (const int &) to (double &) is allowed (support only for convertibles)
|
||||
* review build process for testbed (i.e. tests first due to SDL)
|
||||
* use any for meta_custom_node
|
||||
* support names directly on meta nodes
|
||||
* fwd meta_ctx (and update testbed)
|
||||
|
||||
@@ -51,6 +51,7 @@ target_sources(
|
||||
PRIVATE
|
||||
application/application.cpp
|
||||
application/context.cpp
|
||||
meta/meta.cpp
|
||||
system/hud_system.cpp
|
||||
system/imgui_system.cpp
|
||||
system/input_system.cpp
|
||||
|
||||
30
testbed/meta/meta.cpp
Normal file
30
testbed/meta/meta.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <component/input_listener_component.h>
|
||||
#include <component/position_component.h>
|
||||
#include <component/rect_component.h>
|
||||
#include <component/renderable_component.h>
|
||||
#include <entt/core/hashed_string.hpp>
|
||||
#include <entt/davey/meta.hpp>
|
||||
#include <entt/meta/factory.hpp>
|
||||
#include <meta/meta.h>
|
||||
|
||||
namespace testbed {
|
||||
|
||||
void meta_setup() {
|
||||
using namespace entt::literals;
|
||||
|
||||
entt::meta_factory<input_listener_component>()
|
||||
.custom<entt::davey_data>("input listener")
|
||||
.data<&input_listener_component::command>("command"_hs)
|
||||
.custom<entt::davey_data>("command");
|
||||
|
||||
entt::meta_factory<position_component>()
|
||||
.custom<entt::davey_data>("position")
|
||||
.data<&SDL_FPoint::x>("x"_hs)
|
||||
.custom<entt::davey_data>("x")
|
||||
.data<&SDL_FPoint::y>("y"_hs)
|
||||
.custom<entt::davey_data>("y");
|
||||
|
||||
// bind components...
|
||||
}
|
||||
|
||||
} // namespace testbed
|
||||
7
testbed/meta/meta.h
Normal file
7
testbed/meta/meta.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace testbed {
|
||||
|
||||
void meta_setup();
|
||||
|
||||
} // namespace testbed
|
||||
Reference in New Issue
Block a user