InputMap.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="InputMap" inherits="Object" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Singleton that manages [InputEventAction].
  5. </brief_description>
  6. <description>
  7. Manages all [InputEventAction] which can be created/modified from the project settings menu [b]Project &gt; Project Settings &gt; 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>$DOCS_URL/tutorials/inputs/inputevent.html#inputmap</link>
  11. </tutorials>
  12. <methods>
  13. <method name="action_add_event">
  14. <return type="void" />
  15. <argument index="0" name="action" type="String" />
  16. <argument 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. <argument index="0" name="action" type="String" />
  24. <argument 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. <argument index="0" name="action" type="String" />
  32. <description>
  33. Removes all events from an action.
  34. </description>
  35. </method>
  36. <method name="action_get_deadzone">
  37. <return type="float" />
  38. <argument index="0" name="action" type="String" />
  39. <description>
  40. Returns a deadzone value for the action.
  41. </description>
  42. </method>
  43. <method name="action_has_event">
  44. <return type="bool" />
  45. <argument index="0" name="action" type="String" />
  46. <argument index="1" name="event" type="InputEvent" />
  47. <description>
  48. Returns [code]true[/code] if the action has the given [InputEvent] associated with it.
  49. </description>
  50. </method>
  51. <method name="action_set_deadzone">
  52. <return type="void" />
  53. <argument index="0" name="action" type="String" />
  54. <argument index="1" name="deadzone" type="float" />
  55. <description>
  56. Sets a deadzone value for the action.
  57. </description>
  58. </method>
  59. <method name="add_action">
  60. <return type="void" />
  61. <argument index="0" name="action" type="String" />
  62. <argument index="1" name="deadzone" type="float" default="0.5" />
  63. <description>
  64. Adds an empty action to the [InputMap] with a configurable [code]deadzone[/code].
  65. An [InputEvent] can then be added to this action with [method action_add_event].
  66. </description>
  67. </method>
  68. <method name="erase_action">
  69. <return type="void" />
  70. <argument index="0" name="action" type="String" />
  71. <description>
  72. Removes an action from the [InputMap].
  73. </description>
  74. </method>
  75. <method name="event_is_action" qualifiers="const">
  76. <return type="bool" />
  77. <argument index="0" name="event" type="InputEvent" />
  78. <argument index="1" name="action" type="String" />
  79. <argument index="2" name="exact_match" type="bool" default="false" />
  80. <description>
  81. 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.
  82. If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events.
  83. </description>
  84. </method>
  85. <method name="get_action_list">
  86. <return type="Array" />
  87. <argument index="0" name="action" type="String" />
  88. <description>
  89. Returns an array of [InputEvent]s associated with a given action.
  90. [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].
  91. </description>
  92. </method>
  93. <method name="get_actions">
  94. <return type="Array" />
  95. <description>
  96. Returns an array of all actions in the [InputMap].
  97. </description>
  98. </method>
  99. <method name="has_action" qualifiers="const">
  100. <return type="bool" />
  101. <argument index="0" name="action" type="String" />
  102. <description>
  103. Returns [code]true[/code] if the [InputMap] has a registered action with the given name.
  104. </description>
  105. </method>
  106. <method name="load_from_globals">
  107. <return type="void" />
  108. <description>
  109. Clears all [InputEventAction] in the [InputMap] and load it anew from [ProjectSettings].
  110. </description>
  111. </method>
  112. </methods>
  113. <constants>
  114. </constants>
  115. </class>