跳转至

TouchScreenButton

继承

Node2D

简要描述

触摸屏设备的按钮。

描述

触摸屏设备的按钮。您可以将其设置为在所有屏幕上或仅在触摸设备上可见。

成员

类型 属性名 默认值
String action ""
BitMap bitmask
Texture normal
bool passby_press false
Texture pressed
Shape2D shape
bool shape_centered true
bool shape_visible true
int visibility_mode 0

方法

返回值类型 方法名称
bool is_pressed() const

信号

  • pressed

按下按钮(向下)时发出。


  • released

释放按钮(向上)时发出。


枚举

enum VisibilityMode: - VISIBILITY_ALWAYS = 0

始终可见。

  • VISIBILITY_TOUCHSCREEN_ONLY = 1

仅在触摸屏上可见。


常量

成员说明

  • String action
Default ""
setter set_action(value)
getter get_action
  • BitMap bitmask
setter set_bitmask(value)
getter get_bitmask
  • Texture normal
setter set_texture(value)
getter get_texture
  • bool passby_press
Default false
setter set_passby_press(value)
getter is_passby_press_enabled
  • Texture pressed
setter set_texture_pressed(value)
getter get_texture_pressed
  • Shape2D shape
setter set_shape(value)
getter get_shape
  • bool shape_centered
Default true
setter set_shape_centered(value)
getter is_shape_centered
  • bool shape_visible
Default true
setter set_shape_visible(value)
getter is_shape_visible
  • int visibility_mode
Default 0
setter set_visibility_mode(value)
getter get_visibility_mode

方法说明

  • is_pressed is_pressed() const

如果当前按下此按钮,则返回true