mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-02 21:48:52 +03:00
309 lines
12 KiB
ReStructuredText
309 lines
12 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_TouchScreenButton:
|
|
|
|
TouchScreenButton
|
|
=================
|
|
|
|
**Eredita:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
|
|
|
Pulsante per dispositivi touch screen per l'utilizzo nel gioco.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Descrizione
|
|
----------------------
|
|
|
|
TouchScreenButton consente di creare pulsanti sullo schermo per dispositivi touch. È pensato per l'uso nel gameplay, come un'unità che bisogna toccare per muoversi. A differenza di :ref:`Button<class_Button>`, TouchScreenButton supporta il multitouch pronto all'uso. È possibile premere più TouchScreenButton allo stesso tempo con gli input di tocco.
|
|
|
|
Questo nodo eredita da :ref:`Node2D<class_Node2D>`. A differenza dei nodi :ref:`Control<class_Control>`, non è possibile impostare ancore su di esso. Se vuoi creare menu o interfacce utente, potresti voler usare i nodi :ref:`Button<class_Button>`. Per far reagire i nodi pulsante agli eventi di tocco, puoi abilitare :ref:`ProjectSettings.input_devices/pointing/emulate_mouse_from_touch<class_ProjectSettings_property_input_devices/pointing/emulate_mouse_from_touch>` nelle Impostazioni del progetto.
|
|
|
|
Puoi configurare TouchScreenButton in modo che sia visibile solo sui dispositivi touch, aiutandoti a sviluppare il tuo gioco sia per i desktop sia per i dispositivi mobili.
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Proprietà
|
|
------------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
|
|
| :ref:`String<class_String>` | :ref:`action<class_TouchScreenButton_property_action>` | ``""`` |
|
|
+--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
|
|
| :ref:`BitMap<class_BitMap>` | :ref:`bitmask<class_TouchScreenButton_property_bitmask>` | |
|
|
+--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
|
|
| :ref:`bool<class_bool>` | :ref:`passby_press<class_TouchScreenButton_property_passby_press>` | ``false`` |
|
|
+--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
|
|
| :ref:`Shape2D<class_Shape2D>` | :ref:`shape<class_TouchScreenButton_property_shape>` | |
|
|
+--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
|
|
| :ref:`bool<class_bool>` | :ref:`shape_centered<class_TouchScreenButton_property_shape_centered>` | ``true`` |
|
|
+--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
|
|
| :ref:`bool<class_bool>` | :ref:`shape_visible<class_TouchScreenButton_property_shape_visible>` | ``true`` |
|
|
+--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`texture_normal<class_TouchScreenButton_property_texture_normal>` | |
|
|
+--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`texture_pressed<class_TouchScreenButton_property_texture_pressed>` | |
|
|
+--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
|
|
| :ref:`VisibilityMode<enum_TouchScreenButton_VisibilityMode>` | :ref:`visibility_mode<class_TouchScreenButton_property_visibility_mode>` | ``0`` |
|
|
+--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Metodi
|
|
------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-------------------------+----------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_pressed<class_TouchScreenButton_method_is_pressed>`\ (\ ) |const| |
|
|
+-------------------------+----------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Segnali
|
|
--------------
|
|
|
|
.. _class_TouchScreenButton_signal_pressed:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**pressed**\ (\ ) :ref:`🔗<class_TouchScreenButton_signal_pressed>`
|
|
|
|
Emesso quando il pulsante viene premuto.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_TouchScreenButton_signal_released:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**released**\ (\ ) :ref:`🔗<class_TouchScreenButton_signal_released>`
|
|
|
|
Emesso quando il pulsante viene rilasciato.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Enumerazioni
|
|
------------------------
|
|
|
|
.. _enum_TouchScreenButton_VisibilityMode:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **VisibilityMode**: :ref:`🔗<enum_TouchScreenButton_VisibilityMode>`
|
|
|
|
.. _class_TouchScreenButton_constant_VISIBILITY_ALWAYS:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`VisibilityMode<enum_TouchScreenButton_VisibilityMode>` **VISIBILITY_ALWAYS** = ``0``
|
|
|
|
Sempre visibile.
|
|
|
|
.. _class_TouchScreenButton_constant_VISIBILITY_TOUCHSCREEN_ONLY:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`VisibilityMode<enum_TouchScreenButton_VisibilityMode>` **VISIBILITY_TOUCHSCREEN_ONLY** = ``1``
|
|
|
|
Visibile solo sui touchscreen.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descrizioni delle proprietà
|
|
------------------------------------------------------
|
|
|
|
.. _class_TouchScreenButton_property_action:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`String<class_String>` **action** = ``""`` :ref:`🔗<class_TouchScreenButton_property_action>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_action**\ (\ value\: :ref:`String<class_String>`\ )
|
|
- :ref:`String<class_String>` **get_action**\ (\ )
|
|
|
|
L'azione del pulsante. Le azioni possono essere gestite con :ref:`InputEventAction<class_InputEventAction>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_TouchScreenButton_property_bitmask:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`BitMap<class_BitMap>` **bitmask** :ref:`🔗<class_TouchScreenButton_property_bitmask>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_bitmask**\ (\ value\: :ref:`BitMap<class_BitMap>`\ )
|
|
- :ref:`BitMap<class_BitMap>` **get_bitmask**\ (\ )
|
|
|
|
La maschera di bit del pulsante.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_TouchScreenButton_property_passby_press:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **passby_press** = ``false`` :ref:`🔗<class_TouchScreenButton_property_passby_press>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_passby_press**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :ref:`bool<class_bool>` **is_passby_press_enabled**\ (\ )
|
|
|
|
Se ``true``, i segnali :ref:`pressed<class_TouchScreenButton_signal_pressed>` e :ref:`released<class_TouchScreenButton_signal_released>` sono emessi ogni volta che un dito premuto entra ed esce dal pulsante, anche se la pressione è iniziata all'esterno dell'area attiva del pulsante.
|
|
|
|
\ **Nota:** Questa è una modalità di pressione "pass-by" (non "bypass").
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_TouchScreenButton_property_shape:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Shape2D<class_Shape2D>` **shape** :ref:`🔗<class_TouchScreenButton_property_shape>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_shape**\ (\ value\: :ref:`Shape2D<class_Shape2D>`\ )
|
|
- :ref:`Shape2D<class_Shape2D>` **get_shape**\ (\ )
|
|
|
|
La forma del pulsante.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_TouchScreenButton_property_shape_centered:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **shape_centered** = ``true`` :ref:`🔗<class_TouchScreenButton_property_shape_centered>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_shape_centered**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :ref:`bool<class_bool>` **is_shape_centered**\ (\ )
|
|
|
|
Se ``true``, la forma del pulsante è centrata nella texture fornita. Se nessuna texture è utilizzata, questa proprietà non ha effetto.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_TouchScreenButton_property_shape_visible:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **shape_visible** = ``true`` :ref:`🔗<class_TouchScreenButton_property_shape_visible>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_shape_visible**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :ref:`bool<class_bool>` **is_shape_visible**\ (\ )
|
|
|
|
Se ``true``, la forma del pulsante è visibile nell'editor.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_TouchScreenButton_property_texture_normal:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **texture_normal** :ref:`🔗<class_TouchScreenButton_property_texture_normal>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_texture_normal**\ (\ value\: :ref:`Texture2D<class_Texture2D>`\ )
|
|
- :ref:`Texture2D<class_Texture2D>` **get_texture_normal**\ (\ )
|
|
|
|
La texture del pulsante per lo stato normale.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_TouchScreenButton_property_texture_pressed:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **texture_pressed** :ref:`🔗<class_TouchScreenButton_property_texture_pressed>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_texture_pressed**\ (\ value\: :ref:`Texture2D<class_Texture2D>`\ )
|
|
- :ref:`Texture2D<class_Texture2D>` **get_texture_pressed**\ (\ )
|
|
|
|
La texture del pulsante per lo stato premuto.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_TouchScreenButton_property_visibility_mode:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`VisibilityMode<enum_TouchScreenButton_VisibilityMode>` **visibility_mode** = ``0`` :ref:`🔗<class_TouchScreenButton_property_visibility_mode>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_visibility_mode**\ (\ value\: :ref:`VisibilityMode<enum_TouchScreenButton_VisibilityMode>`\ )
|
|
- :ref:`VisibilityMode<enum_TouchScreenButton_VisibilityMode>` **get_visibility_mode**\ (\ )
|
|
|
|
La modalità di visibilità del pulsante.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descrizioni dei metodi
|
|
--------------------------------------------
|
|
|
|
.. _class_TouchScreenButton_method_is_pressed:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **is_pressed**\ (\ ) |const| :ref:`🔗<class_TouchScreenButton_method_is_pressed>`
|
|
|
|
Restituisce ``true`` se questo pulsante è attualmente premuto.
|
|
|
|
.. |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.)`
|