2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-02-14 14:18:53 +01:00
<class name= "TouchScreenButton" inherits= "Node2D" version= "4.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 22:42:36 +02:00
<brief_description >
2020-08-27 18:55:00 +02:00
Button for touch screen devices for gameplay use.
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2021-02-21 00:23:08 +01:00
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.
2020-08-27 18:55:00 +02:00
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 the Emulate Mouse option in the Project Settings.
You can configure TouchScreenButton to be visible only on touch devices, helping you develop your game both for desktop and mobile devices.
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "is_pressed" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2017-09-12 22:42:36 +02:00
<description >
2017-10-10 23:31:04 +02:00
Returns [code]true[/code] if this button is currently pressed.
2017-09-12 22:42:36 +02:00
</description>
</method>
</methods>
<members >
2019-06-29 12:38:01 +02:00
<member name= "action" type= "String" setter= "set_action" getter= "get_action" default= """" >
2017-10-10 23:31:04 +02:00
The button's action. Actions can be handled with [InputEventAction].
2017-09-12 22:42:36 +02:00
</member>
2019-07-15 20:42:47 +02:00
<member name= "bitmask" type= "BitMap" setter= "set_bitmask" getter= "get_bitmask" >
2017-10-10 23:31:04 +02:00
The button's bitmask.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "passby_press" type= "bool" setter= "set_passby_press" getter= "is_passby_press_enabled" default= "false" >
2021-02-15 11:45:58 +01:00
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.
2021-10-05 14:24:34 +02:00
[b]Note:[/b] This is a "pass-by" (not "bypass") press mode.
2017-09-12 22:42:36 +02:00
</member>
2019-07-15 20:42:47 +02:00
<member name= "shape" type= "Shape2D" setter= "set_shape" getter= "get_shape" >
2017-10-10 23:31:04 +02:00
The button's shape.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "shape_centered" type= "bool" setter= "set_shape_centered" getter= "is_shape_centered" default= "true" >
2019-11-08 11:02:22 +01:00
If [code]true[/code], the button's shape is centered in the provided texture. If no texture is used, this property has no effect.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "shape_visible" type= "bool" setter= "set_shape_visible" getter= "is_shape_visible" default= "true" >
2020-12-27 21:02:01 +01:00
If [code]true[/code], the button's shape is visible in the editor.
2017-09-12 22:42:36 +02:00
</member>
2021-12-06 15:46:05 +01:00
<member name= "texture_normal" type= "Texture2D" setter= "set_texture_normal" getter= "get_texture_normal" >
The button's texture for the normal state.
</member>
<member name= "texture_pressed" type= "Texture2D" setter= "set_texture_pressed" getter= "get_texture_pressed" >
The button's texture for the pressed state.
</member>
2019-06-29 12:38:01 +02:00
<member name= "visibility_mode" type= "int" setter= "set_visibility_mode" getter= "get_visibility_mode" enum= "TouchScreenButton.VisibilityMode" default= "0" >
2019-06-22 01:04:47 +02:00
The button's visibility mode. See [enum VisibilityMode] for possible values.
2017-09-12 22:42:36 +02:00
</member>
</members>
<signals >
<signal name= "pressed" >
<description >
2017-10-10 23:31:04 +02:00
Emitted when the button is pressed (down).
2017-09-12 22:42:36 +02:00
</description>
</signal>
<signal name= "released" >
<description >
2017-10-10 23:31:04 +02:00
Emitted when the button is released (up).
2017-09-12 22:42:36 +02:00
</description>
</signal>
</signals>
<constants >
2017-11-24 23:16:30 +01:00
<constant name= "VISIBILITY_ALWAYS" value= "0" enum= "VisibilityMode" >
2017-10-10 23:31:04 +02:00
Always visible.
2017-09-16 01:46:14 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "VISIBILITY_TOUCHSCREEN_ONLY" value= "1" enum= "VisibilityMode" >
2017-10-10 23:31:04 +02:00
Visible on touch screens only.
2017-09-16 01:46:14 +02:00
</constant>
2017-09-12 22:42:36 +02:00
</constants>
</class>