xinput/flags/
caps.rs

1use bytemuck::{Pod, Zeroable};
2use winapi::um::xinput::*;
3
4
5
6/// \[[microsoft.com](https://learn.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_capabilities#members)\]
7/// XINPUT_CAPS_\*
8///
9/// Bitmask of the device digital caps of an Xbox 360 style gamepad.
10///
11/// ### See Also
12/// *   [Xbox 360 controller: Layout](https://en.wikipedia.org/wiki/Xbox_360_controller#Layout) (Wikipedia)
13#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
14#[derive(Pod, Zeroable)]
15#[repr(transparent)] pub struct Caps(u16);
16
17flags! { Caps => u16; None, VoiceSupported, FfbSupported, Wireless, PmdSupported, NoNavigation }
18
19#[allow(non_upper_case_globals)] impl Caps {
20    /// No capabilities are held.
21    pub const None              : Caps = Caps(0);
22
23    /// Device has an integrated voice device.
24    pub const VoiceSupported    : Caps = Caps(XINPUT_CAPS_VOICE_SUPPORTED);
25
26    /// **F**orce **F**eed**b**ack is supported.
27    pub const FfbSupported      : Caps = Caps(XINPUT_CAPS_FFB_SUPPORTED);
28
29    /// The device is wireless.
30    pub const Wireless          : Caps = Caps(XINPUT_CAPS_WIRELESS);
31
32    /// **P**lug-in **M**o**d**ules are supported.
33    ///
34    /// **NOTE:** Plug-in modules like the text input device (TID) may not be supported on Windows.
35    pub const PmdSupported      : Caps = Caps(XINPUT_CAPS_PMD_SUPPORTED);
36
37    /// Device lacks menu navigation buttons (START, BACK, DPAD).
38    pub const NoNavigation      : Caps = Caps(XINPUT_CAPS_NO_NAVIGATION);
39}
40
41
42
43//#cpp2rust XINPUT_CAPS_VOICE_SUPPORTED     = xinput::Caps::VoiceSupported
44//#cpp2rust XINPUT_CAPS_FFB_SUPPORTED       = xinput::Caps::FfbSupported
45//#cpp2rust XINPUT_CAPS_WIRELESS            = xinput::Caps::Wireless
46//#cpp2rust XINPUT_CAPS_PMD_SUPPORTED       = xinput::Caps::PmdSupported
47//#cpp2rust XINPUT_CAPS_NO_NAVIGATION       = xinput::Caps::NoNavigation