From 34e692b06d6a826017ec5b922c82e0e146750425 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sun, 23 Jul 2017 11:20:45 +0200 Subject: [PATCH] Update README.md --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 281ee040c..0de360790 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ ECS is an architectural pattern used mostly in game development. For further det ## Code Example -``` +```cpp #include #include @@ -145,7 +145,9 @@ CMake version 3.4 or later is mandatory to compile the tests, you don't have to `EnTT` is a header-only library. This means that including the `registry.hpp` header is enough to use it.
It's a matter of adding the following line at the top of a file: - #include +```cpp +#include +``` Then pass the proper `-I` argument to the compiler to add the `src` directory to the include paths.
@@ -164,7 +166,7 @@ There are three options to instantiate your own registry: * By using the default one: - ``` + ```cpp auto registry = entt::DefaultRegistry{args...}; ``` @@ -172,7 +174,7 @@ There are three options to instantiate your own registry: * By using the standard one: - ``` + ```cpp auto registry = entt::StandardRegistry{args...}; ``` @@ -180,7 +182,7 @@ There are three options to instantiate your own registry: * By using your own pool: - ``` + ```cpp auto registry = entt::Registry>{args...}; ``` @@ -225,7 +227,7 @@ There are three different kinds of view, each one with a slighlty different inte All of them are iterable. In other terms they have `begin` and `end` member functions that are suitable for a range-based for loop: -``` +```cpp auto view = registry.view(); for(auto entity: view) { @@ -253,7 +255,7 @@ The multi component view has an additional member function: A filtered view is nothing more than a multi component view with an additional set of components that act as filters.
Users can create filtered views either from a single component view or from a multi component view by means of the `exclude` member function: -``` +```cpp auto view = registry.view().exclude(); for(auto entity: view) { @@ -295,7 +297,7 @@ concurrently on a separate thread if needed. Custom pools for a given component can be defined as a specialization of the class template `ComponentPool`.
In particular: -``` +```cpp template<> struct ComponentPool final { // ... @@ -327,7 +329,7 @@ In cases when the per-component pools are not good enough, the registry can be i In other terms, `entt::Registry` has a template template parameter that can be used to provide both the pool and the list of components: -``` +```cpp auto registry = entt::Registry>{}; ```