1786001529
This commit is contained in:
5
build
Executable file
5
build
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
git add .
|
||||
git commit -am "$(date +%s)"
|
||||
|
||||
ssh trekstor -c "cd dashboard && git pull && cargo r -r"
|
||||
19
src/input.rs
19
src/input.rs
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
use evdev::{AbsoluteAxisCode, Device, EventSummary, KeyCode};
|
||||
use evdev::{AbsoluteAxisCode, Device, EventSummary, InputEvent, KeyCode};
|
||||
|
||||
struct InputState {
|
||||
x: i32,
|
||||
@@ -22,4 +22,21 @@ impl InputState {
|
||||
clear_before_next_event: true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_event(&mut self, event: &InputEvent) {
|
||||
match event.destructure() {
|
||||
EventSummary::AbsoluteAxis(_, AbsoluteAxisCode::ABS_X, value) => {
|
||||
self.x = (((value - 13) as f32 / 882.) * (screen.width() as f32)) as i32;
|
||||
}
|
||||
EventSummary::AbsoluteAxis(_, AbsoluteAxisCode::ABS_Y, value) => {
|
||||
self.y = (((value - 13) as f32 / 624.) * (screen.height() as f32)) as i32;
|
||||
}
|
||||
EventSummary::Key(_, KeyCode::BTN_TOUCH, value) => {
|
||||
// if value is 1, touch is started
|
||||
// if value is 0, touch ended
|
||||
println!("touch: {}", value)
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user