[lib] CTRL - input handling
Posted: Wed Jun 28, 2017 8:26 pm
https://bitbucket.org/rcoaxil/ctrl
https://love2d.org/wiki/CTRL
Simple for basic usage and at the same time robust and advanced for extended use, this library provides all necessary facilities to handle user input, and with enough skill, can be extended to handle even the input devices not natively supported by the framework.
Currently supports keyboard, mouse, gamepad, joystick input devices, input binding in many-to-many fashion, raw value mapping functions and clean value filtering functions, custom events and event triggers, and automatic grabbing of user input & autobind - for controls setup screens, and some more.
https://love2d.org/wiki/CTRL
Simple for basic usage and at the same time robust and advanced for extended use, this library provides all necessary facilities to handle user input, and with enough skill, can be extended to handle even the input devices not natively supported by the framework.
Code: Select all
local ctrl = require ( 'ctrl' ) ( )
function ctrl:inputpressed ( name, value ) print ( "pressed", name, value ) end
function ctrl:inputreleased ( name, value ) print ( "released", name, value ) end
function ctrl:inputmoved ( name, value ) print ( "moved", name, value ) end
ctrl:bind ( "fire", { "keyboard", "space" } )
ctrl:bind ( "fire", { "joystick", "default", "button", 1 } )
ctrl:bind ( "fire", { "mouse", "left" } )
ctrl:hookup ( )