InputConfig

Inherits: Resource

Inherited By: GatoControlScheme, InputAction

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 class is the base type for the addon’s model. It’s a generic input configuration type that can hold variables and methods that will be used later to de/serialize and apply this configuration, but leaves the implementation to the implementing sub-classes.

Properties

StringName

name

Methods

void

apply_config()

Dictionary

get_as_dict()

InputConfig

new_from_dict(dict: Dictionary) static


Property Descriptions

StringName name 🔗

Name for this InputConfig. If it’s an action, it will be used as the action name. If it’s a ControlScheme, it will be displayed in the UI with this name.


Method Descriptions

void apply_config() 🔗

If you want to use an InputAction, this is the method to call. This method tells the InputAction to call Godot’s Input API to configure itself there. For concrete actions, this means creating an action on the InputMap and assigning the input to it, for schemes or group of actions this means applying each InputAction individually.


Dictionary get_as_dict() 🔗

Method used for serialization. When saving a control scheme to a file, it is first turned into a Dictionary with the data it needs (category, name, configuration…) so it can be stored as a JSON file. The configuration might include the InputEvent object that triggers the action.


InputConfig new_from_dict(dict: Dictionary) static 🔗

Method used for deserialization. When loading a control scheme from a file, new instances of InputAction classes are created with the configuration from the stored JSON file. This method uses the data in those JSON objects to create a new instance of the InputAction.