Richer input events
This expands input events to represent sub-pixel mouse positions, devices responsible for generating events, and raw device-oriented events. The X11 back end is refactored to make full use of the new expressiveness. Other backends have had new functionality minimally stubbed out, save for the macos backend which already supports sub-pixel mouse positions.
This commit is contained in:
parent
544ee13bf3
commit
22bc119cd7
19 changed files with 994 additions and 786 deletions
|
|
@ -1,6 +1,6 @@
|
|||
extern crate winit;
|
||||
|
||||
use winit::{Event, ElementState, MouseCursor, WindowEvent};
|
||||
use winit::{Event, ElementState, MouseCursor, WindowEvent, KeyboardInput};
|
||||
|
||||
fn main() {
|
||||
let events_loop = winit::EventsLoop::new();
|
||||
|
|
@ -13,7 +13,7 @@ fn main() {
|
|||
|
||||
events_loop.run_forever(|event| {
|
||||
match event {
|
||||
Event::WindowEvent { event: WindowEvent::KeyboardInput(ElementState::Pressed, _, _, _), .. } => {
|
||||
Event::WindowEvent { event: WindowEvent::KeyboardInput { input: KeyboardInput { state: ElementState::Pressed, .. }, .. }, .. } => {
|
||||
println!("Setting cursor to \"{:?}\"", cursors[cursor_idx]);
|
||||
window.set_cursor(cursors[cursor_idx]);
|
||||
if cursor_idx < cursors.len() - 1 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue