mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-24 03:41:29 +11:00
added support for Ctrl and Shift keys
This commit is contained in:
parent
0c2e4cee7c
commit
3d54525d46
|
@ -135,8 +135,12 @@ pub enum Key {
|
||||||
Space,
|
Space,
|
||||||
Tab,
|
Tab,
|
||||||
CapsLock,
|
CapsLock,
|
||||||
|
LeftShift,
|
||||||
|
RightShift,
|
||||||
|
LeftCtrl,
|
||||||
|
RightCtrl,
|
||||||
|
|
||||||
Count = 80,
|
Count = 84,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
|
|
@ -106,6 +106,10 @@ fn update_key_state(window: &mut Window, wparam: u32, state: bool) {
|
||||||
0x039 => window.keys[Key::Space as usize] = state,
|
0x039 => window.keys[Key::Space as usize] = state,
|
||||||
0x00F => window.keys[Key::Tab as usize] = state,
|
0x00F => window.keys[Key::Tab as usize] = state,
|
||||||
0x03A => window.keys[Key::CapsLock as usize] = state,
|
0x03A => window.keys[Key::CapsLock as usize] = state,
|
||||||
|
0x02A => window.keys[Key::LeftShift as usize] = state,
|
||||||
|
0x036 => window.keys[Key::RightShift as usize] = state,
|
||||||
|
0x01D => window.keys[Key::LeftCtrl as usize] = state,
|
||||||
|
0x11D => window.keys[Key::RightCtrl as usize] = state,
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue