InputEvent.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="InputEvent" inherits="Resource" category="Core" version="3.1.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/3.1/tutorials/inputs/inputevent.html</link>
  11. <link>https://docs.godotengine.org/en/3.1/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. <description>
  55. Returns [code]true[/code] if the given action is being pressed (and is not an echo event for [InputEventKey] events). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  56. </description>
  57. </method>
  58. <method name="is_action_released" qualifiers="const">
  59. <return type="bool">
  60. </return>
  61. <argument index="0" name="action" type="String">
  62. </argument>
  63. <description>
  64. Returns [code]true[/code] if the given action is released (i.e. not pressed). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  65. </description>
  66. </method>
  67. <method name="is_action_type" qualifiers="const">
  68. <return type="bool">
  69. </return>
  70. <description>
  71. Returns [code]true[/code] if this input event's type is one that can be assigned to an input action.
  72. </description>
  73. </method>
  74. <method name="is_echo" qualifiers="const">
  75. <return type="bool">
  76. </return>
  77. <description>
  78. Returns [code]true[/code] if this input event is an echo event (only for events of type [InputEventKey]).
  79. </description>
  80. </method>
  81. <method name="is_pressed" qualifiers="const">
  82. <return type="bool">
  83. </return>
  84. <description>
  85. Returns [code]true[/code] if this input event is pressed. Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  86. </description>
  87. </method>
  88. <method name="shortcut_match" qualifiers="const">
  89. <return type="bool">
  90. </return>
  91. <argument index="0" name="event" type="InputEvent">
  92. </argument>
  93. <description>
  94. Returns [code]true[/code] if the given input event is checking for the same key ([InputEventKey]), button ([InputEventJoypadButton]) or action ([InputEventAction]).
  95. </description>
  96. </method>
  97. <method name="xformed_by" qualifiers="const">
  98. <return type="InputEvent">
  99. </return>
  100. <argument index="0" name="xform" type="Transform2D">
  101. </argument>
  102. <argument index="1" name="local_ofs" type="Vector2" default="Vector2( 0, 0 )">
  103. </argument>
  104. <description>
  105. 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].
  106. </description>
  107. </method>
  108. </methods>
  109. <members>
  110. <member name="device" type="int" setter="set_device" getter="get_device">
  111. The event's device ID.
  112. </member>
  113. </members>
  114. <constants>
  115. </constants>
  116. </class>