From 054b9c24024b2d9e04bf8dc65e75cef7bc906e15 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 5 Apr 2019 23:17:58 +0200 Subject: [PATCH] updated doc --- docs/md/entity.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/md/entity.md b/docs/md/entity.md index 09676b545..856bf387d 100644 --- a/docs/md/entity.md +++ b/docs/md/entity.md @@ -10,6 +10,7 @@ * [A bitset-free entity-component system](#a-bitset-free-entity-component-system) * [Pay per use](#pay-per-use) * [All or nothing](#all-or-nothing) + * [Stateless systems](#stateless-systems) * [Vademecum](#vademecum) * [The Registry, the Entity and the Component](#the-registry-the-entity-and-the-component) * [Observe changes](#observe-changes) @@ -109,6 +110,18 @@ development.
The rest is experimentation and the desire to invent something new, hoping to have succeeded. +## Stateless systems + +`EnTT` is designed so that it can work with _stateless systems_. In other words, +all systems can be free functions and there is no need to define them as classes +(although nothing prevents users from doing so).
+This is possible because the main class with which the users will work provides +all what is needed to act as the sole _source of truth_ of an application. + +To be honest, this point became part of the design principles at a later date, +but has also become one of the cornerstones of the library to date, as stateless +systems are widely used and appreciated in general. + # Vademecum The registry to store, the views and the groups to iterate. That's all. @@ -439,9 +452,8 @@ In fact, there are two functions that respond to slightly different needs: Or by accessing their entities: ```cpp - registry.sort([](const entt::entity &lhs, const entt::entity &rhs) { - return lhs.z < rhs.z; - + registry.sort([®istry](const entt::entity lhs, const entt::entity rhs) { + return registry.entity(lhs) < registry.entity(rhs); }); ```