forked from Green-Sky/tomato
Squashed 'external/entt/entt/' content from commit fef92113
git-subtree-dir: external/entt/entt git-subtree-split: fef921132cae7588213d0f9bcd2fb9c8ffd8b7fc
This commit is contained in:
38
test/lib/meta/lib.cpp
Normal file
38
test/lib/meta/lib.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <entt/core/attribute.h>
|
||||
#include <entt/core/hashed_string.hpp>
|
||||
#include <entt/meta/factory.hpp>
|
||||
#include <entt/meta/meta.hpp>
|
||||
#include "types.h"
|
||||
|
||||
position create_position(int x, int y) {
|
||||
return position{x, y};
|
||||
}
|
||||
|
||||
ENTT_API void share(entt::locator<entt::meta_ctx>::node_type handle) {
|
||||
entt::locator<entt::meta_ctx>::reset(handle);
|
||||
}
|
||||
|
||||
ENTT_API void set_up() {
|
||||
using namespace entt::literals;
|
||||
|
||||
entt::meta<position>()
|
||||
.type("position"_hs)
|
||||
.ctor<&create_position>()
|
||||
.data<&position::x>("x"_hs)
|
||||
.data<&position::y>("y"_hs);
|
||||
|
||||
entt::meta<velocity>()
|
||||
.type("velocity"_hs)
|
||||
.ctor<>()
|
||||
.data<&velocity::dx>("dx"_hs)
|
||||
.data<&velocity::dy>("dy"_hs);
|
||||
}
|
||||
|
||||
ENTT_API void tear_down() {
|
||||
entt::meta_reset<position>();
|
||||
entt::meta_reset<velocity>();
|
||||
}
|
||||
|
||||
ENTT_API entt::meta_any wrap_int(int value) {
|
||||
return value;
|
||||
}
|
||||
Reference in New Issue
Block a user