Jelajahi Sumber

doc: updated examples (close #401)

Michele Caini 6 tahun lalu
induk
melakukan
eee8a338e2
2 mengubah file dengan 10 tambahan dan 3 penghapusan
  1. 3 0
      TODO
  2. 7 3
      docs/md/process.md

+ 3 - 0
TODO

@@ -19,6 +19,9 @@
 * any-of rule for views/groups (eg entity has A and any of B/C/D)
   - get -> all, exclude -> none
 * deprecate sigh::publish, use operator()
+* meta:
+  - type -> alias, resolve search by type id and alias
+  - no longer detached unnamed types, all them are "searchable"
 * remove args... from registry::assure and the others (index would be duplicated)
   - use prepare properly and do not forward to assure
 

+ 7 - 3
docs/md/process.md

@@ -74,6 +74,10 @@ Here is a minimal example for the sake of curiosity:
 struct my_process: entt::process<my_process, std::uint32_t> {
     using delta_type = std::uint32_t;
 
+    my_process(delta_type delay)
+        : remaining{delay}
+    {}
+
     void update(delta_type delta, void *) {
         remaining -= std::min(remaining, delta);
 
@@ -85,7 +89,7 @@ struct my_process: entt::process<my_process, std::uint32_t> {
     }
 
 private:
-    delta_type remaining{1000u};
+    delta_type remaining;
 };
 ```
 
@@ -158,7 +162,7 @@ To attach a process to a scheduler there are mainly two ways:
   the `attach` member function:
 
   ```cpp
-  scheduler.attach<my_process>("foobar");
+  scheduler.attach<my_process>(1000u);
   ```
 
 * Otherwise, in case of a lambda or a functor, it's enough to provide an
@@ -182,7 +186,7 @@ scheduler.attach([](auto delta, void *, auto succeed, auto fail) {
     // ...
 })
 // appends a child in the form of a process class
-.then<my_process>();
+.then<my_process>(1000u);
 ```
 
 To update a scheduler and therefore all its processes, the `update` member