dead reckoning for mouse shadow because OS draws it before we get the event
This commit is contained in:
parent
52f7414dfe
commit
8471ec85fa
10
src/main.rs
10
src/main.rs
|
@ -30,6 +30,7 @@ use ferretro_components::provided::{
|
||||||
use sdl2::mouse::{Cursor, MouseUtil};
|
use sdl2::mouse::{Cursor, MouseUtil};
|
||||||
use sdl2::rect::Rect;
|
use sdl2::rect::Rect;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
use sdl2::event::WindowEvent;
|
||||||
|
|
||||||
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
|
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
|
||||||
|
|
||||||
|
@ -231,10 +232,13 @@ impl Zretro {
|
||||||
self.emu.libretro_core().unload_game();
|
self.emu.libretro_core().unload_game();
|
||||||
self.emu.load_game(filename)?;
|
self.emu.load_game(filename)?;
|
||||||
}
|
}
|
||||||
Event::MouseMotion { x, y, .. } => {
|
Event::MouseMotion { x, y, xrel, yrel, .. } => {
|
||||||
self.mouse_shadow_pos.set_x(x + 5);
|
self.mouse_shadow_pos.set_x(x + xrel + 5);
|
||||||
self.mouse_shadow_pos.set_y(y + 7);
|
self.mouse_shadow_pos.set_y(y + yrel + 7);
|
||||||
},
|
},
|
||||||
|
Event::Window { win_event: WindowEvent::Leave, .. } => {
|
||||||
|
self.mouse_shadow_pos.set_x(-(self.mouse_shadow_surf.width() as i32));
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue