Input Manager supports the following input:
- Keyboard [list]
- keypressed()
- keyreleased()
- isDown()
- mousepressed()
- mousereleased()
- isDown()
- joystickpressed()
- joystickreleased()
- isDown()
- getAxis()
- getHat()
I was inspired to write this library after reading this website: http://tannerrogalsky.com/blog/2012/04/ ... in-love2d/
Please report any bugs, feature requests or comment on general usefulness/structure/whatever. c:
Quick documentation:
Code: Select all
--[[
Add Button Binding
device - Hardware device
toggle - Callback
button - Button code
action - Function to execute
joystick - [optional] joystick number
]]--
Input:addButton(device, toggle, button, action, joystick)
--[[
Add Hat Binding
joystick - Joystick number
hat - Hat number
button - Button code
action - Function to execute
]]--
Input:addHat(joystick, hat, button, action)
--[[
Add Axis Binding
joystick - Joystick number
axis - Axis number
action - Function to execute
]]--
Input:addAxis(joystick, axis, action)
--[[
Remove Button Binding
device - Hardware device
toggle - Callback
button - Button code
joystick - [optional] joystick number
]]--
Input:removeButton(device, toggle, button, joystick)
--[[
Remove Hat Binding
joystick - Joystick number
hat - Hat number
button - Button code
]]--
Input:removeHat(joystick, hat, button)
--[[
Add Axis Binding
joystick - Joystick number
axis - Axis number
]]--
Input:removeAxis(joystick, axis)
--[[
Key Pressed Callback
key - Key code
unicode - Key unicode
]]--
Input:keypressed(key, unicode)
--[[
Key Released Callback
key - Key code
unicode - Key unicode
]]--
Input:keyreleased(key, unicode)
--[[
Mouse Button Pressed Callback
x - X position of cursor
y - Y position of cursor
button - Button code
]]--
Input:mousepressed(x, y, button)
--[[
Mouse Button Released Callback
x - X position of cursor
y - Y position of cursor
button - Button code
]]--
Input:mousereleased(x, y, button)
--[[
Joystick Pressed Callback
joystick - Joystick number
button - Button code
]]--
Input:joystickpressed(joystick, button)
--[[
Joystick Released Callback
joystick - Joystick number
button - Button code
]]--
Input:joystickreleased(joystick, button)
--[[
Key Held Down
dt - Delta time
]]--
Input:keyboardisdown(dt)
--[[
Mouse Button Held Down
dt - Delta time
]]--
Input:mouseisdown(dt)
--[[
Joystick Button/hat/Axis Held Down
dt - Delta time
]]--
Input:joystickisdown(dt)
--[[
Update All Devices
dt - Delta time
]]--
Input:update(dt)