keyboard
v0.0.6keyIsDown(k);
Check if a keyboard key is pressed, returns true
if key is down and returns false
if it's not
Arguments
k
The keyboard key to check as a key global, or a stringReturns
boolean
Whether or not the key is down -- Use a string
if (keyIsDown('a')) then
-- key 'a' is down
end
-- use a global
if (keyIsDown(LEFT_ARROW)) then
-- left arrow is down
end
keyPressed(key, keyCode);
EventCalled whenever a key is pressed.
Arguments
key
The pressed key as a string, is nil if glfw cannot find a name for the keykeyCode
The pressed key as a key code function setup()
createWindow(600, 600);
end
function draw()
background(51);
end
function keyPressed(key, keyCode)
print(key, keyCode)
end
keyReleased(key, keyCode);
EventCalled whenever a key is released.
Arguments
key
The released key as a string, is nil if glfw cannot find a name for the keykeyCode
The released key as a key codekeyHeld(key, keyCode);
EventCalled whenever a key is held down.
Arguments
key
The held key as a string, is nil if glfw cannot find a name for the keykeyCode
The held key as a key codeUP_ARROW
GlobalNo description
DOWN_ARROW
GlobalNo description
LEFT_ARROW
GlobalNo description
RIGHT_ARROW
GlobalNo description
KEY_ENTER
GlobalNo description
KEY_BACKSPACE
GlobalNo description
KEY_A
GlobalNo description
KEY_B
GlobalNo description
KEY_C
GlobalNo description
KEY_D
GlobalNo description
KEY_E
GlobalNo description
KEY_F
GlobalNo description
KEY_G
GlobalNo description
KEY_H
GlobalNo description
KEY_I
GlobalNo description
KEY_J
GlobalNo description
KEY_K
GlobalNo description
KEY_L
GlobalNo description
KEY_M
GlobalNo description
KEY_N
GlobalNo description
KEY_O
GlobalNo description
KEY_P
GlobalNo description
KEY_Q
GlobalNo description
KEY_R
GlobalNo description
KEY_S
GlobalNo description
KEY_T
GlobalNo description
KEY_U
GlobalNo description
KEY_V
GlobalNo description
KEY_W
GlobalNo description
KEY_X
GlobalNo description
KEY_Y
GlobalNo description
KEY_Z
GlobalNo description