1786001529

This commit is contained in:
2026-08-06 09:32:09 +02:00
parent f6a3aa3bc7
commit 292f1b3675
2 changed files with 23 additions and 1 deletions

5
build Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
git add .
git commit -am "$(date +%s)"
ssh trekstor -c "cd dashboard && git pull && cargo r -r"

View File

@@ -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)
}
_ => {}
}
}
}