Struct egui_speedy2d::WindowWrapper
source · pub struct WindowWrapper<UserEventType> { /* private fields */ }
Expand description
Wraps an egui context with features that are useful for integrating egui with Speedy2d.
Implementations§
source§impl<UserEventType> WindowWrapper<UserEventType>
impl<UserEventType> WindowWrapper<UserEventType>
sourcepub fn new(handler: impl WindowHandler<UserEventType> + 'static) -> Self
pub fn new(handler: impl WindowHandler<UserEventType> + 'static) -> Self
Creates a new WindowWrapper
and underlying egui context.
sourcepub fn draw(
&mut self,
full_output: FullOutput,
gfx: &mut Graphics2D
) -> Result<(), BacktraceError<ErrorMessage>>
pub fn draw(
&mut self,
full_output: FullOutput,
gfx: &mut Graphics2D
) -> Result<(), BacktraceError<ErrorMessage>>
Draws the latest finished GUI frame to the screen.
Trait Implementations§
source§impl<UserEventType> WindowHandler<UserEventType> for WindowWrapper<UserEventType>
impl<UserEventType> WindowHandler<UserEventType> for WindowWrapper<UserEventType>
source§fn on_start(
&mut self,
helper: &mut WindowHelper<UserEventType>,
info: WindowStartupInfo
)
fn on_start(
&mut self,
helper: &mut WindowHelper<UserEventType>,
info: WindowStartupInfo
)
Invoked once when the window first starts.
source§fn on_user_event(
&mut self,
helper: &mut WindowHelper<UserEventType>,
user_event: UserEventType
)
fn on_user_event(
&mut self,
helper: &mut WindowHelper<UserEventType>,
user_event: UserEventType
)
Invoked when a user-defined event is received, allowing you to wake up the event loop to handle events from other threads.
source§fn on_resize(
&mut self,
helper: &mut WindowHelper<UserEventType>,
size_pixels: UVec2
)
fn on_resize(
&mut self,
helper: &mut WindowHelper<UserEventType>,
size_pixels: UVec2
)
Invoked when the window is resized.
source§fn on_mouse_grab_status_changed(
&mut self,
helper: &mut WindowHelper<UserEventType>,
mouse_grabbed: bool
)
fn on_mouse_grab_status_changed(
&mut self,
helper: &mut WindowHelper<UserEventType>,
mouse_grabbed: bool
)
Invoked if the mouse cursor becomes grabbed or un-grabbed. See WindowHelper::set_cursor_grab.
Note: mouse movement events will behave differently depending on the current cursor grabbing status.
source§fn on_fullscreen_status_changed(
&mut self,
helper: &mut WindowHelper<UserEventType>,
fullscreen: bool
)
fn on_fullscreen_status_changed(
&mut self,
helper: &mut WindowHelper<UserEventType>,
fullscreen: bool
)
Invoked if the window enters or exits fullscreen mode. See WindowHelper::set_fullscreen_mode.
source§fn on_scale_factor_changed(
&mut self,
helper: &mut WindowHelper<UserEventType>,
scale_factor: f64
)
fn on_scale_factor_changed(
&mut self,
helper: &mut WindowHelper<UserEventType>,
scale_factor: f64
)
Invoked when the window scale factor changes.
source§fn on_draw(
&mut self,
helper: &mut WindowHelper<UserEventType>,
graphics: &mut Graphics2D
)
fn on_draw(
&mut self,
helper: &mut WindowHelper<UserEventType>,
graphics: &mut Graphics2D
)
Invoked when the contents of the window needs to be redrawn.
It is possible to request a redraw from any callback using WindowHelper::request_redraw.
source§fn on_mouse_move(
&mut self,
helper: &mut WindowHelper<UserEventType>,
position: Vec2
)
fn on_mouse_move(
&mut self,
helper: &mut WindowHelper<UserEventType>,
position: Vec2
)
Invoked when the mouse changes position.
Normally, this provides the absolute position of the mouse in the window/canvas. However, if the mouse cursor is grabbed, this will instead provide the amount of relative movement since the last move event.
Invoked when a mouse button is pressed.
Invoked when a mouse button is released.
source§fn on_mouse_wheel_scroll(
&mut self,
helper: &mut WindowHelper<UserEventType>,
distance: MouseScrollDistance
)
fn on_mouse_wheel_scroll(
&mut self,
helper: &mut WindowHelper<UserEventType>,
distance: MouseScrollDistance
)
Invoked when the mouse wheel moves.
source§fn on_key_down(
&mut self,
helper: &mut WindowHelper<UserEventType>,
virtual_key_code: Option<VirtualKeyCode>,
scancode: KeyScancode
)
fn on_key_down(
&mut self,
helper: &mut WindowHelper<UserEventType>,
virtual_key_code: Option<VirtualKeyCode>,
scancode: KeyScancode
)
Invoked when a keyboard key is pressed.
To detect when a character is typed, see the WindowHandler::on_keyboard_char callback.
source§fn on_key_up(
&mut self,
helper: &mut WindowHelper<UserEventType>,
virtual_key_code: Option<VirtualKeyCode>,
scancode: KeyScancode
)
fn on_key_up(
&mut self,
helper: &mut WindowHelper<UserEventType>,
virtual_key_code: Option<VirtualKeyCode>,
scancode: KeyScancode
)
Invoked when a keyboard key is released.
source§fn on_keyboard_char(
&mut self,
helper: &mut WindowHelper<UserEventType>,
unicode_codepoint: char
)
fn on_keyboard_char(
&mut self,
helper: &mut WindowHelper<UserEventType>,
unicode_codepoint: char
)
Invoked when a character is typed on the keyboard.
This is invoked in addition to the WindowHandler::on_key_up and WindowHandler::on_key_down callbacks.
source§fn on_keyboard_modifiers_changed(
&mut self,
helper: &mut WindowHelper<UserEventType>,
state: ModifiersState
)
fn on_keyboard_modifiers_changed(
&mut self,
helper: &mut WindowHelper<UserEventType>,
state: ModifiersState
)
Invoked when the state of the modifier keys has changed.