struct Opal::Input::Core::InputBinding

Overview

Pure value-type representing a single physical input trigger (key, mouse button, or gamepad button/axis).

Defined in:

opal/input/core/remap_model.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.from_key_event(event : Terminal::KeyEvent) : InputBinding #

Creates an InputBinding directly from a terminal KeyEvent.


[View source]
def self.from_mouse_event(event : Terminal::MouseEvent) : InputBinding #

Creates an InputBinding directly from a terminal MouseEvent.


[View source]
def self.new(code : String, device : DeviceType = DeviceType::Keyboard, ctrl : Bool = false, alt : Bool = false, shift : Bool = false, axis_direction : Int32 = 0) #

[View source]
def self.parse(descriptor : String, default_device : DeviceType = DeviceType::Keyboard) : InputBinding #

Parses a human-readable descriptor string such as "ctrl+shift+s", "space", "mouse:left", "pad:south", "gamepad:l2", "xbox:a", or "ps2:cross".


[View source]

Class Method Detail

def self.normalize_gamepad_code(raw : String) : String #

[View source]
def self.normalize_key_code(raw : String) : String #

[View source]

Instance Method Detail

def alt=(alt : Bool) #

[View source]
def alt? : Bool #

[View source]
def axis_direction : Int32 #

[View source]
def axis_direction=(axis_direction : Int32) #

[View source]
def code : String #

[View source]
def code=(code : String) #

[View source]
def ctrl=(ctrl : Bool) #

[View source]
def ctrl? : Bool #

[View source]
def descriptor : String #

Canonical string descriptor suitable for Opal::Input::KeyMap and serialization.


[View source]
def device : DeviceType #

[View source]
def device=(device : DeviceType) #

[View source]
def display_label(gamepad_style : GamepadStyle = GamepadStyle::DualShock) : String #

Formats a human-friendly keycap badge label for UI rendering.


[View source]
def empty? : Bool #

[View source]
def matches?(event : Terminal::KeyEvent) : Bool #

Checks whether this binding matches a live Terminal::KeyEvent.


[View source]
def matches?(event : Terminal::MouseEvent) : Bool #

Checks whether this binding matches a live Terminal::MouseEvent.


[View source]
def shift=(shift : Bool) #

[View source]
def shift? : Bool #

[View source]
def to_lapis_symbol : String #

Converts this binding to its Godot 4.8 / Lapis key or joypad constant identifier.


[View source]