Core » ECS module

Entity Component System library.

This module is arguably the heart of the engine, as it provides a means to organize and manage the data and logic of both the engine and games built with it. It is, as of now, a bit of a mess. Most of the exposed types are internal to the documentation, and thus it can get hard to navigate (TODO #377).

System argument types

  • const R& - used to read resource data of type R.
  • R& - used to write resource data of type R.
  • const World& - used to read the world directly (not recommended, ruins parallelism, prefer Commands).
  • World& - used to write the world directly (not recommended, ruins parallelism, prefer Commands).
  • Commands - used to queue entities to be created, destroyed and other operations.
  • EventReader<E> - reads events of type E sent from other systems.
  • EventWriter<E> - sends events of type E to other systems.
  • Query<Args...> - queries the world for entities which match its arguments.
  • Plugins - used to add and remove plugins dynamically.

Query argument types

  • const C& - matches entities with the component C, read-only access.
  • C& - matches entities with the component C, write access.
  • Opt<const C&>" - matches all entities, read-only access when the component C is present. -Opt<C&>` - matches all entities, write access when the component C is present.

Modules

module Entity
Entity part of the ECS.
module Observer
Observer part of the ECS.
module Query
Defines the query functionality of the ECS.
module System
System part of the ECS.
module Table
Contains various table-like data structures which storage data associated to entities.

Files

file blueprint.hpp
Class cubos::core::ecs::Blueprint.
file command_buffer.hpp
Class cubos::core::ecs::CommandBuffer.
file cubos.hpp
Class cubos::core::ecs::Cubos.
file dynamic.hpp
Class cubos::core::ecs::DynamicPlugin.
file name.hpp
Class cubos::core::ecs::Name.
file plugin_queue.hpp
Class cubos::core::ecs::PluginQueue.
file reflection.hpp
Class cubos::core::ecs::TypeBuilder.
file tag.hpp
Class cubos::core::ecs::Tag.
file types.hpp
Class cubos::core::ecs::Types.
file world.hpp
Class cubos::core::ecs::World.

Classes

class cubos::core::ecs::Blueprint
Collection of entities and their respective components and relations.
class cubos::core::ecs::CommandBuffer
Stores commands to execute them later.
struct cubos::core::ecs::DeltaTime
Resource which stores the time since the last iteration of the main loop started.
struct cubos::core::ecs::ShouldQuit
Resource used as a flag to indicate whether the main loop should stop running.
struct cubos::core::ecs::Arguments
Resource which stores the command-line arguments.
class cubos::core::ecs::Cubos
Represents the engine itself, and exposes the interface with which the game developer interacts with. Ties up all the different parts of the engine together.
class cubos::core::ecs::DynamicPlugin
Manages the loading and unloading of a plugin from a shared library.
struct cubos::core::ecs::Name
Component which stores the name of an entity.
struct cubos::core::ecs::PluginQueue
Stores plugin operations to be executed later.
struct cubos::core::ecs::SymmetricTrait
Trait used to identify symmetric relations.
struct cubos::core::ecs::TreeTrait
Trait used to identify tree relations.
struct cubos::core::ecs::EphemeralTrait
Trait used to identify types which are ephemeral and should not be persisted.
template<typename T>
class cubos::core::ecs::TypeBuilder
Builder for reflection::Type objects which represent ECS types.
struct cubos::core::ecs::DataTypeId
Identifies a data type registered in the world.
struct cubos::core::ecs::DataTypeIdHash
Hash functor for DataTypeId.
class cubos::core::ecs::Types
Registry of all data types used in an ECS world.
class cubos::core::ecs::World
Holds entities, their components and resources.

Typedefs

using Plugin = void(*)(Cubos&)
Function pointer type representing a plugin.

Functions

auto convertEntities(const std::unordered_map<Entity, Entity, EntityHash>& map, const reflection::Type& type, void* value) -> CUBOS_CORE_API void
Converts entities in a value to their respective new entities. If an entity is not found in the map, it is left unchanged.

Typedef documentation

using Plugin = void(*)(Cubos&)

Function pointer type representing a plugin.

Function documentation

CUBOS_CORE_API void convertEntities(const std::unordered_map<Entity, Entity, EntityHash>& map, const reflection::Type& type, void* value)

Converts entities in a value to their respective new entities. If an entity is not found in the map, it is left unchanged.

Parameters
map Map of old entities to new entities.
type Value type.
value Value.