RTYPE TECHNICAL DOCUMENTATION
  • Introduction
  • Classes
    • utils::InputMap
    • utils::Window
    • utils::constant::ButtonValue
    • network::Client
    • network::LockedQueue
    • network::Server
    • ecs::EnemyFactory
    • ecs::Engine
    • ecs::Entity
    • ecs::Event
    • ecs::Registry
    • ecs::SparseArray
    • ecs::World
    • ecs::WorldManager
    • ecs::component::Activable
    • ecs::component::Animated
    • ecs::component::Animated::AnimFrame
    • ecs::component::AttackAI
    • ecs::component::AttackAI::Action
    • ecs::component::AttackAI::AI
    • ecs::component::AttackAI::AI::Pattern
    • ecs::component::Controllable
    • ecs::component::Direction
    • ecs::component::Drawable
    • ecs::component::EntityType
    • ecs::component::Faction
    • ecs::component::FollowEntity
    • ecs::component::Health
    • ecs::component::Hitbox
    • ecs::component::MovementAI
    • ecs::component::MovementAI::AI
    • ecs::component::NetworkId
    • ecs::component::Parallax
    • ecs::component::Position
    • ecs::component::Projectile
    • ecs::component::Score
    • ecs::component::Shootable
    • ecs::component::Size
    • ecs::component::Text
    • ecs::component::textColor
    • ecs::component::Velocity
    • ecs::component::Weapon
    • audio::AudioManager
    • asset::AssetLoader
    • anim::Animation
  • Namespaces
    • utils
    • utils::constant
    • network
    • ecs
    • ecs::component
    • ecs::systems
    • audio
    • asset
    • anim
  • Modules
    • Input
  • Files
    • src
    • src/client
    • Animation.cpp
    • Animation.hpp
    • AssetLoader.cpp
    • AssetLoader.hpp
    • AudioManager.cpp
    • AudioManager.hpp
    • entrypoint.cpp
    • GetWorld.cpp
    • GetWorld.hpp
    • NetworkClient.cpp
    • NetworkClient.hpp
    • src/ecs
    • src/ecs/components
    • src/ecs/components/client
    • Activable.hpp
    • Animated.hpp
    • Controllable.hpp
    • Drawable.hpp
    • Hitbox.hpp
    • Parallax.hpp
    • Shootable.hpp
    • Text.hpp
    • src/ecs/components/server
    • AttackAI.cpp
    • AttackAI.hpp
    • FollowEntity.hpp
    • Projectile.hpp
    • Direction.hpp
    • EntityType.hpp
    • Faction.hpp
    • Health.hpp
    • MovementAI.cpp
    • MovementAI.hpp
    • NetworkId.hpp
    • Position.hpp
    • Score.hpp
    • Size.hpp
    • Velocity.hpp
    • Weapon.hpp
    • src/ecs/systems
    • src/ecs/systems/client
    • Animate.hpp
    • Draw.hpp
    • ExecuteOnce.hpp
    • HandleIncomingMessages.hpp
    • HandleParallaxBounds.hpp
    • HandleSFMLEvents.hpp
    • HandleSFMLKeys.hpp
    • HealthBar.hpp
    • MenuSelect.hpp
    • ScoreUpdate.hpp
    • SendDirection.hpp
    • src/ecs/systems/server
    • DeathUpdate.hpp
    • FollowEntitySystem.hpp
    • HandleIncomingMessage.hpp
    • PlayerHealthUpdate.hpp
    • PositionUpdate.hpp
    • ProjectileCollision.hpp
    • RunAttackAI.hpp
    • Waves.hpp
    • ManageClientEvents.hpp
    • Movement.hpp
    • PositionLogger.hpp
    • RunMovementAI.hpp
    • EnemyFactory.cpp
    • EnemyFactory.hpp
    • Engine.hpp
    • Entity.hpp
    • Event.hpp
    • LockedQueue.hpp
    • Registry.hpp
    • SparseArray.hpp
    • World.hpp
    • WorldManager.cpp
    • WorldManager.hpp
    • src/server
    • entrypoint.cpp
    • Server.cpp
    • Server.hpp
    • src/utils
    • Constant.hpp
    • InputMap.cpp
    • InputMap.hpp
    • Window.cpp
    • README.md
  • Pages
    • deprecated
  • GitHub
Powered by GitBook
On this page
  • Public Functions
  • Detailed Description
  • Public Functions Documentation
  • function Registry
  • function registerComponent
  • function getComponents
  • function getComponents
  • function spawn_entity
  • function entityFromIndex
  • function killEntity
  • function addComponent
  • function emplaceComponent
  • function removeComponent
  1. Classes

ecs::Registry

Previousecs::EventNextecs::SparseArray

Last updated 2 years ago

#include <Registry.hpp>

Public Functions

Name

void

template <typename Component > void

Detailed Description

class ecs::Registry;

[This is the core of the ECS]

This class contains many feature as follows :

Public Functions Documentation

function Registry

inline Registry()

function registerComponent

template <class Component >
inline SparseArray< Component > & registerComponent()

Template Parameters:

  • Component The type of components you want to register

This function is used to register a new component in the private member _unordered_map

function getComponents

template <class Component >
inline SparseArray< Component > & getComponents()

Template Parameters:

  • Component The type of components you want to get

function getComponents

template <class Component >
inline SparseArray< Component > const & getComponents() const

Template Parameters:

  • Component The type of components you want to get

function spawn_entity

inline Entity spawn_entity()

Return: The entity just created (id)

This function is used to create a new entity if it doesn't exists in the _entitiesBin, otherwise it recover it from the bin

function entityFromIndex

inline Entity entityFromIndex(
    std::size_t idx
)

Parameters:

  • idx The index of the entity whose id is desired

function killEntity

inline void killEntity(
    Entity const & e
)

Parameters:

function addComponent

template <typename Component >
inline SparseArray< Component >::referenceType addComponent(
    Entity const & to,
    Component && c
)

Parameters:

  • c The component you want to add

Template Parameters:

  • Component The type of component want to be added

Return: the SparseArray reference of the component

function emplaceComponent

template <typename Component ,
typename... Params>
inline SparseArray< Component >::referenceType emplaceComponent(
    Entity const & to,
    Params &&... p
)

Parameters:

  • p Parameters of the component you want to emplace

Template Parameters:

  • Component The type of component you want to emplace

  • Params The parameters' type of the component you want to emplace

Return: the SparseArray reference of the component

This function is used to emplace a component with given parameters of this component

function removeComponent

template <typename Component >
inline void removeComponent(
    Entity const & from
)

Parameters:

Template Parameters:

  • Component The type of the component you want to remove


Updated on 2022-11-13 at 17:21:37 +0100

()

template <class Component > < Component > &

()

template <class Component > < Component > &

()

template <class Component > < Component > const &

() const

()

(std::size_t idx)

( const & e)

template <typename Component > < Component >::referenceType

( const & to, Component && c)

template <typename Component ,typename... Params> < Component >::referenceType

( const & to, Params &&... p)

( const & from)

Component Manager, is able to register/get components from the unordered map

Manager, is able to create/delete and add component to an

(Feel free to check the to learn more about the subject)

EntitiesBin Manager, is saving killed entity in the bin that which can be recovered instead of creating another one

Return: The of components you just registered

Return: The of components you asked

This function is used to get all components already registered in the class following the given component template

Return: The const of components you asked

This function is used to get all components already registered in the class following the given component template as const

Return: The id of the if it exists, ecs::npos otherwise

This function is used to get the id of the following the give index

e The you want to kill

This is used to delete the given (id) For optimisation purposes, class push it in the _entitiesBin

to The in which you want to add component

This function is used to add a component into the given as parameter. In the same time, the erase function of this component is pushed into the _eraseFunctions vector, in this case we can simply delete a component without needing type of it

to The in which you want to emplace component

from The in which you want to remove component

This function is used to remove a component into an given as parameter

Registry
Entity
Registry
Entity
Entity.hpp
Registry
SparseArray
SparseArray
Registry
SparseArray
Registry
Entity
Entity
Entity
Entity
Registry
Entity
Entity
Entity
Entity
Entity
More...
Registry
SparseArray
registerComponent
SparseArray
getComponents
SparseArray
getComponents
Entity
spawn_entity
Entity
entityFromIndex
killEntity
Entity
SparseArray
addComponent
Entity
SparseArray
emplaceComponent
Entity
removeComponent
Entity