quality baseline
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use prometeu_hal::{InputSignals, PadBridge};
|
||||
use prometeu_hal::button::Button;
|
||||
use prometeu_hal::{InputSignals, PadBridge};
|
||||
|
||||
#[derive(Default, Clone, Copy, Debug)]
|
||||
pub struct Pad {
|
||||
@@ -10,31 +10,59 @@ pub struct Pad {
|
||||
|
||||
pub a: Button, // ps: square
|
||||
pub b: Button, // ps: circle
|
||||
pub x: Button, // ps: triangle
|
||||
pub x: Button, // ps: triangle
|
||||
pub y: Button, // ps: cross
|
||||
pub l: Button, // ps: R
|
||||
pub r: Button, // ps: L
|
||||
|
||||
pub start: Button,
|
||||
pub select: Button,
|
||||
pub select: Button,
|
||||
}
|
||||
|
||||
impl PadBridge for Pad {
|
||||
fn begin_frame(&mut self, signals: &InputSignals) { self.begin_frame(signals) }
|
||||
fn any(&self) -> bool { self.any() }
|
||||
fn begin_frame(&mut self, signals: &InputSignals) {
|
||||
self.begin_frame(signals)
|
||||
}
|
||||
fn any(&self) -> bool {
|
||||
self.any()
|
||||
}
|
||||
|
||||
fn up(&self) -> &Button { &self.up }
|
||||
fn down(&self) -> &Button { &self.down }
|
||||
fn left(&self) -> &Button { &self.left }
|
||||
fn right(&self) -> &Button { &self.right }
|
||||
fn a(&self) -> &Button { &self.a }
|
||||
fn b(&self) -> &Button { &self.b }
|
||||
fn x(&self) -> &Button { &self.x }
|
||||
fn y(&self) -> &Button { &self.y }
|
||||
fn l(&self) -> &Button { &self.l }
|
||||
fn r(&self) -> &Button { &self.r }
|
||||
fn start(&self) -> &Button { &self.start }
|
||||
fn select(&self) -> &Button { &self.select }
|
||||
fn up(&self) -> &Button {
|
||||
&self.up
|
||||
}
|
||||
fn down(&self) -> &Button {
|
||||
&self.down
|
||||
}
|
||||
fn left(&self) -> &Button {
|
||||
&self.left
|
||||
}
|
||||
fn right(&self) -> &Button {
|
||||
&self.right
|
||||
}
|
||||
fn a(&self) -> &Button {
|
||||
&self.a
|
||||
}
|
||||
fn b(&self) -> &Button {
|
||||
&self.b
|
||||
}
|
||||
fn x(&self) -> &Button {
|
||||
&self.x
|
||||
}
|
||||
fn y(&self) -> &Button {
|
||||
&self.y
|
||||
}
|
||||
fn l(&self) -> &Button {
|
||||
&self.l
|
||||
}
|
||||
fn r(&self) -> &Button {
|
||||
&self.r
|
||||
}
|
||||
fn start(&self) -> &Button {
|
||||
&self.start
|
||||
}
|
||||
fn select(&self) -> &Button {
|
||||
&self.select
|
||||
}
|
||||
}
|
||||
|
||||
impl Pad {
|
||||
@@ -43,18 +71,18 @@ impl Pad {
|
||||
self.down.begin_frame(signals.down_signal);
|
||||
self.left.begin_frame(signals.left_signal);
|
||||
self.right.begin_frame(signals.right_signal);
|
||||
|
||||
|
||||
self.a.begin_frame(signals.a_signal);
|
||||
self.b.begin_frame(signals.b_signal);
|
||||
self.x.begin_frame(signals.x_signal);
|
||||
self.y.begin_frame(signals.y_signal);
|
||||
self.l.begin_frame(signals.l_signal);
|
||||
self.r.begin_frame(signals.r_signal);
|
||||
|
||||
|
||||
self.start.begin_frame(signals.start_signal);
|
||||
self.select.begin_frame(signals.select_signal);
|
||||
self.select.begin_frame(signals.select_signal);
|
||||
}
|
||||
|
||||
|
||||
pub fn any(&self) -> bool {
|
||||
self.a.down
|
||||
|| self.b.down
|
||||
@@ -66,5 +94,3 @@ impl Pad {
|
||||
|| self.select.down
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user