:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/InputMap.xml. .. _class_InputMap: InputMap ======== **Inherits:** :ref:`Object` A singleton that manages all :ref:`InputEventAction`\ s. .. rst-class:: classref-introduction-group Description ----------- Manages all :ref:`InputEventAction` which can be created/modified from the project settings menu **Project > Project Settings > Input Map** or in code with :ref:`add_action` and :ref:`action_add_event`. See :ref:`Node._input`. .. rst-class:: classref-introduction-group Tutorials --------- - `Using InputEvent: InputMap <../tutorials/inputs/inputevent.html#inputmap>`__ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`action_add_event`\ (\ action\: :ref:`StringName`, event\: :ref:`InputEvent`\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`action_erase_event`\ (\ action\: :ref:`StringName`, event\: :ref:`InputEvent`\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`action_erase_events`\ (\ action\: :ref:`StringName`\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`action_get_deadzone`\ (\ action\: :ref:`StringName`\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array`\[:ref:`InputEvent`\] | :ref:`action_get_events`\ (\ action\: :ref:`StringName`\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`action_has_event`\ (\ action\: :ref:`StringName`, event\: :ref:`InputEvent`\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`action_set_deadzone`\ (\ action\: :ref:`StringName`, deadzone\: :ref:`float`\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`add_action`\ (\ action\: :ref:`StringName`, deadzone\: :ref:`float` = 0.5\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`erase_action`\ (\ action\: :ref:`StringName`\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`event_is_action`\ (\ event\: :ref:`InputEvent`, action\: :ref:`StringName`, exact_match\: :ref:`bool` = false\ ) |const| | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array`\[:ref:`StringName`\] | :ref:`get_actions`\ (\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_action`\ (\ action\: :ref:`StringName`\ ) |const| | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`load_from_project_settings`\ (\ ) | +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_InputMap_method_action_add_event: .. rst-class:: classref-method |void| **action_add_event**\ (\ action\: :ref:`StringName`, event\: :ref:`InputEvent`\ ) :ref:`🔗` Adds an :ref:`InputEvent` to an action. This :ref:`InputEvent` will trigger the action. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_action_erase_event: .. rst-class:: classref-method |void| **action_erase_event**\ (\ action\: :ref:`StringName`, event\: :ref:`InputEvent`\ ) :ref:`🔗` Removes an :ref:`InputEvent` from an action. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_action_erase_events: .. rst-class:: classref-method |void| **action_erase_events**\ (\ action\: :ref:`StringName`\ ) :ref:`🔗` Removes all events from an action. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_action_get_deadzone: .. rst-class:: classref-method :ref:`float` **action_get_deadzone**\ (\ action\: :ref:`StringName`\ ) :ref:`🔗` Returns a deadzone value for the action. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_action_get_events: .. rst-class:: classref-method :ref:`Array`\[:ref:`InputEvent`\] **action_get_events**\ (\ action\: :ref:`StringName`\ ) :ref:`🔗` Returns an array of :ref:`InputEvent`\ s associated with a given action. \ **Note:** When used in the editor (e.g. a tool script or :ref:`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 ``input/*`` settings from :ref:`ProjectSettings`. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_action_has_event: .. rst-class:: classref-method :ref:`bool` **action_has_event**\ (\ action\: :ref:`StringName`, event\: :ref:`InputEvent`\ ) :ref:`🔗` Returns ``true`` if the action has the given :ref:`InputEvent` associated with it. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_action_set_deadzone: .. rst-class:: classref-method |void| **action_set_deadzone**\ (\ action\: :ref:`StringName`, deadzone\: :ref:`float`\ ) :ref:`🔗` Sets a deadzone value for the action. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_add_action: .. rst-class:: classref-method |void| **add_action**\ (\ action\: :ref:`StringName`, deadzone\: :ref:`float` = 0.5\ ) :ref:`🔗` Adds an empty action to the **InputMap** with a configurable ``deadzone``. An :ref:`InputEvent` can then be added to this action with :ref:`action_add_event`. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_erase_action: .. rst-class:: classref-method |void| **erase_action**\ (\ action\: :ref:`StringName`\ ) :ref:`🔗` Removes an action from the **InputMap**. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_event_is_action: .. rst-class:: classref-method :ref:`bool` **event_is_action**\ (\ event\: :ref:`InputEvent`, action\: :ref:`StringName`, exact_match\: :ref:`bool` = false\ ) |const| :ref:`🔗` Returns ``true`` if the given event is part of an existing action. This method ignores keyboard modifiers if the given :ref:`InputEvent` is not pressed (for proper release detection). See :ref:`action_has_event` if you don't want this behavior. If ``exact_match`` is ``false``, it ignores additional input modifiers for :ref:`InputEventKey` and :ref:`InputEventMouseButton` events, and the direction for :ref:`InputEventJoypadMotion` events. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_get_actions: .. rst-class:: classref-method :ref:`Array`\[:ref:`StringName`\] **get_actions**\ (\ ) :ref:`🔗` Returns an array of all actions in the **InputMap**. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_has_action: .. rst-class:: classref-method :ref:`bool` **has_action**\ (\ action\: :ref:`StringName`\ ) |const| :ref:`🔗` Returns ``true`` if the **InputMap** has a registered action with the given name. .. rst-class:: classref-item-separator ---- .. _class_InputMap_method_load_from_project_settings: .. rst-class:: classref-method |void| **load_from_project_settings**\ (\ ) :ref:`🔗` Clears all :ref:`InputEventAction` in the **InputMap** and load it anew from :ref:`ProjectSettings`. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`