2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-02-01 09:03:48 +08:00
<class name= "TextureButton" inherits= "BaseButton" version= "4.0" >
2017-09-13 04:42:36 +08:00
<brief_description >
2017-10-07 15:09:21 +08:00
Texture-based button. Supports Pressed, Hover, Disabled and Focused states.
2017-09-13 04:42:36 +08:00
</brief_description>
<description >
2019-06-22 07:04:47 +08:00
[TextureButton] has the same functionality as [Button], except it uses sprites instead of Godot's [Theme] resource. It is faster to create, but it doesn't support localization like more complex [Control]s.
The "normal" state must contain a texture ([member texture_normal]); other textures are optional.
2020-09-24 05:34:28 +08:00
See also [BaseButton] which contains common properties and methods associated with this node.
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
2020-10-01 16:34:47 +08:00
<link title= "3D Voxel Demo" > https://godotengine.org/asset-library/asset/676</link>
2017-09-13 04:42:36 +08:00
</tutorials>
<members >
2019-06-29 18:38:01 +08:00
<member name= "expand" type= "bool" setter= "set_expand" getter= "get_expand" default= "false" >
2019-06-29 21:24:23 +08:00
If [code]true[/code], the texture stretches to the edges of the node's bounding rectangle using the [member stretch_mode]. If [code]false[/code], the texture will not scale with the node.
2017-09-13 04:42:36 +08:00
</member>
2019-10-03 17:02:51 +08:00
<member name= "flip_h" type= "bool" setter= "set_flip_h" getter= "is_flipped_h" default= "false" >
If [code]true[/code], texture is flipped horizontally.
</member>
<member name= "flip_v" type= "bool" setter= "set_flip_v" getter= "is_flipped_v" default= "false" >
If [code]true[/code], texture is flipped vertically.
</member>
2019-06-29 18:38:01 +08:00
<member name= "stretch_mode" type= "int" setter= "set_stretch_mode" getter= "get_stretch_mode" enum= "TextureButton.StretchMode" default= "0" >
2019-12-07 06:09:20 +08:00
Controls the texture's behavior when you resize the node's bounding rectangle, [b]only if[/b] [member expand] is [code]true[/code]. Set it to one of the [enum StretchMode] constants. See the constants to learn more.
2017-09-13 04:42:36 +08:00
</member>
2019-07-16 02:42:47 +08:00
<member name= "texture_click_mask" type= "BitMap" setter= "set_click_mask" getter= "get_click_mask" >
2019-01-07 17:02:04 +08:00
Pure black and white [BitMap] image to use for click detection. On the mask, white pixels represent the button's clickable area. Use it to create buttons with curved shapes.
2017-09-13 04:42:36 +08:00
</member>
2020-02-12 16:59:06 +08:00
<member name= "texture_disabled" type= "Texture2D" setter= "set_disabled_texture" getter= "get_disabled_texture" >
2017-10-07 15:09:21 +08:00
Texture to display when the node is disabled. See [member BaseButton.disabled].
2017-09-13 04:42:36 +08:00
</member>
2020-02-12 16:59:06 +08:00
<member name= "texture_focused" type= "Texture2D" setter= "set_focused_texture" getter= "get_focused_texture" >
2017-10-07 15:09:21 +08:00
Texture to display when the node has mouse or keyboard focus.
2017-09-13 04:42:36 +08:00
</member>
2020-02-12 16:59:06 +08:00
<member name= "texture_hover" type= "Texture2D" setter= "set_hover_texture" getter= "get_hover_texture" >
2017-10-07 15:09:21 +08:00
Texture to display when the mouse hovers the node.
2017-09-13 04:42:36 +08:00
</member>
2020-02-12 16:59:06 +08:00
<member name= "texture_normal" type= "Texture2D" setter= "set_normal_texture" getter= "get_normal_texture" >
2017-10-07 15:09:21 +08:00
Texture to display by default, when the node is [b]not[/b] in the disabled, focused, hover or pressed state.
2017-09-13 04:42:36 +08:00
</member>
2020-02-12 16:59:06 +08:00
<member name= "texture_pressed" type= "Texture2D" setter= "set_pressed_texture" getter= "get_pressed_texture" >
2019-06-22 07:04:47 +08:00
Texture to display on mouse down over the node, if the node has keyboard focus and the player presses the Enter key or if the player presses the [member BaseButton.shortcut] key.
2017-09-13 04:42:36 +08:00
</member>
</members>
<constants >
2017-11-25 06:16:30 +08:00
<constant name= "STRETCH_SCALE" value= "0" enum= "StretchMode" >
2017-10-07 15:09:21 +08:00
Scale to fit the node's bounding rectangle.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "STRETCH_TILE" value= "1" enum= "StretchMode" >
2017-10-07 15:09:21 +08:00
Tile inside the node's bounding rectangle.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "STRETCH_KEEP" value= "2" enum= "StretchMode" >
2017-10-07 15:09:21 +08:00
The texture keeps its original size and stays in the bounding rectangle's top-left corner.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "STRETCH_KEEP_CENTERED" value= "3" enum= "StretchMode" >
2017-10-07 15:09:21 +08:00
The texture keeps its original size and stays centered in the node's bounding rectangle.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "STRETCH_KEEP_ASPECT" value= "4" enum= "StretchMode" >
2017-10-07 15:09:21 +08:00
Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "STRETCH_KEEP_ASPECT_CENTERED" value= "5" enum= "StretchMode" >
2017-10-07 15:09:21 +08:00
Scale the texture to fit the node's bounding rectangle, center it, and maintain its aspect ratio.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "STRETCH_KEEP_ASPECT_COVERED" value= "6" enum= "StretchMode" >
2017-10-07 15:09:21 +08:00
Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
2017-09-13 04:42:36 +08:00
</constant>
</constants>
</class>