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 must contain a texture (TextureNormal); other textures are optional.

Inheritance Chain

Constructors

    public TextureButton()

Properties

    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.

    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.

Methods

    [Obsolete("GetClickMask is deprecated. Use the TextureClickMask property instead.")]
    public BitMap GetClickMask()

Getter for TextureClickMask

    [Obsolete("GetDisabledTexture is deprecated. Use the TextureDisabled property instead.")]
    public Texture GetDisabledTexture()

Getter for TextureDisabled

    [Obsolete("GetExpand is deprecated. Use the Expand property instead.")]
    public bool GetExpand()

Getter for Expand

    [Obsolete("GetFocusedTexture is deprecated. Use the TextureFocused property instead.")]
    public Texture GetFocusedTexture()

Getter for TextureFocused

    [Obsolete("GetHoverTexture is deprecated. Use the TextureHover property instead.")]
    public Texture GetHoverTexture()

Getter for TextureHover

    [Obsolete("GetNormalTexture is deprecated. Use the TextureNormal property instead.")]
    public Texture GetNormalTexture()

Getter for TextureNormal

    [Obsolete("GetPressedTexture is deprecated. Use the TexturePressed property instead.")]
    public Texture GetPressedTexture()

Getter for TexturePressed

    [Obsolete("GetStretchMode is deprecated. Use the StretchMode property instead.")]
    public StretchModeEnum GetStretchMode()

Getter for StretchMode

    [Obsolete("SetClickMask is deprecated. Use the TextureClickMask property instead.")]
    public void SetClickMask(BitMap mask)

Setter for TextureClickMask

    [Obsolete("SetDisabledTexture is deprecated. Use the TextureDisabled property instead.")]
    public void SetDisabledTexture(Texture texture)

Setter for TextureDisabled

    [Obsolete("SetExpand is deprecated. Use the Expand property instead.")]
    public void SetExpand(bool pExpand)

Setter for Expand

    [Obsolete("SetFocusedTexture is deprecated. Use the TextureFocused property instead.")]
    public void SetFocusedTexture(Texture texture)

Setter for TextureFocused

    [Obsolete("SetHoverTexture is deprecated. Use the TextureHover property instead.")]
    public void SetHoverTexture(Texture texture)

Setter for TextureHover

    [Obsolete("SetNormalTexture is deprecated. Use the TextureNormal property instead.")]
    public void SetNormalTexture(Texture texture)

Setter for TextureNormal

    [Obsolete("SetPressedTexture is deprecated. Use the TexturePressed property instead.")]
    public void SetPressedTexture(Texture texture)

Setter for TexturePressed

    [Obsolete("SetStretchMode is deprecated. Use the StretchMode property instead.")]
    public void SetStretchMode(StretchModeEnum pMode)

Setter for StretchMode

Inner Types

StretchModeEnum

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.
Tags: