Function get_stage

Synopsis

#include <include/flecs/addons/cpp/world.hpp>

flecs::world get_stage(int32_t stage_id) const

Description

Get stage-specific world pointer. Flecs threads can safely invoke the API as long as they have a private context to write to, also referred to as the stage. This function returns a pointer to a stage, disguised as a world pointer.

Note that this function does not(!) create a new world. It simply wraps the existing world in a thread-specific context, which the API knows how to unwrap. The reason the stage is returned as an ecs_world_t is so that it can be passed transparently to the existing API functions, vs. having to create a dediated API for threading.

Parameters

stage_id - The index of the stage to retrieve.

Returns
A thread-specific pointer to the world.

Source

Lines 381-383 in include/flecs/addons/cpp/world.hpp.

flecs::world get_stage(int32_t stage_id) const {
    return flecs::world(ecs_get_stage(m_world, stage_id));
}