Struct gilrs::Gamepad [−][src]
pub struct Gamepad<'a> { /* fields omitted */ }
Expand description
Represents handle to game controller.
Using this struct you can access cached gamepad state, information about gamepad such as name or UUID and manage force feedback effects.
Implementations
Returns the mapping name if it exists otherwise returns the os provided name.
if mapping_source()
is SdlMappings
returns the name of the mapping used by the gamepad.
Otherwise returns None
.
Returns gamepad’s UUID.
It is recommended to process with the UUID crate.
Use Uuid::from_bytes
method to create a Uuid
from the returned bytes.
Returns cached gamepad state.
Returns true if gamepad is connected.
Examines cached gamepad state to check if given button is pressed. Panics if btn
is
Unknown
.
If you know Code
of the element that you want to examine, it’s recommended to use methods
directly on State
, because this version have to check which Code
is mapped to element of
gamepad.
Examines cached gamepad state to check axis’s value. Panics if axis
is Unknown
.
If you know Code
of the element that you want to examine, it’s recommended to use methods
directly on State
, because this version have to check which Code
is mapped to element of
gamepad.
Returns button state and when it changed.
If you know Code
of the element that you want to examine, it’s recommended to use methods
directly on State
, because this version have to check which Code
is mapped to element of
gamepad.
Returns axis state and when it changed.
If you know Code
of the element that you want to examine, it’s recommended to use methods
directly on State
, because this version have to check which Code
is mapped to element of
gamepad.
Returns device’s power supply state. See PowerInfo
for details.
Returns source of gamepad mapping. Can be used to filter gamepads which do not provide unified controller layout.
use gilrs::MappingSource;
for (_, gamepad) in gilrs.gamepads().filter(
|gp| gp.1.mapping_source() != MappingSource::None)
{
println!("{} is ready to use!", gamepad.name());
}
Returns true if force feedback is supported by device.
Change gamepad position used by force feedback effects.
Returns AxisOrBtn
mapped to Code
.
Returns Code
associated with btn
.
Returns area in which axis events should be ignored.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Gamepad<'a>
impl<'a> !UnwindSafe for Gamepad<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more