pub struct SdlPlatform { /* private fields */ }
Expand description
SDL2 backend platform state.
A backend platform handles window/input device events and manages their state.
There are three things you need to do to use this library correctly:
- Initialize a
SdlPlatform
instance - Pass events to the platform (every frame)
- Call frame preparation callback (every frame)
Implementations§
Source§impl SdlPlatform
impl SdlPlatform
Sourcepub fn new(imgui: &mut Context) -> SdlPlatform
pub fn new(imgui: &mut Context) -> SdlPlatform
Initializes a SDL platform instance and configures imgui.
This function configures imgui-rs in the following ways:
- backend flags are updated
- keys are configured
- platform name is set
Sourcepub fn init(imgui: &mut Context) -> SdlPlatform
👎Deprecated: use new
instead
pub fn init(imgui: &mut Context) -> SdlPlatform
new
insteadInitializes a SDL platform instance and configures imgui.
Deprecated since 0.13.0
– use new
instead
Sourcepub fn handle_event(&mut self, context: &mut Context, event: &Event) -> bool
pub fn handle_event(&mut self, context: &mut Context, event: &Event) -> bool
Handles a SDL event.
This function performs the following actions (depends on the event):
- keyboard state is updated
- mouse state is updated
Sourcepub fn prepare_frame(
&mut self,
context: &mut Context,
window: &Window,
event_pump: &EventPump,
)
pub fn prepare_frame( &mut self, context: &mut Context, window: &Window, event_pump: &EventPump, )
Frame preparation callback.
Call this before calling the imgui-rs context frame
function.
This function performs the following actions:
- display size and the framebuffer scale is set
- mouse cursor is repositioned (if requested by imgui-rs)
- current mouse cursor position is passed to imgui-rs
- changes mouse cursor icon (if requested by imgui-rs)
Auto Trait Implementations§
impl Freeze for SdlPlatform
impl RefUnwindSafe for SdlPlatform
impl !Send for SdlPlatform
impl !Sync for SdlPlatform
impl Unpin for SdlPlatform
impl UnwindSafe for SdlPlatform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more