mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
1248 lines
91 KiB
ReStructuredText
1248 lines
91 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_Input:
|
||
|
||
Input
|
||
=====
|
||
|
||
**Eredita:** :ref:`Object<class_Object>`
|
||
|
||
Un singleton per gestire gli input.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Descrizione
|
||
----------------------
|
||
|
||
Il singleton **Input** gestisce la pressione dei tasti, i pulsanti e i movimenti del mouse, i gamepad e le azioni di input. È possibile impostare le azioni e i loro eventi nella scheda **Mappa di Input** in **Progetto > Impostazioni del progetto**, oppure con la classe :ref:`InputMap<class_InputMap>`.
|
||
|
||
\ **Nota:** I metodi di **Input** riflettono lo stato di input globale e non sono influenzati da :ref:`Control.accept_event()<class_Control_method_accept_event>` o :ref:`Viewport.set_input_as_handled()<class_Viewport_method_set_input_as_handled>`, poiché tali metodi si occupano solo del modo in cui gli input vengono propagati nello :ref:`SceneTree<class_SceneTree>`.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Tutorial
|
||
----------------
|
||
|
||
- :doc:`Indice della documentazione sugli input <../tutorials/inputs/index>`
|
||
|
||
- `Demo 2D "Dodge The Creeps" <https://godotengine.org/asset-library/asset/2712>`__
|
||
|
||
- `Demo di voxel 3D <https://godotengine.org/asset-library/asset/2755>`__
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Proprietà
|
||
------------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+----------------------------------------+--------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`emulate_mouse_from_touch<class_Input_property_emulate_mouse_from_touch>` |
|
||
+----------------------------------------+--------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`emulate_touch_from_mouse<class_Input_property_emulate_touch_from_mouse>` |
|
||
+----------------------------------------+--------------------------------------------------------------------------------+
|
||
| :ref:`MouseMode<enum_Input_MouseMode>` | :ref:`mouse_mode<class_Input_property_mouse_mode>` |
|
||
+----------------------------------------+--------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`use_accumulated_input<class_Input_property_use_accumulated_input>` |
|
||
+----------------------------------------+--------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Metodi
|
||
------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`action_press<class_Input_method_action_press>`\ (\ action\: :ref:`StringName<class_StringName>`, strength\: :ref:`float<class_float>` = 1.0\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`action_release<class_Input_method_action_release>`\ (\ action\: :ref:`StringName<class_StringName>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`add_joy_mapping<class_Input_method_add_joy_mapping>`\ (\ mapping\: :ref:`String<class_String>`, update_existing\: :ref:`bool<class_bool>` = false\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`flush_buffered_events<class_Input_method_flush_buffered_events>`\ (\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Vector3<class_Vector3>` | :ref:`get_accelerometer<class_Input_method_get_accelerometer>`\ (\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Array<class_Array>`\[:ref:`int<class_int>`\] | :ref:`get_connected_joypads<class_Input_method_get_connected_joypads>`\ (\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`CursorShape<enum_Input_CursorShape>` | :ref:`get_current_cursor_shape<class_Input_method_get_current_cursor_shape>`\ (\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Vector3<class_Vector3>` | :ref:`get_gravity<class_Input_method_get_gravity>`\ (\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Vector3<class_Vector3>` | :ref:`get_gyroscope<class_Input_method_get_gyroscope>`\ (\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`String<class_String>` | :ref:`get_joy_guid<class_Input_method_get_joy_guid>`\ (\ device\: :ref:`int<class_int>`\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Dictionary<class_Dictionary>` | :ref:`get_joy_info<class_Input_method_get_joy_info>`\ (\ device\: :ref:`int<class_int>`\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`String<class_String>` | :ref:`get_joy_name<class_Input_method_get_joy_name>`\ (\ device\: :ref:`int<class_int>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`float<class_float>` | :ref:`get_joy_vibration_duration<class_Input_method_get_joy_vibration_duration>`\ (\ device\: :ref:`int<class_int>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Vector2<class_Vector2>` | :ref:`get_joy_vibration_strength<class_Input_method_get_joy_vibration_strength>`\ (\ device\: :ref:`int<class_int>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Vector2<class_Vector2>` | :ref:`get_last_mouse_screen_velocity<class_Input_method_get_last_mouse_screen_velocity>`\ (\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Vector2<class_Vector2>` | :ref:`get_last_mouse_velocity<class_Input_method_get_last_mouse_velocity>`\ (\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Vector3<class_Vector3>` | :ref:`get_magnetometer<class_Input_method_get_magnetometer>`\ (\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |bitfield|\[:ref:`MouseButtonMask<enum_@GlobalScope_MouseButtonMask>`\] | :ref:`get_mouse_button_mask<class_Input_method_get_mouse_button_mask>`\ (\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`has_joy_light<class_Input_method_has_joy_light>`\ (\ device\: :ref:`int<class_int>`\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`is_anything_pressed<class_Input_method_is_anything_pressed>`\ (\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`is_joy_known<class_Input_method_is_joy_known>`\ (\ device\: :ref:`int<class_int>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`is_key_label_pressed<class_Input_method_is_key_label_pressed>`\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`is_key_pressed<class_Input_method_is_key_pressed>`\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`is_mouse_button_pressed<class_Input_method_is_mouse_button_pressed>`\ (\ button\: :ref:`MouseButton<enum_@GlobalScope_MouseButton>`\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`is_physical_key_pressed<class_Input_method_is_physical_key_pressed>`\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`parse_input_event<class_Input_method_parse_input_event>`\ (\ event\: :ref:`InputEvent<class_InputEvent>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`remove_joy_mapping<class_Input_method_remove_joy_mapping>`\ (\ guid\: :ref:`String<class_String>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_accelerometer<class_Input_method_set_accelerometer>`\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |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)\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_default_cursor_shape<class_Input_method_set_default_cursor_shape>`\ (\ shape\: :ref:`CursorShape<enum_Input_CursorShape>` = 0\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_gravity<class_Input_method_set_gravity>`\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_gyroscope<class_Input_method_set_gyroscope>`\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`set_joy_light<class_Input_method_set_joy_light>`\ (\ device\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_magnetometer<class_Input_method_set_magnetometer>`\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |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\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`stop_joy_vibration<class_Input_method_stop_joy_vibration>`\ (\ device\: :ref:`int<class_int>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`vibrate_handheld<class_Input_method_vibrate_handheld>`\ (\ duration_ms\: :ref:`int<class_int>` = 500, amplitude\: :ref:`float<class_float>` = -1.0\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`warp_mouse<class_Input_method_warp_mouse>`\ (\ position\: :ref:`Vector2<class_Vector2>`\ ) |
|
||
+-------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Segnali
|
||
--------------
|
||
|
||
.. _class_Input_signal_joy_connection_changed:
|
||
|
||
.. rst-class:: classref-signal
|
||
|
||
**joy_connection_changed**\ (\ device\: :ref:`int<class_int>`, connected\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_Input_signal_joy_connection_changed>`
|
||
|
||
Emesso quando un dispositivo joypad è stato collegato o scollegato.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Enumerazioni
|
||
------------------------
|
||
|
||
.. _enum_Input_MouseMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **MouseMode**: :ref:`🔗<enum_Input_MouseMode>`
|
||
|
||
.. _class_Input_constant_MOUSE_MODE_VISIBLE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_VISIBLE** = ``0``
|
||
|
||
Rende visibile il cursore del mouse se è nascosto.
|
||
|
||
.. _class_Input_constant_MOUSE_MODE_HIDDEN:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_HIDDEN** = ``1``
|
||
|
||
Nasconde il cursore del mouse se è visibile.
|
||
|
||
.. _class_Input_constant_MOUSE_MODE_CAPTURED:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_CAPTURED** = ``2``
|
||
|
||
Cattura il mouse. Il mouse sarà nascosto e la sua posizione sarà ristretta al centro della finestra del gestore delle finestre.
|
||
|
||
\ **Nota:** Se si desidera elaborare il movimento del mouse in questa modalità, bisogna usare :ref:`InputEventMouseMotion.relative<class_InputEventMouseMotion_property_relative>`.
|
||
|
||
.. _class_Input_constant_MOUSE_MODE_CONFINED:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_CONFINED** = ``3``
|
||
|
||
Restringe il cursore del mouse alla finestra del gioco e lo rende visibile.
|
||
|
||
.. _class_Input_constant_MOUSE_MODE_CONFINED_HIDDEN:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_CONFINED_HIDDEN** = ``4``
|
||
|
||
Restringe il cursore del mouse alla finestra del gioco e lo rende nascosto.
|
||
|
||
.. _class_Input_constant_MOUSE_MODE_MAX:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`MouseMode<enum_Input_MouseMode>` **MOUSE_MODE_MAX** = ``5``
|
||
|
||
Valore massimo di :ref:`MouseMode<enum_Input_MouseMode>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_Input_CursorShape:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **CursorShape**: :ref:`🔗<enum_Input_CursorShape>`
|
||
|
||
.. _class_Input_constant_CURSOR_ARROW:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_ARROW** = ``0``
|
||
|
||
Cursore a freccia. Cursore di puntamento standard e predefinito.
|
||
|
||
.. _class_Input_constant_CURSOR_IBEAM:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_IBEAM** = ``1``
|
||
|
||
Cursore a I. Solitamente utilizzato per mostrare dove apparirà il cursore di testo quando si clicca con il mouse.
|
||
|
||
.. _class_Input_constant_CURSOR_POINTING_HAND:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_POINTING_HAND** = ``2``
|
||
|
||
Cursore di mano che punta. Solitamente utilizzato quando il cursore passa sopra un collegamento o un altro elemento interattivo.
|
||
|
||
.. _class_Input_constant_CURSOR_CROSS:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_CROSS** = ``3``
|
||
|
||
Cursore a croce. Solitamente appare sulle regioni in cui è possibile eseguire un'operazione di disegno, o per le selezioni.
|
||
|
||
.. _class_Input_constant_CURSOR_WAIT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_WAIT** = ``4``
|
||
|
||
Cursore di attesa. Indica che l'applicazione è impegnata nell'esecuzione di un'operazione e che non può essere utilizzata durante l'operazione (ad esempio, qualcosa sta bloccando il suo thread principale).
|
||
|
||
.. _class_Input_constant_CURSOR_BUSY:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_BUSY** = ``5``
|
||
|
||
Cursore occupato. Indica che l'applicazione è impegnata nell'esecuzione di un'operazione e che è ancora utilizzabile durante l'operazione.
|
||
|
||
.. _class_Input_constant_CURSOR_DRAG:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_DRAG** = ``6``
|
||
|
||
Cursore di trascinamento. Solitamente visualizzato quando si trascina qualcosa.
|
||
|
||
\ **Nota:** Windows non ha un cursore di trascinamento, quindi :ref:`CURSOR_DRAG<class_Input_constant_CURSOR_DRAG>` è uguale a :ref:`CURSOR_MOVE<class_Input_constant_CURSOR_MOVE>` per questa piattaforma.
|
||
|
||
.. _class_Input_constant_CURSOR_CAN_DROP:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_CAN_DROP** = ``7``
|
||
|
||
Cursore di rilascio . Solitamente visualizzato quando si trascina qualcosa per indicare che può essere rilasciato nella posizione attuale.
|
||
|
||
.. _class_Input_constant_CURSOR_FORBIDDEN:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_FORBIDDEN** = ``8``
|
||
|
||
Cursore di divieto. Indica che l'azione attuale è proibita (ad esempio, quando si trascina qualcosa) o che il controllo in una posizione è disabilitato.
|
||
|
||
.. _class_Input_constant_CURSOR_VSIZE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_VSIZE** = ``9``
|
||
|
||
Cursore del mouse per il ridimensionamento verticale. Una freccia verticale a due punte. Indica all'utente che può ridimensionare la finestra o il pannello verticalmente.
|
||
|
||
.. _class_Input_constant_CURSOR_HSIZE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_HSIZE** = ``10``
|
||
|
||
Cursore del mouse per il ridimensionamento orizzontale. Una freccia orizzontale a due punte. Indica all'utente che può ridimensionare la finestra o il pannello orizzontalmente.
|
||
|
||
.. _class_Input_constant_CURSOR_BDIAGSIZE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_BDIAGSIZE** = ``11``
|
||
|
||
Cursore del mouse per ridimensionare la finestra. Il cursore è una freccia a due punte che va dal basso a sinistra all'alto a destra. Indica all'utente che può ridimensionare la finestra o il pannello sia orizzontalmente sia verticalmente.
|
||
|
||
.. _class_Input_constant_CURSOR_FDIAGSIZE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_FDIAGSIZE** = ``12``
|
||
|
||
Cursore del mouse per ridimensionare la finestra. Il cursore è una freccia a due punte che va dall'alto a sinistra al basso a destra, l'opposto di :ref:`CURSOR_BDIAGSIZE<class_Input_constant_CURSOR_BDIAGSIZE>`. Indica all'utente che può ridimensionare la finestra o il pannello sia orizzontalmente sia verticalmente.
|
||
|
||
.. _class_Input_constant_CURSOR_MOVE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_MOVE** = ``13``
|
||
|
||
Cursore di spostamento. Indica che qualcosa può essere spostato.
|
||
|
||
.. _class_Input_constant_CURSOR_VSPLIT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_VSPLIT** = ``14``
|
||
|
||
Cursore di separazione verticale. Su Windows, è identico a :ref:`CURSOR_VSIZE<class_Input_constant_CURSOR_VSIZE>`.
|
||
|
||
.. _class_Input_constant_CURSOR_HSPLIT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_HSPLIT** = ``15``
|
||
|
||
Cursore di separazione orizzontale. Su Windows, è identico a :ref:`CURSOR_HSIZE<class_Input_constant_CURSOR_HSIZE>`.
|
||
|
||
.. _class_Input_constant_CURSOR_HELP:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **CURSOR_HELP** = ``16``
|
||
|
||
Cursore di aiuto. Solitamente un punto interrogativo.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Descrizioni delle proprietà
|
||
------------------------------------------------------
|
||
|
||
.. _class_Input_property_emulate_mouse_from_touch:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **emulate_mouse_from_touch** :ref:`🔗<class_Input_property_emulate_mouse_from_touch>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_emulate_mouse_from_touch**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_emulating_mouse_from_touch**\ (\ )
|
||
|
||
Se ``true``, invia eventi di input del mouse quando si tocca o si scorre sul touchscreen. Vedi anche :ref:`ProjectSettings.input_devices/pointing/emulate_mouse_from_touch<class_ProjectSettings_property_input_devices/pointing/emulate_mouse_from_touch>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_property_emulate_touch_from_mouse:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **emulate_touch_from_mouse** :ref:`🔗<class_Input_property_emulate_touch_from_mouse>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_emulate_touch_from_mouse**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_emulating_touch_from_mouse**\ (\ )
|
||
|
||
Se ``true``, invia eventi di input touch quando si clicca o si trascina il mouse. Vedi anche :ref:`ProjectSettings.input_devices/pointing/emulate_touch_from_mouse<class_ProjectSettings_property_input_devices/pointing/emulate_touch_from_mouse>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_property_mouse_mode:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`MouseMode<enum_Input_MouseMode>` **mouse_mode** :ref:`🔗<class_Input_property_mouse_mode>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_mouse_mode**\ (\ value\: :ref:`MouseMode<enum_Input_MouseMode>`\ )
|
||
- :ref:`MouseMode<enum_Input_MouseMode>` **get_mouse_mode**\ (\ )
|
||
|
||
Controlla la modalità del mouse.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_property_use_accumulated_input:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **use_accumulated_input** :ref:`🔗<class_Input_property_use_accumulated_input>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_use_accumulated_input**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_using_accumulated_input**\ (\ )
|
||
|
||
Se ``true``, vengono accumulati gli eventi di input simili inviati dal sistema operativo. Quando l'accumulo di input è abilitato, tutti gli eventi di input generati durante un frame verranno uniti ed emessi quando il frame termina il rendering. Pertanto, questo limita il numero di chiamate al metodo di input al secondo al FPS di rendering.
|
||
|
||
L'accumulo di input può essere disabilitato per ottenere un input leggermente più preciso/reattivo a costo di un maggiore utilizzo della CPU. Nelle applicazioni in cui è necessario disegnare linee a mano libera, l'accumulo di input dovrebbe generalmente essere disabilitato mentre l'utente sta tracciando la linea per ottenere risultati che seguono più accuratamente l'input.
|
||
|
||
\ **Nota:** L'accumulo di input è *abilitato* per impostazione predefinita.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Descrizioni dei metodi
|
||
--------------------------------------------
|
||
|
||
.. _class_Input_method_action_press:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **action_press**\ (\ action\: :ref:`StringName<class_StringName>`, strength\: :ref:`float<class_float>` = 1.0\ ) :ref:`🔗<class_Input_method_action_press>`
|
||
|
||
Questo simulerà la pressione dell'azione specificata.
|
||
|
||
La forza può essere utilizzata per azioni non booleane, è compresa tra 0 e 1 e rappresenta l'intensità dell'azione specificata.
|
||
|
||
\ **Nota:** Questo metodo non causerà alcuna chiamata a :ref:`Node._input()<class_Node_private_method__input>`. È pensato per essere utilizzato con :ref:`is_action_pressed()<class_Input_method_is_action_pressed>` e :ref:`is_action_just_pressed()<class_Input_method_is_action_just_pressed>`. Se si desidera simulare ``_input``, usa invece :ref:`parse_input_event()<class_Input_method_parse_input_event>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_action_release:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **action_release**\ (\ action\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Input_method_action_release>`
|
||
|
||
Se l'azione specificata è già premuta, questo la rilascerà.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_add_joy_mapping:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **add_joy_mapping**\ (\ mapping\: :ref:`String<class_String>`, update_existing\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_Input_method_add_joy_mapping>`
|
||
|
||
Aggiunge una nuova voce di mappatura (in formato SDL2) al database di mappatura. Aggiorna facoltativamente i dispositivi già connessi.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_flush_buffered_events:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **flush_buffered_events**\ (\ ) :ref:`🔗<class_Input_method_flush_buffered_events>`
|
||
|
||
Invia tutti gli eventi di input che si trovano nel buffer attuale al ciclo di gioco. Questi eventi potrebbero essere stati bufferizzati come risultato di input accumulati (:ref:`use_accumulated_input<class_Input_property_use_accumulated_input>`) o di uno svuotamento agile degli input (:ref:`ProjectSettings.input_devices/buffering/agile_event_flushing<class_ProjectSettings_property_input_devices/buffering/agile_event_flushing>`).
|
||
|
||
Il motore lo farà già da solo nei punti di esecuzione importanti (almeno una volta per frame). Tuttavia, questo può essere utile in casi avanzati in cui si desidera un controllo preciso sulla tempistica della gestione degli eventi.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_accelerometer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Vector3<class_Vector3>` **get_accelerometer**\ (\ ) |const| :ref:`🔗<class_Input_method_get_accelerometer>`
|
||
|
||
Restituisce l'accelerazione in m/s² del sensore accelerometro del dispositivo, se il dispositivo ne ha uno. Altrimenti, il metodo restituisce :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
|
||
|
||
Nota che questo metodo restituisce un :ref:`Vector3<class_Vector3>` vuoto quando viene eseguito dall'editor anche quando il dispositivo ha un accelerometro. È necessario esportare il progetto su un dispositivo supportato per leggere i valori dall'accelerometro.
|
||
|
||
\ **Nota:** Questo metodo funziona solo su Android e iOS. Su altre piattaforme, restituisce sempre :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
|
||
|
||
\ **Nota:** Per Android, :ref:`ProjectSettings.input_devices/sensors/enable_accelerometer<class_ProjectSettings_property_input_devices/sensors/enable_accelerometer>` deve essere abilitato.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_action_raw_strength:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Restituisce un valore compreso tra 0 e 1 che rappresenta l'intensità grezza dell'azione fornita, ignorando la zona morta dell'azione. Nella maggior parte dei casi, dovresti invece usare :ref:`get_action_strength()<class_Input_method_get_action_strength>`.
|
||
|
||
Se ``exact_match`` è ``false``, ignora i modificatori aggiuntivi di input per gli eventi :ref:`InputEventKey<class_InputEventKey>` e :ref:`InputEventMouseButton<class_InputEventMouseButton>` e la direzione per gli eventi :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_action_strength:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Restituisce un valore compreso tra 0 e 1 che rappresenta l'intensità dell'azione fornita. In un joypad, ad esempio, più l'asse (stick analogici o i grilletti L2, R2) è lontano dalla zona morta, più il valore sarà vicino a 1. Se l'azione è mappata su un controllo che non ha asse, come la tastiera, il valore restituito sarà 0 o 1.
|
||
|
||
Se ``exact_match`` è ``false``, ignora i modificatori aggiuntivi di input per gli eventi :ref:`InputEventKey<class_InputEventKey>` e :ref:`InputEventMouseButton<class_InputEventMouseButton>` e la direzione per gli eventi :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_axis:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Ottiene l'input dell'asse specificando due azioni, una negativa e una positiva.
|
||
|
||
Questo è un'abbreviazione per scrivere ``Input.get_action_strength("positive_action") - Input.get_action_strength("negative_action")``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_connected_joypads:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Array<class_Array>`\[:ref:`int<class_int>`\] **get_connected_joypads**\ (\ ) :ref:`🔗<class_Input_method_get_connected_joypads>`
|
||
|
||
Restituisce un :ref:`Array<class_Array>` contenente gli ID di dispositivo di tutti i joypad attualmente connessi.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_current_cursor_shape:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`CursorShape<enum_Input_CursorShape>` **get_current_cursor_shape**\ (\ ) |const| :ref:`🔗<class_Input_method_get_current_cursor_shape>`
|
||
|
||
Restituisce la forma del cursore attualmente assegnata.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_gravity:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Vector3<class_Vector3>` **get_gravity**\ (\ ) |const| :ref:`🔗<class_Input_method_get_gravity>`
|
||
|
||
Restituisce la gravità in m/s² del sensore accelerometro del dispositivo, se il dispositivo ne ha uno. Altrimenti, il metodo restituisce :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
|
||
|
||
\ **Nota:** Questo metodo funziona solo su Android e iOS. Su altre piattaforme, restituisce sempre :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
|
||
|
||
\ **Nota:** Per Android, :ref:`ProjectSettings.input_devices/sensors/enable_gravity<class_ProjectSettings_property_input_devices/sensors/enable_gravity>` deve essere abilitato.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_gyroscope:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Vector3<class_Vector3>` **get_gyroscope**\ (\ ) |const| :ref:`🔗<class_Input_method_get_gyroscope>`
|
||
|
||
Restituisce la velocità di rotazione (in radianti al secondo) attorno agli assi X, Y e Z del sensore giroscopio di un dispositivo, se il dispositivo ne ha uno. Altrimenti, il metodo restituisce :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
|
||
|
||
\ **Nota:** Questo metodo funziona solo su Android e iOS. Su altre piattaforme, restituisce sempre :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
|
||
|
||
\ **Nota:** Per Android, :ref:`ProjectSettings.input_devices/sensors/enable_gyroscope<class_ProjectSettings_property_input_devices/sensors/enable_gyroscope>` deve essere abilitato.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_joy_axis:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Restituisce il valore attuale dell'asse del joypad all'indice [param axis).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_joy_guid:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`String<class_String>` **get_joy_guid**\ (\ device\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Input_method_get_joy_guid>`
|
||
|
||
Restituisce un GUID dispositivo compatibile con SDL2 su piattaforme che utilizzano la rimappatura del gamepad, ad esempio ``030000004c050000c405000000010000``. Restituisce una stringa vuota se non può essere trovato. Godot utilizza il `database dei controller di gioco SDL2 <https://github.com/gabomdq/SDL_GameControllerDB>`__ per determinare i nomi e le mappature dei gamepad in base a questo GUID.
|
||
|
||
Su Windows, tutti i GUID dei joypad XInput saranno sovrascritti da Godot in ``__XINPUT_DEVICE__``, perché le loro mappature sono le stesse.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_joy_info:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Dictionary<class_Dictionary>` **get_joy_info**\ (\ device\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Input_method_get_joy_info>`
|
||
|
||
Restituisce un dizionario con ulteriori informazioni sul dispositivo, specifiche per la piattaforma, ad esempio il nome grezzo del gamepad dal sistema operativo o l'indice per Steam Input.
|
||
|
||
Su Windows, Linux e macOS il dizionario contiene i seguenti campi:
|
||
|
||
\ ``raw_name``: Il nome del controller così come è stato fornito dall'OS, prima di essere rinominato dal database dei controller.
|
||
|
||
\ ``vendor_id``: L'ID fornitore USB del dispositivo.
|
||
|
||
\ ``product_id``: l'ID prodotto USB del dispositivo.
|
||
|
||
\ ``steam_input_index``: l'indice Steam Input del gamepad, se il dispositivo non è un dispositivo Steam Input questa chiave non sarà presente.
|
||
|
||
Su Windows, il dizionario può avere un ulteriore campo:
|
||
|
||
\ ``xinput_index``: l'indice del controller nel sistema XInput. Questa chiave non sarà presente sui dispositivi non gestiti da XInput.
|
||
|
||
\ **Nota:** Il dizionario restituito è sempre vuoto su Android, iOS, visionOS e Web.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_joy_name:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`String<class_String>` **get_joy_name**\ (\ device\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Input_method_get_joy_name>`
|
||
|
||
Restituisce il nome del joypad all'indice del dispositivo specificato, ad esempio ``PS4 Controller ``. Godot utilizza il `database dei controller di gioco SDL2 <https://github.com/gabomdq/SDL_GameControllerDB>`__ per determinare i nomi dei gamepad.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_joy_vibration_duration:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`float<class_float>` **get_joy_vibration_duration**\ (\ device\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Input_method_get_joy_vibration_duration>`
|
||
|
||
Restituisce la durata dell'effetto di vibrazione attuale in secondi.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_joy_vibration_strength:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Vector2<class_Vector2>` **get_joy_vibration_strength**\ (\ device\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Input_method_get_joy_vibration_strength>`
|
||
|
||
Restituisce l'intensità della vibrazione del joypad: x è l'intensità del motore debole e y è l'intensità del motore forte.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_last_mouse_screen_velocity:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Vector2<class_Vector2>` **get_last_mouse_screen_velocity**\ (\ ) :ref:`🔗<class_Input_method_get_last_mouse_screen_velocity>`
|
||
|
||
Restituisce l'ultima velocità del mouse in coordinate dello schermo. Per fornire una velocità precisa e senza tremolii, la velocità del mouse viene calcolata solo ogni 0,1 secondi. Pertanto, la velocità del mouse sarà in ritardo rispetto ai movimenti del mouse.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_last_mouse_velocity:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Vector2<class_Vector2>` **get_last_mouse_velocity**\ (\ ) :ref:`🔗<class_Input_method_get_last_mouse_velocity>`
|
||
|
||
Restituisce l'ultima velocità del mouse. Per fornire una velocità precisa e senza tremolii, la velocità del mouse viene calcolata solo ogni 0,1 secondi. Pertanto, la velocità del mouse sarà in ritardo rispetto ai movimenti del mouse.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_magnetometer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Vector3<class_Vector3>` **get_magnetometer**\ (\ ) |const| :ref:`🔗<class_Input_method_get_magnetometer>`
|
||
|
||
Restituisce l'intensità del campo magnetico in micro-Tesla per tutti gli assi del sensore magnetometrico del dispositivo, se il dispositivo ne ha uno. Altrimenti, il metodo restituisce :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
|
||
|
||
\ **Nota:** Questo metodo funziona solo su Android e iOS. Su altre piattaforme, restituisce sempre :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`.
|
||
|
||
\ **Nota:** Per Android, :ref:`ProjectSettings.input_devices/sensors/enable_magnetometer<class_ProjectSettings_property_input_devices/sensors/enable_magnetometer>` deve essere abilitato.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_mouse_button_mask:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|bitfield|\[:ref:`MouseButtonMask<enum_@GlobalScope_MouseButtonMask>`\] **get_mouse_button_mask**\ (\ ) |const| :ref:`🔗<class_Input_method_get_mouse_button_mask>`
|
||
|
||
Restituisce i pulsanti del mouse come maschera di bit. Se vengono premuti più pulsanti del mouse allo stesso tempo, i bit vengono sommati. Equivale a :ref:`DisplayServer.mouse_get_button_state()<class_DisplayServer_method_mouse_get_button_state>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_get_vector:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Ottiene un vettore di input specificando quattro azioni per gli assi X e Y positivi e negativi.
|
||
|
||
Questo metodo è utile quando si ottiene un input vettoriale, ad esempio da un joystick, un pad direzionale, frecce o WASD. Il vettore ha una lunghezza limitata a 1 e ha una zona morta circolare, il che lo rende utile per il movimento.
|
||
|
||
Per impostazione predefinita, la zona morta viene calcolata automaticamente dalla media delle zone morte delle azioni. Tuttavia, è possibile sovrascrivere la zona morta in modo che sia qualsiasi valore si desidera (nell'intervallo da 0 a 1).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_has_joy_light:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **has_joy_light**\ (\ device\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Input_method_has_joy_light>`
|
||
|
||
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>`.
|
||
|
||
\ **Note:** This feature is only supported on Windows, Linux, and macOS.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_action_just_pressed:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
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.
|
||
|
||
This is useful for code that needs to run only once when an action is pressed, instead of every frame while it's pressed.
|
||
|
||
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.
|
||
|
||
\ **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.
|
||
|
||
\ **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.
|
||
|
||
\ **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>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_action_just_pressed_by_event:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Restituisce ``true`` quando l'utente ha *iniziato* a premere l'evento d'azione nel frame o nel tick di fisica attuale. Restituirà ``true`` solo sul frame o sul tick in cui l'utente ha premuto il pulsante.
|
||
|
||
Questo è utile per codice che bisogna eseguire solo una volta quando viene premuta un'azione, anziché a ogni frame mentre viene premuta.
|
||
|
||
Se ``exact_match`` è ``false``, ignora i modificatori aggiuntivi di input per gli eventi :ref:`InputEventKey<class_InputEventKey>` e :ref:`InputEventMouseButton<class_InputEventMouseButton>` e la direzione per gli eventi :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>`.
|
||
|
||
\ **Nota:** Restituire ``true`` non significa che l'azione sia *ancora* premuta. Un'azione può essere premuta e rilasciata di nuovo rapidamente e ``true`` verrà comunque restituito per non perdere gli input.
|
||
|
||
\ **Nota:** A causa di ghosting per le tastiere, :ref:`is_action_just_pressed()<class_Input_method_is_action_just_pressed>` potrebbe restituire ``false`` anche se viene premuto uno dei tasti dell'azione. Consulta `Esempi di input <../tutorials/inputs/input_examples.html#keyboard-events>`__ nella documentazione per maggiori informazioni.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_action_just_released:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
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.
|
||
|
||
\ **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.
|
||
|
||
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.
|
||
|
||
\ **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>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_action_just_released_by_event:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Restituisce ``true`` quando l'utente ha *finito* di premere l'evento azione nel frame o nel tick di fisica attuale, e il primo evento che ha attivato il rilascio dell'azione nel frame/tick di fisica attuale è stato ``event``. Restituirà ``true`` solo sul frame o sul tick in cui l'utente ha rilasciato il pulsante.
|
||
|
||
Ciò è utile quando un'azione è elaborata durante la gestione degli input (ad esempio :ref:`Node._input()<class_Node_private_method__input>`).
|
||
|
||
\ **Nota:** Restituire ``true`` non significa che l'azione non sia *ancora* premuta. Un'azione può essere premuta e rilasciata di nuovo rapidamente e ``true`` verrà comunque restituito per non perdere gli input.
|
||
|
||
Se ``exact_match`` è ``false``, ignora i modificatori aggiuntivi di input per gli eventi :ref:`InputEventKey<class_InputEventKey>` e :ref:`InputEventMouseButton<class_InputEventMouseButton>` e la direzione per gli eventi :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_action_pressed:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Restituisce ``true`` se si preme l'evento d'azione.
|
||
|
||
Se ``exact_match`` è ``false``, ignora i modificatori aggiuntivi di input per gli eventi :ref:`InputEventKey<class_InputEventKey>` e :ref:`InputEventMouseButton<class_InputEventMouseButton>` e la direzione per gli eventi :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>`.
|
||
|
||
\ **Nota:** A causa di ghosting per le tastiere, :ref:`is_action_just_pressed()<class_Input_method_is_action_just_pressed>` potrebbe restituire ``false`` anche se viene premuto uno dei tasti dell'azione. Consulta `Esempi di input <../tutorials/inputs/input_examples.html#keyboard-events>`__ nella documentazione per maggiori informazioni.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_anything_pressed:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **is_anything_pressed**\ (\ ) |const| :ref:`🔗<class_Input_method_is_anything_pressed>`
|
||
|
||
Restituisce ``true`` se è premuto una qualsiasi azione, tasto, pulsante del joypad o pulsante del mouse. Restituirà anche ``true`` se un'azione è simulata tramite codice chiamando :ref:`action_press()<class_Input_method_action_press>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_joy_button_pressed:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Restituisce ``true`` se è premuto il pulsante del joypad all'indice ``button``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_joy_known:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **is_joy_known**\ (\ device\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Input_method_is_joy_known>`
|
||
|
||
Restituisce ``true`` se il sistema riconosce il dispositivo specificato. Ciò significa che imposta tutti gli indici dei pulsanti e degli assi. Non è previsto che i joypad sconosciuti corrispondano a queste costanti, ma è comunque possibile recuperare eventi da essi.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_key_label_pressed:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **is_key_label_pressed**\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| :ref:`🔗<class_Input_method_is_key_label_pressed>`
|
||
|
||
Restituisce ``true`` se è premuto un tasto con il ``keycode`` stampato su di esso. È possibile passare una constante :ref:`Key<enum_@GlobalScope_Key>` o qualsiasi codice di carattere Unicode.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_key_pressed:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **is_key_pressed**\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| :ref:`🔗<class_Input_method_is_key_pressed>`
|
||
|
||
Restituisce ``true`` se si sta premendo il tasto latino nel layout di tastiera attuale. È possibile passare una costante di :ref:`Key<enum_@GlobalScope_Key>`.
|
||
|
||
\ :ref:`is_key_pressed()<class_Input_method_is_key_pressed>` è consigliato solo rispetto a :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>` in applicazioni non di gioco. Ciò garantisce che i tasti di scelta rapida si comportino come previsto a seconda del layout di tastiera dell'utente, poiché i tasti di scelta rapida dipendono generalmente dal layout di tastiera in applicazioni non di gioco. In caso di dubbi, usa :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>`.
|
||
|
||
\ **Nota:** A causa del ghosting delle tastiere, :ref:`is_action_just_pressed()<class_Input_method_is_action_just_pressed>` potrebbe restituire ``false`` anche se viene premuto uno dei tasti dell'azione. Consulta `Esempi di input <../tutorials/inputs/input_examples.html#keyboard-events>`__ nella documentazione per maggiori informazioni.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_mouse_button_pressed:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **is_mouse_button_pressed**\ (\ button\: :ref:`MouseButton<enum_@GlobalScope_MouseButton>`\ ) |const| :ref:`🔗<class_Input_method_is_mouse_button_pressed>`
|
||
|
||
Restituisce ``true`` se è premuto il pulsante del mouse specificato con :ref:`MouseButton<enum_@GlobalScope_MouseButton>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_is_physical_key_pressed:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **is_physical_key_pressed**\ (\ keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |const| :ref:`🔗<class_Input_method_is_physical_key_pressed>`
|
||
|
||
Restituisce ``true`` se si sta premendo il tasto nella posizione fisica sulla tastiera QWERTY statunitense a 101/102 tasti. È possibile passare una costante di :ref:`Key<enum_@GlobalScope_Key>`.
|
||
|
||
\ :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>` è consigliato rispetto a :ref:`is_key_pressed()<class_Input_method_is_key_pressed>` per le azioni di gioco, poiché farà funzionare i layout :kbd:`W`/:kbd:`A`/:kbd:`S`/:kbd:`D` a prescindere dal layout della tastiera dell'utente. :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>` garantirà inoltre che i tasti numerici della riga superiore funzionino su qualsiasi layout di tastiera. In caso di dubbi, usa :ref:`is_physical_key_pressed()<class_Input_method_is_physical_key_pressed>`.
|
||
|
||
\ **Nota:** A causa del ghosting delle tastiere, :ref:`is_action_just_pressed()<class_Input_method_is_action_just_pressed>` potrebbe restituire ``false`` anche se viene premuto uno dei tasti dell'azione. Consulta `Esempi di input <../tutorials/inputs/input_examples.html#keyboard-events>`__ nella documentazione per maggiori informazioni.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_parse_input_event:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **parse_input_event**\ (\ event\: :ref:`InputEvent<class_InputEvent>`\ ) :ref:`🔗<class_Input_method_parse_input_event>`
|
||
|
||
Fornisce un :ref:`InputEvent<class_InputEvent>` al gioco. Può essere utilizzato per attivare artificialmente eventi di input da codice. Genera anche chiamate a :ref:`Node._input()<class_Node_private_method__input>`.
|
||
|
||
|
||
.. tabs::
|
||
|
||
.. code-tab:: gdscript
|
||
|
||
var cancel_event = InputEventAction.new()
|
||
cancel_event.action = "ui_cancel"
|
||
cancel_event.pressed = true
|
||
Input.parse_input_event(cancel_event)
|
||
|
||
.. code-tab:: csharp
|
||
|
||
var cancelEvent = new InputEventAction();
|
||
cancelEvent.Action = "ui_cancel";
|
||
cancelEvent.Pressed = true;
|
||
Input.ParseInputEvent(cancelEvent);
|
||
|
||
|
||
|
||
\ **Nota:** Chiamare questa funzione non influenza il sistema operativo. Ad esempio, l'invio di un :ref:`InputEventMouseMotion<class_InputEventMouseMotion>` non sposterà il cursore del mouse del sistema operativo nella posizione specificata (usa invece :ref:`warp_mouse()<class_Input_method_warp_mouse>`) e l'invio di :kbd:`Alt/Cmd + Tab` come :ref:`InputEventKey<class_InputEventKey>` non consentirà di alternare le finestre attive.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_remove_joy_mapping:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **remove_joy_mapping**\ (\ guid\: :ref:`String<class_String>`\ ) :ref:`🔗<class_Input_method_remove_joy_mapping>`
|
||
|
||
Rimuove tutte le mappature dal database interno che corrispondono al GUID specificato. Tutti i joypad attualmente connessi che utilizzano questo GUID diventeranno non mappati.
|
||
|
||
Su Android, Godot mapperà una mappatura interna di riserva.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_set_accelerometer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_accelerometer**\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Input_method_set_accelerometer>`
|
||
|
||
Imposta il valore di accelerazione del sensore accelerometro. Può essere utilizzato per il debug su dispositivi senza sensore, ad esempio in un editor su un PC.
|
||
|
||
\ **Nota:** Questo valore può essere immediatamente sovrascritto dal valore del sensore su Android e iOS.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_set_custom_mouse_cursor:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|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>`
|
||
|
||
Imposta un'immagine personalizzata per il cursore del mouse, visibile solo all'interno della finestra di gioco. È anche possibile specificare il punto dove è centrata l'immagine. Passando ``null`` al parametro dell'immagine si reimposta il cursore del sistema.
|
||
|
||
\ ``image`` può essere :ref:`Texture2D<class_Texture2D>` o :ref:`Image<class_Image>` e la sua dimensione deve essere inferiore o uguale a 256×256. Per evitare problemi di rendering, si consigliano dimensioni inferiori o uguali a 128×128.
|
||
|
||
\ ``hotspot`` deve essere all'interno della dimensione di ``image``.
|
||
|
||
\ **Nota:** Le :ref:`AnimatedTexture<class_AnimatedTexture>` non sono supportate come cursori del mouse personalizzati. Se si utilizza una :ref:`AnimatedTexture<class_AnimatedTexture>`, verrà visualizzato solo il primo fotogramma.
|
||
|
||
\ **Nota:** Sono consigliate le modalità di compressione **Lossless**, **Lossy** o **Uncompressed**. È possibile utilizzare la modalità di compressione **Video RAM**, ma sarà decompressa sulla CPU, il che significa che i tempi di caricamento saranno rallentati e memoria non sarà risparmiata rispetto alle modalità lossless.
|
||
|
||
\ **Nota:** Sulla piattaforma web, le dimensioni massime consentite per l'immagine del cursore sono 128×128. Le immagini del cursore più grandi di 32×32 saranno visualizzate solo se l'immagine del cursore del mouse si trova interamente all'interno della pagina per `motivi di sicurezza <https://chromestatus.com/feature/5825971391299584>`__.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_set_default_cursor_shape:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_default_cursor_shape**\ (\ shape\: :ref:`CursorShape<enum_Input_CursorShape>` = 0\ ) :ref:`🔗<class_Input_method_set_default_cursor_shape>`
|
||
|
||
Imposta la forma predefinita del cursore da utilizzare nella viewport invece di :ref:`CURSOR_ARROW<class_Input_constant_CURSOR_ARROW>`.
|
||
|
||
\ **Nota:** Se si desidera modificare la forma predefinita del cursore per i nodi :ref:`Control<class_Control>`, usa invece :ref:`Control.mouse_default_cursor_shape<class_Control_property_mouse_default_cursor_shape>`.
|
||
|
||
\ **Nota:** Questo metodo genera un :ref:`InputEventMouseMotion<class_InputEventMouseMotion>` per aggiornare immediatamente il cursore.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_set_gravity:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_gravity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Input_method_set_gravity>`
|
||
|
||
Imposta il valore di gravità del sensore accelerometro. Può essere utilizzato per il debug su dispositivi senza sensore, ad esempio in un editor su un PC.
|
||
|
||
\ **Nota:** Questo valore può essere immediatamente sovrascritto dal valore del sensore su Android e iOS.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_set_gyroscope:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_gyroscope**\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Input_method_set_gyroscope>`
|
||
|
||
Imposta il valore della velocità di rotazione del sensore giroscopio. Può essere utilizzato per il debug su dispositivi senza sensore, ad esempio in un editor su un PC.
|
||
|
||
\ **Nota:** Questo valore può essere immediatamente sovrascritto dal valore del sensore su Android e iOS.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_set_joy_light:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **set_joy_light**\ (\ device\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_Input_method_set_joy_light>`
|
||
|
||
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>`.
|
||
|
||
\ **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.
|
||
|
||
\ **Note:** This feature is only supported on Windows, Linux, and macOS.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_set_magnetometer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_magnetometer**\ (\ value\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Input_method_set_magnetometer>`
|
||
|
||
Imposta il valore del campo magnetico del sensore magnetometro. Può essere utilizzato per il debug su dispositivi senza sensore, ad esempio in un editor su un PC.
|
||
|
||
\ **Nota:** Questo valore può essere immediatamente sovrascritto dal valore del sensore su Android e iOS.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_should_ignore_device:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Richiede se un dispositivo di input deve essere ignorato o meno. È possibile ignorare i dispositivi impostando la variabile di ambiente ``SDL_GAMECONTROLLER_IGNORE_DEVICES``. Leggi la `documentazione SDL <https://wiki.libsdl.org/SDL2>`__ per maggiori informazioni.
|
||
|
||
\ **Nota:** Alcuni strumenti di terze parti possono contribuire all'elenco dei dispositivi ignorati. Ad esempio, *SteamInput* crea dispositivi virtuali da dispositivi fisici per scopi di rimappatura. Per evitare di gestire lo stesso dispositivo di input due volte, il dispositivo originale è aggiunto all'elenco di quelli ignorati.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_start_joy_vibration:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|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>`
|
||
|
||
Inizia a far vibrare il joypad. I joypad solitamente sono dotati di due motori di vibrazione, uno forte e uno debole. ``weak_magnitude`` è l'intensità del motore debole (tra 0 e 1) e ``strong_magnitude`` è l'intensità del motore forte (tra 0 e 1). ``duration`` è la durata dell'effetto in secondi (una durata di 0 proverà a riprodurre la vibrazione indefinitamente). La vibrazione può essere interrotta in anticipo chiamando :ref:`stop_joy_vibration()<class_Input_method_stop_joy_vibration>`.
|
||
|
||
\ **Nota:** Non tutti gli hardware sono compatibili con lunghe durate degli effetti; si consiglia di riavviare un effetto se deve essere riprodotto per più di qualche secondo.
|
||
|
||
\ **Nota:** Per macOS, la vibrazione è supportata solo in macOS 11 e versioni successive.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_stop_joy_vibration:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **stop_joy_vibration**\ (\ device\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Input_method_stop_joy_vibration>`
|
||
|
||
Arresta la vibrazione del joypad avviata con :ref:`start_joy_vibration()<class_Input_method_start_joy_vibration>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_vibrate_handheld:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **vibrate_handheld**\ (\ duration_ms\: :ref:`int<class_int>` = 500, amplitude\: :ref:`float<class_float>` = -1.0\ ) :ref:`🔗<class_Input_method_vibrate_handheld>`
|
||
|
||
Vibra il dispositivo portatile per la durata specificata in millisecondi.
|
||
|
||
\ ``amplitude`` è l'intensità della vibrazione, come valore compreso tra ``0.0`` e ``1.0``. Se impostato su ``-1.0``, viene utilizzata l'intensità di vibrazione predefinita del dispositivo.
|
||
|
||
\ **Nota:** Questo metodo è implementato su Android, iOS e Web. Non ha effetto su altre piattaforme.
|
||
|
||
\ **Nota:** Per Android, :ref:`vibrate_handheld()<class_Input_method_vibrate_handheld>` richiede di abilitare l'autorizzazione ``VIBRATE`` nella preimpostazione d'esportazione. Altrimenti, :ref:`vibrate_handheld()<class_Input_method_vibrate_handheld>` non avrà effetto.
|
||
|
||
\ **Nota:** Per iOS, la specifica della durata è supportata solo in iOS 13 e versioni successive.
|
||
|
||
\ **Nota:** Per Web, l'intensità non può essere modificata.
|
||
|
||
\ **Nota:** Alcuni browser web come Safari e Firefox per Android non supportano :ref:`vibrate_handheld()<class_Input_method_vibrate_handheld>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Input_method_warp_mouse:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **warp_mouse**\ (\ position\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_Input_method_warp_mouse>`
|
||
|
||
Imposta la posizione del mouse sul vettore specificato, fornito in pixel e relativo a un'origine nell'angolo in alto a sinistra della finestra di gioco attualmente focalizzata.
|
||
|
||
La posizione del mouse viene ritagliata ai limiti della risoluzione dello schermo o ai limiti della finestra di gioco se :ref:`MouseMode<enum_Input_MouseMode>` è impostato su :ref:`MOUSE_MODE_CONFINED<class_Input_constant_MOUSE_MODE_CONFINED>` o :ref:`MOUSE_MODE_CONFINED_HIDDEN<class_Input_constant_MOUSE_MODE_CONFINED_HIDDEN>`.
|
||
|
||
\ **Nota:** :ref:`warp_mouse()<class_Input_method_warp_mouse>` è supportato solo su Windows, macOS e Linux. Non ha effetto su Android, iOS e Web.
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (Questo metodo dovrebbe solitamente essere sovrascritto dall'utente per aver un effetto.)`
|
||
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
||
.. |const| replace:: :abbr:`const (Questo metodo non ha effetti collaterali. Non modifica alcuna variabile appartenente all'istanza.)`
|
||
.. |vararg| replace:: :abbr:`vararg (Questo metodo accetta qualsiasi numero di argomenti oltre a quelli descritti qui.)`
|
||
.. |constructor| replace:: :abbr:`constructor (Questo metodo è utilizzato per creare un tipo.)`
|
||
.. |static| replace:: :abbr:`static (Questo metodo non necessita di alcun'istanza per essere chiamato, quindi può essere chiamato direttamente usando il nome della classe.)`
|
||
.. |operator| replace:: :abbr:`operator (Questo metodo descrive un operatore valido da usare con questo tipo come operando di sinistra.)`
|
||
.. |bitfield| replace:: :abbr:`BitField (Questo valore è un intero composto da una maschera di bit dei seguenti flag.)`
|
||
.. |void| replace:: :abbr:`void (Nessun valore restituito.)`
|