rcade/inputs/controls

Types

State of a player’s joystick and buttons.

pub type Controls {
  Controls(
    up: Bool,
    down: Bool,
    left: Bool,
    right: Bool,
    a: Bool,
    b: Bool,
  )
}

Constructors

  • Controls(
      up: Bool,
      down: Bool,
      left: Bool,
      right: Bool,
      a: Bool,
      b: Bool,
    )

State of the system buttons.

pub type SystemButtons {
  SystemButtons(one_player: Bool, two_player: Bool)
}

Constructors

  • SystemButtons(one_player: Bool, two_player: Bool)

Values

pub fn connected() -> Bool

Whether the classic controls hardware is connected.

pub fn read_player(player: player.Player) -> Controls

Read the current state of a player’s “classic” controls.

pub fn read_system() -> SystemButtons

Read the current state of the system buttons (one player, two players).

pub fn subscribe(
  callback: fn(Int, String, Bool) -> Nil,
) -> fn() -> Nil
Search Document