testbed: meta setup function proto

This commit is contained in:
skypjack
2025-05-02 11:36:45 +02:00
parent ebab67c314
commit 4dd03da2e2
4 changed files with 40 additions and 0 deletions

2
TODO
View File

@@ -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)

View File

@@ -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
View 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
View File

@@ -0,0 +1,7 @@
#pragma once
namespace testbed {
void meta_setup();
} // namespace testbed