test: review

This commit is contained in:
Michele Caini
2019-12-21 23:58:03 +01:00
parent 4af7d975c1
commit 14034642f1
2 changed files with 5 additions and 0 deletions

View File

@@ -10,6 +10,9 @@ ENTT_API void update_position(entt::registry &registry) {
}
ENTT_API void assign_velocity(entt::registry &registry) {
// forces the creation of the pool for the velocity component
registry.prepare<velocity>();
for(auto entity: registry.view<position>()) {
registry.assign<velocity>(entity, 1., 1.);
}

View File

@@ -7,6 +7,8 @@ CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
case CR_STEP:
[ctx]() {
auto *registry = static_cast<entt::registry *>(ctx->userdata);
// forces the creation of the pool for the velocity component
registry->prepare<velocity>();
for(auto entity: registry->view<position>()) {
registry->assign<velocity>(entity, 1., 1.);