ECSM v0.3.0
ecsm.hpp File Reference

Entity Component System Manager classes. More...

#include "singleton.hpp"
#include "linear-pool.hpp"
#include "tsl/robin_map.h"
#include <cassert>
#include <cstdint>
#include <set>
#include <mutex>
#include <functional>
#include <string_view>
#include <type_traits>

Classes

struct  SvHash
 String view heterogeneous hash functions. More...
 
struct  SvEqual
 String view heterogeneous equal functions. More...
 
struct  Component
 Base component structure. More...
 
class  System
 Base system class. More...
 
class  Entity
 An object containing components. More...
 
struct  Entity::ComponentData
 Entity component data container. More...
 
class  Manager
 Systems and entities coordinator. More...
 
struct  Manager::Event
 Event data container. More...
 
class  ComponentSystem< T, DestroyComponents >
 Base system class with components. More...
 
struct  DoNotDestroyComponent
 Component indicating that this entity should not be destroyed. More...
 
class  DoNotDestroySystem
 Handles entities that should not be destroyed. More...
 
struct  DoNotDuplicateComponent
 Component indicating that this entity should not be duplicated. More...
 
class  DoNotDuplicateSystem
 Handles entities that should not be duplicated. More...
 

Macros

#define ECSM_SUBSCRIBE_TO_EVENT(name, func)
 Subscribes System function to the event.
 
#define ECSM_UNSUBSCRIBE_FROM_EVENT(name, func)
 Unsubscribes System function from the event.
 
#define ECSM_TRY_SUBSCRIBE_TO_EVENT(name, func)
 Subscribes System function to the event if exist.
 
#define ECSM_TRY_UNSUBSCRIBE_FROM_EVENT(name, func)
 Unsubscribes System function from the event if exist.
 

Detailed Description

Entity Component System Manager classes.


Class Documentation

◆ ecsm::Entity::ComponentData

struct ecsm::Entity::ComponentData

Entity component data container.

Class Members
size_t type = 0
System * system = nullptr
ID< Component > instance = {}

Macro Definition Documentation

◆ ECSM_SUBSCRIBE_TO_EVENT

#define ECSM_SUBSCRIBE_TO_EVENT ( name,
func )
Value:
ecsm::Manager::Instance::get()->subscribeToEvent(name, std::bind(&func, this))
T bind(T... args)
static T * get()
Returns class singleton or manager instance.
Definition singleton.hpp:104

Subscribes System function to the event.

◆ ECSM_UNSUBSCRIBE_FROM_EVENT

#define ECSM_UNSUBSCRIBE_FROM_EVENT ( name,
func )
Value:
ecsm::Manager::Instance::get()->unsubscribeFromEvent(name, std::bind(&func, this))

Unsubscribes System function from the event.

◆ ECSM_TRY_SUBSCRIBE_TO_EVENT

#define ECSM_TRY_SUBSCRIBE_TO_EVENT ( name,
func )
Value:
ecsm::Manager::Instance::get()->trySubscribeToEvent(name, std::bind(&func, this))

Subscribes System function to the event if exist.

◆ ECSM_TRY_UNSUBSCRIBE_FROM_EVENT

#define ECSM_TRY_UNSUBSCRIBE_FROM_EVENT ( name,
func )
Value:
ecsm::Manager::Instance::get()->tryUnsubscribeFromEvent(name, std::bind(&func, this))

Unsubscribes System function from the event if exist.