Struct TextureButton

Texture-based button. Supports Pressed, Hover, Disabled and Focused states.

struct TextureButton ;

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 (textureNormal); other textures are optional.

Properties

NameTypeDescription
expand[get, set] boolIf true, the texture stretches to the edges of the node's bounding rectangle using the stretchMode. If false, the texture will not scale with the node.
stretchMode[get, set] TextureButton.StretchModeControls the texture's behavior when you resize the node's bounding rectangle, only if expand is true. Set it to one of the stretchmode constants. See the constants to learn more.
textureClickMask[get, set] BitMapPure 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.
textureDisabled[get, set] TextureTexture to display when the node is disabled. See BaseButton.disabled.
textureFocused[get, set] TextureTexture to display when the node has mouse or keyboard focus.
textureHover[get, set] TextureTexture to display when the mouse hovers the node.
textureNormal[get, set] TextureTexture to display by default, when the node is not in the disabled, focused, hover or pressed state.
texturePressed[get, set] TextureTexture 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 BaseButton.shortcut key.

Methods

NameDescription
getClickMask
getDisabledTexture
getExpand
getFocusedTexture
getHoverTexture
getNormalTexture
getPressedTexture
getStretchMode
setClickMask
setDisabledTexture
setExpand
setFocusedTexture
setHoverTexture
setNormalTexture
setPressedTexture
setStretchMode

Enums

NameDescription
Constants
StretchMode