lib.cpp 688 B

123456789101112131415161718192021
  1. #include <entt/core/attribute.h>
  2. #include <entt/entity/registry.hpp>
  3. #include <entt/entity/view.hpp>
  4. #include "../../../common/boxed_type.h"
  5. #include "../../../common/empty.h"
  6. template class entt::basic_registry<entt::entity>;
  7. ENTT_API void update(entt::registry &registry, int value) {
  8. registry.view<test::boxed_int, test::empty>().each([value](auto &elem) {
  9. elem.value += value;
  10. });
  11. }
  12. ENTT_API void insert(entt::registry &registry) {
  13. // forces the creation of the pool for the empty type
  14. static_cast<void>(registry.storage<test::empty>());
  15. const auto view = registry.view<test::boxed_int>();
  16. registry.insert<test::empty>(view.begin(), view.end());
  17. }