reckfellENGINE

TouchScreenButton

Button for touch screen devices for gameplay use.

On this page
class TouchScreenButtonReckfellSharpInherits Entity2D

Button for touch screen devices for gameplay use.

TouchScreenButton allows you to create on-screen buttons for touch devices. It's intended for gameplay use, such as a unit you have to touch to move. Unlike Button, TouchScreenButton supports multitouch out of the box. Several TouchScreenButtons can be pressed at the same time with touch input. This node inherits from Entity2D. Unlike with Control nodes, you cannot set anchors on it. If you want to create menus or user interfaces, you may want to use Button nodes instead. To make button nodes react to touch events, you can enable ProjectSettings.input_devices/pointing/emulate_mouse_from_touch in the Project Settings. You can configure TouchScreenButton to be visible only on touch devices, helping you develop your game both for desktop and mobile devices.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

TouchScreenButtonConstructor
# TouchScreenButton
C#
public TouchScreenButton();

Properties9

ActionProperty
# Action
C#
public string Action { get; set; }

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

BitmaskProperty
# Bitmask
C#
public Bitmap Bitmask { get; set; }

The button's bitmask.

PassbyPressProperty
# PassbyPress
C#
public bool PassbyPress { get; set; }

If true, the TouchScreenButton.Pressed and TouchScreenButton.Released signals are emitted whenever a pressed finger goes in and out of the button, even if the pressure started outside the active area of the button. Note: This is a "pass-by" (not "bypass") press mode.

ShapeProperty
# Shape
C#
public Shape2D Shape { get; set; }

The button's shape.

ShapeCenteredProperty
# ShapeCentered
C#
public bool ShapeCentered { get; set; }

If true, the button's shape is centered in the provided texture. If no texture is used, this property has no effect.

ShapeVisibleProperty
# ShapeVisible
C#
public bool ShapeVisible { get; set; }

If true, the button's shape is visible in the editor.

TextureNormalProperty
# TextureNormal
C#
public Texture2D TextureNormal { get; set; }

The button's texture for the normal state.

TexturePressedProperty
# TexturePressed
C#
public Texture2D TexturePressed { get; set; }

The button's texture for the pressed state.

VisibilityModeProperty
# VisibilityMode
C#
public TouchScreenButton.VisibilityModeEnum VisibilityMode { get; set; }

The button's visibility mode.

Methods19

GetActionstring
# GetAction
C#
public string GetAction();
Returns string
GetBitmaskBitmap
# GetBitmask
C#
public Bitmap GetBitmask();
Returns Bitmap
GetShapeShape2D
# GetShape
C#
public Shape2D GetShape();
Returns Shape2D
GetTextureNormalTexture2D
# GetTextureNormal
C#
public Texture2D GetTextureNormal();
Returns Texture2D
GetTexturePressedTexture2D
# GetTexturePressed
C#
public Texture2D GetTexturePressed();
Returns Texture2D
GetVisibilityModeTouchScreenButton.VisibilityModeEnum
# GetVisibilityMode
C#
public TouchScreenButton.VisibilityModeEnum GetVisibilityMode();
Returns TouchScreenButton.VisibilityModeEnum
IsPassbyPressEnabledbool
# IsPassbyPressEnabled
C#
public bool IsPassbyPressEnabled();
Returns bool
IsPressedbool
# IsPressed
C#
public bool IsPressed();

Returns true if this button is currently pressed.

Returns bool
IsShapeCenteredbool
# IsShapeCentered
C#
public bool IsShapeCentered();
Returns bool
IsShapeVisiblebool
# IsShapeVisible
C#
public bool IsShapeVisible();
Returns bool
SetActionvoid
# SetAction
C#
public void SetAction(string action);
Parameters
NameTypeDefault
actionstring—
SetBitmaskvoid
# SetBitmask
C#
public void SetBitmask(Bitmap bitmask);
Parameters
NameTypeDefault
bitmaskBitmap—
SetPassbyPressvoid
# SetPassbyPress
C#
public void SetPassbyPress(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetShapevoid
# SetShape
C#
public void SetShape(Shape2D shape);
Parameters
NameTypeDefault
shapeShape2D—
SetShapeCenteredvoid
# SetShapeCentered
C#
public void SetShapeCentered(bool @bool);
Parameters
NameTypeDefault
boolbool—
SetShapeVisiblevoid
# SetShapeVisible
C#
public void SetShapeVisible(bool @bool);
Parameters
NameTypeDefault
boolbool—
SetTextureNormalvoid
# SetTextureNormal
C#
public void SetTextureNormal(Texture2D texture);
Parameters
NameTypeDefault
textureTexture2D—
SetTexturePressedvoid
# SetTexturePressed
C#
public void SetTexturePressed(Texture2D texture);
Parameters
NameTypeDefault
textureTexture2D—
SetVisibilityModevoid
# SetVisibilityMode
C#
public void SetVisibilityMode(TouchScreenButton.VisibilityModeEnum mode);
Parameters
NameTypeDefault
modeTouchScreenButton.VisibilityModeEnum—

Signals and events2

PressedEvent
# Pressed
C#
public event Action Pressed;

Emitted when the button is pressed (down).

ReleasedEvent
# Released
C#
public event Action Released;

Emitted when the button is released (up).

TouchScreenButton.VisibilityModeEnum

ValueDescription
Always = 0

Always visible.

TouchscreenOnly = 1

Visible on touch screens only.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.