Skip to main content

Keyboard

Description:

  An interface for handling keyboard inputs.

Keyboard.KeyName

Type: Enumeration.

Description:

  Enumeration for defining the keys.

Signature:

enum KeyName
"Return"
"Escape"
"BackSpace"
"Tab"
"Space"
"!"
"\""
"#"
"%"
"$"
"&"
"'"
"("
")"
"*"
"+"
","
"-"
"."
"/"
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
"0"
":"
";"
"<"
"="
">"
"?"
"@"
"["
"\\"
"]"
"^"
"_"
"`"
"A"
"B"
"C"
"D"
"E"
"F"
"G"
"H"
"I"
"J"
"K"
"L"
"M"
"N"
"O"
"P"
"Q"
"R"
"S"
"T"
"U"
"V"
"W"
"X"
"Y"
"Z"
"Delete"
"CapsLock"
"F1"
"F2"
"F3"
"F4"
"F5"
"F6"
"F7"
"F8"
"F9"
"F10"
"F11"
"F12"
"PrintScreen"
"ScrollLock"
"Pause"
"Insert"
"Home"
"PageUp"
"Delete"
"End"
"PageDown"
"Right"
"Left"
"Down"
"Up"
"Application"
"LCtrl"
"LShift"
"LAlt"
"LGui"
"RCtrl"
"RShift"
"RAlt"
"RGui"
end

isKeyDown

Type: Function.

Description:

  Check whether a key is pressed down in current frame.

Signature:

isKeyDown: function(self: Keyboard, name: KeyName): boolean

Parameters:

ParameterTypeDescription
nameKeyNameThe name of the key to check.

Returns:

Return TypeDescription
booleanWhether the key is pressed down.

isKeyUp

Type: Function.

Description:

  Check whether a key is released in current frame.

Signature:

isKeyUp: function(self: Keyboard, name: KeyName): boolean

Parameters:

ParameterTypeDescription
nameKeyNameThe name of the key to check.

Returns:

Return TypeDescription
booleanWhether the key is released.

isKeyPressed

Type: Function.

Description:

  Check whether a key is in pressed state.

Signature:

isKeyPressed: function(self: Keyboard, name: KeyName): boolean

Parameters:

ParameterTypeDescription
nameKeyNameThe name of the key to check.

Returns:

Return TypeDescription
booleanWhether the key is in pressed state.

updateIMEPosHint

Type: Function.

Description:

  Update the input method editor (IME) position hint.

Signature:

updateIMEPosHint: function(self: Keyboard, winPos: Vec2)

Parameters:

ParameterTypeDescription
winPosVec2The position of the keyboard window.