TheAtlasEngine
 
Loading...
Searching...
No Matches
atlas::game_object Class Reference

Creates a pointer wrapper which extends capabilities of flecs::entity. More...

#include <game_object.hpp>

Inheritance diagram for atlas::game_object:

Public Member Functions

 game_object ()=delete
 Should not construct a scene object not created through flecs::world.
 
 game_object (flecs::world_t *p_registry, flecs::entity_t p_id)
 
 game_object (const flecs::entity &p_base)
 
 game_object (flecs::entity &p_base)
 
void child_of (const std::optional< game_object > &p_parent)
 sets the entity to be a parent of the specified entity
 
template<typename UFunction >
void children (UFunction &&p_callback)
 iterates through all children entities if the given entity is a parent of any given entities
 

Detailed Description

Creates a pointer wrapper which extends capabilities of flecs::entity.

Provides our own construct of API's that handles any workload around some of the raw flecs API's that can still be used by other flecs API's without completely interacting touching raw flecs API

Member Function Documentation

◆ child_of()

void atlas::game_object::child_of ( const std::optional< game_object > &  p_parent)

sets the entity to be a parent of the specified entity

Parameters
p_entityis the specified entity to specify as the parent.

Example Usage:

++
atlas::game_object obj1 = entity("Parent");
atlas::game_object obj2 = entity("Chlid");
// obj2 is the child of obj1
// As obj1 is a parent node
obj2.child_of(obj1);
Creates a pointer wrapper which extends capabilities of flecs::entity.
Definition game_object.hpp:15

◆ children()

template<typename UFunction >
void atlas::game_object::children ( UFunction &&  p_callback)
inline

iterates through all children entities if the given entity is a parent of any given entities

Example Usage:

++
atlas::game_object obj1 = entity("Parent Node");
atlas::game_object obj2 = entity("Chlid Node");
// obj1 is the parent of obj2.
obj2.child_of(parent);
// iteration should only include for "Child Node"
obj1.children([](flecs::entity p_child){
// do stuff with the child entity
});

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