workaround for an issue of VS2019
This commit is contained in:
3
TODO
3
TODO
@@ -27,3 +27,6 @@ TODO
|
||||
* make meta work across boundaries
|
||||
- inline variables are fine here, only the head represents a problem
|
||||
- we should always resolve by looking into the list of types when working across boundaries, no direct resolve
|
||||
* signals: entity/registry/component instead of registry/entity/component
|
||||
- dependency becomes a short circuit on the registry
|
||||
- deprecate dependency
|
||||
|
||||
@@ -149,7 +149,8 @@ void dependency(basic_registry<Entity> ®, const Entity entt) {
|
||||
*/
|
||||
template<typename... Dependency, typename Component, typename Entity>
|
||||
void connect(sink<void(basic_registry<Entity> &, const Entity, Component &)> sink) {
|
||||
sink.template connect<dependency<Entity, Dependency...>>();
|
||||
constexpr auto function = &dependency<Entity, Dependency...>;
|
||||
sink.template connect<function>();
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +174,8 @@ void connect(sink<void(basic_registry<Entity> &, const Entity, Component &)> sin
|
||||
*/
|
||||
template<typename... Dependency, typename Component, typename Entity>
|
||||
void disconnect(sink<void(basic_registry<Entity> &, const Entity, Component &)> sink) {
|
||||
sink.template disconnect<dependency<Entity, Dependency...>>();
|
||||
constexpr auto function = &dependency<Entity, Dependency...>;
|
||||
sink.template disconnect<function>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,8 +26,12 @@ TEST(Helper, AsGroup) {
|
||||
TEST(Helper, Dependency) {
|
||||
entt::registry registry;
|
||||
const auto entity = registry.create();
|
||||
|
||||
ASSERT_TRUE(registry.on_construct<int>().empty());
|
||||
|
||||
entt::connect<double, float>(registry.on_construct<int>());
|
||||
|
||||
ASSERT_FALSE(registry.on_construct<int>().empty());
|
||||
ASSERT_FALSE(registry.has<double>(entity));
|
||||
ASSERT_FALSE(registry.has<float>(entity));
|
||||
|
||||
@@ -62,9 +66,16 @@ TEST(Helper, Dependency) {
|
||||
registry.remove<int>(entity);
|
||||
registry.remove<double>(entity);
|
||||
registry.remove<float>(entity);
|
||||
|
||||
ASSERT_FALSE(registry.has<int>(entity));
|
||||
ASSERT_FALSE(registry.has<double>(entity));
|
||||
ASSERT_FALSE(registry.has<float>(entity));
|
||||
|
||||
entt::disconnect<double, float>(registry.on_construct<int>());
|
||||
registry.assign<int>(entity);
|
||||
|
||||
ASSERT_TRUE(registry.on_construct<int>().empty());
|
||||
ASSERT_TRUE(registry.has<int>(entity));
|
||||
ASSERT_FALSE(registry.has<double>(entity));
|
||||
ASSERT_FALSE(registry.has<float>(entity));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user