Trait kludgine_app::Window [−][src]
pub trait Window: Send + Sync + 'static {
fn initialize(
&mut self,
_scene: &Target,
_redrawer: RedrawRequester,
_window: WindowHandle
) -> Result<()>
where
Self: Sized,
{ ... }
fn close_requested(
&mut self,
_window: WindowHandle
) -> Result<CloseResponse> { ... }
fn process_input(
&mut self,
_input: InputEvent,
_status: &mut RedrawStatus,
_scene: &Target,
_window: WindowHandle
) -> Result<()>
where
Self: Sized,
{ ... }
fn receive_character(
&mut self,
_character: char,
_status: &mut RedrawStatus,
_scene: &Target,
_window: WindowHandle
) -> Result<()>
where
Self: Sized,
{ ... }
fn target_fps(&self) -> Option<u16> { ... }
fn render(
&mut self,
scene: &Target,
status: &mut RedrawStatus,
_window: WindowHandle
) -> Result<()> { ... }
fn update(
&mut self,
scene: &Target,
status: &mut RedrawStatus,
_window: WindowHandle
) -> Result<()>
where
Self: Sized,
{ ... }
fn additional_scale(&self) -> Scale<f32, Scaled, Points> { ... }
}
Expand description
Trait to implement a Window
Provided methods
fn initialize(
&mut self,
_scene: &Target,
_redrawer: RedrawRequester,
_window: WindowHandle
) -> Result<()> where
Self: Sized,
fn initialize(
&mut self,
_scene: &Target,
_redrawer: RedrawRequester,
_window: WindowHandle
) -> Result<()> where
Self: Sized,
Called when the window is being initilaized.
fn close_requested(&mut self, _window: WindowHandle) -> Result<CloseResponse>
fn close_requested(&mut self, _window: WindowHandle) -> Result<CloseResponse>
The window was requested to be closed, most likely from the Close Button. Override this implementation if you want logic in place to prevent a window from closing.
fn process_input(
&mut self,
_input: InputEvent,
_status: &mut RedrawStatus,
_scene: &Target,
_window: WindowHandle
) -> Result<()> where
Self: Sized,
fn process_input(
&mut self,
_input: InputEvent,
_status: &mut RedrawStatus,
_scene: &Target,
_window: WindowHandle
) -> Result<()> where
Self: Sized,
The window has received an input event.
fn receive_character(
&mut self,
_character: char,
_status: &mut RedrawStatus,
_scene: &Target,
_window: WindowHandle
) -> Result<()> where
Self: Sized,
fn receive_character(
&mut self,
_character: char,
_status: &mut RedrawStatus,
_scene: &Target,
_window: WindowHandle
) -> Result<()> where
Self: Sized,
A text input was received.
fn target_fps(&self) -> Option<u16>
fn target_fps(&self) -> Option<u16>
Specify a target frames per second, which will force your window to redraw at this rate. If None is returned, the Window will only redraw when requested via methods on Context.
fn render(
&mut self,
scene: &Target,
status: &mut RedrawStatus,
_window: WindowHandle
) -> Result<()>
fn render(
&mut self,
scene: &Target,
status: &mut RedrawStatus,
_window: WindowHandle
) -> Result<()>
Renders the contents of the window. Called whenever the operating system
needs the window’s contents to be redrawn or when RedrawStatus
indicates a new frame should be rendered in Window::update()
.
fn update(
&mut self,
scene: &Target,
status: &mut RedrawStatus,
_window: WindowHandle
) -> Result<()> where
Self: Sized,
fn update(
&mut self,
scene: &Target,
status: &mut RedrawStatus,
_window: WindowHandle
) -> Result<()> where
Self: Sized,
Called on a regular basis as events come in. Use status
to indicate
when a redraw should happen.
fn additional_scale(&self) -> Scale<f32, Scaled, Points>
fn additional_scale(&self) -> Scale<f32, Scaled, Points>
Called prior to rendering to allow setting a scaling amount that operates on top of the automatic DPI scaling. This can be used to offer a zoom setting to end-users.