From ba8ca93afcb7f25f9f50817bc47bacf4a18fdd8f Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 31 Jan 2020 23:19:24 +0100 Subject: [PATCH] doc: updated the doc for the ecs part (close #390) --- docs/md/entity.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/md/entity.md b/docs/md/entity.md index c62a2a770..10772d411 100644 --- a/docs/md/entity.md +++ b/docs/md/entity.md @@ -23,6 +23,7 @@ * [Tags](#tags) * [Actor](#actor) * [Context variables](#context-variables) + * [Meet the runtime](#meet-the-runtime) * [Snapshot: complete vs continuous](#snapshot-complete-vs-continuous) * [Snapshot loader](#snapshot-loader) * [Continuous loader](#continuous-loader) @@ -696,6 +697,32 @@ context variable or overwrites an already existing one if any. The `try_ctx` member function returns a pointer to the context variable if it exists, otherwise it returns a null pointer. +## Meet the runtime + +Type identifiers are stable in `EnTT` during executions and most of the times +also across different executions. This makes them suitable to mix runtime and +compile-time features.
+The registry offers a couple of functions to _visit_ it and get the types of +components it manages: + +```cpp +registry.visit([](const auto component) { + // ... +}); +``` + +Moreover, there exists an overload to _visit_ a specific entity: + +```cpp +registry.visit(entity, [](const auto component) { + // ... +}); +``` + +This helps to create a bridge between the registry, that is heavily based on the +C++ type system, and any other context where the compile-time isn't an option. +For example: plugin systems, meta system, serialization, and so on. + ## Snapshot: complete vs continuous The `registry` class offers basic support to serialization.