keyIsDown(k);Check if a keyboard key is pressed, returns true if key is down and returns false if it's not
Arguments
kThe keyboard key to check as a key global, or a stringReturns
booleanWhether 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
endkeyPressed(key, keyCode);EventCalled whenever a key is pressed.
Arguments
keyThe pressed key as a string, is nil if glfw cannot find a name for the keykeyCodeThe pressed key as a key codefunction setup()
createWindow(600, 600);
end
function draw()
background(51);
end
function keyPressed(key, keyCode)
print(key, keyCode)
endkeyReleased(key, keyCode);EventCalled whenever a key is released.
Arguments
keyThe released key as a string, is nil if glfw cannot find a name for the keykeyCodeThe released key as a key codekeyHeld(key, keyCode);EventCalled whenever a key is held down.
Arguments
keyThe held key as a string, is nil if glfw cannot find a name for the keykeyCodeThe held key as a key code