struct Espresso::GamepadState

Overview

Describes the input state of a gamepad.

The #guide button may not be available for input as it is often hooked by the system or the Steam client.

Not all devices have all the buttons or axes defined by this type. Unavailable buttons and axes will always report ButtonState::Released and 0.0 respectively.

Defined in:

espresso/input/joystick/gamepad_state.cr

Instance Method Summary

Instance Method Detail

def a : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def a? #

Indicates whether the button is currently pressed.


def axes : Indexable(Float) #

The states of each gamepad axis, in the range -1.0 to 1.0 inclusive.


[View source]
def b : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def b? #

Indicates whether the button is currently pressed.


def back : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def back? #

Indicates whether the button is currently pressed.


def buttons : Indexable(ButtonState) #

The states of each gamepad button, ButtonState::Pressed or ButtonState::Released.


[View source]
def circle : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def circle? #

Indicates whether the button is currently pressed.


def cross : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def cross? #

Indicates whether the button is currently pressed.


def dpad_down : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def dpad_down? #

Indicates whether the button is currently pressed.


def dpad_left : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def dpad_left? #

Indicates whether the button is currently pressed.


def dpad_right : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def dpad_right? #

Indicates whether the button is currently pressed.


def dpad_up : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def dpad_up? #

Indicates whether the button is currently pressed.


def guide : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def guide? #

Indicates whether the button is currently pressed.


def left_bumper : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def left_bumper? #

Indicates whether the button is currently pressed.


def left_thumb : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def left_thumb? #

Indicates whether the button is currently pressed.


def left_trigger : GamepadAxis #

Gets the state of the axis, in the range -1.0 to 1.0 inclusive.


def left_x : GamepadAxis #

Gets the state of the axis, in the range -1.0 to 1.0 inclusive.


def left_y : GamepadAxis #

Gets the state of the axis, in the range -1.0 to 1.0 inclusive.


def right_bumper : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def right_bumper? #

Indicates whether the button is currently pressed.


def right_thumb : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def right_thumb? #

Indicates whether the button is currently pressed.


def right_trigger : GamepadAxis #

Gets the state of the axis, in the range -1.0 to 1.0 inclusive.


def right_x : GamepadAxis #

Gets the state of the axis, in the range -1.0 to 1.0 inclusive.


def right_y : GamepadAxis #

Gets the state of the axis, in the range -1.0 to 1.0 inclusive.


def square : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def square? #

Indicates whether the button is currently pressed.


def start : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def start? #

Indicates whether the button is currently pressed.


def to_unsafe : LibGLFW::GamepadState #

Returns the underlying GLFW gamepad state structure.


[View source]
def triangle : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def triangle? #

Indicates whether the button is currently pressed.


def x : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def x? #

Indicates whether the button is currently pressed.


def y : GamepadState #

Gets the state of the button. This will be one of ButtonState::Pressed or ButtonState::Released.


def y? #

Indicates whether the button is currently pressed.