| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #include <entt/entity/registry.hpp>
- #include "component.h"
- #ifndef LIB_EXPORT
- #if defined _WIN32 || defined __CYGWIN__
- #define LIB_EXPORT __declspec(dllexport)
- #elif defined __GNUC__
- #define LIB_EXPORT __attribute__((visibility("default")))
- #else
- #define LIB_EXPORT
- #endif
- #endif
- ENTT_SHARED_TYPE(int)
- ENTT_SHARED_TYPE(char)
- ENTT_SHARED_TYPE(double)
- ENTT_SHARED_TYPE(float)
- LIB_EXPORT typename entt::registry<>::component_type a_module_int_type() {
- entt::registry<> registry;
- (void)registry.type<double>();
- (void)registry.type<float>();
- return registry.type<int>();
- }
- LIB_EXPORT typename entt::registry<>::component_type a_module_char_type() {
- entt::registry<> registry;
- (void)registry.type<double>();
- (void)registry.type<float>();
- return registry.type<char>();
- }
- LIB_EXPORT void update_position(int delta, entt::registry<> ®istry) {
- registry.view<position, velocity>().each([delta](auto &pos, auto &vel) {
- pos.x += delta * vel.dx;
- pos.y += delta * vel.dy;
- });
- }
|