TheAtlasEngine
 
Loading...
Searching...
No Matches
game_object.hpp
1#pragma once
2#include <flecs.h>
3#include <optional>
4
5namespace atlas {
6
15 class game_object : public flecs::entity {
16 public:
19 game_object() = delete;
20
21 game_object(flecs::world_t* p_registry, flecs::entity_t p_id);
22
23 game_object(const flecs::entity& p_base);
24
25 explicit game_object(flecs::entity& p_base);
26
48 void child_of(const std::optional<game_object>& p_parent);
49
71 template<typename UFunction>
72 void children(UFunction&& p_callback) {
73 children(p_callback);
74 }
75 };
76
83 using game_object_optional = std::optional<game_object>;
84};
Creates a pointer wrapper which extends capabilities of flecs::entity.
Definition game_object.hpp:15
void children(UFunction &&p_callback)
iterates through all children entities if the given entity is a parent of any given entities
Definition game_object.hpp:72
void child_of(const std::optional< game_object > &p_parent)
sets the entity to be a parent of the specified entity
game_object()=delete
Should not construct a scene object not created through flecs::world.