|
@@ -2,27 +2,15 @@
|
|
|
|
|
|
|
|
#include <cr.h>
|
|
#include <cr.h>
|
|
|
#include <gtest/gtest.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
|
+#include <entt/core/type_info.hpp>
|
|
|
#include <entt/entity/registry.hpp>
|
|
#include <entt/entity/registry.hpp>
|
|
|
-#include "proxy.h"
|
|
|
|
|
#include "types.h"
|
|
#include "types.h"
|
|
|
|
|
|
|
|
-proxy::proxy(entt::registry &ref)
|
|
|
|
|
- : registry{&ref}
|
|
|
|
|
-{}
|
|
|
|
|
-
|
|
|
|
|
-void proxy::for_each(void(*cb)(position &, velocity &)) {
|
|
|
|
|
- registry->view<position, velocity>().each(cb);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-void proxy::assign(velocity vel) {
|
|
|
|
|
- for(auto entity: registry->view<position>()) {
|
|
|
|
|
- registry->assign<velocity>(entity, vel);
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+template<typename Type>
|
|
|
|
|
+struct entt::type_index<Type> {};
|
|
|
|
|
|
|
|
TEST(Lib, Registry) {
|
|
TEST(Lib, Registry) {
|
|
|
entt::registry registry;
|
|
entt::registry registry;
|
|
|
- proxy handler{registry};
|
|
|
|
|
|
|
|
|
|
for(auto i = 0; i < 3; ++i) {
|
|
for(auto i = 0; i < 3; ++i) {
|
|
|
const auto entity = registry.create();
|
|
const auto entity = registry.create();
|
|
@@ -30,7 +18,7 @@ TEST(Lib, Registry) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
cr_plugin ctx;
|
|
cr_plugin ctx;
|
|
|
- ctx.userdata = &handler;
|
|
|
|
|
|
|
+ ctx.userdata = ®istry;
|
|
|
cr_plugin_load(ctx, PLUGIN);
|
|
cr_plugin_load(ctx, PLUGIN);
|
|
|
cr_plugin_update(ctx);
|
|
cr_plugin_update(ctx);
|
|
|
|
|
|
|
@@ -41,5 +29,6 @@ TEST(Lib, Registry) {
|
|
|
ASSERT_EQ(position.y, entt::to_integral(entity) + 16);
|
|
ASSERT_EQ(position.y, entt::to_integral(entity) + 16);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ registry = {};
|
|
|
cr_plugin_close(ctx);
|
|
cr_plugin_close(ctx);
|
|
|
}
|
|
}
|