viiper_client/devices/xbox360/
input.rs1use crate::wire::DeviceInput;
4
5#[derive(Debug, Clone, Default)]
6pub struct Xbox360Input {
7 pub buttons: u32,
8 pub lt: u8,
9 pub rt: u8,
10 pub lx: i16,
11 pub ly: i16,
12 pub rx: i16,
13 pub ry: i16,
14}
15
16impl DeviceInput for Xbox360Input {
17 fn to_bytes(&self) -> Vec<u8> {
18 let mut buf = Vec::new();
19 buf.extend_from_slice(&self.buttons.to_le_bytes());
20 buf.extend_from_slice(&self.lt.to_le_bytes());
21 buf.extend_from_slice(&self.rt.to_le_bytes());
22 buf.extend_from_slice(&self.lx.to_le_bytes());
23 buf.extend_from_slice(&self.ly.to_le_bytes());
24 buf.extend_from_slice(&self.rx.to_le_bytes());
25 buf.extend_from_slice(&self.ry.to_le_bytes());
26 buf
27 }
28}