[][src]Struct thorium::win32::xinput::XInput

pub struct XInput { /* fields omitted */ }

A handle to a dynamically loaded XInput DLL.

Several versions of XInput exist (MSDN), and XInput might not even be installed on the user's machine at all. To compensate for this, we dynamically load the user's XInput DLL at runtime, and then call the XInput functions though that.

If the version of XInput that you end up loading doesn't possess a particular function you will simply get Err(DEVICE_NOT_CONNECTED) when calling said function. For every function foo there's also a has_foo method if you want to specifically confirm that the function is loaded.

Methods

impl XInput[src]

pub fn load() -> Result<Self, Self>[src]

Loads in an XInput DLL, if possible.

Failure

If no XInput DLL can be loaded this returns an Err value with an empty XInput instance. You can still call methods on it, they'll just all always give Err(DEVICE_NOT_CONNECTED).

pub fn dll_name(&self) -> &'static str[src]

The name of the DLL that this has loaded.

pub fn enable(&self, enabled: bool) -> Result<(), DWORD>[src]

Allows you to enable and disable the whole XInput sub-system.

Not available in older versions of XInput.

MSDN

pub fn has_enable(&self) -> bool[src]

Is enable loaded.

pub fn get_audio_device_ids(
    &self,
    controller: Controller
) -> Result<AudioDeviceIDs, DWORD>
[src]

Get audio device IDs for the controller.

Not available in older versions of XInput.

MSDN

pub fn has_get_audio_device_ids(&self) -> bool[src]

Is get_audio_device_ids loaded.

pub fn get_battery_information(
    &self,
    controller: Controller,
    battery: BatteryDeviceType
) -> Result<XINPUT_BATTERY_INFORMATION, DWORD>
[src]

Attempts to get battery info for the controller.

Not available in older versions of XInput.

MSDN

pub fn has_get_battery_information(&self) -> bool[src]

Is get_battery_information loaded.

pub fn get_capabilities(
    &self,
    controller: Controller,
    gamepad: bool
) -> Result<XINPUT_CAPABILITIES, DWORD>
[src]

Query the capabilities of the controller.

The legacy "xinput9_1_0.dll" DLL will always return a fixed set of capabilities, regardless of the device's actual capabilities.

MSDN

pub fn has_get_capabilities(&self) -> bool[src]

Is get_capabilities loaded.

pub fn get_dsound_audio_device_guids(
    &self,
    controller: Controller
) -> Result<DSoundIDs, DWORD>
[src]

Gets the DirectSound GUIDs for the controller.

Note that if there is a controller connected but no headset with that controller you'll get Ok(GUID_NULL).

Not available in older versions of XInput.

MSDN

pub fn has_get_dsound_audio_device_guids(&self) -> bool[src]

Is get_dsound_audio_device_guids loaded.

pub fn get_keystroke(
    &self,
    opt_controller: Option<Controller>
) -> Result<XINPUT_KEYSTROKE, DWORD>
[src]

Gets a "keystroke" from the controller specified.

If no controller is specified it gets the input from any connected controller.

MSDN

pub fn has_get_keystroke(&self) -> bool[src]

Is get_keystroke loaded.

pub fn get_state(&self, controller: Controller) -> Result<XINPUT_STATE, DWORD>[src]

Gets the state of a controller.

MSDN

pub fn has_get_state(&self) -> bool[src]

Is get_state loaded.

pub fn set_state(
    &self,
    controller: Controller,
    left: u16,
    right: u16
) -> Result<(), DWORD>
[src]

Sets the vibration state of a controller.

MSDN

pub fn has_set_state(&self) -> bool[src]

Is set_state loaded.

Trait Implementations

impl Drop for XInput[src]

impl Debug for XInput[src]

Auto Trait Implementations

impl !Send for XInput

impl !Sync for XInput

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]