viiper-client 0.4.1

VIIPER Client Library for Rust
Documentation
// This file is auto-generated by VIIPER codegen. DO NOT EDIT.

use crate::wire::DeviceInput;

#[derive(Debug, Clone, Default)]
pub struct Xbox360Input {
    pub buttons: u32,
    pub lt: u8,
    pub rt: u8,
    pub lx: i16,
    pub ly: i16,
    pub rx: i16,
    pub ry: i16,
}

impl DeviceInput for Xbox360Input {
    fn to_bytes(&self) -> Vec<u8> {
        let mut buf = Vec::new();
        buf.extend_from_slice(&self.buttons.to_le_bytes());
        buf.extend_from_slice(&self.lt.to_le_bytes());
        buf.extend_from_slice(&self.rt.to_le_bytes());
        buf.extend_from_slice(&self.lx.to_le_bytes());
        buf.extend_from_slice(&self.ly.to_le_bytes());
        buf.extend_from_slice(&self.rx.to_le_bytes());
        buf.extend_from_slice(&self.ry.to_le_bytes());
        buf
    }
}