26 lines
687 B
Rust
26 lines
687 B
Rust
use prometeu_abi::model::Button;
|
|
use prometeu_hardware_contract::{InputSignals, TouchBridge};
|
|
|
|
#[derive(Default, Clone, Copy, Debug)]
|
|
pub struct Touch {
|
|
pub f: Button,
|
|
pub x: i32,
|
|
pub y: i32,
|
|
}
|
|
|
|
impl TouchBridge for Touch {
|
|
fn begin_frame(&mut self, signals: &InputSignals) { self.begin_frame(signals) }
|
|
fn f(&self) -> &Button { &self.f }
|
|
fn x(&self) -> i32 { self.x }
|
|
fn y(&self) -> i32 { self.y }
|
|
}
|
|
|
|
impl Touch {
|
|
/// Transient flags should last only 1 frame.
|
|
pub fn begin_frame(&mut self, signals: &InputSignals) {
|
|
self.f.begin_frame(signals.f_signal);
|
|
self.x = signals.x_pos.clone();
|
|
self.y = signals.y_pos.clone();
|
|
}
|
|
}
|