diff options
Diffstat (limited to 'src/client/input')
| -rw-r--r-- | src/client/input/mod.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/client/input/mod.rs b/src/client/input/mod.rs index e8b1821..26d39c6 100644 --- a/src/client/input/mod.rs +++ b/src/client/input/mod.rs @@ -29,6 +29,7 @@ use crate::math::{ExactSurface, Rect, Vec2}; use crate::stable_vec::StableVec; use raylib::ffi::KeyboardKey; use raylib::RaylibHandle; +use raylib_sys::GetCharPressed; use std::collections::HashMap; use std::sync::mpsc::{self, Receiver, Sender}; @@ -64,10 +65,17 @@ impl Input { Some('\n') } else if rl.is_key_pressed(KeyboardKey::KEY_ESCAPE) { Some('\x1B') + } else if rl.is_key_pressed(KeyboardKey::KEY_TAB) { + Some('\t') } else if rl.is_key_pressed(KeyboardKey::KEY_BACKSPACE) { Some('\x7f') } else { - rl.get_key_pressed_number().map(|c| c as u8 as char) + let c_opt = unsafe { GetCharPressed() }; + if c_opt > 0 { + Some(c_opt as u8 as char) + } else { + None + } }; /* Send the character to the listening entity or push it to the text that @@ -75,7 +83,7 @@ impl Input { */ if let Some(text_pipe) = self.text_pipe.as_mut() { if let Some(c) = c { - if text_pipe.send(c).is_err() { + if text_pipe.send(dbg!(c)).is_err() { self.last_text.push(c); self.text_pipe = None; } |
