diff options
Diffstat (limited to 'engine/src/windowing/keyboard.rs')
| -rw-r--r-- | engine/src/windowing/keyboard.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/engine/src/windowing/keyboard.rs b/engine/src/windowing/keyboard.rs index 5a31e7c..4515d8a 100644 --- a/engine/src/windowing/keyboard.rs +++ b/engine/src/windowing/keyboard.rs @@ -6,6 +6,7 @@ use crate::ecs::Sole; pub struct Keyboard { map: HashMap<Key, KeyData>, + text_keys: String, } impl Keyboard @@ -71,6 +72,11 @@ impl Keyboard key_data.previous_state } + pub fn text_keys(&self) -> &str + { + &self.text_keys + } + pub fn set_key_state(&mut self, key: Key, key_state: KeyState) { let key_data = self.map.entry(key).or_default(); @@ -84,6 +90,12 @@ impl Keyboard key_data.previous_state = key_data.curr_state; } } + + pub fn set_text_keys(&mut self, text_keys: impl IntoIterator<Item = char>) + { + self.text_keys.clear(); + self.text_keys.extend(text_keys); + } } #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
