class_input.rst 89 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Input.xml.
  6. .. _class_Input:
  7. Input
  8. =====
  9. **Inherits:** :ref:`Object<class_Object>`
  10. A singleton for handling inputs.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The **Input** singleton handles key presses, mouse buttons and movement, gamepads, and input actions. Actions and their events can be set in the **Input Map** tab in **Project > Project Settings**, or with the :ref:`InputMap<class_InputMap>` class.
  15. \ **Note:** **Input**'s methods reflect the global input state and are not affected by :ref:`Control.accept_event()<class_Control_method_accept_event>` or :ref:`Viewport.set_input_as_handled()<class_Viewport_method_set_input_as_handled>`, as those methods only deal with the way input is propagated in the :ref:`SceneTree<class_SceneTree>`.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`Inputs documentation index <../tutorials/inputs/index>`
  20. - `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/2712>`__
  21. - `3D Voxel Demo <https://godotengine.org/asset-library/asset/2755>`__
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +----------------------------------------+--------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`emulate_mouse_from_touch<class_Input_property_emulate_mouse_from_touch>` |
  29. +----------------------------------------+--------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`emulate_touch_from_mouse<class_Input_property_emulate_touch_from_mouse>` |
  31. +----------------------------------------+--------------------------------------------------------------------------------+
  32. | :ref:`MouseMode<enum_Input_MouseMode>` | :ref:`mouse_mode<class_Input_property_mouse_mode>` |
  33. +----------------------------------------+--------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`use_accumulated_input<class_Input_property_use_accumulated_input>` |
  35. +----------------------------------------+--------------------------------------------------------------------------------+
  36. .. rst-class:: classref-reftable-group
  37. Methods
  38. -------
  39. .. table::
  40. :widths: auto
  41. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | |void| | :ref:`action_press<class_Input_method_action_press>`\ (\ action\: :ref:`StringName<class_StringName>`, strength\: :ref:`float<class_float>` = 1.0\ ) |
  43. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | |void| | :ref:`action_release<class_Input_method_action_release>`\ (\ action\: :ref:`StringName<class_StringName>`\ ) |
  45. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | |void| | :ref:`add_joy_mapping<class_Input_method_add_joy_mapping>`\ (\ mapping\: :ref:`String<class_String>`, update_existing\: :ref:`bool<class_bool>` = false\ ) |
  47. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | |void| | :ref:`flush_buffered_events<class_Input_method_flush_buffered_events>`\ (\ ) |
  49. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Vector3<class_Vector3>` | :ref:`get_accelerometer<class_Input_method_get_accelerometer>`\ (\ ) |const| |
  51. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`float<class_float>` | :ref:`get_action_raw_strength<class_Input_method_get_action_raw_strength>`\ (\ action\: :ref:`StringName<class_StringName>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| |
  53. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`float<class_float>` | :ref:`get_action_strength<class_Input_method_get_action_strength>`\ (\ action\: :ref:`StringName<class_StringName>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| |
  55. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`float<class_float>` | :ref:`get_axis<class_Input_method_get_axis>`\ (\ negative_action\: :ref:`StringName<class_StringName>`, positive_action\: :ref:`StringName<class_StringName>`\ ) |const| |
  57. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Array<class_Array>`\[:ref:`int<class_int>`\] | :ref:`get_connected_joypads<class_Input_method_get_connected_joypads>`\ (\ ) |
  59. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`CursorShape<enum_Input_CursorShape>` | :ref:`get_current_cursor_shape<class_Input_method_get_current_cursor_shape>`\ (\ ) |const| |
  61. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`Vector3<class_Vector3>` | :ref:`get_gravity<class_Input_method_get_gravity>`\ (\ ) |const| |
  63. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`Vector3<class_Vector3>` | :ref:`get_gyroscope<class_Input_method_get_gyroscope>`\ (\ ) |const| |
  65. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`float<class_float>` | :ref:`get_joy_axis<class_Input_method_get_joy_axis>`\ (\ device\: :ref:`int<class_int>`, axis\: :ref:`JoyAxis<enum_@GlobalScope_JoyAxis>`\ ) |const| |
  67. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`String<class_String>` | :ref:`get_joy_guid<class_Input_method_get_joy_guid>`\ (\ device\: :ref:`int<class_int>`\ ) |const| |
  69. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_joy_info<class_Input_method_get_joy_info>`\ (\ device\: :ref:`int<class_int>`\ ) |const| |
  71. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`String<class_String>` | :ref:`get_joy_name<class_Input_method_get_joy_name>`\ (\ device\: :ref:`int<class_int>`\ ) |
  73. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`float<class_float>` | :ref:`get_joy_vibration_duration<class_Input_method_get_joy_vibration_duration>`\ (\ device\: :ref:`int<class_int>`\ ) |
  75. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`Vector2<class_Vector2>` | :ref:`get_joy_vibration_strength<class_Input_method_get_joy_vibration_strength>`\ (\ device\: :ref:`int<class_int>`\ ) |
  77. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`Vector2<class_Vector2>` | :ref:`get_last_mouse_screen_velocity<class_Input_method_get_last_mouse_screen_velocity>`\ (\ ) |
  79. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`Vector2<class_Vector2>` | :ref:`get_last_mouse_velocity<class_Input_method_get_last_mouse_velocity>`\ (\ ) |
  81. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`Vector3<class_Vector3>` | :ref:`get_magnetometer<class_Input_method_get_magnetometer>`\ (\ ) |const| |
  83. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | |bitfield|\[:ref:`MouseButtonMask<enum_@GlobalScope_MouseButtonMask>`\] | :ref:`get_mouse_button_mask<class_Input_method_get_mouse_button_mask>`\ (\ ) |const| |
  85. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`Vector2<class_Vector2>` | :ref:`get_vector<class_Input_method_get_vector>`\ (\ negative_x\: :ref:`StringName<class_StringName>`, positive_x\: :ref:`StringName<class_StringName>`, negative_y\: :ref:`StringName<class_StringName>`, positive_y\: :ref:`StringName<class_StringName>`, deadzone\: :ref:`float<class_float>` = -1.0\ ) |const| |
  87. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`bool<class_bool>` | :ref:`has_joy_light<class_Input_method_has_joy_light>`\ (\ device\: :ref:`int<class_int>`\ ) |const| |
  89. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`bool<class_bool>` | :ref:`is_action_just_pressed<class_Input_method_is_action_just_pressed>`\ (\ action\: :ref:`StringName<class_StringName>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| |
  91. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`bool<class_bool>` | :ref:`is_action_just_pressed_by_event<class_Input_method_is_action_just_pressed_by_event>`\ (\ action\: :ref:`StringName<class_StringName>`, event\: :ref:`InputEvent<class_InputEvent>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| |
  93. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`bool<class_bool>` | :ref:`is_action_just_released<class_Input_method_is_action_just_released>`\ (\ action\: :ref:`StringName<class_StringName>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| |
  95. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`bool<class_bool>` | :ref:`is_action_just_released_by_event<class_Input_method_is_action_just_released_by_event>`\ (\ action\: :ref:`StringName<class_StringName>`, event\: :ref:`InputEvent<class_InputEvent>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| |
  97. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`bool<class_bool>` | :ref:`is_action_pressed<class_Input_method_is_action_pressed>`\ (\ action\: :ref:`StringName<class_StringName>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| |
  99. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :ref:`bool<class_bool>` | :ref:`is_anything_pressed<class_Input_method_is_anything_pressed>`\ (\ ) |const| |
  101. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :ref:`bool<class_bool>` | :ref:`is_joy_button_pressed<class_Input_method_is_joy_button_pressed>`\ (\ device\: :ref:`int<class_int>`, button\: :ref:`JoyButton<enum_@GlobalScope_JoyButton>`\ ) |const| |
  103. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :ref:`bool<class_bool>` | :ref:`is_joy_known<class_Input_method_is_joy_known>`\ (\ device\: :ref:`int<class_int>`\ ) |
  105. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | :ref:`bool<class_bool>` | :ref:`is_key_label_pressed<class_Input_method_is_key_label_pressed>`\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| |
  107. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | :ref:`bool<class_bool>` | :ref:`is_key_pressed<class_Input_method_is_key_pressed>`\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| |
  109. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`bool<class_bool>` | :ref:`is_mouse_button_pressed<class_Input_method_is_mouse_button_pressed>`\ (\ button\: :ref:`MouseButton<enum_@GlobalScope_MouseButton>`\ ) |const| |
  111. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`bool<class_bool>` | :ref:`is_physical_key_pressed<class_Input_method_is_physical_key_pressed>`\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| |
  113. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | |void| | :ref:`parse_input_event<class_Input_method_parse_input_event>`\ (\ event\: :ref:`InputEvent<class_InputEvent>`\ ) |
  115. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | |void| | :ref:`remove_joy_mapping<class_Input_method_remove_joy_mapping>`\ (\ guid\: :ref:`String<class_String>`\ ) |
  117. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | |void| | :ref:`set_accelerometer<class_Input_method_set_accelerometer>`\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) |
  119. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | |void| | :ref:`set_custom_mouse_cursor<class_Input_method_set_custom_mouse_cursor>`\ (\ image\: :ref:`Resource<class_Resource>`, shape\: :ref:`CursorShape<enum_Input_CursorShape>` = 0, hotspot\: :ref:`Vector2<class_Vector2>` = Vector2(0, 0)\ ) |
  121. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | |void| | :ref:`set_default_cursor_shape<class_Input_method_set_default_cursor_shape>`\ (\ shape\: :ref:`CursorShape<enum_Input_CursorShape>` = 0\ ) |
  123. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | |void| | :ref:`set_gravity<class_Input_method_set_gravity>`\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) |
  125. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | |void| | :ref:`set_gyroscope<class_Input_method_set_gyroscope>`\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) |
  127. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | :ref:`bool<class_bool>` | :ref:`set_joy_light<class_Input_method_set_joy_light>`\ (\ device\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`\ ) |
  129. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | |void| | :ref:`set_magnetometer<class_Input_method_set_magnetometer>`\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) |
  131. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | :ref:`bool<class_bool>` | :ref:`should_ignore_device<class_Input_method_should_ignore_device>`\ (\ vendor_id\: :ref:`int<class_int>`, product_id\: :ref:`int<class_int>`\ ) |const| |
  133. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | |void| | :ref:`start_joy_vibration<class_Input_method_start_joy_vibration>`\ (\ device\: :ref:`int<class_int>`, weak_magnitude\: :ref:`float<class_float>`, strong_magnitude\: :ref:`float<class_float>`, duration\: :ref:`float<class_float>` = 0\ ) |
  135. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | |void| | :ref:`stop_joy_vibration<class_Input_method_stop_joy_vibration>`\ (\ device\: :ref:`int<class_int>`\ ) |
  137. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | |void| | :ref:`vibrate_handheld<class_Input_method_vibrate_handheld>`\ (\ duration_ms\: :ref:`int<class_int>` = 500, amplitude\: :ref:`float<class_float>` = -1.0\ ) |
  139. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | |void| | :ref:`warp_mouse<class_Input_method_warp_mouse>`\ (\ position\: :ref:`Vector2<class_Vector2>`\ ) |
  141. +-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. .. rst-class:: classref-section-separator
  143. ----
  144. .. rst-class:: classref-descriptions-group
  145. Signals
  146. -------
  147. .. _class_Input_signal_joy_connection_changed:
  148. .. rst-class:: classref-signal
  149. **joy_connection_changed**\ (\ device\: :ref:`int<class_int>`, connected\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_Input_signal_joy_connection_changed>`
  150. Emitted when a joypad device has been connected or disconnected.
  151. .. rst-class:: classref-section-separator
  152. ----
  153. .. rst-class:: classref-descriptions-group
  154. Enumerations
  155. ------------
  156. .. _enum_Input_MouseMode:
  157. .. rst-class:: classref-enumeration
  158. enum **MouseMode**: :ref:`🔗<enum_Input_MouseMode>`
  159. .. _class_Input_constant_MOUSE_MODE_VISIBLE:
  160. .. rst-class:: classref-enumeration-constant
  161. :ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_VISIBLE** = ``0``
  162. Makes the mouse cursor visible if it is hidden.
  163. .. _class_Input_constant_MOUSE_MODE_HIDDEN:
  164. .. rst-class:: classref-enumeration-constant
  165. :ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_HIDDEN** = ``1``
  166. Makes the mouse cursor hidden if it is visible.
  167. .. _class_Input_constant_MOUSE_MODE_CAPTURED:
  168. .. rst-class:: classref-enumeration-constant
  169. :ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_CAPTURED** = ``2``
  170. Captures the mouse. The mouse will be hidden and its position locked at the center of the window manager's window.
  171. \ **Note:** If you want to process the mouse's movement in this mode, you need to use :ref:`InputEventMouseMotion.relative<class_InputEventMouseMotion_property_relative>`.
  172. .. _class_Input_constant_MOUSE_MODE_CONFINED:
  173. .. rst-class:: classref-enumeration-constant
  174. :ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_CONFINED** = ``3``
  175. Confines the mouse cursor to the game window, and make it visible.
  176. .. _class_Input_constant_MOUSE_MODE_CONFINED_HIDDEN:
  177. .. rst-class:: classref-enumeration-constant
  178. :ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_CONFINED_HIDDEN** = ``4``
  179. Confines the mouse cursor to the game window, and make it hidden.
  180. .. _class_Input_constant_MOUSE_MODE_MAX:
  181. .. rst-class:: classref-enumeration-constant
  182. :ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_MAX** = ``5``
  183. Max value of the :ref:`MouseMode<enum_Input_MouseMode>`.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _enum_Input_CursorShape:
  187. .. rst-class:: classref-enumeration
  188. enum **CursorShape**: :ref:`🔗<enum_Input_CursorShape>`
  189. .. _class_Input_constant_CURSOR_ARROW:
  190. .. rst-class:: classref-enumeration-constant
  191. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_ARROW** = ``0``
  192. Arrow cursor. Standard, default pointing cursor.
  193. .. _class_Input_constant_CURSOR_IBEAM:
  194. .. rst-class:: classref-enumeration-constant
  195. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_IBEAM** = ``1``
  196. I-beam cursor. Usually used to show where the text cursor will appear when the mouse is clicked.
  197. .. _class_Input_constant_CURSOR_POINTING_HAND:
  198. .. rst-class:: classref-enumeration-constant
  199. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_POINTING_HAND** = ``2``
  200. Pointing hand cursor. Usually used to indicate the pointer is over a link or other interactable item.
  201. .. _class_Input_constant_CURSOR_CROSS:
  202. .. rst-class:: classref-enumeration-constant
  203. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_CROSS** = ``3``
  204. Cross cursor. Typically appears over regions in which a drawing operation can be performed or for selections.
  205. .. _class_Input_constant_CURSOR_WAIT:
  206. .. rst-class:: classref-enumeration-constant
  207. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_WAIT** = ``4``
  208. Wait cursor. Indicates that the application is busy performing an operation, and that it cannot be used during the operation (e.g. something is blocking its main thread).
  209. .. _class_Input_constant_CURSOR_BUSY:
  210. .. rst-class:: classref-enumeration-constant
  211. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_BUSY** = ``5``
  212. Busy cursor. Indicates that the application is busy performing an operation, and that it is still usable during the operation.
  213. .. _class_Input_constant_CURSOR_DRAG:
  214. .. rst-class:: classref-enumeration-constant
  215. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_DRAG** = ``6``
  216. Drag cursor. Usually displayed when dragging something.
  217. \ **Note:** Windows lacks a dragging cursor, so :ref:`CURSOR_DRAG<class_Input_constant_CURSOR_DRAG>` is the same as :ref:`CURSOR_MOVE<class_Input_constant_CURSOR_MOVE>` for this platform.
  218. .. _class_Input_constant_CURSOR_CAN_DROP:
  219. .. rst-class:: classref-enumeration-constant
  220. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_CAN_DROP** = ``7``
  221. Can drop cursor. Usually displayed when dragging something to indicate that it can be dropped at the current position.
  222. .. _class_Input_constant_CURSOR_FORBIDDEN:
  223. .. rst-class:: classref-enumeration-constant
  224. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_FORBIDDEN** = ``8``
  225. Forbidden cursor. Indicates that the current action is forbidden (for example, when dragging something) or that the control at a position is disabled.
  226. .. _class_Input_constant_CURSOR_VSIZE:
  227. .. rst-class:: classref-enumeration-constant
  228. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_VSIZE** = ``9``
  229. Vertical resize mouse cursor. A double-headed vertical arrow. It tells the user they can resize the window or the panel vertically.
  230. .. _class_Input_constant_CURSOR_HSIZE:
  231. .. rst-class:: classref-enumeration-constant
  232. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_HSIZE** = ``10``
  233. Horizontal resize mouse cursor. A double-headed horizontal arrow. It tells the user they can resize the window or the panel horizontally.
  234. .. _class_Input_constant_CURSOR_BDIAGSIZE:
  235. .. rst-class:: classref-enumeration-constant
  236. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_BDIAGSIZE** = ``11``
  237. Window resize mouse cursor. The cursor is a double-headed arrow that goes from the bottom left to the top right. It tells the user they can resize the window or the panel both horizontally and vertically.
  238. .. _class_Input_constant_CURSOR_FDIAGSIZE:
  239. .. rst-class:: classref-enumeration-constant
  240. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_FDIAGSIZE** = ``12``
  241. Window resize mouse cursor. The cursor is a double-headed arrow that goes from the top left to the bottom right, the opposite of :ref:`CURSOR_BDIAGSIZE<class_Input_constant_CURSOR_BDIAGSIZE>`. It tells the user they can resize the window or the panel both horizontally and vertically.
  242. .. _class_Input_constant_CURSOR_MOVE:
  243. .. rst-class:: classref-enumeration-constant
  244. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_MOVE** = ``13``
  245. Move cursor. Indicates that something can be moved.
  246. .. _class_Input_constant_CURSOR_VSPLIT:
  247. .. rst-class:: classref-enumeration-constant
  248. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_VSPLIT** = ``14``
  249. Vertical split mouse cursor. On Windows, it's the same as :ref:`CURSOR_VSIZE<class_Input_constant_CURSOR_VSIZE>`.
  250. .. _class_Input_constant_CURSOR_HSPLIT:
  251. .. rst-class:: classref-enumeration-constant
  252. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_HSPLIT** = ``15``
  253. Horizontal split mouse cursor. On Windows, it's the same as :ref:`CURSOR_HSIZE<class_Input_constant_CURSOR_HSIZE>`.
  254. .. _class_Input_constant_CURSOR_HELP:
  255. .. rst-class:: classref-enumeration-constant
  256. :ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_HELP** = ``16``
  257. Help cursor. Usually a question mark.
  258. .. rst-class:: classref-section-separator
  259. ----
  260. .. rst-class:: classref-descriptions-group
  261. Property Descriptions
  262. ---------------------
  263. .. _class_Input_property_emulate_mouse_from_touch:
  264. .. rst-class:: classref-property
  265. :ref:`bool<class_bool>` **emulate_mouse_from_touch** :ref:`🔗<class_Input_property_emulate_mouse_from_touch>`
  266. .. rst-class:: classref-property-setget
  267. - |void| **set_emulate_mouse_from_touch**\ (\ value\: :ref:`bool<class_bool>`\ )
  268. - :ref:`bool<class_bool>` **is_emulating_mouse_from_touch**\ (\ )
  269. If ``true``, sends mouse input events when tapping or swiping on the touchscreen. See also :ref:`ProjectSettings.input_devices/pointing/emulate_mouse_from_touch<class_ProjectSettings_property_input_devices/pointing/emulate_mouse_from_touch>`.
  270. .. rst-class:: classref-item-separator
  271. ----
  272. .. _class_Input_property_emulate_touch_from_mouse:
  273. .. rst-class:: classref-property
  274. :ref:`bool<class_bool>` **emulate_touch_from_mouse** :ref:`🔗<class_Input_property_emulate_touch_from_mouse>`
  275. .. rst-class:: classref-property-setget
  276. - |void| **set_emulate_touch_from_mouse**\ (\ value\: :ref:`bool<class_bool>`\ )
  277. - :ref:`bool<class_bool>` **is_emulating_touch_from_mouse**\ (\ )
  278. If ``true``, sends touch input events when clicking or dragging the mouse. See also :ref:`ProjectSettings.input_devices/pointing/emulate_touch_from_mouse<class_ProjectSettings_property_input_devices/pointing/emulate_touch_from_mouse>`.
  279. .. rst-class:: classref-item-separator
  280. ----
  281. .. _class_Input_property_mouse_mode:
  282. .. rst-class:: classref-property
  283. :ref:`MouseMode<enum_Input_MouseMode>` **mouse_mode** :ref:`🔗<class_Input_property_mouse_mode>`
  284. .. rst-class:: classref-property-setget
  285. - |void| **set_mouse_mode**\ (\ value\: :ref:`MouseMode<enum_Input_MouseMode>`\ )
  286. - :ref:`MouseMode<enum_Input_MouseMode>` **get_mouse_mode**\ (\ )
  287. Controls the mouse mode.
  288. .. rst-class:: classref-item-separator
  289. ----
  290. .. _class_Input_property_use_accumulated_input:
  291. .. rst-class:: classref-property
  292. :ref:`bool<class_bool>` **use_accumulated_input** :ref:`🔗<class_Input_property_use_accumulated_input>`
  293. .. rst-class:: classref-property-setget
  294. - |void| **set_use_accumulated_input**\ (\ value\: :ref:`bool<class_bool>`\ )
  295. - :ref:`bool<class_bool>` **is_using_accumulated_input**\ (\ )
  296. If ``true``, similar input events sent by the operating system are accumulated. When input accumulation is enabled, all input events generated during a frame will be merged and emitted when the frame is done rendering. Therefore, this limits the number of input method calls per second to the rendering FPS.
  297. Input accumulation can be disabled to get slightly more precise/reactive input at the cost of increased CPU usage. In applications where drawing freehand lines is required, input accumulation should generally be disabled while the user is drawing the line to get results that closely follow the actual input.
  298. \ **Note:** Input accumulation is *enabled* by default.
  299. .. rst-class:: classref-section-separator
  300. ----
  301. .. rst-class:: classref-descriptions-group
  302. Method Descriptions
  303. -------------------
  304. .. _class_Input_method_action_press:
  305. .. rst-class:: classref-method
  306. |void| **action_press**\ (\ action\: :ref:`StringName<class_StringName>`, strength\: :ref:`float<class_float>` = 1.0\ ) :ref:`🔗<class_Input_method_action_press>`
  307. This will simulate pressing the specified action.
  308. The strength can be used for non-boolean actions, it's ranged between 0 and 1 representing the intensity of the given action.
  309. \ **Note:** This method will not cause any :ref:`Node._input()<class_Node_private_method__input>` calls. It is intended to be used with :ref:`is_action_pressed()<class_Input_method_is_action_pressed>` and :ref:`is_action_just_pressed()<class_Input_method_is_action_just_pressed>`. If you want to simulate ``_input``, use :ref:`parse_input_event()<class_Input_method_parse_input_event>` instead.
  310. .. rst-class:: classref-item-separator
  311. ----
  312. .. _class_Input_method_action_release:
  313. .. rst-class:: classref-method
  314. |void| **action_release**\ (\ action\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Input_method_action_release>`
  315. If the specified action is already pressed, this will release it.
  316. .. rst-class:: classref-item-separator
  317. ----
  318. .. _class_Input_method_add_joy_mapping:
  319. .. rst-class:: classref-method
  320. |void| **add_joy_mapping**\ (\ mapping\: :ref:`String<class_String>`, update_existing\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_Input_method_add_joy_mapping>`
  321. Adds a new mapping entry (in SDL2 format) to the mapping database. Optionally update already connected devices.
  322. .. rst-class:: classref-item-separator
  323. ----
  324. .. _class_Input_method_flush_buffered_events:
  325. .. rst-class:: classref-method
  326. |void| **flush_buffered_events**\ (\ ) :ref:`🔗<class_Input_method_flush_buffered_events>`
  327. Sends all input events which are in the current buffer to the game loop. These events may have been buffered as a result of accumulated input (:ref:`use_accumulated_input<class_Input_property_use_accumulated_input>`) or agile input flushing (:ref:`ProjectSettings.input_devices/buffering/agile_event_flushing<class_ProjectSettings_property_input_devices/buffering/agile_event_flushing>`).
  328. The engine will already do this itself at key execution points (at least once per frame). However, this can be useful in advanced cases where you want precise control over the timing of event handling.
  329. .. rst-class:: classref-item-separator
  330. ----
  331. .. _class_Input_method_get_accelerometer:
  332. .. rst-class:: classref-method
  333. :ref:`Vector3<class_Vector3>` **get_accelerometer**\ (\ ) |const| :ref:`🔗<class_Input_method_get_accelerometer>`
  334. Returns the acceleration in m/s² of the device's accelerometer sensor, if the device has one. Otherwise, the method returns :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
  335. Note this method returns an empty :ref:`Vector3<class_Vector3>` when running from the editor even when your device has an accelerometer. You must export your project to a supported device to read values from the accelerometer.
  336. \ **Note:** This method only works on Android and iOS. On other platforms, it always returns :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
  337. \ **Note:** For Android, :ref:`ProjectSettings.input_devices/sensors/enable_accelerometer<class_ProjectSettings_property_input_devices/sensors/enable_accelerometer>` must be enabled.
  338. .. rst-class:: classref-item-separator
  339. ----
  340. .. _class_Input_method_get_action_raw_strength:
  341. .. rst-class:: classref-method
  342. :ref:`float<class_float>` **get_action_raw_strength**\ (\ action\: :ref:`StringName<class_StringName>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Input_method_get_action_raw_strength>`
  343. Returns a value between 0 and 1 representing the raw intensity of the given action, ignoring the action's deadzone. In most cases, you should use :ref:`get_action_strength()<class_Input_method_get_action_strength>` instead.
  344. If ``exact_match`` is ``false``, it ignores additional input modifiers for :ref:`InputEventKey<class_InputEventKey>` and :ref:`InputEventMouseButton<class_InputEventMouseButton>` events, and the direction for :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>` events.
  345. .. rst-class:: classref-item-separator
  346. ----
  347. .. _class_Input_method_get_action_strength:
  348. .. rst-class:: classref-method
  349. :ref:`float<class_float>` **get_action_strength**\ (\ action\: :ref:`StringName<class_StringName>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Input_method_get_action_strength>`
  350. Returns a value between 0 and 1 representing the intensity of the given action. In a joypad, for example, the further away the axis (analog sticks or L2, R2 triggers) is from the dead zone, the closer the value will be to 1. If the action is mapped to a control that has no axis such as the keyboard, the value returned will be 0 or 1.
  351. If ``exact_match`` is ``false``, it ignores additional input modifiers for :ref:`InputEventKey<class_InputEventKey>` and :ref:`InputEventMouseButton<class_InputEventMouseButton>` events, and the direction for :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>` events.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _class_Input_method_get_axis:
  355. .. rst-class:: classref-method
  356. :ref:`float<class_float>` **get_axis**\ (\ negative_action\: :ref:`StringName<class_StringName>`, positive_action\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Input_method_get_axis>`
  357. Get axis input by specifying two actions, one negative and one positive.
  358. This is a shorthand for writing ``Input.get_action_strength("positive_action") - Input.get_action_strength("negative_action")``.
  359. .. rst-class:: classref-item-separator
  360. ----
  361. .. _class_Input_method_get_connected_joypads:
  362. .. rst-class:: classref-method
  363. :ref:`Array<class_Array>`\[:ref:`int<class_int>`\] **get_connected_joypads**\ (\ ) :ref:`🔗<class_Input_method_get_connected_joypads>`
  364. Returns an :ref:`Array<class_Array>` containing the device IDs of all currently connected joypads.
  365. .. rst-class:: classref-item-separator
  366. ----
  367. .. _class_Input_method_get_current_cursor_shape:
  368. .. rst-class:: classref-method
  369. :ref:`CursorShape<enum_Input_CursorShape>` **get_current_cursor_shape**\ (\ ) |const| :ref:`🔗<class_Input_method_get_current_cursor_shape>`
  370. Returns the currently assigned cursor shape.
  371. .. rst-class:: classref-item-separator
  372. ----
  373. .. _class_Input_method_get_gravity:
  374. .. rst-class:: classref-method
  375. :ref:`Vector3<class_Vector3>` **get_gravity**\ (\ ) |const| :ref:`🔗<class_Input_method_get_gravity>`
  376. Returns the gravity in m/s² of the device's accelerometer sensor, if the device has one. Otherwise, the method returns :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
  377. \ **Note:** This method only works on Android and iOS. On other platforms, it always returns :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
  378. \ **Note:** For Android, :ref:`ProjectSettings.input_devices/sensors/enable_gravity<class_ProjectSettings_property_input_devices/sensors/enable_gravity>` must be enabled.
  379. .. rst-class:: classref-item-separator
  380. ----
  381. .. _class_Input_method_get_gyroscope:
  382. .. rst-class:: classref-method
  383. :ref:`Vector3<class_Vector3>` **get_gyroscope**\ (\ ) |const| :ref:`🔗<class_Input_method_get_gyroscope>`
  384. Returns the rotation rate in rad/s around a device's X, Y, and Z axes of the gyroscope sensor, if the device has one. Otherwise, the method returns :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
  385. \ **Note:** This method only works on Android and iOS. On other platforms, it always returns :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
  386. \ **Note:** For Android, :ref:`ProjectSettings.input_devices/sensors/enable_gyroscope<class_ProjectSettings_property_input_devices/sensors/enable_gyroscope>` must be enabled.
  387. .. rst-class:: classref-item-separator
  388. ----
  389. .. _class_Input_method_get_joy_axis:
  390. .. rst-class:: classref-method
  391. :ref:`float<class_float>` **get_joy_axis**\ (\ device\: :ref:`int<class_int>`, axis\: :ref:`JoyAxis<enum_@GlobalScope_JoyAxis>`\ ) |const| :ref:`🔗<class_Input_method_get_joy_axis>`
  392. Returns the current value of the joypad axis at index ``axis``.
  393. .. rst-class:: classref-item-separator
  394. ----
  395. .. _class_Input_method_get_joy_guid:
  396. .. rst-class:: classref-method
  397. :ref:`String<class_String>` **get_joy_guid**\ (\ device\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Input_method_get_joy_guid>`
  398. Returns an SDL2-compatible device GUID on platforms that use gamepad remapping, e.g. ``030000004c050000c405000000010000``. Returns an empty string if it cannot be found. Godot uses the `SDL2 game controller database <https://github.com/gabomdq/SDL_GameControllerDB>`__ to determine gamepad names and mappings based on this GUID.
  399. On Windows, all XInput joypad GUIDs will be overridden by Godot to ``__XINPUT_DEVICE__``, because their mappings are the same.
  400. .. rst-class:: classref-item-separator
  401. ----
  402. .. _class_Input_method_get_joy_info:
  403. .. rst-class:: classref-method
  404. :ref:`Dictionary<class_Dictionary>` **get_joy_info**\ (\ device\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Input_method_get_joy_info>`
  405. Returns a dictionary with extra platform-specific information about the device, e.g. the raw gamepad name from the OS or the Steam Input index.
  406. On Windows, Linux, and macOS, the dictionary contains the following fields:
  407. \ ``raw_name``: The name of the controller as it came from the OS, before getting renamed by the controller database.
  408. \ ``vendor_id``: The USB vendor ID of the device.
  409. \ ``product_id``: The USB product ID of the device.
  410. \ ``steam_input_index``: The Steam Input gamepad index, if the device is not a Steam Input device this key won't be present.
  411. On Windows, the dictionary can have an additional field:
  412. \ ``xinput_index``: The index of the controller in the XInput system. This key won't be present for devices not handled by XInput.
  413. \ **Note:** The returned dictionary is always empty on Android, iOS, visionOS, and Web.
  414. .. rst-class:: classref-item-separator
  415. ----
  416. .. _class_Input_method_get_joy_name:
  417. .. rst-class:: classref-method
  418. :ref:`String<class_String>` **get_joy_name**\ (\ device\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Input_method_get_joy_name>`
  419. Returns the name of the joypad at the specified device index, e.g. ``PS4 Controller``. Godot uses the `SDL2 game controller database <https://github.com/gabomdq/SDL_GameControllerDB>`__ to determine gamepad names.
  420. .. rst-class:: classref-item-separator
  421. ----
  422. .. _class_Input_method_get_joy_vibration_duration:
  423. .. rst-class:: classref-method
  424. :ref:`float<class_float>` **get_joy_vibration_duration**\ (\ device\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Input_method_get_joy_vibration_duration>`
  425. Returns the duration of the current vibration effect in seconds.
  426. .. rst-class:: classref-item-separator
  427. ----
  428. .. _class_Input_method_get_joy_vibration_strength:
  429. .. rst-class:: classref-method
  430. :ref:`Vector2<class_Vector2>` **get_joy_vibration_strength**\ (\ device\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Input_method_get_joy_vibration_strength>`
  431. Returns the strength of the joypad vibration: x is the strength of the weak motor, and y is the strength of the strong motor.
  432. .. rst-class:: classref-item-separator
  433. ----
  434. .. _class_Input_method_get_last_mouse_screen_velocity:
  435. .. rst-class:: classref-method
  436. :ref:`Vector2<class_Vector2>` **get_last_mouse_screen_velocity**\ (\ ) :ref:`🔗<class_Input_method_get_last_mouse_screen_velocity>`
  437. Returns the last mouse velocity in screen coordinates. To provide a precise and jitter-free velocity, mouse velocity is only calculated every 0.1s. Therefore, mouse velocity will lag mouse movements.
  438. .. rst-class:: classref-item-separator
  439. ----
  440. .. _class_Input_method_get_last_mouse_velocity:
  441. .. rst-class:: classref-method
  442. :ref:`Vector2<class_Vector2>` **get_last_mouse_velocity**\ (\ ) :ref:`🔗<class_Input_method_get_last_mouse_velocity>`
  443. Returns the last mouse velocity. To provide a precise and jitter-free velocity, mouse velocity is only calculated every 0.1s. Therefore, mouse velocity will lag mouse movements.
  444. .. rst-class:: classref-item-separator
  445. ----
  446. .. _class_Input_method_get_magnetometer:
  447. .. rst-class:: classref-method
  448. :ref:`Vector3<class_Vector3>` **get_magnetometer**\ (\ ) |const| :ref:`🔗<class_Input_method_get_magnetometer>`
  449. Returns the magnetic field strength in micro-Tesla for all axes of the device's magnetometer sensor, if the device has one. Otherwise, the method returns :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
  450. \ **Note:** This method only works on Android and iOS. On other platforms, it always returns :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
  451. \ **Note:** For Android, :ref:`ProjectSettings.input_devices/sensors/enable_magnetometer<class_ProjectSettings_property_input_devices/sensors/enable_magnetometer>` must be enabled.
  452. .. rst-class:: classref-item-separator
  453. ----
  454. .. _class_Input_method_get_mouse_button_mask:
  455. .. rst-class:: classref-method
  456. |bitfield|\[:ref:`MouseButtonMask<enum_@GlobalScope_MouseButtonMask>`\] **get_mouse_button_mask**\ (\ ) |const| :ref:`🔗<class_Input_method_get_mouse_button_mask>`
  457. Returns mouse buttons as a bitmask. If multiple mouse buttons are pressed at the same time, the bits are added together. Equivalent to :ref:`DisplayServer.mouse_get_button_state()<class_DisplayServer_method_mouse_get_button_state>`.
  458. .. rst-class:: classref-item-separator
  459. ----
  460. .. _class_Input_method_get_vector:
  461. .. rst-class:: classref-method
  462. :ref:`Vector2<class_Vector2>` **get_vector**\ (\ negative_x\: :ref:`StringName<class_StringName>`, positive_x\: :ref:`StringName<class_StringName>`, negative_y\: :ref:`StringName<class_StringName>`, positive_y\: :ref:`StringName<class_StringName>`, deadzone\: :ref:`float<class_float>` = -1.0\ ) |const| :ref:`🔗<class_Input_method_get_vector>`
  463. Gets an input vector by specifying four actions for the positive and negative X and Y axes.
  464. This method is useful when getting vector input, such as from a joystick, directional pad, arrows, or WASD. The vector has its length limited to 1 and has a circular deadzone, which is useful for using vector input as movement.
  465. By default, the deadzone is automatically calculated from the average of the action deadzones. However, you can override the deadzone to be whatever you want (on the range of 0 to 1).
  466. .. rst-class:: classref-item-separator
  467. ----
  468. .. _class_Input_method_has_joy_light:
  469. .. rst-class:: classref-method
  470. :ref:`bool<class_bool>` **has_joy_light**\ (\ device\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Input_method_has_joy_light>`
  471. Returns ``true`` if the joypad has an LED light that can change colors and/or brightness. See also :ref:`set_joy_light()<class_Input_method_set_joy_light>`.
  472. \ **Note:** This feature is only supported on Windows, Linux, and macOS.
  473. .. rst-class:: classref-item-separator
  474. ----
  475. .. _class_Input_method_is_action_just_pressed:
  476. .. rst-class:: classref-method
  477. :ref:`bool<class_bool>` **is_action_just_pressed**\ (\ action\: :ref:`StringName<class_StringName>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Input_method_is_action_just_pressed>`
  478. Returns ``true`` when the user has *started* pressing the action event in the current frame or physics tick. It will only return ``true`` on the frame or tick that the user pressed down the button.
  479. This is useful for code that needs to run only once when an action is pressed, instead of every frame while it's pressed.
  480. If ``exact_match`` is ``false``, it ignores additional input modifiers for :ref:`InputEventKey<class_InputEventKey>` and :ref:`InputEventMouseButton<class_InputEventMouseButton>` events, and the direction for :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>` events.
  481. \ **Note:** Returning ``true`` does not imply that the action is *still* pressed. An action can be pressed and released again rapidly, and ``true`` will still be returned so as not to miss input.
  482. \ **Note:** Due to keyboard ghosting, :ref:`is_action_just_pressed()<class_Input_method_is_action_just_pressed>` may return ``false`` even if one of the action's keys is pressed. See `Input examples <../tutorials/inputs/input_examples.html#keyboard-events>`__ in the documentation for more information.
  483. \ **Note:** During input handling (e.g. :ref:`Node._input()<class_Node_private_method__input>`), use :ref:`InputEvent.is_action_pressed()<class_InputEvent_method_is_action_pressed>` instead to query the action state of the current event. See also :ref:`is_action_just_pressed_by_event()<class_Input_method_is_action_just_pressed_by_event>`.
  484. .. rst-class:: classref-item-separator
  485. ----
  486. .. _class_Input_method_is_action_just_pressed_by_event:
  487. .. rst-class:: classref-method
  488. :ref:`bool<class_bool>` **is_action_just_pressed_by_event**\ (\ action\: :ref:`StringName<class_StringName>`, event\: :ref:`InputEvent<class_InputEvent>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Input_method_is_action_just_pressed_by_event>`
  489. Returns ``true`` when the user has *started* pressing the action event in the current frame or physics tick, and the first event that triggered action press in the current frame/physics tick was ``event``. It will only return ``true`` on the frame or tick that the user pressed down the button.
  490. This is useful for code that needs to run only once when an action is pressed, and the action is processed during input handling (e.g. :ref:`Node._input()<class_Node_private_method__input>`).
  491. If ``exact_match`` is ``false``, it ignores additional input modifiers for :ref:`InputEventKey<class_InputEventKey>` and :ref:`InputEventMouseButton<class_InputEventMouseButton>` events, and the direction for :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>` events.
  492. \ **Note:** Returning ``true`` does not imply that the action is *still* pressed. An action can be pressed and released again rapidly, and ``true`` will still be returned so as not to miss input.
  493. \ **Note:** Due to keyboard ghosting, :ref:`is_action_just_pressed()<class_Input_method_is_action_just_pressed>` may return ``false`` even if one of the action's keys is pressed. See `Input examples <../tutorials/inputs/input_examples.html#keyboard-events>`__ in the documentation for more information.
  494. .. rst-class:: classref-item-separator
  495. ----
  496. .. _class_Input_method_is_action_just_released:
  497. .. rst-class:: classref-method
  498. :ref:`bool<class_bool>` **is_action_just_released**\ (\ action\: :ref:`StringName<class_StringName>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Input_method_is_action_just_released>`
  499. Returns ``true`` when the user *stops* pressing the action event in the current frame or physics tick. It will only return ``true`` on the frame or tick that the user releases the button.
  500. \ **Note:** Returning ``true`` does not imply that the action is *still* not pressed. An action can be released and pressed again rapidly, and ``true`` will still be returned so as not to miss input.
  501. If ``exact_match`` is ``false``, it ignores additional input modifiers for :ref:`InputEventKey<class_InputEventKey>` and :ref:`InputEventMouseButton<class_InputEventMouseButton>` events, and the direction for :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>` events.
  502. \ **Note:** During input handling (e.g. :ref:`Node._input()<class_Node_private_method__input>`), use :ref:`InputEvent.is_action_released()<class_InputEvent_method_is_action_released>` instead to query the action state of the current event. See also :ref:`is_action_just_released_by_event()<class_Input_method_is_action_just_released_by_event>`.
  503. .. rst-class:: classref-item-separator
  504. ----
  505. .. _class_Input_method_is_action_just_released_by_event:
  506. .. rst-class:: classref-method
  507. :ref:`bool<class_bool>` **is_action_just_released_by_event**\ (\ action\: :ref:`StringName<class_StringName>`, event\: :ref:`InputEvent<class_InputEvent>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Input_method_is_action_just_released_by_event>`
  508. Returns ``true`` when the user *stops* pressing the action event in the current frame or physics tick, and the first event that triggered action release in the current frame/physics tick was ``event``. It will only return ``true`` on the frame or tick that the user releases the button.
  509. This is useful when an action is processed during input handling (e.g. :ref:`Node._input()<class_Node_private_method__input>`).
  510. \ **Note:** Returning ``true`` does not imply that the action is *still* not pressed. An action can be released and pressed again rapidly, and ``true`` will still be returned so as not to miss input.
  511. If ``exact_match`` is ``false``, it ignores additional input modifiers for :ref:`InputEventKey<class_InputEventKey>` and :ref:`InputEventMouseButton<class_InputEventMouseButton>` events, and the direction for :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>` events.
  512. .. rst-class:: classref-item-separator
  513. ----
  514. .. _class_Input_method_is_action_pressed:
  515. .. rst-class:: classref-method
  516. :ref:`bool<class_bool>` **is_action_pressed**\ (\ action\: :ref:`StringName<class_StringName>`, exact_match\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Input_method_is_action_pressed>`
  517. Returns ``true`` if you are pressing the action event.
  518. If ``exact_match`` is ``false``, it ignores additional input modifiers for :ref:`InputEventKey<class_InputEventKey>` and :ref:`InputEventMouseButton<class_InputEventMouseButton>` events, and the direction for :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>` events.
  519. \ **Note:** Due to keyboard ghosting, :ref:`is_action_pressed()<class_Input_method_is_action_pressed>` may return ``false`` even if one of the action's keys is pressed. See `Input examples <../tutorials/inputs/input_examples.html#keyboard-events>`__ in the documentation for more information.
  520. .. rst-class:: classref-item-separator
  521. ----
  522. .. _class_Input_method_is_anything_pressed:
  523. .. rst-class:: classref-method
  524. :ref:`bool<class_bool>` **is_anything_pressed**\ (\ ) |const| :ref:`🔗<class_Input_method_is_anything_pressed>`
  525. Returns ``true`` if any action, key, joypad button, or mouse button is being pressed. This will also return ``true`` if any action is simulated via code by calling :ref:`action_press()<class_Input_method_action_press>`.
  526. .. rst-class:: classref-item-separator
  527. ----
  528. .. _class_Input_method_is_joy_button_pressed:
  529. .. rst-class:: classref-method
  530. :ref:`bool<class_bool>` **is_joy_button_pressed**\ (\ device\: :ref:`int<class_int>`, button\: :ref:`JoyButton<enum_@GlobalScope_JoyButton>`\ ) |const| :ref:`🔗<class_Input_method_is_joy_button_pressed>`
  531. Returns ``true`` if you are pressing the joypad button at index ``button``.
  532. .. rst-class:: classref-item-separator
  533. ----
  534. .. _class_Input_method_is_joy_known:
  535. .. rst-class:: classref-method
  536. :ref:`bool<class_bool>` **is_joy_known**\ (\ device\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Input_method_is_joy_known>`
  537. Returns ``true`` if the system knows the specified device. This means that it sets all button and axis indices. Unknown joypads are not expected to match these constants, but you can still retrieve events from them.
  538. .. rst-class:: classref-item-separator
  539. ----
  540. .. _class_Input_method_is_key_label_pressed:
  541. .. rst-class:: classref-method
  542. :ref:`bool<class_bool>` **is_key_label_pressed**\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| :ref:`🔗<class_Input_method_is_key_label_pressed>`
  543. Returns ``true`` if you are pressing the key with the ``keycode`` printed on it. You can pass a :ref:`Key<enum_@GlobalScope_Key>` constant or any Unicode character code.
  544. .. rst-class:: classref-item-separator
  545. ----
  546. .. _class_Input_method_is_key_pressed:
  547. .. rst-class:: classref-method
  548. :ref:`bool<class_bool>` **is_key_pressed**\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| :ref:`🔗<class_Input_method_is_key_pressed>`
  549. Returns ``true`` if you are pressing the Latin key in the current keyboard layout. You can pass a :ref:`Key<enum_@GlobalScope_Key>` constant.
  550. \ :ref:`is_key_pressed()<class_Input_method_is_key_pressed>` is only recommended over :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>` in non-game applications. This ensures that shortcut keys behave as expected depending on the user's keyboard layout, as keyboard shortcuts are generally dependent on the keyboard layout in non-game applications. If in doubt, use :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>`.
  551. \ **Note:** Due to keyboard ghosting, :ref:`is_key_pressed()<class_Input_method_is_key_pressed>` may return ``false`` even if one of the action's keys is pressed. See `Input examples <../tutorials/inputs/input_examples.html#keyboard-events>`__ in the documentation for more information.
  552. .. rst-class:: classref-item-separator
  553. ----
  554. .. _class_Input_method_is_mouse_button_pressed:
  555. .. rst-class:: classref-method
  556. :ref:`bool<class_bool>` **is_mouse_button_pressed**\ (\ button\: :ref:`MouseButton<enum_@GlobalScope_MouseButton>`\ ) |const| :ref:`🔗<class_Input_method_is_mouse_button_pressed>`
  557. Returns ``true`` if you are pressing the mouse button specified with :ref:`MouseButton<enum_@GlobalScope_MouseButton>`.
  558. .. rst-class:: classref-item-separator
  559. ----
  560. .. _class_Input_method_is_physical_key_pressed:
  561. .. rst-class:: classref-method
  562. :ref:`bool<class_bool>` **is_physical_key_pressed**\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| :ref:`🔗<class_Input_method_is_physical_key_pressed>`
  563. Returns ``true`` if you are pressing the key in the physical location on the 101/102-key US QWERTY keyboard. You can pass a :ref:`Key<enum_@GlobalScope_Key>` constant.
  564. \ :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>` is recommended over :ref:`is_key_pressed()<class_Input_method_is_key_pressed>` for in-game actions, as it will make :kbd:`W`/:kbd:`A`/:kbd:`S`/:kbd:`D` layouts work regardless of the user's keyboard layout. :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>` will also ensure that the top row number keys work on any keyboard layout. If in doubt, use :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>`.
  565. \ **Note:** Due to keyboard ghosting, :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>` may return ``false`` even if one of the action's keys is pressed. See `Input examples <../tutorials/inputs/input_examples.html#keyboard-events>`__ in the documentation for more information.
  566. .. rst-class:: classref-item-separator
  567. ----
  568. .. _class_Input_method_parse_input_event:
  569. .. rst-class:: classref-method
  570. |void| **parse_input_event**\ (\ event\: :ref:`InputEvent<class_InputEvent>`\ ) :ref:`🔗<class_Input_method_parse_input_event>`
  571. Feeds an :ref:`InputEvent<class_InputEvent>` to the game. Can be used to artificially trigger input events from code. Also generates :ref:`Node._input()<class_Node_private_method__input>` calls.
  572. .. tabs::
  573. .. code-tab:: gdscript
  574. var cancel_event = InputEventAction.new()
  575. cancel_event.action = "ui_cancel"
  576. cancel_event.pressed = true
  577. Input.parse_input_event(cancel_event)
  578. .. code-tab:: csharp
  579. var cancelEvent = new InputEventAction();
  580. cancelEvent.Action = "ui_cancel";
  581. cancelEvent.Pressed = true;
  582. Input.ParseInputEvent(cancelEvent);
  583. \ **Note:** Calling this function has no influence on the operating system. So for example sending an :ref:`InputEventMouseMotion<class_InputEventMouseMotion>` will not move the OS mouse cursor to the specified position (use :ref:`warp_mouse()<class_Input_method_warp_mouse>` instead) and sending :kbd:`Alt/Cmd + Tab` as :ref:`InputEventKey<class_InputEventKey>` won't toggle between active windows.
  584. .. rst-class:: classref-item-separator
  585. ----
  586. .. _class_Input_method_remove_joy_mapping:
  587. .. rst-class:: classref-method
  588. |void| **remove_joy_mapping**\ (\ guid\: :ref:`String<class_String>`\ ) :ref:`🔗<class_Input_method_remove_joy_mapping>`
  589. Removes all mappings from the internal database that match the given GUID. All currently connected joypads that use this GUID will become unmapped.
  590. On Android, Godot will map to an internal fallback mapping.
  591. .. rst-class:: classref-item-separator
  592. ----
  593. .. _class_Input_method_set_accelerometer:
  594. .. rst-class:: classref-method
  595. |void| **set_accelerometer**\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Input_method_set_accelerometer>`
  596. Sets the acceleration value of the accelerometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.
  597. \ **Note:** This value can be immediately overwritten by the hardware sensor value on Android and iOS.
  598. .. rst-class:: classref-item-separator
  599. ----
  600. .. _class_Input_method_set_custom_mouse_cursor:
  601. .. rst-class:: classref-method
  602. |void| **set_custom_mouse_cursor**\ (\ image\: :ref:`Resource<class_Resource>`, shape\: :ref:`CursorShape<enum_Input_CursorShape>` = 0, hotspot\: :ref:`Vector2<class_Vector2>` = Vector2(0, 0)\ ) :ref:`🔗<class_Input_method_set_custom_mouse_cursor>`
  603. Sets a custom mouse cursor image, which is only visible inside the game window, for the given mouse ``shape``. The hotspot can also be specified. Passing ``null`` to the image parameter resets to the system cursor.
  604. \ ``image`` can be either :ref:`Texture2D<class_Texture2D>` or :ref:`Image<class_Image>` and its size must be lower than or equal to 256×256. To avoid rendering issues, sizes lower than or equal to 128×128 are recommended.
  605. \ ``hotspot`` must be within ``image``'s size.
  606. \ **Note:** :ref:`AnimatedTexture<class_AnimatedTexture>`\ s aren't supported as custom mouse cursors. If using an :ref:`AnimatedTexture<class_AnimatedTexture>`, only the first frame will be displayed.
  607. \ **Note:** The **Lossless**, **Lossy** or **Uncompressed** compression modes are recommended. The **Video RAM** compression mode can be used, but it will be decompressed on the CPU, which means loading times are slowed down and no memory is saved compared to lossless modes.
  608. \ **Note:** On the web platform, the maximum allowed cursor image size is 128×128. Cursor images larger than 32×32 will also only be displayed if the mouse cursor image is entirely located within the page for `security reasons <https://chromestatus.com/feature/5825971391299584>`__.
  609. .. rst-class:: classref-item-separator
  610. ----
  611. .. _class_Input_method_set_default_cursor_shape:
  612. .. rst-class:: classref-method
  613. |void| **set_default_cursor_shape**\ (\ shape\: :ref:`CursorShape<enum_Input_CursorShape>` = 0\ ) :ref:`🔗<class_Input_method_set_default_cursor_shape>`
  614. Sets the default cursor shape to be used in the viewport instead of :ref:`CURSOR_ARROW<class_Input_constant_CURSOR_ARROW>`.
  615. \ **Note:** If you want to change the default cursor shape for :ref:`Control<class_Control>`'s nodes, use :ref:`Control.mouse_default_cursor_shape<class_Control_property_mouse_default_cursor_shape>` instead.
  616. \ **Note:** This method generates an :ref:`InputEventMouseMotion<class_InputEventMouseMotion>` to update cursor immediately.
  617. .. rst-class:: classref-item-separator
  618. ----
  619. .. _class_Input_method_set_gravity:
  620. .. rst-class:: classref-method
  621. |void| **set_gravity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Input_method_set_gravity>`
  622. Sets the gravity value of the accelerometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.
  623. \ **Note:** This value can be immediately overwritten by the hardware sensor value on Android and iOS.
  624. .. rst-class:: classref-item-separator
  625. ----
  626. .. _class_Input_method_set_gyroscope:
  627. .. rst-class:: classref-method
  628. |void| **set_gyroscope**\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Input_method_set_gyroscope>`
  629. Sets the value of the rotation rate of the gyroscope sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.
  630. \ **Note:** This value can be immediately overwritten by the hardware sensor value on Android and iOS.
  631. .. rst-class:: classref-item-separator
  632. ----
  633. .. _class_Input_method_set_joy_light:
  634. .. rst-class:: classref-method
  635. :ref:`bool<class_bool>` **set_joy_light**\ (\ device\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_Input_method_set_joy_light>`
  636. Sets the joypad's LED light, if available, to the specified color. Returns ``true`` if the operation was successful. See also :ref:`has_joy_light()<class_Input_method_has_joy_light>`.
  637. \ **Note:** There is no way to get the color of the light from a joypad. If you need to know the assigned color, store it separately.
  638. \ **Note:** This feature is only supported on Windows, Linux, and macOS.
  639. .. rst-class:: classref-item-separator
  640. ----
  641. .. _class_Input_method_set_magnetometer:
  642. .. rst-class:: classref-method
  643. |void| **set_magnetometer**\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Input_method_set_magnetometer>`
  644. Sets the value of the magnetic field of the magnetometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.
  645. \ **Note:** This value can be immediately overwritten by the hardware sensor value on Android and iOS.
  646. .. rst-class:: classref-item-separator
  647. ----
  648. .. _class_Input_method_should_ignore_device:
  649. .. rst-class:: classref-method
  650. :ref:`bool<class_bool>` **should_ignore_device**\ (\ vendor_id\: :ref:`int<class_int>`, product_id\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Input_method_should_ignore_device>`
  651. Queries whether an input device should be ignored or not. Devices can be ignored by setting the environment variable ``SDL_GAMECONTROLLER_IGNORE_DEVICES``. Read the `SDL documentation <https://wiki.libsdl.org/SDL2>`__ for more information.
  652. \ **Note:** Some 3rd party tools can contribute to the list of ignored devices. For example, *SteamInput* creates virtual devices from physical devices for remapping purposes. To avoid handling the same input device twice, the original device is added to the ignore list.
  653. .. rst-class:: classref-item-separator
  654. ----
  655. .. _class_Input_method_start_joy_vibration:
  656. .. rst-class:: classref-method
  657. |void| **start_joy_vibration**\ (\ device\: :ref:`int<class_int>`, weak_magnitude\: :ref:`float<class_float>`, strong_magnitude\: :ref:`float<class_float>`, duration\: :ref:`float<class_float>` = 0\ ) :ref:`🔗<class_Input_method_start_joy_vibration>`
  658. Starts to vibrate the joypad. Joypads usually come with two rumble motors, a strong and a weak one. ``weak_magnitude`` is the strength of the weak motor (between 0 and 1) and ``strong_magnitude`` is the strength of the strong motor (between 0 and 1). ``duration`` is the duration of the effect in seconds (a duration of 0 will try to play the vibration indefinitely). The vibration can be stopped early by calling :ref:`stop_joy_vibration()<class_Input_method_stop_joy_vibration>`.
  659. \ **Note:** Not every hardware is compatible with long effect durations; it is recommended to restart an effect if it has to be played for more than a few seconds.
  660. \ **Note:** For macOS, vibration is only supported in macOS 11 and later.
  661. .. rst-class:: classref-item-separator
  662. ----
  663. .. _class_Input_method_stop_joy_vibration:
  664. .. rst-class:: classref-method
  665. |void| **stop_joy_vibration**\ (\ device\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Input_method_stop_joy_vibration>`
  666. Stops the vibration of the joypad started with :ref:`start_joy_vibration()<class_Input_method_start_joy_vibration>`.
  667. .. rst-class:: classref-item-separator
  668. ----
  669. .. _class_Input_method_vibrate_handheld:
  670. .. rst-class:: classref-method
  671. |void| **vibrate_handheld**\ (\ duration_ms\: :ref:`int<class_int>` = 500, amplitude\: :ref:`float<class_float>` = -1.0\ ) :ref:`🔗<class_Input_method_vibrate_handheld>`
  672. Vibrate the handheld device for the specified duration in milliseconds.
  673. \ ``amplitude`` is the strength of the vibration, as a value between ``0.0`` and ``1.0``. If set to ``-1.0``, the default vibration strength of the device is used.
  674. \ **Note:** This method is implemented on Android, iOS, and Web. It has no effect on other platforms.
  675. \ **Note:** For Android, :ref:`vibrate_handheld()<class_Input_method_vibrate_handheld>` requires enabling the ``VIBRATE`` permission in the export preset. Otherwise, :ref:`vibrate_handheld()<class_Input_method_vibrate_handheld>` will have no effect.
  676. \ **Note:** For iOS, specifying the duration is only supported in iOS 13 and later.
  677. \ **Note:** For Web, the amplitude cannot be changed.
  678. \ **Note:** Some web browsers such as Safari and Firefox for Android do not support :ref:`vibrate_handheld()<class_Input_method_vibrate_handheld>`.
  679. .. rst-class:: classref-item-separator
  680. ----
  681. .. _class_Input_method_warp_mouse:
  682. .. rst-class:: classref-method
  683. |void| **warp_mouse**\ (\ position\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_Input_method_warp_mouse>`
  684. Sets the mouse position to the specified vector, provided in pixels and relative to an origin at the upper left corner of the currently focused Window Manager game window.
  685. Mouse position is clipped to the limits of the screen resolution, or to the limits of the game window if :ref:`MouseMode<enum_Input_MouseMode>` is set to :ref:`MOUSE_MODE_CONFINED<class_Input_constant_MOUSE_MODE_CONFINED>` or :ref:`MOUSE_MODE_CONFINED_HIDDEN<class_Input_constant_MOUSE_MODE_CONFINED_HIDDEN>`.
  686. \ **Note:** :ref:`warp_mouse()<class_Input_method_warp_mouse>` is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.
  687. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  688. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  689. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  690. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  691. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  692. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  693. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  694. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  695. .. |void| replace:: :abbr:`void (No return value.)`