mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Char input support on Windows
This commit is contained in:
parent
1ca62fa111
commit
2a8d09fb28
|
@ -145,6 +145,11 @@ fn update_key_state(window: &mut Window, wparam: u32, state: bool) {
|
|||
}
|
||||
}
|
||||
|
||||
fn char_down(window: &mut Window, code_point: u32) {
|
||||
if let Some(ref mut callback) = window.key_handler.key_callback {
|
||||
callback.add_char(code_point);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
unsafe fn set_window_long(window: winapi::HWND, data: winapi::LONG_PTR) -> winapi::LONG_PTR {
|
||||
|
@ -203,6 +208,14 @@ unsafe extern "system" fn wnd_proc(window: winapi::HWND,
|
|||
return 0;
|
||||
}
|
||||
|
||||
winapi::winuser::WM_CHAR => {
|
||||
char_down(wnd, wparam as u32);
|
||||
}
|
||||
|
||||
winapi::winuser::WM_SYSCHAR => {
|
||||
char_down(wnd, wparam as u32);
|
||||
}
|
||||
|
||||
winapi::winuser::WM_LBUTTONDOWN => {
|
||||
wnd.mouse.state[0] = true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue