For example, here's code that changes the background image when I press the midi note '48':
Code: Select all
function love.update(dt)
-- do some calculations
a,b,c,d = midi.getMessage(midi_controller_port)
if a == 144 and b == 48 then
next_scene()
end
end
It's very brief (I think only one frame) but noticeable enough to be jarring.
I have almost identical code in love.keypressed:
Code: Select all
function love.keypressed(key, u)
if key == "w" then
next_scene()
end
end
Why does the keypressed function not interfere with the graphics?
Is the keypressed listener running on a separate thread than the main drawing thread or something?
How can I mimic this behavior with a "midi listener"? I tried to figure out how to use a thread to do this but haven't been able to figure threads out from the wiki/forums. Some concrete examples would be most appreciated!