InputRemapper

Inherits: Node

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Description

This autoload is the main point of interaction from your code to the addon. It let’s you do things like get the current control scheme, change to a different control scheme, load/save the configuration and react to the controls updating or being saved from a central point. You can use the methods and signals in this autoload to programatically create a UI for the input remapper in your game. You have an example of that in res://addons/gato_input_remapper/ui/input_remapper_ui.tscn.

Properties

Variant

storage_service

Array[GatoControlScheme]

control_schemes

[]

int

current_control_scheme_index

0

Methods

GatoControlScheme

get_current_scheme()

void

load_next_scheme()

void

load_previous_scheme()

void

apply_control_scheme(control_scheme: GatoControlScheme)

void

save_changes()

Array[GatoControlScheme]

get_stored_config()

void

reset_changes()


Signals

control_scheme_saved_to_file() 🔗

Emitted when the current control schemes configuratin is saved to the input.data file.


control_scheme_changed(new_scheme: GatoControlScheme) 🔗

Emitted when the current control scheme changes to a different one. The parameter is the newly loaded control scheme.


Property Descriptions

Variant storage_service 🔗

Reference to the storage service that handles config file saving and loading. See res://addons/gato_input_remapper/service/storage_service.gd


Array[GatoControlScheme] control_schemes = [] 🔗

List of currently loaded control schemes. The current control scheme can be accessed by using the current_control_scheme_index property.


int current_control_scheme_index = 0 🔗

Index of the currently selected control scheme. This index is based on the control_schemes property. So, if the first scheme from the control_schemes list is loaded, it will be control_schemes``0``.


Method Descriptions

GatoControlScheme get_current_scheme() 🔗

Returns the currently selected control scheme.


void load_next_scheme() 🔗

Loads and applies the next control scheme in the control_schemes list. If it reaches the end of the list, it loops back to the initial element.


void load_previous_scheme() 🔗

Loads and applies the previous control scheme in the control_schemes list. If it reaches the beginning of the list, it loops back to the final element.


void apply_control_scheme(control_scheme: GatoControlScheme) 🔗

Applies the configuration defined in the parameter control scheme.


void save_changes() 🔗

Saves the changes on the control schemes list in memory to the input.data file.


Array[GatoControlScheme] get_stored_config() 🔗

Loads the control scheme list from the input.data file.


void reset_changes() 🔗

Discards the changes to the control schemes in memory and reverts them back to the version in the input.data file.