🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
771 B

  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 "types.h"
  6. position create_position(int x, int y) {
  7. return position{x, y};
  8. }
  9. ENTT_API void set_up() {
  10. using namespace entt::literals;
  11. entt::meta<position>()
  12. .type("position"_hs)
  13. .ctor<&create_position>()
  14. .data<&position::x>("x"_hs)
  15. .data<&position::y>("y"_hs);
  16. entt::meta<velocity>()
  17. .type("velocity"_hs)
  18. .ctor<>()
  19. .data<&velocity::dx>("dx"_hs)
  20. .data<&velocity::dy>("dy"_hs);
  21. }
  22. ENTT_API void tear_down() {
  23. entt::meta_reset<position>();
  24. entt::meta_reset<velocity>();
  25. }
  26. ENTT_API entt::meta_any wrap_int(int value) {
  27. return value;
  28. }