Buttons

Struct Buttons 

Source
pub struct Buttons(/* private fields */);
Expand description

[microsoft.com] XINPUT_GAMEPAD_*

Bitmask of the device digital buttons of an Xbox 360 style gamepad.

§See Also

Implementations§

Source§

impl Buttons

Source

pub const fn zeroed() -> Self

Initialize to 0.

Source

pub const fn none() -> Self

Initialize to 0.

Source

pub const fn from_unchecked(d3d: u16) -> Self

Convert from an underlying winapi type. This is probably safe… probably…

Source

pub const fn into_inner(self) -> u16

Convert back into an underlying winapi type.

Source§

impl Buttons

Source

pub fn any_held(&self, buttons: Buttons) -> bool

Returns true if any button from buttons is set in self

Source

pub fn all_held(&self, buttons: Buttons) -> bool

Returns true if all buttons from buttons are set in self

Source§

impl Buttons

Source

pub const None: Buttons

No buttons are held.

Source

pub const DPadUp: Buttons

ControllerWhere
Xbox 360Directional pad on the bottom left of the face
Xbox OneDirectional pad on the bottom left of the face
Source

pub const DPadDown: Buttons

ControllerWhere
Xbox 360Directional pad on the bottom left of the face
Xbox OneDirectional pad on the bottom left of the face
Source

pub const DPadLeft: Buttons

ControllerWhere
Xbox 360Directional pad on the bottom left of the face
Xbox OneDirectional pad on the bottom left of the face
Source

pub const DPadRight: Buttons

ControllerWhere
Xbox 360Directional pad on the bottom left of the face
Xbox OneDirectional pad on the bottom left of the face
Source

pub const Start: Buttons

ControllerLegendWhere
Xbox 360Start Right button of the middle face cluster
Xbox OneMenu Right button of the middle face cluster
Source

pub const Back: Buttons

ControllerLegendWhere
Xbox 360Back Left button of the middle face cluster
Xbox OneView Left button of the middle face cluster
Source

pub const LeftThumb: Buttons

ControllerLegendWhen
Xbox 360LPressing the left thumbstick into the controller
Xbox OneLPressing the left thumbstick into the controller
Source

pub const RightThumb: Buttons

ControllerLegendWhen
Xbox 360RPressing the right thumbstick into the controller
Xbox OneRPressing the right thumbstick into the controller
Source

pub const LeftShoulder: Buttons

ControllerLegendWhere
Xbox 360LBTop left on the controller
Xbox OneLBTop left on the controller
Source

pub const RightShoulder: Buttons

ControllerLegendWhere
Xbox 360RBTop right on the controller
Xbox OneRBTop right on the controller
Source

pub const LeftTrigger: () = ()

NOTE ❌ Not actually exposed by XInput as Buttons, see Gamepad::left_trigger instead.

ControllerLegendWhere
Xbox 360LTUnder the top left of the controller
Xbox OneLTUnder the top left of the controller
Source

pub const RightTrigger: () = ()

NOTE ❌ Not actually available as part of Buttons, see Gamepad::right_trigger instead.

ControllerLegendWhere
Xbox 360RTUnder the top right on the controller
Xbox OneRTUnder the top right on the controller
Source

pub const Guide: Buttons

Available on crate feature undocumented only.

⚠️ NOTE ⚠️ This undocumented button is not returned by most APIs, being reserved for system software.

Specifically, you must use the undocumented XInputGetStateEx function (same API as XInputGetState?) to ever retrieve this value. Additionally, this is generally meant to be reserved by the system software. Windows, Steam, and other store apps all hook this globally regardless of what app/window has focus.

ControllerLegendWhere
Xbox 360GuideCenter of the middle face cluster.
Xbox OneXboxCenter of the middle face cluster.
§Conflicting Software: Xbox Game Bar (Windows 8+)

To disable:

  • Launch Xbox Game Bar from the start menu
  • Open Settings (Gear icon on the right of the top menu bar)
  • Under Shortcuts > Controller,
  • Unselect Open Xbox Game Bar using (X) button on a controller
§Conflicting Software: Steam

To disable, close Steam, or:

  • Open Steam’s Settings
    • Settings after right clicking the Steam system tray icon, or
    • Steam > Settings in Steam’s menu bar
  • Under Controller > Guide Button Chord Configuration:
    • Choose Browse Configs
    • Select Templates > Gamepad (inert/do-nothing template)
  • Under Controller > General Controller Settings:
    • Disable Guide Button Focuses Steam
Source

pub const A: Buttons

Typically synonymous select/accept in menus on Xbox 360 style controllers/games/console.

ControllerLegendWhere
Xbox 360Green ABottom button of the right face cluster
Xbox OneABottom button of the right face cluster
Source

pub const B: Buttons

Typically synonymous back/cancel in menus on Xbox 360 style controllers/games/console.

ControllerLegendWhere
Xbox 360Red BRight button of the right face cluster
Xbox OneBRight button of the right face cluster
Source

pub const X: Buttons

ControllerLegendWhere
Xbox 360Blue XLeft button of the right face cluster
Xbox OneXLeft button of the right face cluster
Source

pub const Y: Buttons

ControllerLegendWhere
Xbox 360Yellow YTop button of the right face cluster
Xbox OneYTop button of the right face cluster

Trait Implementations§

Source§

impl BitOr for Buttons

Source§

type Output = Buttons

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Self) -> Self

Performs the | operation. Read more
Source§

impl BitOrAssign for Buttons

Source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
Source§

impl Clone for Buttons

Source§

fn clone(&self) -> Buttons

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Buttons

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Buttons

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<Buttons> for u16

Source§

fn from(value: Buttons) -> Self

Converts to this type from the input type.
Source§

impl Hash for Buttons

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Buttons

Source§

fn cmp(&self, other: &Buttons) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Buttons

Source§

fn eq(&self, other: &Buttons) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Buttons

Source§

fn partial_cmp(&self, other: &Buttons) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Zeroable for Buttons

Source§

fn zeroed() -> Self

Source§

impl Copy for Buttons

Source§

impl Eq for Buttons

Source§

impl Pod for Buttons

Source§

impl StructuralPartialEq for Buttons

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> NoUninit for T
where T: Pod,