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

57 lines
1.5 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 another_module_int_type() {
  19. entt::registry registry;
  20. (void)registry.type<char>();
  21. (void)registry.type<const int>();
  22. (void)registry.type<double>();
  23. (void)registry.type<const char>();
  24. (void)registry.type<float>();
  25. return registry.type<int>();
  26. }
  27. LIB_EXPORT typename entt::registry::component_type another_module_char_type() {
  28. entt::registry registry;
  29. (void)registry.type<int>();
  30. (void)registry.type<const char>();
  31. (void)registry.type<float>();
  32. (void)registry.type<const int>();
  33. (void)registry.type<double>();
  34. return registry.type<char>();
  35. }
  36. LIB_EXPORT void assign_velocity(int vel, entt::registry &registry) {
  37. for(auto entity: registry.view<position>()) {
  38. registry.assign<velocity>(entity, vel, vel);
  39. }
  40. }
  41. LIB_EXPORT void trigger_an_event(int payload, entt::dispatcher &dispatcher) {
  42. dispatcher.trigger<an_event>(payload);
  43. }
  44. LIB_EXPORT void emit_an_event(int payload, test_emitter &emitter) {
  45. emitter.publish<an_event>(payload);
  46. }