pub trait WindowProvider: 'static {
// Required methods
fn create(native_loop: &dyn Any, config: &WindowConfig) -> Self
where Self: Sized;
fn request_redraw(&self);
fn inner_size(&self) -> (u32, u32);
fn scale_factor(&self) -> f64;
fn as_khora_window(&self) -> &dyn KhoraWindow;
fn translate_event(&self, raw_event: &dyn Any) -> Option<InputEvent>;
fn clone_raw_window_arc(&self) -> Arc<dyn Any + Send + Sync> ⓘ;
}Expand description
Provides a platform window for the engine to render into.
The engine doesn’t know about winit, SDL, or any specific windowing library. This trait abstracts window creation, event polling, and surface queries.
Required Methods§
Sourcefn create(native_loop: &dyn Any, config: &WindowConfig) -> Selfwhere
Self: Sized,
fn create(native_loop: &dyn Any, config: &WindowConfig) -> Selfwhere
Self: Sized,
Creates the window.
The native_loop parameter is an opaque handle to the native event loop.
The implementation must downcast it to the correct type.
For winit: native_loop.downcast_ref::<winit::event_loop::ActiveEventLoop>().
Sourcefn request_redraw(&self)
fn request_redraw(&self)
Polls for window events and returns them as an iterator of raw event types.
Sourcefn inner_size(&self) -> (u32, u32)
fn inner_size(&self) -> (u32, u32)
Returns the current inner size of the window in physical pixels.
Sourcefn scale_factor(&self) -> f64
fn scale_factor(&self) -> f64
Returns the current DPI scaling factor for the window.
Sourcefn as_khora_window(&self) -> &dyn KhoraWindow
fn as_khora_window(&self) -> &dyn KhoraWindow
Returns a reference to the window as a dyn KhoraWindow for use by the engine and agents.
Sourcefn translate_event(&self, raw_event: &dyn Any) -> Option<InputEvent>
fn translate_event(&self, raw_event: &dyn Any) -> Option<InputEvent>
Translates a raw window event (e.g., winit::event::Event) into an engine-agnostic InputEvent that can be forwarded to game logic.
Sourcefn clone_raw_window_arc(&self) -> Arc<dyn Any + Send + Sync> ⓘ
fn clone_raw_window_arc(&self) -> Arc<dyn Any + Send + Sync> ⓘ
Clones a long-lived handle to the raw native window as an opaque
Arc<dyn Any>. Used by the winit runner to insert the underlying
Arc<winit::window::Window> into the service registry so that
editor hooks (e.g., overlay begin_frame) can retrieve it without
the SDK leaking winit types into application code.