pub struct Window<UserEventType = ()>where
UserEventType: 'static,{ /* private fields */ }
Expand description
Struct representing a window.
Implementations§
source§impl Window<()>
impl Window<()>
sourcepub fn new_centered<Str, Size>(
title: Str,
size: Size
) -> Result<Window<()>, BacktraceError<WindowCreationError>>where
Str: AsRef<str>,
Size: Into<UVec2>,
pub fn new_centered<Str, Size>(
title: Str,
size: Size
) -> Result<Window<()>, BacktraceError<WindowCreationError>>where
Str: AsRef<str>,
Size: Into<UVec2>,
Create a new window, centered in the middle of the primary monitor.
sourcepub fn new_fullscreen_borderless<Str>(
title: Str
) -> Result<Window<()>, BacktraceError<WindowCreationError>>where
Str: AsRef<str>,
pub fn new_fullscreen_borderless<Str>(
title: Str
) -> Result<Window<()>, BacktraceError<WindowCreationError>>where
Str: AsRef<str>,
Create a new window, in fullscreen borderless mode on the primary monitor.
sourcepub fn new_with_options(
title: &str,
options: WindowCreationOptions
) -> Result<Window<()>, BacktraceError<WindowCreationError>>
pub fn new_with_options(
title: &str,
options: WindowCreationOptions
) -> Result<Window<()>, BacktraceError<WindowCreationError>>
Create a new window with the specified options.
source§impl<UserEventType: 'static> Window<UserEventType>
impl<UserEventType: 'static> Window<UserEventType>
sourcepub fn new_with_user_events(
title: &str,
options: WindowCreationOptions
) -> Result<Self, BacktraceError<WindowCreationError>>
pub fn new_with_user_events(
title: &str,
options: WindowCreationOptions
) -> Result<Self, BacktraceError<WindowCreationError>>
Create a new window with the specified options, with support for user events. See window::UserEventSender.
sourcepub fn create_user_event_sender(&self) -> UserEventSender<UserEventType>
pub fn create_user_event_sender(&self) -> UserEventSender<UserEventType>
Creates a window::UserEventSender, which can be used to post custom events to this event loop from another thread.
If calling this, specify the type of the event data using
Window::<YourTypeHere>::new_with_user_events()
.
See UserEventSender::send_event, WindowHandler::on_user_event.
sourcepub fn run_loop<H>(self, handler: H) -> !where
H: WindowHandler<UserEventType> + 'static,
pub fn run_loop<H>(self, handler: H) -> !where
H: WindowHandler<UserEventType> + 'static,
Run the window event loop, with the specified callback handler.
Once the event loop finishes running, the entire app will terminate, even if other threads are still running. See window::WindowHelper::terminate_loop().