pub struct FrameInput {
pub events: Vec<Event>,
pub elapsed_time: f64,
pub accumulated_time: f64,
pub viewport: Viewport,
pub window_width: u32,
pub window_height: u32,
pub device_pixel_ratio: f32,
pub first_frame: bool,
pub context: Context,
}Expand description
Input for rendering (and whatever else needs it) each frame. It includes events that can be used as input to controls. The data should only be used for one frame.
Note: FrameInput is automatically generated if using the default Window. Use FrameInputGenerator to generate it with a custom winit window.
Fields§
§events: Vec<Event>A list of events which has occurred since last frame.
elapsed_time: f64Milliseconds since last frame.
accumulated_time: f64Milliseconds accumulated time since start.
viewport: ViewportViewport of the window in physical pixels (the size of the screen RenderTarget which is returned from FrameInput::screen).
window_width: u32Width of the window in logical pixels.
window_height: u32Height of the window in logical pixels.
device_pixel_ratio: f32Number of physical pixels for each logical pixel.
first_frame: boolWhether or not this is the first frame. Note: also set after the window becomes (partially) visible.
context: ContextThe graphics context for the window.
Implementations§
Source§impl FrameInput
impl FrameInput
Sourcepub fn screen(&self) -> RenderTarget<'_>
Available on crate feature window only.
pub fn screen(&self) -> RenderTarget<'_>
window only.Returns the screen render target, which is used for drawing to the screen, for this window. Same as
RenderTarget::screen(&frame_input.context, frame_input.viewport.width, frame_input.viewport.height)Trait Implementations§
Source§impl Clone for FrameInput
Available on crate feature window only.
impl Clone for FrameInput
window only.Source§fn clone(&self) -> FrameInput
fn clone(&self) -> FrameInput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more