![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Wrapper around entt::registry to expand functionality. More...
#include <Registry.hpp>
Public Member Functions | |
Registry () | |
Constructor. | |
Registry (Registry &&) | |
Move constructor. | |
Registry & | operator= (Registry &&) |
Move assignment operator. | |
~Registry () | |
Destructor. | |
entt::entity | create () |
Create an entity with some default components. | |
entt::entity | create_from_prefab (const std::string &name) |
Create an entity from a prefab. | |
bool | is_valid (const entt::entity entity) |
Validate an entity to make sure all components have met their requirements as defined by register_dependencies(). | |
void | update (b2World &b2World) |
Updates pending component data. | |
void | clear () |
Clear any pending data. | |
Public Attributes | |
entt::registry | m_entt |
Scene entities. | |
Private Types | |
using | B2BodyConstruction = meta::vector<std::pair<components::RigidBody*, components::Transform*>> |
Typedef for creating b2 bodies from components. | |
Private Member Functions | |
Registry (const Registry &)=delete | |
Copy constructor. | |
Registry & | operator= (const Registry &)=delete |
Copy assignment operator. | |
void | construct_rigidbody (entt::registry ®istry, entt::entity entity) |
Function that integrates a box2d construction with entt. | |
void | destroy_rigidbody (entt::registry ®istry, entt::entity entity) |
Function that integrates a box2d destruction with entt. | |
void | construct_script (entt::registry ®istry, entt::entity entity) |
Function that integrates lua init with entt on construct event. | |
void | destruct_script (entt::registry ®istry, entt::entity entity) |
Function that integrates lua destroy with entt on destruction event. | |
void | construct_nui (entt::registry ®istry, entt::entity entity) |
Function that integrates nuklear init with entt on construct event. | |
void | destruct_nui (entt::registry ®istry, entt::entity entity) |
Function that integrates nuklear destroy with entt on destruction event. | |
void | enable_entity (entt::registry ®istry, entt::entity entity) |
Function that runs when an entity is enabled. | |
void | disable_entity (entt::registry ®istry, entt::entity entity) |
Function that runs when an entity is disabled. | |
Private Attributes | |
B2BodyConstruction | m_bodies_to_construct |
List of rigid bodies that need to be constructed. | |
Wrapper around entt::registry to expand functionality.
Definition at line 20 of file Registry.hpp.
|
private |
Typedef for creating b2 bodies from components.
Definition at line 25 of file Registry.hpp.
galaxy::core::Registry::Registry | ( | ) |
Constructor.
Definition at line 23 of file Registry.cpp.
galaxy::core::Registry::Registry | ( | Registry && | r | ) |
Move constructor.
Definition at line 34 of file Registry.cpp.
galaxy::core::Registry::~Registry | ( | ) |
Destructor.
Definition at line 51 of file Registry.cpp.
|
privatedelete |
Copy constructor.
Move assignment operator.
Definition at line 40 of file Registry.cpp.
entt::entity galaxy::core::Registry::create | ( | ) |
Create an entity with some default components.
Definition at line 55 of file Registry.cpp.
entt::entity galaxy::core::Registry::create_from_prefab | ( | const std::string & | name | ) |
Create an entity from a prefab.
name | Name of the prefab to load. |
Definition at line 67 of file Registry.cpp.
|
nodiscard |
Validate an entity to make sure all components have met their requirements as defined by register_dependencies().
entity | Entity to validate. |
Definition at line 81 of file Registry.cpp.
void galaxy::core::Registry::update | ( | b2World & | b2World | ) |
Updates pending component data.
For example, box2d bodies.
b2World | Box2d world data. |
Definition at line 96 of file Registry.cpp.
void galaxy::core::Registry::clear | ( | ) |
Clear any pending data.
Definition at line 127 of file Registry.cpp.
Copy assignment operator.
|
private |
Function that integrates a box2d construction with entt.
registry | Registry component belongs to. |
entity | Entity component belongs to. |
Definition at line 133 of file Registry.cpp.
|
private |
Function that integrates a box2d destruction with entt.
registry | Registry component belongs to. |
entity | Entity component belongs to. |
Definition at line 144 of file Registry.cpp.
|
private |
Function that integrates lua init with entt on construct event.
registry | Registry component belongs to. |
entity | Entity component belongs to. |
Definition at line 157 of file Registry.cpp.
|
private |
Function that integrates lua destroy with entt on destruction event.
registry | Registry component belongs to. |
entity | Entity component belongs to. |
Definition at line 198 of file Registry.cpp.
|
private |
Function that integrates nuklear init with entt on construct event.
registry | Registry component belongs to. |
entity | Entity component belongs to. |
Definition at line 214 of file Registry.cpp.
|
private |
Function that integrates nuklear destroy with entt on destruction event.
registry | Registry component belongs to. |
entity | Entity component belongs to. |
Definition at line 256 of file Registry.cpp.
|
private |
Function that runs when an entity is enabled.
registry | Registry component belongs to. |
entity | Entity component belongs to. |
Definition at line 265 of file Registry.cpp.
|
private |
Function that runs when an entity is disabled.
registry | Registry component belongs to. |
entity | Entity component belongs to. |
Definition at line 274 of file Registry.cpp.
entt::registry galaxy::core::Registry::m_entt |
Scene entities.
Definition at line 166 of file Registry.hpp.
|
private |
List of rigid bodies that need to be constructed.
Definition at line 172 of file Registry.hpp.