Skip to content

Commit

Permalink
add get_char_pressed binding
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaracco committed Jun 14, 2022
1 parent ac58cc2 commit 8596d52
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions raylib/src/core/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ impl RaylibHandle {
None
}

/// Gets latest char (unicode) pressed
#[inline]
pub fn get_char_pressed(&mut self) -> Option<char> {
let char_code = unsafe { ffi::GetCharPressed() };
if char_code > 0 {
return char::from_u32(char_code as i32);
}
None
}

/// Sets a custom key to exit program (default is ESC).
// #[inline]
pub fn set_exit_key(&mut self, key: Option<crate::consts::KeyboardKey>) {
Expand Down

0 comments on commit 8596d52

Please sign in to comment.