Nui Engine
A game engine framework
Loading...
Searching...
No Matches
Nui::World Class Referencefinal

World class - the main context for the engine. More...

#include <World.h>

Inheritance diagram for Nui::World:
Nui::ECS::Context

Public Member Functions

 World ()
 World constructor - initializes the ECS context.
 
 ~World ()=default
 Default destructor.
 
 World (const World &)=delete
 
 World (World &&)=delete
 
World operator= (const World &)=delete
 
World operator= (World &&)=delete
 
- Public Member Functions inherited from Nui::ECS::Context
 Context ()
 Constructs a new ECS context.
 
virtual ~Context ()
 Destroys the ECS context.
 
U64 GetEntityCount () const noexcept
 Gets the total count of entities in the ECS context.
 
EntityGetEntityById (U64 id)
 Retrieves an entity by its unique identifier.
 
EntityGetEntityByIndex (U64 index)
 Retrieves an entity by its index.
 
EntityCreateEntity ()
 Creates a new entity in the ECS context.
 
void DestroyEntity (Entity *e, bool immediate=false)
 Destroys an entity in the ECS context.
 
bool ClearPending ()
 Clears all entities pending destruction in the ECS context.
 
void Reset ()
 Resets the ECS context, clearing all entities but keeping the systems.
 
template<typename T , typename... Args>
requires IsSystem<T>
T * RegisterSystem (Args &&... args)
 Registers a new system in the ECS context.
 
template<typename T >
requires IsSystem<T>
void UnregisterSystem ()
 Unregisters a system from the ECS context.
 
void UnregisterAllSystems ()
 Un-registers all systems from the ECS context.
 
template<typename T >
requires IsSystem<T>
T * GetSystem ()
 Gets a system from the ECS context.
 
template<typename T >
requires IsSystem<T>
void EnableSystem ()
 Enables a system in the ECS context.
 
template<typename T >
requires IsSystem<T>
void DisableSystem ()
 Disables a system in the ECS context.
 
template<typename T >
requires IsSystem<T>
bool IsSystmEnabled ()
 Checks if a system is enabled in the ECS context.
 
template<typename T >
void SubscribeEvent (EventSubscriber< T > *subscriber)
 Subscribes to an event in the ECS context.
 
template<typename T >
void UnsubscribeEvent (EventSubscriber< T > *subscriber)
 Unsubscribes from an event in the ECS context.
 
void UnsubscribeAll (void *subscriber)
 Un-subscribes from all events in the ECS context (usually called in the system destructor)
 
template<typename T >
void EmitEvent (const T &event)
 Emits an event in the ECS context to all subscribers.
 
template<typename... Types>
Internal::EntityComponentView< Types... > Each (bool includePendingDestroy=false)
 Iterates over all entities in the ECS context (used in ranged loops)
 
template<typename... Types>
void Each (typename std::common_type< std::function< void(Entity *, ComponentHandle< Types >...)> >::type viewFunc, bool includePendingDestroy=false)
 Iterates over all entities in the ECS context (using a lambda/function)
 
Internal::EntityView All (bool includePendingDestroy=false)
 Iterates over all entities in the ECS context (used in ranged loops)
 
void All (std::function< void(Entity *)> viewFunc, bool includePendingDestroy=false)
 Iterates over all entities in the ECS context (using a lambda/function)
 
void Tick (const F64 dt)
 Updates the ECS context (updates all the systems)
 

Friends

class AppBase
 

Additional Inherited Members

- Public Types inherited from Nui::ECS::Context
using SubscriberMap = std::unordered_map<TypeIndex, std::vector<Internal::EventSubscriberBase*>, std::hash<TypeIndex>, std::equal_to<TypeIndex>>
 Unordered map of subscribers to array of events subscriber base pointers.
 

Detailed Description

World class - the main context for the engine.


The documentation for this class was generated from the following files: