2#include <core/core.hpp>
4#include <core/event/event_bus.hpp>
5#include <core/scene/game_object.hpp>
33 virtual ~scene() =
default;
65 template<
typename UEventType,
typename UObject,
typename UCallback>
66 void subscribe(UObject* p_instance,
const UCallback& p_callback) {
67 m_bus->subscribe<UEventType>(p_instance, p_callback);
95 template<
typename... Comps,
typename... Args>
97 return flecs::query_builder<Comps...>(m_registry,
98 std::forward(args)...);
153 [[nodiscard]] std::string
name()
const {
return m_name; }
162 operator flecs::world&() {
return m_registry; }
165 flecs::world m_registry;
Event bus that holds the responsibility to reroute events to the subscribers of those particular even...
Definition event_bus.hpp:13
Creates a pointer wrapper which extends capabilities of flecs::entity.
Definition game_object.hpp:15
Constructs a scene that defines an area where game objects are part of contained within an atlas::wor...
Definition scene.hpp:24
event::event_bus * event_handle() const
Definition scene.hpp:156
bool defer_end()
Definition scene.hpp:150
bool defer_begin()
Defer operations until end of frame. When this operation is invoked while iterating,...
Definition scene.hpp:139
uint32_t children_count(const game_object &p_parent)
game_object entity(uint64_t p_id)
Retrieves if an entity already exists within the registry, create new entity otherwise.
void subscribe(UObject *p_instance, const UCallback &p_callback)
subscribes an event to the event::bus to get invoked when publishers notify all subscribers when an u...
Definition scene.hpp:66
game_object entity(std::string_view p_name)
Retrieves if an entity already exists within the registry, create new entity otherwise.
std::string name() const
Definition scene.hpp:153
flecs::query_builder< Comps... > query_builder(Args &&... args) const
queries components, returning entities (game objects) that contain those components queried with.
Definition scene.hpp:96
scene(const std::string &p_name, event::event_bus &p_bus)