libecs-cpp 2.1.0
Entity Component System library in C++
Loading...
Searching...
No Matches
Classes | Typedefs | Variables
ecs Namespace Reference

Classes

class  Clock
 A source of time for systems and containers. More...
 
class  Component
 Base class for the data attached to an entity. More...
 
class  Container
 A container: the entities, components, systems and resources that are updated together. More...
 
class  Entity
 One thing in a container, to which components are attached. More...
 
class  Manager
 Creates and owns containers, routes messages between them and shuts them down. More...
 
class  ManualClock
 A clock that only moves when told to, for tests. More...
 
struct  Resource
 A block of bytes that a container stores under a name with Container::ResourceAdd(). More...
 
class  SteadyClock
 The real clock: std::chrono::steady_clock, truncated to whole microseconds. More...
 
class  System
 Base class for the logic that runs in a container. More...
 
class  Timer
 A callback that fires after a length of time, owned by a System. More...
 
class  Timing
 A repeating schedule: says when the next update is due. More...
 
class  Uuid
 A 128-bit random identifier in the standard version 4 text form (for example "550e8400-e29b-41d4-a716-446655440000"). More...
 

Typedefs

typedef std::unordered_map< std::string, std::shared_ptr< ecs::Component > > EntityComponentList
 The components of one type, by entity handle.
 
typedef std::unordered_map< std::string, ecs::EntityComponentList > TypeEntityComponentList
 The components of a container, by type name and then by entity handle.
 

Variables

constexpr std::chrono::microseconds MAX_INTERVAL = std::chrono::hours(24 * 36525)
 The longest interval or timer length that is accepted: 100 years of 365.25 days.
 
constexpr std::chrono::microseconds DEFAULT_INTERVAL {1000000 / 30}
 The interval of a new schedule: 33 333 microseconds, about 30 updates a second.
 
constexpr uint32_t MAX_CATCHUP = 2
 Maximum number of intervals to catch up after a stall.
 

Typedef Documentation

◆ EntityComponentList

typedef std::unordered_map<std::string, std::shared_ptr<ecs::Component> > ecs::EntityComponentList

The components of one type, by entity handle.

They are stored as shared pointers.

◆ TypeEntityComponentList

typedef std::unordered_map<std::string, ecs::EntityComponentList> ecs::TypeEntityComponentList

The components of a container, by type name and then by entity handle.

Reading Components[type][entity] inserts an empty entry when the type or entity is missing, while Container::ComponentGet() and Entity::ComponentGet() leave the table unchanged.

Variable Documentation

◆ DEFAULT_INTERVAL

constexpr std::chrono::microseconds ecs::DEFAULT_INTERVAL {1000000 / 30}
constexpr

The interval of a new schedule: 33 333 microseconds, about 30 updates a second.

◆ MAX_CATCHUP

constexpr uint32_t ecs::MAX_CATCHUP = 2
constexpr

Maximum number of intervals to catch up after a stall.

Beyond this, the schedule snaps forward to avoid a burst of updates.

◆ MAX_INTERVAL

constexpr std::chrono::microseconds ecs::MAX_INTERVAL = std::chrono::hours(24 * 36525)
constexpr

The longest interval or timer length that is accepted: 100 years of 365.25 days.