34 lines
706 B
Rust
34 lines
706 B
Rust
use prometeu_hal::button::Button;
|
|
use prometeu_hal::{InputSignals, TouchBridge};
|
|
|
|
#[derive(Default, Clone, Copy, Debug)]
|
|
pub struct Touch {
|
|
pub f: Button,
|
|
pub x: i32,
|
|
pub y: i32,
|
|
}
|
|
|
|
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;
|
|
self.y = signals.y_pos;
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|