added support for Ctrl and Shift keys

This commit is contained in:
Krzysztof Kondrak 2015-12-16 09:31:14 +01:00 committed by Krzysztof Kondrak
parent 0c2e4cee7c
commit 3d54525d46
2 changed files with 9 additions and 1 deletions

View file

@ -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")]

View file

@ -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,
_ => (), _ => (),
} }
} }