Texture-based button. Supports Pressed, Hover, Disabled and Focused states.
    public class TextureButton : BaseButton

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’s texture is required. Others are optional.

Inheritance Chain


    public TextureButton()


    public bool Expand { get; set; }

If 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. Default value: false.

    public StretchModeEnum StretchMode { get; set; }

Controls the texture’s behavior when you resize the node’s bounding rectangle, only if Expand is true. Set it to one of the STRETCH_* constants. See the constants to learn more.

    public BitMap TextureClickMask { get; set; }

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.

    public Texture TextureDisabled { get; set; }

Texture to display when the node is disabled. See BaseButton.Disabled.

    public Texture TextureFocused { get; set; }

Texture to display when the node has mouse or keyboard focus.

    public Texture TextureHover { get; set; }

Texture to display when the mouse hovers the node.

    public Texture TextureNormal { get; set; }

Texture to display by default, when the node is not in the disabled, focused, hover or pressed state.

    public Texture TexturePressed { get; set; }

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 BaseButton.Shortcut key.


    public BitMap GetClickMask()

Getter for TextureClickMask

    public Texture GetDisabledTexture()

Getter for TextureDisabled

    public bool GetExpand()

Getter for Expand

    public Texture GetFocusedTexture()

Getter for TextureFocused

    public Texture GetHoverTexture()

Getter for TextureHover

    public Texture GetNormalTexture()

Getter for TextureNormal

    public Texture GetPressedTexture()

Getter for TexturePressed

    public StretchModeEnum GetStretchMode()

Getter for StretchMode

    public void SetClickMask(BitMap mask)

Setter for TextureClickMask

    public void SetDisabledTexture(Texture texture)

Setter for TextureDisabled

    public void SetExpand(bool pExpand)

Setter for Expand

    public void SetFocusedTexture(Texture texture)

Setter for TextureFocused

    public void SetHoverTexture(Texture texture)

Setter for TextureHover

    public void SetNormalTexture(Texture texture)

Setter for TextureNormal

    public void SetPressedTexture(Texture texture)

Setter for TexturePressed

    public void SetStretchMode(StretchModeEnum pMode)

Setter for StretchMode

Inner Types


Name Value Description
Scale 0 Scale to fit the node’s bounding rectangle.
Tile 1 Tile inside the node’s bounding rectangle.
Keep 2 The texture keeps its original size and stays in the bounding rectangle’s top-left corner.
KeepCentered 3 The texture keeps its original size and stays centered in the node’s bounding rectangle.
KeepAspect 4 Scale the texture to fit the node’s bounding rectangle, but maintain the texture’s aspect ratio.
KeepAspectCentered 5 Scale the texture to fit the node’s bounding rectangle, center it, and maintain its aspect ratio.
KeepAspectCovered 6 Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node’s limits.