Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Jul 23, 2017
1 parent 045c423 commit 34e692b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ECS is an architectural pattern used mostly in game development. For further det

## Code Example

```
```cpp
#include <iostream>
#include <registry.hpp>

Expand Down Expand Up @@ -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.<br/>
It's a matter of adding the following line at the top of a file:

#include <registry.hpp>
```cpp
#include <registry.hpp>
```

Then pass the proper `-I` argument to the compiler to add the `src` directory to the include paths.<br/>

Expand All @@ -164,23 +166,23 @@ There are three options to instantiate your own registry:

* By using the default one:

```
```cpp
auto registry = entt::DefaultRegistry<Components...>{args...};
```

That is, you must provide the whole list of components to be registered with the default registry.

* By using the standard one:

```
```cpp
auto registry = entt::StandardRegistry<std::uint16_t, Components...>{args...};
```

That is, you must provide the whole list of components to be registered with the default registry **and** the desired type for the entities. Note that the default type is `std::uint32_t`, that is larger enough for almost all the games but also too big for the most of the games.

* By using your own pool:

```
```cpp
auto registry = entt::Registry<DesiredEntityType, YourOwnPool<Components...>>{args...};
```

Expand Down Expand Up @@ -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<Position, Velocity>();

for(auto entity: view) {
Expand Down Expand Up @@ -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.<br/>
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<Position>().exclude<Velocity>();

for(auto entity: view) {
Expand Down Expand Up @@ -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`.<br/>
In particular:

```
```cpp
template<>
struct ComponentPool<Entity, MyComponent> final {
// ...
Expand Down Expand Up @@ -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<Entity, MyCustomPool<Component1, Component2>>{};
```

Expand Down

0 comments on commit 34e692b

Please sign in to comment.