2
0

InputEvent.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="InputEvent" inherits="Resource" version="3.3">
  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 title="InputEvent">https://docs.godotengine.org/en/3.3/tutorials/inputs/inputevent.html</link>
  11. <link title="Viewport and canvas transforms">https://docs.godotengine.org/en/3.3/tutorials/2d/2d_transforms.html</link>
  12. <link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link>
  13. <link title="3D Voxel Demo">https://godotengine.org/asset-library/asset/676</link>
  14. </tutorials>
  15. <methods>
  16. <method name="accumulate">
  17. <return type="bool">
  18. </return>
  19. <argument index="0" name="with_event" type="InputEvent">
  20. </argument>
  21. <description>
  22. Returns [code]true[/code] if the given input event and this input event can be added together (only for events of type [InputEventMouseMotion]).
  23. 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.
  24. </description>
  25. </method>
  26. <method name="as_text" qualifiers="const">
  27. <return type="String">
  28. </return>
  29. <description>
  30. Returns a [String] representation of the event.
  31. </description>
  32. </method>
  33. <method name="get_action_strength" qualifiers="const">
  34. <return type="float">
  35. </return>
  36. <argument index="0" name="action" type="String">
  37. </argument>
  38. <description>
  39. 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].
  40. </description>
  41. </method>
  42. <method name="is_action" qualifiers="const">
  43. <return type="bool">
  44. </return>
  45. <argument index="0" name="action" type="String">
  46. </argument>
  47. <description>
  48. Returns [code]true[/code] if this input event matches a pre-defined action of any type.
  49. </description>
  50. </method>
  51. <method name="is_action_pressed" qualifiers="const">
  52. <return type="bool">
  53. </return>
  54. <argument index="0" name="action" type="String">
  55. </argument>
  56. <argument index="1" name="allow_echo" type="bool" default="false">
  57. </argument>
  58. <description>
  59. 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].
  60. </description>
  61. </method>
  62. <method name="is_action_released" qualifiers="const">
  63. <return type="bool">
  64. </return>
  65. <argument index="0" name="action" type="String">
  66. </argument>
  67. <description>
  68. Returns [code]true[/code] if the given action is released (i.e. not pressed). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  69. </description>
  70. </method>
  71. <method name="is_action_type" qualifiers="const">
  72. <return type="bool">
  73. </return>
  74. <description>
  75. Returns [code]true[/code] if this input event's type is one that can be assigned to an input action.
  76. </description>
  77. </method>
  78. <method name="is_echo" qualifiers="const">
  79. <return type="bool">
  80. </return>
  81. <description>
  82. Returns [code]true[/code] if this input event is an echo event (only for events of type [InputEventKey]).
  83. </description>
  84. </method>
  85. <method name="is_pressed" qualifiers="const">
  86. <return type="bool">
  87. </return>
  88. <description>
  89. Returns [code]true[/code] if this input event is pressed. Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  90. </description>
  91. </method>
  92. <method name="shortcut_match" qualifiers="const">
  93. <return type="bool">
  94. </return>
  95. <argument index="0" name="event" type="InputEvent">
  96. </argument>
  97. <description>
  98. Returns [code]true[/code] if the given input event is checking for the same key ([InputEventKey]), button ([InputEventJoypadButton]) or action ([InputEventAction]).
  99. </description>
  100. </method>
  101. <method name="xformed_by" qualifiers="const">
  102. <return type="InputEvent">
  103. </return>
  104. <argument index="0" name="xform" type="Transform2D">
  105. </argument>
  106. <argument index="1" name="local_ofs" type="Vector2" default="Vector2( 0, 0 )">
  107. </argument>
  108. <description>
  109. 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].
  110. </description>
  111. </method>
  112. </methods>
  113. <members>
  114. <member name="device" type="int" setter="set_device" getter="get_device" default="0">
  115. The event's device ID.
  116. [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.
  117. </member>
  118. </members>
  119. <constants>
  120. </constants>
  121. </class>