![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Preconstructed entity definition that can be loaded at any time. More...
#include <Prefab.hpp>
Public Member Functions | |
Prefab () | |
Constructor. | |
Prefab (entt::entity entity, entt::registry ®istry) | |
Entity constructor. | |
Prefab (const nlohmann::json &json) | |
JSON constructor. | |
Prefab (const Prefab &) | |
Copy constructor. | |
Prefab (Prefab &&) | |
Move constructor. | |
Prefab & | operator= (const Prefab &) |
Copy assignment operator. | |
Prefab & | operator= (Prefab &&) |
Move assignment operator. | |
~Prefab () | |
Destructor. | |
bool | load (const std::string &file) |
Loads from a json file on disk. | |
void | from_entity (entt::entity entity, entt::registry ®istry) |
Creates the prefab from an entity. | |
void | from_json (const nlohmann::json &json) |
Creates the prefab from a json object. | |
entt::entity | to_entity (entt::registry ®istry) const |
Creates an entity from this prefab. | |
const nlohmann::json & | to_json () const |
Gets the json representation of this prefab. | |
Private Attributes | |
nlohmann::json | m_json |
Prefab as json data. | |
Preconstructed entity definition that can be loaded at any time.
Definition at line 21 of file Prefab.hpp.
galaxy::core::Prefab::Prefab | ( | ) |
Constructor.
Definition at line 27 of file Prefab.cpp.
galaxy::core::Prefab::Prefab | ( | entt::entity | entity, |
entt::registry & | registry ) |
Entity constructor.
entity | Entity to use. |
registry | Registry entity and its components belong to. |
Definition at line 31 of file Prefab.cpp.
galaxy::core::Prefab::Prefab | ( | const nlohmann::json & | json | ) |
JSON constructor.
json | JSON data to construct prefab from. |
Definition at line 36 of file Prefab.cpp.
galaxy::core::Prefab::Prefab | ( | const Prefab & | p | ) |
Copy constructor.
Definition at line 41 of file Prefab.cpp.
galaxy::core::Prefab::Prefab | ( | Prefab && | p | ) |
Move constructor.
Definition at line 46 of file Prefab.cpp.
galaxy::core::Prefab::~Prefab | ( | ) |
Destructor.
Definition at line 71 of file Prefab.cpp.
Copy assignment operator.
Definition at line 51 of file Prefab.cpp.
Move assignment operator.
Definition at line 61 of file Prefab.cpp.
|
nodiscard |
Loads from a json file on disk.
file | Json file to read from disk. |
Definition at line 75 of file Prefab.cpp.
void galaxy::core::Prefab::from_entity | ( | entt::entity | entity, |
entt::registry & | registry ) |
Creates the prefab from an entity.
entity | Entity to use. |
registry | Registry entity and its components belong to. |
Definition at line 95 of file Prefab.cpp.
void galaxy::core::Prefab::from_json | ( | const nlohmann::json & | json | ) |
Creates the prefab from a json object.
json | JSON data to construct prefab from. |
Definition at line 105 of file Prefab.cpp.
|
nodiscard |
Creates an entity from this prefab.
registry | Registry to create the entity from. |
Definition at line 113 of file Prefab.cpp.
|
nodiscard |
Gets the json representation of this prefab.
Definition at line 119 of file Prefab.cpp.
|
private |
Prefab as json data.
Definition at line 114 of file Prefab.hpp.