mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2025-01-27 02:56:33 +11:00
Merge pull request #4 from kondrak/windows-rs
added ScrollLock and numeric keypad
This commit is contained in:
commit
2a05ff3659
2 changed files with 38 additions and 1 deletions
21
src/lib.rs
21
src/lib.rs
|
@ -134,13 +134,32 @@ pub enum Key {
|
|||
Pause,
|
||||
Space,
|
||||
Tab,
|
||||
NumLock,
|
||||
CapsLock,
|
||||
ScrollLock,
|
||||
LeftShift,
|
||||
RightShift,
|
||||
LeftCtrl,
|
||||
RightCtrl,
|
||||
|
||||
Count = 84,
|
||||
NumPad0,
|
||||
NumPad1,
|
||||
NumPad2,
|
||||
NumPad3,
|
||||
NumPad4,
|
||||
NumPad5,
|
||||
NumPad6,
|
||||
NumPad7,
|
||||
NumPad8,
|
||||
NumPad9,
|
||||
NumPadDot,
|
||||
NumPadSlash,
|
||||
NumPadAsterisk,
|
||||
NumPadMinus,
|
||||
NumPadPlus,
|
||||
NumPadEnter,
|
||||
|
||||
Count = 102,
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
|
|
|
@ -105,11 +105,29 @@ fn update_key_state(window: &mut Window, wparam: u32, state: bool) {
|
|||
0x045 => window.keys[Key::Pause as usize] = state,
|
||||
0x039 => window.keys[Key::Space as usize] = state,
|
||||
0x00F => window.keys[Key::Tab as usize] = state,
|
||||
0x145 => window.keys[Key::NumLock as usize] = state,
|
||||
0x03A => window.keys[Key::CapsLock as usize] = state,
|
||||
0x046 => window.keys[Key::ScrollLock 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,
|
||||
0x052 => window.keys[Key::NumPad0 as usize] = state,
|
||||
0x04F => window.keys[Key::NumPad1 as usize] = state,
|
||||
0x050 => window.keys[Key::NumPad2 as usize] = state,
|
||||
0x051 => window.keys[Key::NumPad3 as usize] = state,
|
||||
0x04B => window.keys[Key::NumPad4 as usize] = state,
|
||||
0x04C => window.keys[Key::NumPad5 as usize] = state,
|
||||
0x04D => window.keys[Key::NumPad6 as usize] = state,
|
||||
0x047 => window.keys[Key::NumPad7 as usize] = state,
|
||||
0x048 => window.keys[Key::NumPad8 as usize] = state,
|
||||
0x049 => window.keys[Key::NumPad9 as usize] = state,
|
||||
0x053 => window.keys[Key::NumPadDot as usize] = state,
|
||||
0x135 => window.keys[Key::NumPadSlash as usize] = state,
|
||||
0x037 => window.keys[Key::NumPadAsterisk as usize] = state,
|
||||
0x04A => window.keys[Key::NumPadMinus as usize] = state,
|
||||
0x04E => window.keys[Key::NumPadPlus as usize] = state,
|
||||
0x11C => window.keys[Key::NumPadEnter as usize] = state,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue