|
|
@@ -803,8 +803,8 @@ std::unordered_map<entt::id_type, clone_fn_type *> clone_functions;
|
|
|
|
|
|
// ...
|
|
|
|
|
|
-clone_functions[entt::type_info<position>::id()] = &clone<position>;
|
|
|
-clone_functions[entt::type_info<velocity>::id()] = &clone<velocity>;
|
|
|
+clone_functions[entt::type_hash<position>::value()] = &clone<position>;
|
|
|
+clone_functions[entt::type_hash<velocity>::value()] = &clone<velocity>;
|
|
|
```
|
|
|
|
|
|
Stamping a registry becomes straightforward with such a mapping then:
|
|
|
@@ -865,8 +865,8 @@ std::unordered_map<entt::id_type, stamp_fn_type *> stamp_functions;
|
|
|
|
|
|
// ...
|
|
|
|
|
|
-stamp_functions[entt::type_info<position>::id()] = &stamp<position>;
|
|
|
-stamp_functions[entt::type_info<velocity>::id()] = &stamp<velocity>;
|
|
|
+stamp_functions[entt::type_hash<position>::value()] = &stamp<position>;
|
|
|
+stamp_functions[entt::type_hash<velocity>::value()] = &stamp<velocity>;
|
|
|
```
|
|
|
|
|
|
Then _stamp_ entities across different registries as:
|
|
|
@@ -1281,7 +1281,7 @@ thrown away. The reasons for this go far beyond the scope of this document.<br/>
|
|
|
To iterate a runtime view, either use it in a range-for loop:
|
|
|
|
|
|
```cpp
|
|
|
-entt::id_type types[] = { entt::type_info<position>::id(), entt::type_info<velocity>::id() };
|
|
|
+entt::id_type types[] = { entt::type_hash<position>::value(), entt::type_hash<velocity>::value() };
|
|
|
auto view = registry.runtime_view(std::cbegin(types), std::cend(types));
|
|
|
|
|
|
for(auto entity: view) {
|
|
|
@@ -1299,7 +1299,7 @@ for(auto entity: view) {
|
|
|
Or rely on the `each` member function to iterate entities:
|
|
|
|
|
|
```cpp
|
|
|
-entt::id_type types[] = { entt::type_info<position>::id(), entt::type_info<velocity>::id() };
|
|
|
+entt::id_type types[] = { entt::type_hash<position>::value(), entt::type_hash<velocity>::value() };
|
|
|
|
|
|
registry.runtime_view(std::cbegin(types), std::cend(types)).each([](auto entity) {
|
|
|
// ...
|
|
|
@@ -1310,8 +1310,8 @@ Performance are exactly the same in both cases.<br/>
|
|
|
Filtering entities by components is also supported for this kind of views:
|
|
|
|
|
|
```cpp
|
|
|
-entt::id_type components[] = { entt::type_info<position>::id() };
|
|
|
-entt::id_type filter[] = { entt::type_info<velocity>::id() };
|
|
|
+entt::id_type components[] = { entt::type_hash<position>::value() };
|
|
|
+entt::id_type filter[] = { entt::type_hash<velocity>::value() };
|
|
|
auto view = registry.runtime_view(std::cbegin(components), std::cend(components), std::cbegin(filter), std::cend(filter));
|
|
|
```
|
|
|
|