pub struct EngineCore<A: EngineApp> { /* private fields */ }Expand description
The core engine state, independent of any windowing backend.
Created by the windowing driver (e.g. WinitAppRunner), then
driven frame-by-frame via EngineCore::tick.
Implementations§
Source§impl<A: EngineApp> EngineCore<A>
impl<A: EngineApp> EngineCore<A>
Sourcepub fn bootstrap(&mut self, app: A, runtime: Runtime)
pub fn bootstrap(&mut self, app: A, runtime: Runtime)
Bootstraps the engine: creates DCC, telemetry, scheduler,
registers agents, calls app.setup(), and initializes agents.
This method takes ownership of the runtime populated
by the windowing driver’s bootstrap closure. It wraps the runtime
in an Arc once all built-in entries have been inserted.
Sourcepub fn feed_input(&mut self, event: InputEvent)
pub fn feed_input(&mut self, event: InputEvent)
Queues an input event to be processed on the next tick.
Sourcepub fn tick(&mut self)
pub fn tick(&mut self)
Executes one frame: app update, ECS maintenance, scheduler.
This method is called by the windowing driver (e.g. winit) each time a redraw is requested.
Sourcepub fn tick_with_runtime(&mut self, frame_runtime_arc: Arc<Runtime>)
pub fn tick_with_runtime(&mut self, frame_runtime_arc: Arc<Runtime>)
Executes one frame with a custom per-frame Runtime overlay.
Used by the winit runner to inject a FrameContext into the
per-frame Resources for cross-agent synchronization.
This is a convenience wrapper that calls the staged methods in order
without invoking any EngineApp lifecycle hooks. Drivers that need
to interleave hooks (e.g., the editor’s overlay/shell) should call the
staged methods directly via the winit runner.
Sourcepub fn run_maintenance(&mut self)
pub fn run_maintenance(&mut self)
Stage 6 — runs the end-of-tick Maintenance-phase DataSystems
against the scheduler’s per-frame [OutputDeck].
The engine is subsystem-agnostic here: it threads the deck through
the substrate dispatcher and lets each DataSystem drain whatever
typed slot belongs to its domain (audio writeback, physics
writeback, future subsystems …). No subsystem-specific code lives
in this method.
Sourcepub fn drain_inputs(&mut self) -> Vec<InputEvent>
pub fn drain_inputs(&mut self) -> Vec<InputEvent>
Stage 1 — drain queued input events. Also marks simulation started
(emits the "simulation" phase change on the first call), ticks
the telemetry service, and feeds the events into the engine-wide
[khora_core::platform::InputMap] so app code can query actions
(is_pressed, just_pressed) from the same frame’s inputs.
Sourcepub fn run_app_update(&mut self, inputs: &[InputEvent])
pub fn run_app_update(&mut self, inputs: &[InputEvent])
Stage 2 — run app.update, ECS maintenance, mesh sync, and scene/UI
extractions. Called between drain_inputs and
begin_render_frame.
Sourcepub fn begin_render_frame(&mut self, frame_runtime_arc: &Arc<Runtime>) -> bool
pub fn begin_render_frame(&mut self, frame_runtime_arc: &Arc<Runtime>) -> bool
Stage 3 — acquire the swapchain via RenderSystem::begin_frame and
populate the per-frame [FrameContext] with ColorTarget,
DepthTarget, and ClearColor.
Returns true when a renderer is present and begin_frame succeeded
(driver should later call present_frame).
Returns false only when no renderer is registered or the swapchain
could not be acquired.
Sourcepub fn run_scheduler(&mut self, frame_runtime_arc: &Arc<Runtime>)
pub fn run_scheduler(&mut self, frame_runtime_arc: &Arc<Runtime>)
Stage 4 — dispatch the scheduler so all registered agents execute their phases for this frame.
Sourcepub fn submit_passes(&mut self, presents: bool)
pub fn submit_passes(&mut self, presents: bool)
Stage 5a — submit recorded passes from the [FrameGraph] to the GPU.
When presents is false (render-to-viewport mode), the frame graph
is discarded instead.
Sourcepub fn present_frame(&mut self, presents: bool)
pub fn present_frame(&mut self, presents: bool)
Stage 5b — call RenderSystem::end_frame to present the swapchain.
No-op when presents is false.
Sourcepub fn end_render_frame(&mut self, presents: bool)
pub fn end_render_frame(&mut self, presents: bool)
Convenience: runs both submit_passes and
present_frame in order. Used by the default
tick path; drivers that need to interleave hooks should call the
staged methods directly.
Sourcepub fn app_mut(&mut self) -> Option<&mut A>
pub fn app_mut(&mut self) -> Option<&mut A>
Mutable accessor for the application instance. Used by the winit
runner to invoke EngineApp lifecycle hooks between staged frame
methods.
Sourcepub fn with_app_and_world<F>(&mut self, f: F)
pub fn with_app_and_world<F>(&mut self, f: F)
Invokes a closure with mutable access to BOTH the application and the
game world simultaneously. Used by the winit runner to call lifecycle
hooks that need to read/write components (e.g., gizmo collection)
without re-borrowing EngineCore twice.
The closure is skipped silently if either is uninitialized.
Sourcepub fn set_runtime(&mut self, runtime: Arc<Runtime>)
pub fn set_runtime(&mut self, runtime: Arc<Runtime>)
Stores the runtime Arc. Used by the winit runner after bootstrap.
Sourcepub fn game_world_mut(&mut self) -> Option<&mut GameWorld>
pub fn game_world_mut(&mut self) -> Option<&mut GameWorld>
Returns a mutable reference to the game world, if initialized.
Sourcepub fn dcc(&self) -> Option<&DccService>
pub fn dcc(&self) -> Option<&DccService>
Returns the DCC service, if initialized.
Sourcepub fn set_engine_hint(&self, hint: EngineHint)
pub fn set_engine_hint(&self, hint: EngineHint)
Applies a developer EngineHint
biasing GORNA arbitration (Cap a per-frame budget, Prioritize an
agent) without changing game semantics. No-op if the DCC isn’t running.
Thread-safe; takes effect on the next arbitration tick.
Sourcepub fn clear_agent_hints(&self, agent_id: AgentId)
pub fn clear_agent_hints(&self, agent_id: AgentId)
Clears all developer hints for an agent, restoring engine defaults.
Sourcepub fn engine_hints(&self) -> HashMap<AgentId, AgentHints>
pub fn engine_hints(&self) -> HashMap<AgentId, AgentHints>
Read-only snapshot of the accumulated per-agent hints (glass-box), or an empty map if the DCC isn’t running.
Trait Implementations§
Auto Trait Implementations§
impl<A> !Freeze for EngineCore<A>
impl<A> !RefUnwindSafe for EngineCore<A>
impl<A> Send for EngineCore<A>
impl<A> !Sync for EngineCore<A>
impl<A> Unpin for EngineCore<A>where
A: Unpin,
impl<A> UnsafeUnpin for EngineCore<A>where
A: UnsafeUnpin,
impl<A> !UnwindSafe for EngineCore<A>
Blanket Implementations§
§impl<T> AppLifecycle for Twhere
T: ?Sized,
impl<T> AppLifecycle for Twhere
T: ?Sized,
§fn on_start(&mut self, ctx: &mut dyn AppContext)
fn on_start(&mut self, ctx: &mut dyn AppContext)
update. Apps install their theme / fonts here.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.