Input Commands
Nibble has the following buttons:
UP
DOWN
LEFT
RIGHT
RED
BLUE
BLACK
WHITE
All of them can be used with these functions.
(button)
button_downReturns true
if button
is pressed.
(button)
button_pressReturns true
only if button
was just pressed.
If the button keeps pressed, during the next update()
call it will return
false
again.
(button)
button_upReturns true
if button
is released.
(button)
button_pressReturns true
only if button
was just released.
If the button keeps released, during the next update()
call it will return
false
again.
Emulator Only inputs
When running in emulator (tools) mode, Nibble can handle MIDI, keyboard and mouse.
()
read_keysReturns a string containing the keys that were pressed.
local input = read_keys()
()
read_midiReads midi messages from any connected MIDI controllers (or DAW).
local midi_messages = read_midi()
for _, msg in ipairs(midi_messages) do
local cmd = math.floor(msg[1]/16)
...
end
()
mouse_positionGets the current mouse position
local x, y = mouse_position()
(button)
mouse_button_down(button)
mouse_button_press(button)
mouse_button_release(button)
mouse_button_upCan be used in the same way as the default button_down
, button_press
,
button_release
, button_up
, but with these mouse buttons:
- MOUSE_RIGHT
- MOUSE_LEFT