class_touchscreenbutton.rst 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the TouchScreenButton.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_TouchScreenButton:
  6. TouchScreenButton
  7. =================
  8. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Button for touch screen devices.
  10. Description
  11. -----------
  12. Button for touch screen devices. You can set it to be visible on all screens, or only on touch devices.
  13. Properties
  14. ----------
  15. +--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  16. | :ref:`String<class_String>` | :ref:`action<class_TouchScreenButton_property_action>` | ``""`` |
  17. +--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  18. | :ref:`BitMap<class_BitMap>` | :ref:`bitmask<class_TouchScreenButton_property_bitmask>` | |
  19. +--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  20. | :ref:`Texture2D<class_Texture2D>` | :ref:`normal<class_TouchScreenButton_property_normal>` | |
  21. +--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  22. | :ref:`bool<class_bool>` | :ref:`passby_press<class_TouchScreenButton_property_passby_press>` | ``false`` |
  23. +--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  24. | :ref:`Texture2D<class_Texture2D>` | :ref:`pressed<class_TouchScreenButton_property_pressed>` | |
  25. +--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  26. | :ref:`Shape2D<class_Shape2D>` | :ref:`shape<class_TouchScreenButton_property_shape>` | |
  27. +--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  28. | :ref:`bool<class_bool>` | :ref:`shape_centered<class_TouchScreenButton_property_shape_centered>` | ``true`` |
  29. +--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  30. | :ref:`bool<class_bool>` | :ref:`shape_visible<class_TouchScreenButton_property_shape_visible>` | ``true`` |
  31. +--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  32. | :ref:`VisibilityMode<enum_TouchScreenButton_VisibilityMode>` | :ref:`visibility_mode<class_TouchScreenButton_property_visibility_mode>` | ``0`` |
  33. +--------------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  34. Methods
  35. -------
  36. +-------------------------+--------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`is_pressed<class_TouchScreenButton_method_is_pressed>` **(** **)** const |
  38. +-------------------------+--------------------------------------------------------------------------------+
  39. Signals
  40. -------
  41. .. _class_TouchScreenButton_signal_pressed:
  42. - **pressed** **(** **)**
  43. Emitted when the button is pressed (down).
  44. ----
  45. .. _class_TouchScreenButton_signal_released:
  46. - **released** **(** **)**
  47. Emitted when the button is released (up).
  48. Enumerations
  49. ------------
  50. .. _enum_TouchScreenButton_VisibilityMode:
  51. .. _class_TouchScreenButton_constant_VISIBILITY_ALWAYS:
  52. .. _class_TouchScreenButton_constant_VISIBILITY_TOUCHSCREEN_ONLY:
  53. enum **VisibilityMode**:
  54. - **VISIBILITY_ALWAYS** = **0** --- Always visible.
  55. - **VISIBILITY_TOUCHSCREEN_ONLY** = **1** --- Visible on touch screens only.
  56. Property Descriptions
  57. ---------------------
  58. .. _class_TouchScreenButton_property_action:
  59. - :ref:`String<class_String>` **action**
  60. +-----------+-------------------+
  61. | *Default* | ``""`` |
  62. +-----------+-------------------+
  63. | *Setter* | set_action(value) |
  64. +-----------+-------------------+
  65. | *Getter* | get_action() |
  66. +-----------+-------------------+
  67. The button's action. Actions can be handled with :ref:`InputEventAction<class_InputEventAction>`.
  68. ----
  69. .. _class_TouchScreenButton_property_bitmask:
  70. - :ref:`BitMap<class_BitMap>` **bitmask**
  71. +----------+--------------------+
  72. | *Setter* | set_bitmask(value) |
  73. +----------+--------------------+
  74. | *Getter* | get_bitmask() |
  75. +----------+--------------------+
  76. The button's bitmask.
  77. ----
  78. .. _class_TouchScreenButton_property_normal:
  79. - :ref:`Texture2D<class_Texture2D>` **normal**
  80. +----------+--------------------+
  81. | *Setter* | set_texture(value) |
  82. +----------+--------------------+
  83. | *Getter* | get_texture() |
  84. +----------+--------------------+
  85. The button's texture for the normal state.
  86. ----
  87. .. _class_TouchScreenButton_property_passby_press:
  88. - :ref:`bool<class_bool>` **passby_press**
  89. +-----------+---------------------------+
  90. | *Default* | ``false`` |
  91. +-----------+---------------------------+
  92. | *Setter* | set_passby_press(value) |
  93. +-----------+---------------------------+
  94. | *Getter* | is_passby_press_enabled() |
  95. +-----------+---------------------------+
  96. If ``true``, pass-by presses are enabled.
  97. ----
  98. .. _class_TouchScreenButton_property_pressed:
  99. - :ref:`Texture2D<class_Texture2D>` **pressed**
  100. +----------+----------------------------+
  101. | *Setter* | set_texture_pressed(value) |
  102. +----------+----------------------------+
  103. | *Getter* | get_texture_pressed() |
  104. +----------+----------------------------+
  105. The button's texture for the pressed state.
  106. ----
  107. .. _class_TouchScreenButton_property_shape:
  108. - :ref:`Shape2D<class_Shape2D>` **shape**
  109. +----------+------------------+
  110. | *Setter* | set_shape(value) |
  111. +----------+------------------+
  112. | *Getter* | get_shape() |
  113. +----------+------------------+
  114. The button's shape.
  115. ----
  116. .. _class_TouchScreenButton_property_shape_centered:
  117. - :ref:`bool<class_bool>` **shape_centered**
  118. +-----------+---------------------------+
  119. | *Default* | ``true`` |
  120. +-----------+---------------------------+
  121. | *Setter* | set_shape_centered(value) |
  122. +-----------+---------------------------+
  123. | *Getter* | is_shape_centered() |
  124. +-----------+---------------------------+
  125. If ``true``, the button's shape is centered in the provided texture. If no texture is used, this property has no effect.
  126. ----
  127. .. _class_TouchScreenButton_property_shape_visible:
  128. - :ref:`bool<class_bool>` **shape_visible**
  129. +-----------+--------------------------+
  130. | *Default* | ``true`` |
  131. +-----------+--------------------------+
  132. | *Setter* | set_shape_visible(value) |
  133. +-----------+--------------------------+
  134. | *Getter* | is_shape_visible() |
  135. +-----------+--------------------------+
  136. If ``true``, the button's shape is visible.
  137. ----
  138. .. _class_TouchScreenButton_property_visibility_mode:
  139. - :ref:`VisibilityMode<enum_TouchScreenButton_VisibilityMode>` **visibility_mode**
  140. +-----------+----------------------------+
  141. | *Default* | ``0`` |
  142. +-----------+----------------------------+
  143. | *Setter* | set_visibility_mode(value) |
  144. +-----------+----------------------------+
  145. | *Getter* | get_visibility_mode() |
  146. +-----------+----------------------------+
  147. The button's visibility mode. See :ref:`VisibilityMode<enum_TouchScreenButton_VisibilityMode>` for possible values.
  148. Method Descriptions
  149. -------------------
  150. .. _class_TouchScreenButton_method_is_pressed:
  151. - :ref:`bool<class_bool>` **is_pressed** **(** **)** const
  152. Returns ``true`` if this button is currently pressed.