class_inputmap.rst 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the InputMap.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_InputMap:
  5. InputMap
  6. ========
  7. **Inherits:** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Singleton that manages :ref:`InputEventAction<class_inputeventaction>`.
  12. Member Functions
  13. ----------------
  14. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`action_add_event<class_InputMap_action_add_event>` **(** :ref:`String<class_string>` action, :ref:`InputEvent<class_inputevent>` event **)** |
  16. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`action_erase_event<class_InputMap_action_erase_event>` **(** :ref:`String<class_string>` action, :ref:`InputEvent<class_inputevent>` event **)** |
  18. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`action_erase_events<class_InputMap_action_erase_events>` **(** :ref:`String<class_string>` action **)** |
  20. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`action_has_event<class_InputMap_action_has_event>` **(** :ref:`String<class_string>` action, :ref:`InputEvent<class_inputevent>` event **)** |
  22. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`action_set_deadzone<class_InputMap_action_set_deadzone>` **(** :ref:`String<class_string>` deadzone, :ref:`float<class_float>` arg1 **)** |
  24. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`add_action<class_InputMap_add_action>` **(** :ref:`String<class_string>` action, :ref:`float<class_float>` deadzone=0.5 **)** |
  26. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`erase_action<class_InputMap_erase_action>` **(** :ref:`String<class_string>` action **)** |
  28. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`event_is_action<class_InputMap_event_is_action>` **(** :ref:`InputEvent<class_inputevent>` event, :ref:`String<class_string>` action **)** const |
  30. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Array<class_array>` | :ref:`get_action_list<class_InputMap_get_action_list>` **(** :ref:`String<class_string>` action **)** |
  32. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Array<class_array>` | :ref:`get_actions<class_InputMap_get_actions>` **(** **)** |
  34. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`has_action<class_InputMap_has_action>` **(** :ref:`String<class_string>` action **)** const |
  36. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`load_from_globals<class_InputMap_load_from_globals>` **(** **)** |
  38. +----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. Description
  40. -----------
  41. 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_add_action>` and :ref:`action_add_event<class_InputMap_action_add_event>`. See :ref:`Node._input<class_Node__input>`.
  42. Member Function Description
  43. ---------------------------
  44. .. _class_InputMap_action_add_event:
  45. - void **action_add_event** **(** :ref:`String<class_string>` action, :ref:`InputEvent<class_inputevent>` event **)**
  46. Adds an :ref:`InputEvent<class_inputevent>` to an action. This :ref:`InputEvent<class_inputevent>` will trigger the action.
  47. .. _class_InputMap_action_erase_event:
  48. - void **action_erase_event** **(** :ref:`String<class_string>` action, :ref:`InputEvent<class_inputevent>` event **)**
  49. Removes an :ref:`InputEvent<class_inputevent>` from an action.
  50. .. _class_InputMap_action_erase_events:
  51. - void **action_erase_events** **(** :ref:`String<class_string>` action **)**
  52. .. _class_InputMap_action_has_event:
  53. - :ref:`bool<class_bool>` **action_has_event** **(** :ref:`String<class_string>` action, :ref:`InputEvent<class_inputevent>` event **)**
  54. Returns true if an action has an :ref:`InputEvent<class_inputevent>` associated with it.
  55. .. _class_InputMap_action_set_deadzone:
  56. - void **action_set_deadzone** **(** :ref:`String<class_string>` deadzone, :ref:`float<class_float>` arg1 **)**
  57. .. _class_InputMap_add_action:
  58. - void **add_action** **(** :ref:`String<class_string>` action, :ref:`float<class_float>` deadzone=0.5 **)**
  59. Adds an (empty) action to the ``InputMap``, with a configurable ``deadzone``.
  60. An :ref:`InputEvent<class_inputevent>` can then be added to this action with :ref:`action_add_event<class_InputMap_action_add_event>`.
  61. .. _class_InputMap_erase_action:
  62. - void **erase_action** **(** :ref:`String<class_string>` action **)**
  63. Removes an action from the ``InputMap``.
  64. .. _class_InputMap_event_is_action:
  65. - :ref:`bool<class_bool>` **event_is_action** **(** :ref:`InputEvent<class_inputevent>` event, :ref:`String<class_string>` action **)** const
  66. 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_action_has_event>` if you don't want this behavior.
  67. .. _class_InputMap_get_action_list:
  68. - :ref:`Array<class_array>` **get_action_list** **(** :ref:`String<class_string>` action **)**
  69. Returns an array of :ref:`InputEvent<class_inputevent>`\ s associated with a given action.
  70. .. _class_InputMap_get_actions:
  71. - :ref:`Array<class_array>` **get_actions** **(** **)**
  72. Returns an array of all actions in the ``InputMap``.
  73. .. _class_InputMap_has_action:
  74. - :ref:`bool<class_bool>` **has_action** **(** :ref:`String<class_string>` action **)** const
  75. Returns ``true`` if the ``InputMap`` has a registered action with the given name.
  76. .. _class_InputMap_load_from_globals:
  77. - void **load_from_globals** **(** **)**
  78. Clears all :ref:`InputEventAction<class_inputeventaction>` in the ``InputMap`` and load it anew from :ref:`ProjectSettings<class_projectsettings>`.