Skip to content

InputMapApi

An Api for attaching InputEventEmitterNodes that emit signals for cancellable input events.

Description

The InputMapApi makes it possible to attach an InputEventEmitterNode as a child of a node using get_or_append_event_emitter ( Node node ). It additionally handles synchronization of ShortcutConfigNodes and has some methods for serializing and deserializing InputEventKeys.

Methods

void define_actions ( String category, Dictionary actions )
InputEventKey deserialize_event ( String string )
String event_as_string ( InputEventKey event )
ActionConfigSyncAgent get_agent ( String action )
InputEventEmitterNode get_or_append_event_emitter ( Node node )
ActionConfigSyncAgent get_or_create_agent ( String action, float deadzone = 0.5 )
InputEventEmitterNode master_event_emitter ( )
String serialize_event ( InputEventKey event )

Method Descriptions

void define_actions ( String category, Dictionary actions ):
Registers actions to the InputMap from a Dictionary and adds them to the Shortcuts menu. actions may consist of nested dictionaries to define categories inside the Shortcuts menu. Shortcut entries can either be a String defining the action name or an Array. The arrays first entry defines the action name while the following entries define the default shortcuts, either as a String denoting the shortcut or a InputEventKey. Example:

var input_definitions: Dictionary = {
    "Some Shortcut": ["shortcut1", "Ctrl+P", "L"],
    "Some Category":{
        "Other Shortcut": "shortcut2",
        "Third Shortcut": "shortcut3"
    }
}
self.Global.API.InputMapApi.define_actions("Example Mod", input_definitions)

InputEventKey deserialize_event ( String string ):
Deserializes an InputEventKey from string.

String serialize_event ( InputEventKey event ):
Serializes event into a String.

String event_as_string ( InputEventKey event ):
Turns event into a human readable String representation.

ActionConfigSyncAgent get_agent ( String action ):
Gets the ActionConfigSyncAgent for action.

ActionConfigSyncAgent get_or_create_agent ( String action, float deadzone = 0.5 ):
Gets or creates the ActionConfigSyncAgent for action.

InputEventEmitterNode get_or_append_event_emitter ( Node node ):
Gets the InputEventEmitterNode attached to node or creates one if necessary.

InputEventEmitterNode master_event_emitter ( ):
Gets the InputEventEmitterNode attached to the Master node (owner of Editor & World) or creates one if necessary.