0.2.0-dev Download ZIP
71 lines ·3.6 KB Raw
| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="TouchScreenButton" inherits="Node2D" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Button for touch screen devices for gameplay use. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | TouchScreenButton allows you to create on-screen buttons for touch devices. It's intended for gameplay use, such as a unit you have to touch to move. Unlike [Button], TouchScreenButton supports multitouch out of the box. Several TouchScreenButtons can be pressed at the same time with touch input. |
| 8 | This node inherits from [Node2D]. Unlike with [Control] nodes, you cannot set anchors on it. If you want to create menus or user interfaces, you may want to use [Button] nodes instead. To make button nodes react to touch events, you can enable [member ProjectSettings.input_devices/pointing/emulate_mouse_from_touch] in the Project Settings. |
| 9 | You can configure TouchScreenButton to be visible only on touch devices, helping you develop your game both for desktop and mobile devices. |
| 10 | </description> |
| 11 | <tutorials> |
| 12 | </tutorials> |
| 13 | <methods> |
| 14 | <method name="is_pressed" qualifiers="const"> |
| 15 | <return type="bool" /> |
| 16 | <description> |
| 17 | Returns [code]true[/code] if this button is currently pressed. |
| 18 | </description> |
| 19 | </method> |
| 20 | </methods> |
| 21 | <members> |
| 22 | <member name="action" type="String" setter="set_action" getter="get_action" default=""""> |
| 23 | The button's action. Actions can be handled with [InputEventAction]. |
| 24 | </member> |
| 25 | <member name="bitmask" type="BitMap" setter="set_bitmask" getter="get_bitmask"> |
| 26 | The button's bitmask. |
| 27 | </member> |
| 28 | <member name="passby_press" type="bool" setter="set_passby_press" getter="is_passby_press_enabled" default="false"> |
| 29 | If [code]true[/code], the [signal pressed] and [signal released] signals are emitted whenever a pressed finger goes in and out of the button, even if the pressure started outside the active area of the button. |
| 30 | [b]Note:[/b] This is a "pass-by" (not "bypass") press mode. |
| 31 | </member> |
| 32 | <member name="shape" type="Shape2D" setter="set_shape" getter="get_shape"> |
| 33 | The button's shape. |
| 34 | </member> |
| 35 | <member name="shape_centered" type="bool" setter="set_shape_centered" getter="is_shape_centered" default="true"> |
| 36 | If [code]true[/code], the button's shape is centered in the provided texture. If no texture is used, this property has no effect. |
| 37 | </member> |
| 38 | <member name="shape_visible" type="bool" setter="set_shape_visible" getter="is_shape_visible" default="true"> |
| 39 | If [code]true[/code], the button's shape is visible in the editor. |
| 40 | </member> |
| 41 | <member name="texture_normal" type="Texture2D" setter="set_texture_normal" getter="get_texture_normal"> |
| 42 | The button's texture for the normal state. |
| 43 | </member> |
| 44 | <member name="texture_pressed" type="Texture2D" setter="set_texture_pressed" getter="get_texture_pressed"> |
| 45 | The button's texture for the pressed state. |
| 46 | </member> |
| 47 | <member name="visibility_mode" type="int" setter="set_visibility_mode" getter="get_visibility_mode" enum="TouchScreenButton.VisibilityMode" default="0"> |
| 48 | The button's visibility mode. |
| 49 | </member> |
| 50 | </members> |
| 51 | <signals> |
| 52 | <signal name="pressed"> |
| 53 | <description> |
| 54 | Emitted when the button is pressed (down). |
| 55 | </description> |
| 56 | </signal> |
| 57 | <signal name="released"> |
| 58 | <description> |
| 59 | Emitted when the button is released (up). |
| 60 | </description> |
| 61 | </signal> |
| 62 | </signals> |
| 63 | <constants> |
| 64 | <constant name="VISIBILITY_ALWAYS" value="0" enum="VisibilityMode"> |
| 65 | Always visible. |
| 66 | </constant> |
| 67 | <constant name="VISIBILITY_TOUCHSCREEN_ONLY" value="1" enum="VisibilityMode"> |
| 68 | Visible on touch screens only. |
| 69 | </constant> |
| 70 | </constants> |
| 71 | </class> |