[−][src]Struct thorium::win32::xinput::XInput
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.
pub fn has_enable(&self) -> bool
[src]
Is enable
loaded.
pub fn get_audio_device_ids(
&self,
controller: Controller
) -> Result<AudioDeviceIDs, DWORD>
[src]
&self,
controller: Controller
) -> Result<AudioDeviceIDs, DWORD>
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]
&self,
controller: Controller,
battery: BatteryDeviceType
) -> Result<XINPUT_BATTERY_INFORMATION, DWORD>
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]
&self,
controller: Controller,
gamepad: bool
) -> Result<XINPUT_CAPABILITIES, DWORD>
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.
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]
&self,
controller: Controller
) -> Result<DSoundIDs, DWORD>
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.
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]
&self,
opt_controller: Option<Controller>
) -> Result<XINPUT_KEYSTROKE, DWORD>
Gets a "keystroke" from the controller specified.
If no controller is specified it gets the input from any connected controller.
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.
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]
&self,
controller: Controller,
left: u16,
right: u16
) -> Result<(), DWORD>
Sets the vibration state of a controller.
pub fn has_set_state(&self) -> bool
[src]
Is set_state
loaded.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,