1
0
Michele Caini 7 жил өмнө
parent
commit
13250887fa

+ 3 - 3
README.md

@@ -1154,16 +1154,16 @@ The following adds components `AType` and `AnotherType` whenever `MyType` is
 assigned to an entity:
 assigned to an entity:
 
 
 ```cpp
 ```cpp
-entt::dependency<AType, AnotherType>(registry.construction<MyType>());
+entt::connnect<AType, AnotherType>(registry.construction<MyType>());
 ```
 ```
 
 
 A component is assigned to an entity and thus default initialized only in case
 A component is assigned to an entity and thus default initialized only in case
 the entity itself hasn't it yet. It means that already existent components won't
 the entity itself hasn't it yet. It means that already existent components won't
 be overriden.<br/>
 be overriden.<br/>
-A dependency can easily be broken by means of the same function template:
+A dependency can easily be broken by means of the following function template:
 
 
 ```cpp
 ```cpp
-entt::dependency<AType, AnotherType>(entt::break_t{}, registry.construction<MyType>());
+entt::disconnect<AType, AnotherType>(registry.construction<MyType>());
 ```
 ```
 
 
 #### Labels
 #### Labels

+ 1 - 0
TODO

@@ -16,3 +16,4 @@
 * reflection system (maybe)
 * reflection system (maybe)
 * C++17. That's all.
 * C++17. That's all.
 * AOB
 * AOB
+* tag_t and the others, create constexpr var

+ 4 - 4
src/entt/entity/helper.hpp

@@ -44,7 +44,7 @@ void dependency(Registry<Entity> &registry, const Entity entity) {
  * assigned to an entity:
  * assigned to an entity:
  * @code{.cpp}
  * @code{.cpp}
  * entt::DefaultRegistry registry;
  * entt::DefaultRegistry registry;
- * entt::dependency<AType, AnotherType>(registry.construction<MyType>());
+ * entt::connect<AType, AnotherType>(registry.construction<MyType>());
  * @endcode
  * @endcode
  *
  *
  * @tparam Dependency Types of components to assign to an entity if triggered.
  * @tparam Dependency Types of components to assign to an entity if triggered.
@@ -52,7 +52,7 @@ void dependency(Registry<Entity> &registry, const Entity entity) {
  * @param sink A sink object properly initialized.
  * @param sink A sink object properly initialized.
  */
  */
 template<typename... Dependency, typename Entity>
 template<typename... Dependency, typename Entity>
-void dependency(Sink<void(Registry<Entity> &, const Entity)> sink) {
+inline void connect(Sink<void(Registry<Entity> &, const Entity)> sink) {
     sink.template connect<dependency<Entity, Dependency...>>();
     sink.template connect<dependency<Entity, Dependency...>>();
 }
 }
 
 
@@ -67,7 +67,7 @@ void dependency(Sink<void(Registry<Entity> &, const Entity)> sink) {
  * components `AType` and `AnotherType`:
  * components `AType` and `AnotherType`:
  * @code{.cpp}
  * @code{.cpp}
  * entt::DefaultRegistry registry;
  * entt::DefaultRegistry registry;
- * entt::dependency<AType, AnotherType>(entt::break_t{}, registry.construction<MyType>());
+ * entt::disconnect<AType, AnotherType>(registry.construction<MyType>());
  * @endcode
  * @endcode
  *
  *
  * @tparam Dependency Types of components used to create the dependency.
  * @tparam Dependency Types of components used to create the dependency.
@@ -75,7 +75,7 @@ void dependency(Sink<void(Registry<Entity> &, const Entity)> sink) {
  * @param sink A sink object properly initialized.
  * @param sink A sink object properly initialized.
  */
  */
 template<typename... Dependency, typename Entity>
 template<typename... Dependency, typename Entity>
-void dependency(break_t, Sink<void(Registry<Entity> &, const Entity)> sink) {
+inline void disconnect(Sink<void(Registry<Entity> &, const Entity)> sink) {
     sink.template disconnect<dependency<Entity, Dependency...>>();
     sink.template disconnect<dependency<Entity, Dependency...>>();
 }
 }
 
 

+ 0 - 4
src/entt/entity/utility.hpp

@@ -17,10 +17,6 @@ struct persistent_t final {};
 struct raw_t final {};
 struct raw_t final {};
 
 
 
 
-/*! @brief Break type used to disambiguate overloads. */
-struct break_t final {};
-
-
 }
 }
 
 
 
 

+ 2 - 2
test/entt/entity/helper.cpp

@@ -6,7 +6,7 @@
 TEST(Helper, Dependency) {
 TEST(Helper, Dependency) {
     entt::DefaultRegistry registry;
     entt::DefaultRegistry registry;
     const auto entity = registry.create();
     const auto entity = registry.create();
-    entt::dependency<double, float>(registry.construction<int>());
+    entt::connect<double, float>(registry.construction<int>());
 
 
     ASSERT_FALSE(registry.has<double>(entity));
     ASSERT_FALSE(registry.has<double>(entity));
     ASSERT_FALSE(registry.has<float>(entity));
     ASSERT_FALSE(registry.has<float>(entity));
@@ -42,7 +42,7 @@ TEST(Helper, Dependency) {
     registry.remove<int>(entity);
     registry.remove<int>(entity);
     registry.remove<double>(entity);
     registry.remove<double>(entity);
     registry.remove<float>(entity);
     registry.remove<float>(entity);
-    entt::dependency<double, float>(entt::break_t{}, registry.construction<int>());
+    entt::disconnect<double, float>(registry.construction<int>());
     registry.assign<int>(entity);
     registry.assign<int>(entity);
 
 
     ASSERT_FALSE(registry.has<double>(entity));
     ASSERT_FALSE(registry.has<double>(entity));