Added a new way to bind keys. You can now call a binding's :bindNext()
method to bind the next key pressed to the binding. The method accepts a function callback as the argument. The function callback is called with the key pressed passed as an argument.
Example:
-- Load the library.
local controls = require('EZControls')
-- Set the controls library state.
controls.currentState = 'game'
-- Binds the next key pressed to the binding "jetpack_fire".
controls.state('game').binding('jetpack_fire'):bindNext(function(key)
print('binded ' .. key .. ' to binding "jetpack_fire"')
end)
-- Create callbacks for the bindings.
controls.state('game').binding('jetpack_fire'):onPress(function()
enableJetpack()
end)
controls.state('game').binding('jetpack_fire'):onRelease(function()
disableJetpack()
end)