InputEvent.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="InputEvent" inherits="Resource" version="3.2">
  3. <brief_description>
  4. Generic input event.
  5. </brief_description>
  6. <description>
  7. Base class of all sort of input event. See [method Node._input].
  8. </description>
  9. <tutorials>
  10. <link>https://docs.godotengine.org/en/latest/tutorials/inputs/inputevent.html</link>
  11. <link>https://docs.godotengine.org/en/latest/tutorials/2d/2d_transforms.html</link>
  12. </tutorials>
  13. <methods>
  14. <method name="accumulate">
  15. <return type="bool">
  16. </return>
  17. <argument index="0" name="with_event" type="InputEvent">
  18. </argument>
  19. <description>
  20. Returns [code]true[/code] if the given input event and this input event can be added together (only for events of type [InputEventMouseMotion]).
  21. The given input event's position, global position and speed will be copied. The resulting [code]relative[/code] is a sum of both events. Both events' modifiers have to be identical.
  22. </description>
  23. </method>
  24. <method name="as_text" qualifiers="const">
  25. <return type="String">
  26. </return>
  27. <description>
  28. Returns a [String] representation of the event.
  29. </description>
  30. </method>
  31. <method name="get_action_strength" qualifiers="const">
  32. <return type="float">
  33. </return>
  34. <argument index="0" name="action" type="String">
  35. </argument>
  36. <description>
  37. Returns a value between 0.0 and 1.0 depending on the given actions' state. Useful for getting the value of events of type [InputEventJoypadMotion].
  38. </description>
  39. </method>
  40. <method name="is_action" qualifiers="const">
  41. <return type="bool">
  42. </return>
  43. <argument index="0" name="action" type="String">
  44. </argument>
  45. <description>
  46. Returns [code]true[/code] if this input event matches a pre-defined action of any type.
  47. </description>
  48. </method>
  49. <method name="is_action_pressed" qualifiers="const">
  50. <return type="bool">
  51. </return>
  52. <argument index="0" name="action" type="String">
  53. </argument>
  54. <argument index="1" name="allow_echo" type="bool" default="false">
  55. </argument>
  56. <description>
  57. Returns [code]true[/code] if the given action is being pressed (and is not an echo event for [InputEventKey] events, unless [code]allow_echo[/code] is [code]true[/code]). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  58. </description>
  59. </method>
  60. <method name="is_action_released" qualifiers="const">
  61. <return type="bool">
  62. </return>
  63. <argument index="0" name="action" type="String">
  64. </argument>
  65. <description>
  66. Returns [code]true[/code] if the given action is released (i.e. not pressed). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  67. </description>
  68. </method>
  69. <method name="is_action_type" qualifiers="const">
  70. <return type="bool">
  71. </return>
  72. <description>
  73. Returns [code]true[/code] if this input event's type is one that can be assigned to an input action.
  74. </description>
  75. </method>
  76. <method name="is_echo" qualifiers="const">
  77. <return type="bool">
  78. </return>
  79. <description>
  80. Returns [code]true[/code] if this input event is an echo event (only for events of type [InputEventKey]).
  81. </description>
  82. </method>
  83. <method name="is_pressed" qualifiers="const">
  84. <return type="bool">
  85. </return>
  86. <description>
  87. Returns [code]true[/code] if this input event is pressed. Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  88. </description>
  89. </method>
  90. <method name="shortcut_match" qualifiers="const">
  91. <return type="bool">
  92. </return>
  93. <argument index="0" name="event" type="InputEvent">
  94. </argument>
  95. <description>
  96. Returns [code]true[/code] if the given input event is checking for the same key ([InputEventKey]), button ([InputEventJoypadButton]) or action ([InputEventAction]).
  97. </description>
  98. </method>
  99. <method name="xformed_by" qualifiers="const">
  100. <return type="InputEvent">
  101. </return>
  102. <argument index="0" name="xform" type="Transform2D">
  103. </argument>
  104. <argument index="1" name="local_ofs" type="Vector2" default="Vector2( 0, 0 )">
  105. </argument>
  106. <description>
  107. Returns a copy of the given input event which has been offset by [code]local_ofs[/code] and transformed by [code]xform[/code]. Relevant for events of type [InputEventMouseButton], [InputEventMouseMotion], [InputEventScreenTouch], [InputEventScreenDrag], [InputEventMagnifyGesture] and [InputEventPanGesture].
  108. </description>
  109. </method>
  110. </methods>
  111. <members>
  112. <member name="device" type="int" setter="set_device" getter="get_device" default="0">
  113. The event's device ID.
  114. [b]Note:[/b] This device ID will always be [code]-1[/code] for emulated mouse input from a touchscreen. This can be used to distinguish emulated mouse input from physical mouse input.
  115. </member>
  116. </members>
  117. <constants>
  118. </constants>
  119. </class>