|
Brenta Engine 1.0
|
#include <world.hpp>
Static Public Member Functions | |
| static void | Init () |
| Initialize the world. | |
| static void | Delete () |
| Delete the world. | |
| static void | Tick () |
| Tick the world. | |
| static std::set< Entity > * | getEntities () |
| Get the entities container. | |
| static UMap< std::type_index, Resource > * | getResources () |
| Get the resources container. | |
| static UMapVec< std::type_index, Component > * | getComponents () |
| Get the components container. | |
| static Entity | NewEntity () |
| Create a new entity. | |
| template<typename R > | |
| static R * | GetResource () |
| Get a pointer to a resource. | |
| template<typename C > | |
| static void | AddComponent (Entity entity, C new_component) |
| Add a component to an entity. | |
| template<typename R > | |
| static void | AddResource (R resource) |
| Add a resource to the world. | |
| static void | RemoveEntity (Entity entity) |
| Remove an entity. | |
| template<typename R > | |
| static void | RemoveResource () |
| Remove a resource. | |
| template<typename C > | |
| static C * | EntityToComponent (Entity entity) |
| Get the component of an entity. | |
| static void | RunSystems () |
| Run all systems. | |
World class.
This class is a singleton that contains all the entities, components and systems in the game world, provides acces to them through queries and is responsible for updating the game world.
|
inlinestatic |
Add a component to an entity.
This method adds a component to an entity. The component is copied and stored in the world.
| C | The type of the component |
| entity | The entity to add the component to |
| new_component | The component to add |
Example:
|
inlinestatic |
|
static |
|
inlinestatic |
Get the component of an entity.
This method returns a pointer to the component of the specified type of the specified entity. If the component is not found, it returns nullptr.
| C | The type of the component |
| entity | The entity to get the component from |
Example:
|
static |
|
static |
|
inlinestatic |
Get a pointer to a resource.
This method returns a pointer to a resource of the specified type. If the resource is not found, it returns nullptr.
| R | The type of the resource |
Example:
|
static |
|
static |
|
static |
|
static |
Remove an entity.
This method removes an entity from the world, deleting all its components.
| entity | The entity to remove |
Example:
|
inlinestatic |
|
static |
Run all systems.
This method runs all the systems in the world.
|
static |