class_inputmap.rst 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the InputMap.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_InputMap:
  6. InputMap
  7. ========
  8. **Inherits:** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Singleton that manages :ref:`InputEventAction<class_InputEventAction>`.
  13. Methods
  14. -------
  15. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`action_add_event<class_InputMap_method_action_add_event>` **(** :ref:`String<class_String>` action, :ref:`InputEvent<class_InputEvent>` event **)** |
  17. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`action_erase_event<class_InputMap_method_action_erase_event>` **(** :ref:`String<class_String>` action, :ref:`InputEvent<class_InputEvent>` event **)** |
  19. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`action_erase_events<class_InputMap_method_action_erase_events>` **(** :ref:`String<class_String>` action **)** |
  21. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`action_has_event<class_InputMap_method_action_has_event>` **(** :ref:`String<class_String>` action, :ref:`InputEvent<class_InputEvent>` event **)** |
  23. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`action_set_deadzone<class_InputMap_method_action_set_deadzone>` **(** :ref:`String<class_String>` action, :ref:`float<class_float>` deadzone **)** |
  25. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`add_action<class_InputMap_method_add_action>` **(** :ref:`String<class_String>` action, :ref:`float<class_float>` deadzone=0.5 **)** |
  27. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`erase_action<class_InputMap_method_erase_action>` **(** :ref:`String<class_String>` action **)** |
  29. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`event_is_action<class_InputMap_method_event_is_action>` **(** :ref:`InputEvent<class_InputEvent>` event, :ref:`String<class_String>` action **)** const |
  31. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Array<class_Array>` | :ref:`get_action_list<class_InputMap_method_get_action_list>` **(** :ref:`String<class_String>` action **)** |
  33. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Array<class_Array>` | :ref:`get_actions<class_InputMap_method_get_actions>` **(** **)** |
  35. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`has_action<class_InputMap_method_has_action>` **(** :ref:`String<class_String>` action **)** const |
  37. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`load_from_globals<class_InputMap_method_load_from_globals>` **(** **)** |
  39. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. Description
  41. -----------
  42. Manages all :ref:`InputEventAction<class_InputEventAction>` which can be created/modified from the project settings menu **Project > Project Settings > Input Map** or in code with :ref:`add_action<class_InputMap_method_add_action>` and :ref:`action_add_event<class_InputMap_method_action_add_event>`. See :ref:`Node._input<class_Node_method__input>`.
  43. Tutorials
  44. ---------
  45. - `#inputmap <../tutorials/inputs/inputevent.html#inputmap>`_ in :doc:`../tutorials/inputs/inputevent`
  46. Method Descriptions
  47. -------------------
  48. .. _class_InputMap_method_action_add_event:
  49. - void **action_add_event** **(** :ref:`String<class_String>` action, :ref:`InputEvent<class_InputEvent>` event **)**
  50. Adds an :ref:`InputEvent<class_InputEvent>` to an action. This :ref:`InputEvent<class_InputEvent>` will trigger the action.
  51. .. _class_InputMap_method_action_erase_event:
  52. - void **action_erase_event** **(** :ref:`String<class_String>` action, :ref:`InputEvent<class_InputEvent>` event **)**
  53. Removes an :ref:`InputEvent<class_InputEvent>` from an action.
  54. .. _class_InputMap_method_action_erase_events:
  55. - void **action_erase_events** **(** :ref:`String<class_String>` action **)**
  56. Removes all events from an action.
  57. .. _class_InputMap_method_action_has_event:
  58. - :ref:`bool<class_bool>` **action_has_event** **(** :ref:`String<class_String>` action, :ref:`InputEvent<class_InputEvent>` event **)**
  59. Returns ``true`` if the action has the given :ref:`InputEvent<class_InputEvent>` associated with it.
  60. .. _class_InputMap_method_action_set_deadzone:
  61. - void **action_set_deadzone** **(** :ref:`String<class_String>` action, :ref:`float<class_float>` deadzone **)**
  62. .. _class_InputMap_method_add_action:
  63. - void **add_action** **(** :ref:`String<class_String>` action, :ref:`float<class_float>` deadzone=0.5 **)**
  64. Adds an empty action to the ``InputMap`` with a configurable ``deadzone``.
  65. An :ref:`InputEvent<class_InputEvent>` can then be added to this action with :ref:`action_add_event<class_InputMap_method_action_add_event>`.
  66. .. _class_InputMap_method_erase_action:
  67. - void **erase_action** **(** :ref:`String<class_String>` action **)**
  68. Removes an action from the ``InputMap``.
  69. .. _class_InputMap_method_event_is_action:
  70. - :ref:`bool<class_bool>` **event_is_action** **(** :ref:`InputEvent<class_InputEvent>` event, :ref:`String<class_String>` action **)** const
  71. Returns ``true`` if the given event is part of an existing action. This method ignores keyboard modifiers if the given :ref:`InputEvent<class_InputEvent>` is not pressed (for proper release detection). See :ref:`action_has_event<class_InputMap_method_action_has_event>` if you don't want this behavior.
  72. .. _class_InputMap_method_get_action_list:
  73. - :ref:`Array<class_Array>` **get_action_list** **(** :ref:`String<class_String>` action **)**
  74. Returns an array of :ref:`InputEvent<class_InputEvent>`\ s associated with a given action.
  75. .. _class_InputMap_method_get_actions:
  76. - :ref:`Array<class_Array>` **get_actions** **(** **)**
  77. Returns an array of all actions in the ``InputMap``.
  78. .. _class_InputMap_method_has_action:
  79. - :ref:`bool<class_bool>` **has_action** **(** :ref:`String<class_String>` action **)** const
  80. Returns ``true`` if the ``InputMap`` has a registered action with the given name.
  81. .. _class_InputMap_method_load_from_globals:
  82. - void **load_from_globals** **(** **)**
  83. Clears all :ref:`InputEventAction<class_InputEventAction>` in the ``InputMap`` and load it anew from :ref:`ProjectSettings<class_ProjectSettings>`.