| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="InputMap" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A singleton that manages all [InputEventAction]s. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | Manages all [InputEventAction] which can be created/modified from the project settings menu [b]Project > Project Settings > Input Map[/b] or in code with [method add_action] and [method action_add_event]. See [method Node._input]. |
| 8 | </description> |
| 9 | <tutorials> |
| 10 | <link title="Using InputEvent: InputMap">$DOCS_URL/tutorials/inputs/inputevent.html#inputmap</link> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="action_add_event"> |
| 14 | <return type="void" /> |
| 15 | <param index="0" name="action" type="StringName" /> |
| 16 | <param index="1" name="event" type="InputEvent" /> |
| 17 | <description> |
| 18 | Adds an [InputEvent] to an action. This [InputEvent] will trigger the action. |
| 19 | </description> |
| 20 | </method> |
| 21 | <method name="action_erase_event"> |
| 22 | <return type="void" /> |
| 23 | <param index="0" name="action" type="StringName" /> |
| 24 | <param index="1" name="event" type="InputEvent" /> |
| 25 | <description> |
| 26 | Removes an [InputEvent] from an action. |
| 27 | </description> |
| 28 | </method> |
| 29 | <method name="action_erase_events"> |
| 30 | <return type="void" /> |
| 31 | <param index="0" name="action" type="StringName" /> |
| 32 | <description> |
| 33 | Removes all events from an action. |
| 34 | </description> |
| 35 | </method> |
| 36 | <method name="action_get_deadzone"> |
| 37 | <return type="float" /> |
| 38 | <param index="0" name="action" type="StringName" /> |
| 39 | <description> |
| 40 | Returns a deadzone value for the action. |
| 41 | </description> |
| 42 | </method> |
| 43 | <method name="action_get_events"> |
| 44 | <return type="InputEvent[]" /> |
| 45 | <param index="0" name="action" type="StringName" /> |
| 46 | <description> |
| 47 | Returns an array of [InputEvent]s associated with a given action. |
| 48 | [b]Note:[/b] When used in the editor (e.g. a tool script or [EditorPlugin]), this method will return events for the editor action. If you want to access your project's input binds from the editor, read the [code]input/*[/code] settings from [ProjectSettings]. |
| 49 | </description> |
| 50 | </method> |
| 51 | <method name="action_has_event"> |
| 52 | <return type="bool" /> |
| 53 | <param index="0" name="action" type="StringName" /> |
| 54 | <param index="1" name="event" type="InputEvent" /> |
| 55 | <description> |
| 56 | Returns [code]true[/code] if the action has the given [InputEvent] associated with it. |
| 57 | </description> |
| 58 | </method> |
| 59 | <method name="action_set_deadzone"> |
| 60 | <return type="void" /> |
| 61 | <param index="0" name="action" type="StringName" /> |
| 62 | <param index="1" name="deadzone" type="float" /> |
| 63 | <description> |
| 64 | Sets a deadzone value for the action. |
| 65 | </description> |
| 66 | </method> |
| 67 | <method name="add_action"> |
| 68 | <return type="void" /> |
| 69 | <param index="0" name="action" type="StringName" /> |
| 70 | <param index="1" name="deadzone" type="float" default="0.2" /> |
| 71 | <description> |
| 72 | Adds an empty action to the [InputMap] with a configurable [param deadzone]. |
| 73 | An [InputEvent] can then be added to this action with [method action_add_event]. |
| 74 | </description> |
| 75 | </method> |
| 76 | <method name="erase_action"> |
| 77 | <return type="void" /> |
| 78 | <param index="0" name="action" type="StringName" /> |
| 79 | <description> |
| 80 | Removes an action from the [InputMap]. |
| 81 | </description> |
| 82 | </method> |
| 83 | <method name="event_is_action" qualifiers="const"> |
| 84 | <return type="bool" /> |
| 85 | <param index="0" name="event" type="InputEvent" /> |
| 86 | <param index="1" name="action" type="StringName" /> |
| 87 | <param index="2" name="exact_match" type="bool" default="false" /> |
| 88 | <description> |
| 89 | Returns [code]true[/code] if the given event is part of an existing action. This method ignores keyboard modifiers if the given [InputEvent] is not pressed (for proper release detection). See [method action_has_event] if you don't want this behavior. |
| 90 | If [param exact_match] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. |
| 91 | </description> |
| 92 | </method> |
| 93 | <method name="get_action_description" qualifiers="const"> |
| 94 | <return type="String" /> |
| 95 | <param index="0" name="action" type="StringName" /> |
| 96 | <description> |
| 97 | Returns the human-readable description of the given action. |
| 98 | </description> |
| 99 | </method> |
| 100 | <method name="get_actions"> |
| 101 | <return type="StringName[]" /> |
| 102 | <description> |
| 103 | Returns an array of all actions in the [InputMap]. |
| 104 | </description> |
| 105 | </method> |
| 106 | <method name="has_action" qualifiers="const"> |
| 107 | <return type="bool" /> |
| 108 | <param index="0" name="action" type="StringName" /> |
| 109 | <description> |
| 110 | Returns [code]true[/code] if the [InputMap] has a registered action with the given name. |
| 111 | </description> |
| 112 | </method> |
| 113 | <method name="load_from_project_settings"> |
| 114 | <return type="void" /> |
| 115 | <description> |
| 116 | Clears all [InputEventAction] in the [InputMap] and load it anew from [ProjectSettings]. |
| 117 | </description> |
| 118 | </method> |
| 119 | </methods> |
| 120 | <signals> |
| 121 | <signal name="project_settings_loaded"> |
| 122 | <description> |
| 123 | Emitted when the [ProjectSettings] [InputMap] has been loaded. |
| 124 | </description> |
| 125 | </signal> |
| 126 | </signals> |
| 127 | </class> |