Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
TextureButton¶
Inherits: BaseButton < Control < CanvasItem < Node < Object
Texture-based button. Supports Pressed, Hover, Disabled and Focused states.
Description¶
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 Controls.
The "normal" state must contain a texture (texture_normal); other textures are optional.
See also BaseButton which contains common properties and methods associated with this node.
Tutorials¶
Properties¶
|
||
|
||
|
||
|
||
Enumerations¶
enum StretchMode:
StretchMode STRETCH_SCALE = 0
Scale to fit the node's bounding rectangle.
StretchMode STRETCH_TILE = 1
Tile inside the node's bounding rectangle.
StretchMode STRETCH_KEEP = 2
The texture keeps its original size and stays in the bounding rectangle's top-left corner.
StretchMode STRETCH_KEEP_CENTERED = 3
The texture keeps its original size and stays centered in the node's bounding rectangle.
StretchMode STRETCH_KEEP_ASPECT = 4
Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
StretchMode STRETCH_KEEP_ASPECT_CENTERED = 5
Scale the texture to fit the node's bounding rectangle, center it, and maintain its aspect ratio.
StretchMode STRETCH_KEEP_ASPECT_COVERED = 6
Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
Property Descriptions¶
bool flip_h = false
If true
, texture is flipped horizontally.
bool flip_v = false
If true
, texture is flipped vertically.
bool ignore_texture_size = false
If true
, the size of the texture won't be considered for minimum size calculation, so the TextureButton can be shrunk down past the texture size.
StretchMode stretch_mode = 2
void set_stretch_mode ( StretchMode value )
StretchMode get_stretch_mode ( )
Controls the texture's behavior when you resize the node's bounding rectangle. See the StretchMode constants for available options.
BitMap texture_click_mask
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.
Texture2D texture_disabled