Object factory and Main game executor.
More...
#include <Object.hpp>
Object factory and Main game executor.
This class is non-inheritable (final). Use components to extend the functionality of an object instead.
◆ Create() [1/2]
Object & EzGL::Object::Create |
( |
std::string const & |
objectName | ) |
|
|
static |
Object factory.
Created objects are automatically added to the universe. The caller gets a reference to this new object but is not responsible for its memory management.
- Parameters
-
objectName | Name of the object to be created. This object name should appear in the bottom-most level of the provided main json file. |
- Returns
- Reference to the newly created object.
◆ Create() [2/2]
Object & EzGL::Object::Create |
( |
nlohmann::json & |
config | ) |
|
|
static |
Object factory.
Created objects are automatically added to the universe. The caller gets a reference to this new object but is not responsible for its memory management.
- Parameters
-
config | Starting json data for the new object. |
- Returns
- Reference to the newly created object.
◆ Destroy()
bool EzGL::Object::Destroy |
( |
Object const & |
object | ) |
|
|
static |
Object destroyer.
Removes the referenced object from the universe.
- Parameters
-
object | Reference to object you want to delete. |
- Returns
- Whether the object was found and deleted or not.
◆ Main()
int EzGL::Object::Main |
( |
std::string const & |
fileName | ) |
|
|
static |
Initialize and run the game.
- Parameters
-
fileName | File name of the main json file relative to the executable, including the file extension. A c-string accepting version of this function exists too, but does not receive its own documentation subsection. |
- Returns
EXIT_SUCCESS
or EXIT_FAILURE
◆ UpdateAll()
void EzGL::Object::UpdateAll |
( |
| ) |
|
|
static |
Only graphics API binding components should call this.
Updates all the components of all objects in the universe. Should only be called once per frame.
◆ data
nlohmann::json EzGL::Object::data |
Modifiable object data.
Stores object parameters, runtime data, component information, etc. Consult the user guides for more on how the json files are parsed and loaded.
◆ other
Object const* EzGL::Object::other |
Interactor object pointer.
Used in situations when two objects interact with one another. The Collision
module, for example, sets each object's other
pointers to the other when two objects collide. This pointer does not get reset at the end of each frame; it remains the same until it is overwritten.
The documentation for this class was generated from the following files: