Skip to main content

UpdateContext Class

Per-frame context passed to systems during game loop updates. More...

Declaration

class helios::engine::runtime::world::UpdateContext { ... }

Public Constructors Index

UpdateContext (helios::engine::runtime::world::Session &session, helios::engine::runtime::world::RuntimeEnvironment &runtimeEnvironment, const float deltaTime, const float totalTime, helios::engine::runtime::messaging::event::GameLoopEventBus &phaseEventBus, helios::engine::runtime::messaging::event::GameLoopEventBus &passEventBus, helios::engine::runtime::messaging::event::GameLoopEventBus &frameEventBus, const helios::engine::input::InputSnapshot &inputSnapshot, const Level *level, EngineWorld &engineWorld)

Constructs an UpdateContext with all per-frame dependencies. More...

Public Member Functions Index

floatdeltaTime () const noexcept

Returns the time elapsed since the last frame, in seconds. More...

floattotalTime () const noexcept

Returns the time elapsed since the first frame, in seconds. More...

const helios::engine::input::InputSnapshot &inputSnapshot () const noexcept

Returns the immutable input snapshot for this frame. More...

template <typename THandle>
autofind (const THandle handle) noexcept

Resolves an entity facade by typed handle. More...

const Level *level () noexcept

Returns the active Level. More...

helios::engine::runtime::world::Session &session () const noexcept

Returns the session for game/match state access. More...

helios::engine::runtime::world::RuntimeEnvironment &runtimeEnvironment () const noexcept

Returns the runtime environment for platform/runtime readiness state. More...

template <typename E, typename... Args>
voidpushPass (Args &&... args)

Pushes an event to the pass-level event bus. More...

template <typename E, typename... Args>
voidpushPhase (Args &&... args)

Pushes an event to the phase-level event bus. More...

template <typename E>
auto readPhase () -> std::span< const E >

Reads events from the phase-level event bus. More...

template <typename E>
auto readPass () -> std::span< const E >

Reads events from the pass-level event bus. More...

template <typename E>
auto readFrame () -> std::span< const E >

Reads events from the frame-level event bus. More...

template <typename E, typename... Args>
voidpushFrame (Args &&... args)

Pushes an event to the frame-level event bus. More...

template <typename THandle, typename... Components>
autoview ()

Builds a typed ECS view for a handle domain and component set. More...

template <typename THandle, typename TComponent>
auto *sparseSet () const

Returns the sparse set for a handle domain and component type. More...

template <typename THandle>
boolisValid (THandle handle) const

Checks whether a handle refers to a valid entity in the appropriate sub-world. More...

template <typename THandle = void, typename... Components>
voidclearDirtySets ()

Clears the specified dirty components for a handle domain and component set. More...

Private Member Attributes Index

floatdeltaTime_ = 0.0f

Time elapsed since the last frame, in seconds. More...

floattotalTime_ = 0.0f

Time elapsed since the first frame, in seconds. More...

const helios::engine::input::InputSnapshot &inputSnapshot_

Immutable snapshot of input state for the current frame. More...

helios::engine::runtime::world::Session &session_

Reference to the current game session for state tracking. More...

helios::engine::runtime::world::RuntimeEnvironment &runtimeEnvironment_

Reference to the current platform entity. More...

helios::engine::runtime::messaging::event::GameLoopEventBus::WriteSinkphaseEventSink_

Sink for pushing phase-level events during update. More...

const helios::engine::runtime::messaging::event::GameLoopEventBus::ReadSourcephaseEventSource_

Source for reading phase-level events from the previous phase. More...

helios::engine::runtime::messaging::event::GameLoopEventBus::WriteSinkpassEventSink_

Sink for pushing pass-level events during update. More...

const helios::engine::runtime::messaging::event::GameLoopEventBus::ReadSourcepassEventSource_

Source for reading pass-level events from previous passes. More...

helios::engine::runtime::messaging::event::GameLoopEventBus::WriteSinkframeEventSink_

Sink for pushing frame-level events during update. More...

const helios::engine::runtime::messaging::event::GameLoopEventBus::ReadSourceframeEventSource_

Source for reading frame-level events from the previous frame. More...

const Level *level_

Pointer to the active Level, or nullptr if no level is loaded. More...

helios::engine::runtime::world::EngineWorld &engineWorld_

Aggregate typed world used for domain-routed ECS operations. More...

Description

Per-frame context passed to systems during game loop updates.

UpdateContext bundles frame-scoped data and services used by system updates: timing values, immutable input/viewport snapshots, session/runtime environment access, typed entity access via EngineWorld, event-bus read/write channels, and typed ECS access.

Command submission is handled by systems through injected command buffers (CommandBuffer_type) using cmdBuffer.template add<TCommand>(...).

See Also

GameLoop

See Also

Session

See Also

RuntimeEnvironment

See Also

EngineWorld

See Also

ResourceRegistry

Definition at line 46 of file UpdateContext.ixx.

Public Constructors

UpdateContext()

Constructs an UpdateContext with all per-frame dependencies.

Parameters
session

Reference to current session state.

runtimeEnvironment

Reference to runtime-environment state.

deltaTime

Time since last frame in seconds.

totalTime

Accumulated time in seconds.

phaseEventBus

Phase-level event bus.

passEventBus

Pass-level event bus.

frameEventBus

Frame-level event bus.

inputSnapshot

Immutable frame input snapshot.

viewportSnapshots

Immutable frame viewport snapshot set.

level

Active level pointer, or nullptr.

engineWorld

Aggregate typed world for entity operations.

Definition at line 139 of file UpdateContext.ixx.

142 const float deltaTime,
143 const float totalTime,
148 const Level* level,
149 EngineWorld& engineWorld
150 ) :
151 session_(session),
152 runtimeEnvironment_(runtimeEnvironment),
153 deltaTime_(deltaTime),
154 totalTime_(totalTime),
155 phaseEventSink_(phaseEventBus.writeSink()),
156 phaseEventSource_(phaseEventBus.readSource()),
157 passEventSink_(passEventBus.writeSink()),
158 passEventSource_(passEventBus.readSource()),
159 frameEventSink_(frameEventBus.writeSink()),
160 frameEventSource_(frameEventBus.readSource()),
161 inputSnapshot_(inputSnapshot),
162 level_(level),
163 engineWorld_(engineWorld)
164 {
165
166 }

Public Member Functions

clearDirtySets()

template <typename THandle = void, typename... Components>
void helios::engine::runtime::world::UpdateContext::clearDirtySets ()
inline

Clears the specified dirty components for a handle domain and component set.

Template Parameters
THandle

Handle domain type.

Components

Component types to include.

Returns

Domain-specific view.

Definition at line 400 of file UpdateContext.ixx.

401 engineWorld_.clearDirtySets<THandle, Components...>();
402 }

References helios::engine::runtime::world::EngineWorld::clearDirtySets and helios::engine::runtime::registerComponents.

deltaTime()

float helios::engine::runtime::world::UpdateContext::deltaTime ()
inline noexcept

Returns the time elapsed since the last frame, in seconds.

Returns

Delta time in seconds.

Definition at line 175 of file UpdateContext.ixx.

176 return deltaTime_;
177 }

find()

template <typename THandle>
auto helios::engine::runtime::world::UpdateContext::find (const THandle handle)
inline noexcept

Resolves an entity facade by typed handle.

Template Parameters
THandle

Handle type.

Parameters
handle

Entity handle to resolve.

Returns

Domain-specific entity facade.

Definition at line 207 of file UpdateContext.ixx.

207 [[nodiscard]] auto find(const THandle handle) noexcept {
208 return engineWorld_.template find<THandle>(handle);
209 }

Reference helios::engine::runtime::registerComponents.

inputSnapshot()

const helios::engine::input::InputSnapshot & helios::engine::runtime::world::UpdateContext::inputSnapshot ()
inline noexcept

Returns the immutable input snapshot for this frame.

Returns

Const ref to the current InputSnapshot.

Definition at line 193 of file UpdateContext.ixx.

194 return inputSnapshot_;
195 }

isValid()

template <typename THandle>
bool helios::engine::runtime::world::UpdateContext::isValid (THandle handle)
inline

Checks whether a handle refers to a valid entity in the appropriate sub-world.

Template Parameters
THandle

Handle domain type.

Parameters
handle

The handle to check.

Returns

True if the handle is valid, false otherwise.

Definition at line 387 of file UpdateContext.ixx.

387 [[nodiscard]] bool isValid(THandle handle) const {
388 return engineWorld_.template isValid<THandle>(handle);
389 }

Reference helios::engine::runtime::registerComponents.

level()

const Level * helios::engine::runtime::world::UpdateContext::level ()
inline noexcept

Returns the active Level.

Returns

Pointer to the Level, or nullptr if no level is loaded.

Definition at line 217 of file UpdateContext.ixx.

218 return level_;
219 }

pushFrame()

template <typename E, typename... Args>
void helios::engine::runtime::world::UpdateContext::pushFrame (Args &&... args)
inline

Pushes an event to the frame-level event bus.

Events pushed here become readable in the next frame via readFrame(). The frame event bus is swapped at the end of the Post phase in GameLoop.

Use frame-level events for cross-frame communication where events should persist beyond the current phase.

Template Parameters
E

The event type to push.

Args

Constructor argument types for the event.

Parameters
args

Arguments forwarded to the event constructor.

See Also

readFrame()

See Also

GameLoop

Definition at line 349 of file UpdateContext.ixx.

349 void pushFrame(Args&&... args) {
350 frameEventSink_.template push<E>(std::forward<Args>(args)...);
351 }

Reference helios::engine::runtime::registerComponents.

pushPass()

template <typename E, typename... Args>
void helios::engine::runtime::world::UpdateContext::pushPass (Args &&... args)
inline

Pushes an event to the pass-level event bus.

Template Parameters
E

The event type to push.

Args

Constructor argument types for the event.

Parameters
args

Arguments forwarded to the event constructor.

See Also

readPass()

See Also

Pass::addCommitPoint()

Definition at line 252 of file UpdateContext.ixx.

252 void pushPass(Args&&... args) {
253 passEventSink_.template push<E>(std::forward<Args>(args)...);
254 }

Reference helios::engine::runtime::registerComponents.

pushPhase()

template <typename E, typename... Args>
void helios::engine::runtime::world::UpdateContext::pushPhase (Args &&... args)
inline

Pushes an event to the phase-level event bus.

Template Parameters
E

The event type to push.

Args

Constructor argument types for the event.

Parameters
args

Arguments forwarded to the event constructor.

See Also

readPhase()

See Also

GameLoop

Definition at line 268 of file UpdateContext.ixx.

268 void pushPhase(Args&&... args) {
269 phaseEventSink_.template push<E>(std::forward<Args>(args)...);
270 }

Reference helios::engine::runtime::registerComponents.

readFrame()

template <typename E>
std::span< const E > helios::engine::runtime::world::UpdateContext::readFrame ()
inline

Reads events from the frame-level event bus.

Returns events that were pushed during the previous frame via pushFrame(). The frame event bus is swapped at the end of the Post phase, making events readable in the subsequent frame.

Frame-level events are useful for cross-frame communication, such as:

  • Collision events that trigger effects in the next frame
  • Spawn confirmations for UI updates
  • Audio/VFX triggers
Template Parameters
E

The event type to read.

Returns

A span of const events of type E.

See Also

pushFrame()

See Also

GameLoop

Definition at line 326 of file UpdateContext.ixx.

326 std::span<const E> readFrame() {
327 return frameEventSource_.template read<E>();
328 }

Reference helios::engine::runtime::registerComponents.

readPass()

template <typename E>
std::span< const E > helios::engine::runtime::world::UpdateContext::readPass ()
inline

Reads events from the pass-level event bus.

Template Parameters
E

The event type to read.

Returns

A span of const events of type E.

See Also

pushPass()

See Also

Pass::addCommitPoint()

Definition at line 302 of file UpdateContext.ixx.

302 std::span<const E> readPass() {
303 return passEventSource_.template read<E>();
304 }

Reference helios::engine::runtime::registerComponents.

readPhase()

template <typename E>
std::span< const E > helios::engine::runtime::world::UpdateContext::readPhase ()
inline

Reads events from the phase-level event bus.

Returns events that were pushed during the previous phase via pushPhase(). The phase event bus is swapped at phase boundaries, configured in GameLoop::phaseEnd().

Template Parameters
E

The event type to read.

Returns

A span of const events of type E.

See Also

pushPhase()

See Also

GameLoop

Definition at line 287 of file UpdateContext.ixx.

287 std::span<const E> readPhase() {
288 return phaseEventSource_.template read<E>();
289 }

Reference helios::engine::runtime::registerComponents.

runtimeEnvironment()

helios::engine::runtime::world::RuntimeEnvironment & helios::engine::runtime::world::UpdateContext::runtimeEnvironment ()
inline noexcept

Returns the runtime environment for platform/runtime readiness state.

Returns

Reference to runtime environment.

Definition at line 236 of file UpdateContext.ixx.

session()

helios::engine::runtime::world::Session & helios::engine::runtime::world::UpdateContext::session ()
inline noexcept

Returns the session for game/match state access.

Returns

Ref to the Session used with this UpdateContext.

Definition at line 227 of file UpdateContext.ixx.

sparseSet()

template <typename THandle, typename TComponent>
auto * helios::engine::runtime::world::UpdateContext::sparseSet ()
inline

Returns the sparse set for a handle domain and component type.

Template Parameters
THandle

Handle domain type.

TComponent

Component type.

Returns

Pointer to the sparse set for the specified handle and component types.

Definition at line 376 of file UpdateContext.ixx.

376 [[nodiscard]] auto* sparseSet() const {
377 return engineWorld_.template sparseSet<THandle, TComponent>();
378 }

Reference helios::engine::runtime::registerComponents.

totalTime()

float helios::engine::runtime::world::UpdateContext::totalTime ()
inline noexcept

Returns the time elapsed since the first frame, in seconds.

Returns

Total time in seconds.

Definition at line 184 of file UpdateContext.ixx.

185 return totalTime_;
186 }

view()

template <typename THandle, typename... Components>
auto helios::engine::runtime::world::UpdateContext::view ()
inline

Builds a typed ECS view for a handle domain and component set.

Template Parameters
THandle

Handle domain type.

Components

Component types to include.

Returns

Domain-specific view.

Definition at line 363 of file UpdateContext.ixx.

363 [[nodiscard]] auto view() {
364 return engineWorld_.view<THandle, Components...>();
365 }

References helios::engine::runtime::registerComponents and helios::engine::runtime::world::EngineWorld::view.

Private Member Attributes

deltaTime_

float helios::engine::runtime::world::UpdateContext::deltaTime_ = 0.0f

Time elapsed since the last frame, in seconds.

Definition at line 52 of file UpdateContext.ixx.

52 float deltaTime_ = 0.0f;

engineWorld_

helios::engine::runtime::world::EngineWorld& helios::engine::runtime::world::UpdateContext::engineWorld_

Aggregate typed world used for domain-routed ECS operations.

Definition at line 120 of file UpdateContext.ixx.

frameEventSink_

helios::engine::runtime::messaging::event::GameLoopEventBus::WriteSink helios::engine::runtime::world::UpdateContext::frameEventSink_

Sink for pushing frame-level events during update.

Used by systems and components to publish events that will be processed in the next frame. Frame-level events persist across all phases and are swapped at the end of the Post phase.

Definition at line 105 of file UpdateContext.ixx.

105 helios::engine::runtime::messaging::event::GameLoopEventBus::WriteSink frameEventSink_;

frameEventSource_

const helios::engine::runtime::messaging::event::GameLoopEventBus::ReadSource helios::engine::runtime::world::UpdateContext::frameEventSource_

Source for reading frame-level events from the previous frame.

Definition at line 110 of file UpdateContext.ixx.

110 const helios::engine::runtime::messaging::event::GameLoopEventBus::ReadSource frameEventSource_;

inputSnapshot_

const helios::engine::input::InputSnapshot& helios::engine::runtime::world::UpdateContext::inputSnapshot_

Immutable snapshot of input state for the current frame.

Definition at line 62 of file UpdateContext.ixx.

62 const helios::engine::input::InputSnapshot& inputSnapshot_;

level_

const Level* helios::engine::runtime::world::UpdateContext::level_

Pointer to the active Level, or nullptr if no level is loaded.

Definition at line 115 of file UpdateContext.ixx.

115 const Level* level_;

passEventSink_

helios::engine::runtime::messaging::event::GameLoopEventBus::WriteSink helios::engine::runtime::world::UpdateContext::passEventSink_

Sink for pushing pass-level events during update.

Definition at line 91 of file UpdateContext.ixx.

91 helios::engine::runtime::messaging::event::GameLoopEventBus::WriteSink passEventSink_;

passEventSource_

const helios::engine::runtime::messaging::event::GameLoopEventBus::ReadSource helios::engine::runtime::world::UpdateContext::passEventSource_

Source for reading pass-level events from previous passes.

Definition at line 96 of file UpdateContext.ixx.

96 const helios::engine::runtime::messaging::event::GameLoopEventBus::ReadSource passEventSource_;

phaseEventSink_

helios::engine::runtime::messaging::event::GameLoopEventBus::WriteSink helios::engine::runtime::world::UpdateContext::phaseEventSink_

Sink for pushing phase-level events during update.

Used by systems and components to publish events (e.g., collision, spawn requests) that will be processed in the next phase of the game loop.

Definition at line 80 of file UpdateContext.ixx.

80 helios::engine::runtime::messaging::event::GameLoopEventBus::WriteSink phaseEventSink_;

phaseEventSource_

const helios::engine::runtime::messaging::event::GameLoopEventBus::ReadSource helios::engine::runtime::world::UpdateContext::phaseEventSource_

Source for reading phase-level events from the previous phase.

Definition at line 85 of file UpdateContext.ixx.

85 const helios::engine::runtime::messaging::event::GameLoopEventBus::ReadSource phaseEventSource_;

runtimeEnvironment_

helios::engine::runtime::world::RuntimeEnvironment& helios::engine::runtime::world::UpdateContext::runtimeEnvironment_

Reference to the current platform entity.

Definition at line 72 of file UpdateContext.ixx.

session_

helios::engine::runtime::world::Session& helios::engine::runtime::world::UpdateContext::session_

Reference to the current game session for state tracking.

Definition at line 67 of file UpdateContext.ixx.

totalTime_

float helios::engine::runtime::world::UpdateContext::totalTime_ = 0.0f

Time elapsed since the first frame, in seconds.

Definition at line 57 of file UpdateContext.ixx.

57 float totalTime_ = 0.0f;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.