updated example in the README file (close #209)

This commit is contained in:
Michele Caini
2019-03-23 13:51:18 +01:00
parent e4cd5dbf1f
commit f71496693f
2 changed files with 4 additions and 4 deletions

View File

@@ -113,7 +113,7 @@ struct velocity {
float dy;
};
void update(entt::registry<> &registry) {
void update(entt::registry &registry) {
auto view = registry.view<position, velocity>();
for(auto entity: view) {
@@ -128,8 +128,8 @@ void update(entt::registry<> &registry) {
}
}
void update(std::uint64_t dt, entt::registry<> &registry) {
registry.view<position, velocity>().each([dt](const auto, auto &pos, auto &vel) {
void update(std::uint64_t dt, entt::registry &registry) {
registry.view<position, velocity>().each([dt](auto &pos, auto &vel) {
// gets all the components of the view at once ...
pos.x += vel.dx * dt;

2
TODO
View File

@@ -18,6 +18,6 @@
* empty components model allows for shared components and prefabs unity-like
- each with entity return the shared component multiple times, one per entity that refers to it
- each components only return actual component, so shared components are returned only once
* add a sort of "fast each" for when users know they are not to add/remove components, it can use directly raw access and improve even further performance
* types defined at runtime that refer to the same compile-time type (but to different pools) are possible, the library is almost there
* add take functionality, eg registry.take(entity, other); where it takes the entity and all its components from registry and move them to other
* add unset for context variables