mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-27 05:18:27 +00:00
Fix a bug in SDL 2 support crate (#549).
This commit is contained in:
parent
4b9b609817
commit
bcc951a8fc
@ -29,7 +29,7 @@ use sdl2::{
|
|||||||
/// macOS now...)
|
/// macOS now...)
|
||||||
#[derive(Debug, Clone, Copy, Default)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
struct Button {
|
struct Button {
|
||||||
pressed_this_frame: bool,
|
pub pressed_this_frame: bool,
|
||||||
state: bool,
|
state: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,11 @@ impl SdlPlatform {
|
|||||||
// Update mouse button state
|
// Update mouse button state
|
||||||
for (io_down, button) in io.mouse_down.iter_mut().zip(&mut self.mouse_buttons) {
|
for (io_down, button) in io.mouse_down.iter_mut().zip(&mut self.mouse_buttons) {
|
||||||
*io_down = button.get();
|
*io_down = button.get();
|
||||||
*button = Button::new();
|
|
||||||
|
// this frame is now "over" and we can set pressed_this_frame to false, but
|
||||||
|
// the state cannot be set to false due to actions that require multi-frame inputs
|
||||||
|
// ie: dragging, resizing and this is handled by the `MouseButtonDown` event.
|
||||||
|
button.pressed_this_frame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse position if requested by imgui-rs
|
// Set mouse position if requested by imgui-rs
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user