Skip to content

Classes

GlobalDescription
Input

负责处理键盘和手柄输入数据的静态类

Input

负责处理键盘和手柄输入数据的静态类

Kind: global class

  • Input
    • new Input()
    • .keyRepeatWait : Number
    • .keyRepeatInterval : Number
    • .keyMapper : Object
    • .gamepadMapper : Object

new Input()

处理键盘和手柄输入数据的静态类
The static class that handles input data from the keyboard and gamepads.


Input.keyRepeatWait : Number

按键重复的等待时间(帧数)
The wait time of the key repeat in frames.

Kind: static property of Input
Properties

Name
keyRepeatWait

Input.keyRepeatInterval : Number

按键重复的间隔时间(帧数)
The interval of the key repeat in frames.

Kind: static property of Input
Properties

Name
keyRepeatInterval

Input.keyMapper : Object

将虚拟键码转换为映射键名的哈希表
A hash table to convert from a virtual key code to a mapped key name.

Kind: static property of Input
Properties

Name
keyMapper

Input.gamepadMapper : Object

将手柄按钮转换为映射键名的哈希表
A hash table to convert from a gamepad button to a mapped key name.

Kind: static property of Input
Properties

Name
gamepadMapper

.initialize()

初始化输入系统
Initializes the input system.

Kind: static function


.clear()

清除所有输入数据
Clears all the input data.

Kind: static function


.update()

更新输入数据
Updates the input data.

Kind: static function


.isPressed(keyName) ⇒ Boolean

检查按键是否当前被按下
Checks whether a key is currently pressed down.

Kind: static function
Returns: Boolean - 如果按键被按下则返回 true / True if the key is pressed

ParamTypeDescription
keyNameString按键的映射名称 / The mapped name of the key

.isTriggered(keyName) ⇒ Boolean

检查按键是否刚刚被按下
Checks whether a key is just pressed.

Kind: static function
Returns: Boolean - 如果按键被触发则返回 true / True if the key is triggered

ParamTypeDescription
keyNameString按键的映射名称 / The mapped name of the key

.isRepeated(keyName) ⇒ Boolean

检查按键是否刚刚被按下或发生了按键重复
Checks whether a key is just pressed or a key repeat occurred.

Kind: static function
Returns: Boolean - 如果按键重复则返回 true / True if the key is repeated

ParamTypeDescription
keyNameString按键的映射名称 / The mapped name of the key

.isLongPressed(keyName) ⇒ Boolean

检查按键是否被长按
Checks whether a key is kept depressed.

Kind: static function
Returns: Boolean - 如果按键被长按则返回 true / True if the key is long-pressed

ParamTypeDescription
keyNameString按键的映射名称 / The mapped name of the key

贡献者

暂无相关贡献者

页面历史

暂无最近变更历史
最近更新