🛠️🐜 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.

52 lines
1.3 KiB

  1. #include <entt/entity/registry.hpp>
  2. #include <entt/signal/dispatcher.hpp>
  3. #include <entt/signal/emitter.hpp>
  4. #include "types.h"
  5. #ifndef LIB_EXPORT
  6. #if defined _WIN32 || defined __CYGWIN__
  7. #define LIB_EXPORT __declspec(dllexport)
  8. #elif defined __GNUC__
  9. #define LIB_EXPORT __attribute__((visibility("default")))
  10. #else
  11. #define LIB_EXPORT
  12. #endif
  13. #endif
  14. ENTT_NAMED_TYPE(int)
  15. ENTT_NAMED_TYPE(char)
  16. ENTT_NAMED_TYPE(double)
  17. ENTT_NAMED_TYPE(float)
  18. LIB_EXPORT typename entt::registry::component_type a_module_int_type() {
  19. entt::registry registry;
  20. (void)registry.type<double>();
  21. (void)registry.type<float>();
  22. return registry.type<int>();
  23. }
  24. LIB_EXPORT typename entt::registry::component_type a_module_char_type() {
  25. entt::registry registry;
  26. (void)registry.type<double>();
  27. (void)registry.type<float>();
  28. return registry.type<char>();
  29. }
  30. LIB_EXPORT void update_position(int delta, entt::registry &registry) {
  31. registry.view<position, velocity>().each([delta](auto &pos, auto &vel) {
  32. pos.x += delta * vel.dx;
  33. pos.y += delta * vel.dy;
  34. });
  35. }
  36. LIB_EXPORT void trigger_another_event(entt::dispatcher &dispatcher) {
  37. dispatcher.trigger<another_event>();
  38. }
  39. LIB_EXPORT void emit_another_event(test_emitter &emitter) {
  40. emitter.publish<another_event>();
  41. }