summaryrefslogtreecommitdiff
path: root/crates/renderer/src/input.rs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-08-14 22:28:39 -0400
committerLLLL Colonq <llll@colonq>2025-08-14 22:28:39 -0400
commite4ded2c09e6c378040f80e80886aa9c087fe14b4 (patch)
tree74984adf49dde6a1fe7b3b22c0d9c3e2168df267 /crates/renderer/src/input.rs
parent4fb92d6fa3ce2d93c2ce720429f46aa104972674 (diff)
Automata rendering
Diffstat (limited to 'crates/renderer/src/input.rs')
-rw-r--r--crates/renderer/src/input.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/renderer/src/input.rs b/crates/renderer/src/input.rs
new file mode 100644
index 0000000..f0536e9
--- /dev/null
+++ b/crates/renderer/src/input.rs
@@ -0,0 +1,30 @@
+use device_query::DeviceQuery;
+
+pub enum Command {
+ None,
+ Drawing,
+ EraseAll,
+}
+pub struct Input {
+ pub device: device_query::DeviceState,
+}
+impl Input {
+ pub fn new() -> Self {
+ Self {
+ device: device_query::DeviceState::new(),
+ }
+ }
+ pub fn get_mouse(&self) -> (i32, i32) {
+ self.device.get_mouse().coords
+ }
+ pub fn get_command(&mut self) -> Command {
+ let keys = self.device.get_keys();
+ if keys.contains(&device_query::Keycode::LMeta) {
+ Command::Drawing
+ } else if keys.contains(&device_query::Keycode::RMeta) {
+ Command::EraseAll
+ } else {
+ Command::None
+ }
+ }
+}