aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock1
-rw-r--r--Cargo.toml1
-rw-r--r--src/client/gui/dimension_indicator.rs2
-rw-r--r--src/client/input/mod.rs12
4 files changed, 12 insertions, 4 deletions
diff --git a/Cargo.lock b/Cargo.lock
index f35ea11..9596582 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -190,6 +190,7 @@ dependencies = [
"num-traits",
"pretty_env_logger",
"raylib",
+ "raylib-sys",
"ron",
"serde",
"svgtypes",
diff --git a/Cargo.toml b/Cargo.toml
index e04239c..21c58a2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,7 @@ nalgebra = { version = "*", features = ["serde-serialize"] }
num-traits = "*"
pretty_env_logger = "*"
raylib = "3.0.0"
+raylib-sys = "*"
ron = "*"
serde = "*"
svgtypes = "*"
diff --git a/src/client/gui/dimension_indicator.rs b/src/client/gui/dimension_indicator.rs
index 7d5fd65..d6af690 100644
--- a/src/client/gui/dimension_indicator.rs
+++ b/src/client/gui/dimension_indicator.rs
@@ -162,9 +162,7 @@ impl DimensionIndicator {
match key {
// Add a decimal point to the dimension if possible.
'.' => {
- println!("Adding dec point?");
if !edited_dim.contains('.') {
- println!("Adding dec point!");
edited_dim.push('.');
}
// Nothing changed here, since there is an implicit .0 at the end.
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;
}