class
Opal::Input::Core::InputRemapModel
- Opal::Input::Core::InputRemapModel
- Reference
- Object
Overview
Tier-1 Core Engine Model managing a complete profile of input actions, categories, multi-slot bindings, conflict resolution, Lapis/Godot export, and KeyMap synchronization.
Defined in:
opal/input/core/remap_model.crConstructors
-
.default_profile(profile_name : String = "Default Controls") : InputRemapModel
Creates a standard game + TUI default profile if needed.
- .from_content(content : String, format : RemapFormat | Nil = nil) : InputRemapModel
- .from_file(path : String) : InputRemapModel
- .from_json_string(content : String) : InputRemapModel
- .from_yaml_string(content : String) : InputRemapModel
- .new(profile_name : String = "Default Controls", max_slots : Int32 = 2, conflict_policy : ConflictPolicy = ConflictPolicy::Allow, gamepad_style : GamepadStyle = GamepadStyle::DualShock, allow_clear : Bool = true, allow_reset : Bool = true, actions : Array(InputAction) | Nil = nil)
Instance Method Summary
- #action_at(index : Int32) : InputAction | Nil
-
#action_pressed?(action_id : String | Symbol, event : Terminal::KeyEvent | Terminal::MouseEvent) : Bool
Checks whether a live event triggers the given action ID.
- #actions : Array(InputAction)
- #add(action : InputAction) : InputAction
-
#add_action(id : String | Symbol, label : String | Nil = nil, category : String = "General", description : String = "", primary : InputBinding | String | Nil = nil, secondary : InputBinding | String | Nil = nil, deadzone : Float32 = 0.2_f32, locked : Bool = false) : InputAction
Registers or updates an InputAction in the profile.
- #allow_clear=(allow_clear : Bool)
- #allow_clear? : Bool
- #allow_reset=(allow_reset : Bool)
- #allow_reset? : Bool
-
#assign_binding(action_id : String | Symbol, slot : Int32, binding : InputBinding | String, policy : ConflictPolicy | Nil = nil) : Bool
Assigns a binding to an action's slot while applying the configured ConflictPolicy.
-
#assign_binding_at(action_index : Int32, slot : Int32, binding : InputBinding | String, policy : ConflictPolicy | Nil = nil) : Bool
Assigns a binding by action index.
-
#categories : Array(String)
Distinct action categories in registration order.
- #clear_slot(action_id : String | Symbol, slot : Int32) : Bool
- #conflict_policy : ConflictPolicy
- #conflict_policy=(conflict_policy : ConflictPolicy)
-
#conflicts : Array(BindingConflict)
Computes all active duplicate binding conflicts across actions that share scope.
- #conflicts_for(action_id : String | Symbol) : Array(BindingConflict)
- #empty? : Bool
- #export(format : RemapFormat | Symbol | String = RemapFormat::JSON) : String
- #find_action(id : String | Symbol) : InputAction | Nil
- #gamepad_style : GamepadStyle
- #gamepad_style=(gamepad_style : GamepadStyle)
- #has_conflicts? : Bool
- #index_of(id : String | Symbol) : Int32 | Nil
- #max_slots : Int32
- #max_slots=(max_slots : Int32)
- #profile_name : String
- #profile_name=(profile_name : String)
- #reset_action(action_id : String | Symbol) : Bool
- #reset_all! : Bool
- #size : Int32
- #slot_conflicted?(action_id : String | Symbol, slot : Int32) : Bool
-
#to_footer_bindings(category : String | Nil = nil, limit : Int32 = 6) : Array(NamedTuple(key: String, desc: String))
Builds a Footer binding badge array (
Array(NamedTuple(key: String, desc: String))) from the primary bindings of the actions in this model. - #to_json_string(pretty : Bool = true) : String
-
#to_key_map(&on_trigger : String, Terminal::KeyEvent -> Nil) : KeyMap
Builds an Opal::Input::KeyMap wired to the current bindings in this model.
-
#to_lapis_config : String
Exports bindings in Godot 4.8 / Lapis InputMap configuration format (
[input]). - #to_yaml_string : String
-
#triggered_actions(event : Terminal::KeyEvent | Terminal::MouseEvent) : Array(String)
Returns all action IDs triggered by the given input event.
Constructor Detail
Creates a standard game + TUI default profile if needed.
Instance Method Detail
Checks whether a live event triggers the given action ID.
Registers or updates an InputAction in the profile.
Assigns a binding to an action's slot while applying the configured ConflictPolicy. Returns true if assignment succeeded, false if blocked or invalid.
Assigns a binding by action index.
Computes all active duplicate binding conflicts across actions that share scope.
Builds an Opal::Input::KeyMap wired to the current bindings in this model.
Exports bindings in Godot 4.8 / Lapis InputMap configuration format ([input]).
Returns all action IDs triggered by the given input event.