InputEvent.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. <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. <description>
  34. 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].
  35. </description>
  36. </method>
  37. <method name="is_action" qualifiers="const">
  38. <return type="bool" />
  39. <argument index="0" name="action" type="String" />
  40. <description>
  41. Returns [code]true[/code] if this input event matches a pre-defined action of any type.
  42. </description>
  43. </method>
  44. <method name="is_action_pressed" qualifiers="const">
  45. <return type="bool" />
  46. <argument index="0" name="action" type="String" />
  47. <argument index="1" name="allow_echo" type="bool" default="false" />
  48. <description>
  49. 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].
  50. </description>
  51. </method>
  52. <method name="is_action_released" qualifiers="const">
  53. <return type="bool" />
  54. <argument index="0" name="action" type="String" />
  55. <description>
  56. Returns [code]true[/code] if the given action is released (i.e. not pressed). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  57. </description>
  58. </method>
  59. <method name="is_action_type" qualifiers="const">
  60. <return type="bool" />
  61. <description>
  62. Returns [code]true[/code] if this input event's type is one that can be assigned to an input action.
  63. </description>
  64. </method>
  65. <method name="is_echo" qualifiers="const">
  66. <return type="bool" />
  67. <description>
  68. Returns [code]true[/code] if this input event is an echo event (only for events of type [InputEventKey]).
  69. </description>
  70. </method>
  71. <method name="is_pressed" qualifiers="const">
  72. <return type="bool" />
  73. <description>
  74. Returns [code]true[/code] if this input event is pressed. Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag].
  75. </description>
  76. </method>
  77. <method name="shortcut_match" qualifiers="const">
  78. <return type="bool" />
  79. <argument index="0" name="event" type="InputEvent" />
  80. <description>
  81. Returns [code]true[/code] if the given input event is checking for the same key ([InputEventKey]), button ([InputEventJoypadButton]) or action ([InputEventAction]).
  82. </description>
  83. </method>
  84. <method name="xformed_by" qualifiers="const">
  85. <return type="InputEvent" />
  86. <argument index="0" name="xform" type="Transform2D" />
  87. <argument index="1" name="local_ofs" type="Vector2" default="Vector2( 0, 0 )" />
  88. <description>
  89. 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].
  90. </description>
  91. </method>
  92. </methods>
  93. <members>
  94. <member name="device" type="int" setter="set_device" getter="get_device" default="0">
  95. The event's device ID.
  96. [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.
  97. </member>
  98. </members>
  99. <constants>
  100. </constants>
  101. </class>