use classic::GamepadButtons;
use super::{
HasStandardButtons,
PollCommand
};
#[repr(C)]
pub struct DualShock {
pub buttons: GamepadButtons,
pub rx: u8,
pub ry: u8,
pub lx: u8,
pub ly: u8,
}
impl HasStandardButtons for DualShock {
fn buttons(&self) -> GamepadButtons {
self.buttons.clone()
}
}
#[repr(C)]
pub struct DualShock2 {
pub buttons: GamepadButtons,
pub rx: u8,
pub ry: u8,
pub lx: u8,
pub ly: u8,
pub pressures: [u8; 8],
}
impl HasStandardButtons for DualShock2 {
fn buttons(&self) -> GamepadButtons {
self.buttons.clone()
}
}
pub struct ControlDS {
pub little: bool,
pub big: u8,
}
impl ControlDS {
pub fn new(little: bool, big: u8) -> Self {
Self {
little: little,
big: big,
}
}
}
impl PollCommand for ControlDS {
fn set_command(&self, command: &mut [u8]) {
command[0] = if self.little { 0xff } else { 0x00 };
command[1] = self.big;
}
}