Struct egui_winit_platform::Platform
source · pub struct Platform { /* private fields */ }
Expand description
Provides the integration between egui and winit.
Implementations§
source§impl Platform
impl Platform
sourcepub fn new(descriptor: PlatformDescriptor) -> Self
pub fn new(descriptor: PlatformDescriptor) -> Self
Creates a new Platform
.
sourcepub fn handle_event<T>(&mut self, winit_event: &Event<'_, T>)
pub fn handle_event<T>(&mut self, winit_event: &Event<'_, T>)
Handles the given winit event and updates the egui context. Should be called before starting a new frame with start_frame()
.
sourcepub fn captures_event<T>(&self, winit_event: &Event<'_, T>) -> bool
pub fn captures_event<T>(&self, winit_event: &Event<'_, T>) -> bool
Returns true
if egui should handle the event exclusively. Check this to
avoid unexpected interactions, e.g. a mouse click registering “behind” the UI.
sourcepub fn update_time(&mut self, elapsed_seconds: f64)
pub fn update_time(&mut self, elapsed_seconds: f64)
Updates the internal time for egui used for animations. elapsed_seconds
should be the seconds since some point in time (for example application start).
sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Starts a new frame by providing a new Ui
instance to write into.
sourcepub fn end_frame(&mut self, window: Option<&Window>) -> FullOutput
pub fn end_frame(&mut self, window: Option<&Window>) -> FullOutput
Ends the frame. Returns what has happened as Output
and gives you the draw instructions
as PaintJobs
. If the optional window
is set, it will set the cursor key based on
egui’s instructions.
sourcepub fn raw_input_mut(&mut self) -> &mut RawInput
pub fn raw_input_mut(&mut self) -> &mut RawInput
Returns a mutable reference to the raw input that will be passed to egui
the next time Self::begin_frame
is called