lib.cpp 836 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <entt/core/attribute.h>
  2. #include <entt/core/hashed_string.hpp>
  3. #include <entt/meta/factory.hpp>
  4. #include <entt/meta/meta.hpp>
  5. #include <entt/meta/resolve.hpp>
  6. #include "types.h"
  7. position create_position(int x, int y) {
  8. return position{x, y};
  9. }
  10. ENTT_API void set_up() {
  11. using namespace entt::literals;
  12. entt::meta<position>()
  13. .type("position"_hs)
  14. .ctor<&create_position>()
  15. .data<&position::x>("x"_hs)
  16. .data<&position::y>("y"_hs);
  17. entt::meta<velocity>()
  18. .type("velocity"_hs)
  19. .ctor<>()
  20. .data<&velocity::dx>("dx"_hs)
  21. .data<&velocity::dy>("dy"_hs);
  22. }
  23. ENTT_API void tear_down() {
  24. entt::meta_reset<position>();
  25. entt::meta_reset<velocity>();
  26. }
  27. ENTT_API entt::meta_any wrap_int(int value) {
  28. return value;
  29. }