pub struct WindowManager<R: Renderer> { /* private fields */ }Expand description
Owns all windows. The OS adapter calls methods on this.
Generic over R: Renderer — the renderer creates per-window GPU
surfaces from raw window handles. The OS adapter provides the handles,
the renderer creates the surfaces, and this manager owns the pipelines.
Implementations§
Source§impl<R: Renderer> WindowManager<R>
impl<R: Renderer> WindowManager<R>
pub fn new(renderer: R) -> Self
Sourcepub fn create_window<W, F>(
&mut self,
window_handle: &W,
config: WindowCreateConfig,
view_init: F,
) -> Result<(), CreateWindowError>
pub fn create_window<W, F>( &mut self, window_handle: &W, config: WindowCreateConfig, view_init: F, ) -> Result<(), CreateWindowError>
Create a window: create GPU surface from handle, spawn view + render threads.
The OS adapter creates the OS window and passes the raw handle here.
This manager uses the renderer to create the surface, then spawns
the pipeline (render + view threads). The OS adapter keeps the window
handle alive until after close_window returns.
pub fn close_window(&mut self, id: WindowId)
pub fn has_windows(&self) -> bool
pub fn shutdown_all(&mut self)
Sourcepub fn scale_factor(&self, id: WindowId) -> Option<f64>
pub fn scale_factor(&self, id: WindowId) -> Option<f64>
Scale factor for a window — used by the OS adapter for pixel delta conversion.
pub fn on_resize(&mut self, id: WindowId, width: u32, height: u32)
pub fn on_scale_factor_changed( &mut self, id: WindowId, scale_factor: f64, refresh_rate_millihertz: Option<u32>, )
pub fn on_focus_changed(&mut self, id: WindowId, focused: bool)
pub fn on_cursor_moved( &mut self, id: WindowId, physical_x: f64, physical_y: f64, )
pub fn on_cursor_entered(&mut self, id: WindowId)
pub fn on_cursor_left(&mut self, id: WindowId)
pub fn on_mouse_input( &mut self, id: WindowId, button: MouseButton, btn_state: ButtonState, )
pub fn on_mouse_wheel(&mut self, id: WindowId, delta: WheelDelta)
pub fn on_keyboard_input( &mut self, id: WindowId, key: KeyCode, key_state: ButtonState, text: Option<String>, repeat: bool, )
pub fn on_modifiers_changed( &mut self, id: WindowId, shift: bool, ctrl: bool, alt: bool, meta: bool, )
Auto Trait Implementations§
impl<R> Freeze for WindowManager<R>where
R: Freeze,
impl<R> !RefUnwindSafe for WindowManager<R>
impl<R> Send for WindowManager<R>
impl<R> Sync for WindowManager<R>
impl<R> Unpin for WindowManager<R>where
R: Unpin,
impl<R> UnsafeUnpin for WindowManager<R>where
R: UnsafeUnpin,
impl<R> !UnwindSafe for WindowManager<R>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert