class

Swanium::Frontend::InputBindings

Inherits Reference < Object

Keyboard bindings are SDL scancodes, so they remain layout-independent.

Constants

ACTIONS = [:x1, :x2, :x3, :x4, :y1, :y2, :y3, :y4, :a, :b, :start]
CONTROLLER_BUTTON_OPTIONS = [{"A", 0}, {"B", 1}, {"X", 2}, {"Y", 3}, {"Back", 4}, {"Start", 6}, {"Left Shoulder", 9}, {"Right Shoulder", 10}]
DEFAULTS = { x1: 82, x2: 79, x3: 81, x4: 80, y1: 26, y2: 7, y3: 22, y4: 4, a: 27, b: 29, start: 40, }
OPTIONS = [{"Arrow Up", 82}, {"Arrow Right", 79}, {"Arrow Down", 81}, {"Arrow Left", 80}, {"W", 26}, {"A", 4}, {"S", 22}, {"D", 7}, {"X", 27}, {"Z", 29}, {"Return", 40}, {"Space", 44}]

Constructors

default
Source

Class methods

action_label(action : Symbol) : String
Source
controller_button_index(button : Int32) : Int32
Source
controller_button_name(button : Int32) : String
Source
controller_button_names
Source
controller_button_value(index : Int32) : Int32
Source
option_index(scancode : Int32) : Int32
Source
option_name(scancode : Int32) : String
Source
option_names
Source
option_scancode(index : Int32) : Int32
Source

Instance methods

controller_button(action : Symbol) : Int32
Source
controller_destination(name : String, default : Int32) : Int32

0 = disabled, 1 = X pad, 2 = Y pad.

Source
controller_enabled?(name : String, default : Bool = true) : Bool
Source
reset_controller
Source
reset_keyboard
Source
scancode(action : Symbol) : Int32
Source
set(action : Symbol, scancode : Int32) : Nil
Source
set_controller_button(action : Symbol, button : Int32) : Nil
Source
set_controller_destination(name : String, destination : Int32) : Nil
Source
set_controller_enabled(name : String, enabled : Bool) : Nil
Source