InputEvent.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="InputEvent" inherits="Resource" version="3.4">
  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.4/tutorials/inputs/inputevent.html</link>
  11. <link title="Viewport and canvas transforms">https://docs.godotengine.org/en/3.4/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. <argument index="0" name="with_event" type="InputEvent" />
  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. <description>
  27. Returns a [String] representation of the event.
  28. </description>
  29. </method>
  30. <method name="get_action_strength" qualifiers="const">
  31. <return type="float" />
  32. <argument index="0" name="action" type="String" />
  33. <argument index="1" name="exact_match" type="bool" default="false" />
  34. <description>
  35. 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].
  36. If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events.
  37. </description>
  38. </method>
  39. <method name="is_action" qualifiers="const">
  40. <return type="bool" />
  41. <argument index="0" name="action" type="String" />
  42. <argument index="1" name="exact_match" type="bool" default="false" />
  43. <description>
  44. Returns [code]true[/code] if this input event matches a pre-defined action of any type.
  45. If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events.
  46. </description>
  47. </method>
  48. <method name="is_action_pressed" qualifiers="const">
  49. <return type="bool" />
  50. <argument index="0" name="action" type="String" />
  51. <argument index="1" name="allow_echo" type="bool" default="false" />
  52. <argument index="2" name="exact_match" type="bool" default="false" />
  53. <description>
  54. 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].
  55. If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events.
  56. </description>
  57. </method>
  58. <method name="is_action_released" qualifiers="const">
  59. <return type="bool" />
  60. <argument index="0" name="action" type="String" />
  61. <argument index="1" name="exact_match" type="bool" default="false" />
  62. <description>
  63. Returns [code]true[/code] if the given action is released (i.e. not pressed). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  64. If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events.
  65. </description>
  66. </method>
  67. <method name="is_action_type" qualifiers="const">
  68. <return type="bool" />
  69. <description>
  70. Returns [code]true[/code] if this input event's type is one that can be assigned to an input action.
  71. </description>
  72. </method>
  73. <method name="is_echo" qualifiers="const">
  74. <return type="bool" />
  75. <description>
  76. Returns [code]true[/code] if this input event is an echo event (only for events of type [InputEventKey]).
  77. </description>
  78. </method>
  79. <method name="is_pressed" qualifiers="const">
  80. <return type="bool" />
  81. <description>
  82. Returns [code]true[/code] if this input event is pressed. Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  83. </description>
  84. </method>
  85. <method name="shortcut_match" qualifiers="const">
  86. <return type="bool" />
  87. <argument index="0" name="event" type="InputEvent" />
  88. <argument index="1" name="exact_match" type="bool" default="true" />
  89. <description>
  90. Returns [code]true[/code] if the specified [code]event[/code] matches this event. Only valid for action events i.e key ([InputEventKey]), button ([InputEventMouseButton] or [InputEventJoypadButton]), axis [InputEventJoypadMotion] or action ([InputEventAction]) events.
  91. If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events.
  92. </description>
  93. </method>
  94. <method name="xformed_by" qualifiers="const">
  95. <return type="InputEvent" />
  96. <argument index="0" name="xform" type="Transform2D" />
  97. <argument index="1" name="local_ofs" type="Vector2" default="Vector2( 0, 0 )" />
  98. <description>
  99. 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].
  100. </description>
  101. </method>
  102. </methods>
  103. <members>
  104. <member name="device" type="int" setter="set_device" getter="get_device" default="0">
  105. The event's device ID.
  106. [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.
  107. </member>
  108. </members>
  109. <constants>
  110. </constants>
  111. </class>