Button for touch screen devices.
    public class TouchScreenButton : Node2D

Button for touch screen devices. You can set it to be visible on all screens, or only on touch devices.

Inheritance Chain


    public TouchScreenButton()


    "pressed" ()

Emitted when the button is pressed (down).

    "released" ()

Emitted when the button is released (up).


    public string Action { get; set; }

The button’s action. Actions can be handled with InputEventAction.

    public BitMap Bitmask { get; set; }

The button’s bitmask.

    public Texture Normal { get; set; }

The button’s texture for the normal state.

    public bool PassbyPress { get; set; }

If true, passby presses are enabled.

    public Texture Pressed { get; set; }

The button’s texture for the pressed state.

    public Shape2D Shape { get; set; }

The button’s shape.

    public bool ShapeCentered { get; set; }

If true, the button’s shape is centered.

    public bool ShapeVisible { get; set; }

If true, the button’s shape is visible.

    public VisibilityModeEnum VisibilityMode { get; set; }

The button’s visibility mode. See VISIBILITY_* constants.


    public string GetAction()

Getter for Action

    public BitMap GetBitmask()

Getter for Bitmask

    public Shape2D GetShape()

Getter for Shape

    public Texture GetTexture()

Getter for Normal

    public Texture GetTexturePressed()

Getter for Pressed

    public VisibilityModeEnum GetVisibilityMode()

Getter for VisibilityMode

    public bool IsPassbyPressEnabled()

Getter for PassbyPress

    public bool IsPressed()

Returns true if this button is currently pressed.

    public bool IsShapeCentered()

Getter for ShapeCentered

    public bool IsShapeVisible()

Getter for ShapeVisible

    public void SetAction(string action)

Setter for Action

    public void SetBitmask(BitMap bitmask)

Setter for Bitmask

    public void SetPassbyPress(bool enabled)

Setter for PassbyPress

    public void SetShape(Shape2D shape)

Setter for Shape

    public void SetShapeCentered(bool @bool)

Setter for ShapeCentered

    public void SetShapeVisible(bool @bool)

Setter for ShapeVisible

    public void SetTexture(Texture texture)

Setter for Normal

    public void SetTexturePressed(Texture texturePressed)

Setter for Pressed

    public void SetVisibilityMode(VisibilityModeEnum mode)

Setter for VisibilityMode

Inner Types


Name Value Description
Always 0 Always visible.
TouchscreenOnly 1 Visible on touch screens only.