add keyboard TextInput event mapping
This commit is contained in:
parent
f3b6ca46e1
commit
1c39832801
|
@ -76,7 +76,7 @@ bitflags! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||||
pub enum KeyboardEvent {
|
pub enum KeyboardEvent {
|
||||||
KeyUp {
|
KeyUp {
|
||||||
keycode: Option<Keycode>, //
|
keycode: Option<Keycode>, //
|
||||||
|
@ -90,6 +90,9 @@ pub enum KeyboardEvent {
|
||||||
keymod: KeyModifiers,
|
keymod: KeyModifiers,
|
||||||
repeat: bool,
|
repeat: bool,
|
||||||
},
|
},
|
||||||
|
TextInput {
|
||||||
|
text: String,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
|
||||||
|
@ -115,7 +118,7 @@ pub enum MouseEvent {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||||
pub enum SystemEvent {
|
pub enum SystemEvent {
|
||||||
Quit,
|
Quit,
|
||||||
AppTerminating,
|
AppTerminating,
|
||||||
|
@ -159,6 +162,7 @@ impl From<sdl2::event::Event> for SystemEvent {
|
||||||
repeat,
|
repeat,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
sdl2::event::Event::TextInput { text, .. } => SystemEvent::Keyboard(KeyboardEvent::TextInput { text }),
|
||||||
sdl2::event::Event::MouseMotion { mousestate, x, y, xrel, yrel, .. } => {
|
sdl2::event::Event::MouseMotion { mousestate, x, y, xrel, yrel, .. } => {
|
||||||
SystemEvent::Mouse(MouseEvent::MouseMotion {
|
SystemEvent::Mouse(MouseEvent::MouseMotion {
|
||||||
x,
|
x,
|
||||||
|
|
Loading…
Reference in a new issue