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...

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 141 of file UpdateContext.ixx.

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

Public Member Functions

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 177 of file UpdateContext.ixx.

178 return deltaTime_;
179 }

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 209 of file UpdateContext.ixx.

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

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 195 of file UpdateContext.ixx.

196 return inputSnapshot_;
197 }

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 219 of file UpdateContext.ixx.

220 return level_;
221 }

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 361 of file UpdateContext.ixx.

361 void pushFrame(Args&&... args) {
362 frameEventSink_.template push<E>(std::forward<Args>(args)...);
363 }

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.

Events pushed here become readable in subsequent passes within the same phase, after a commit point is reached.

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 257 of file UpdateContext.ixx.

257 void pushPass(Args&&... args) {
258 passEventSink_.template push<E>(std::forward<Args>(args)...);
259 }

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.

Events pushed here become readable in subsequent phases, after the current phase commits.

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 276 of file UpdateContext.ixx.

276 void pushPhase(Args&&... args) {
277 phaseEventSink_.template push<E>(std::forward<Args>(args)...);
278 }

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 338 of file UpdateContext.ixx.

338 std::span<const E> readFrame() {
339 return frameEventSource_.template read<E>();
340 }

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.

Returns events that were pushed during previous passes within the current phase via pushPass(). The pass event bus is swapped at commit points, configured via Pass::addCommitPoint().

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 314 of file UpdateContext.ixx.

314 std::span<const E> readPass() {
315 return passEventSource_.template read<E>();
316 }

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::phaseCommit().

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 295 of file UpdateContext.ixx.

295 std::span<const E> readPhase() {
296 return phaseEventSource_.template read<E>();
297 }

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 238 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 229 of file UpdateContext.ixx.

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 186 of file UpdateContext.ixx.

187 return totalTime_;
188 }

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 375 of file UpdateContext.ixx.

375 [[nodiscard]] auto view() {
376 return engineWorld_.view<THandle, Components...>();
377 }

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 122 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 107 of file UpdateContext.ixx.

107 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 112 of file UpdateContext.ixx.

112 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 117 of file UpdateContext.ixx.

117 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.

Used by systems and components to publish events that will be processed in subsequent passes within the same phase, after a commit point.

Definition at line 93 of file UpdateContext.ixx.

93 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 98 of file UpdateContext.ixx.

98 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.