Fetch event callbacks from love instead of hardcoding it

This commit is contained in:
Matthias Richter 2015-05-30 16:19:26 +02:00
parent c06e8e6ee8
commit 5c9d51d356

View File

@ -67,13 +67,11 @@ function GS.current()
return stack[#stack] return stack[#stack]
end end
local all_callbacks = { -- fetch event callbacks from love.handlers
'draw', 'errhand', 'focus', 'keypressed', 'keyreleased', 'mousefocus', local all_callbacks = { 'draw', 'errhand', 'update' }
'mousemoved', 'mousepressed', 'mousereleased', 'quit', 'resize', for k in pairs(love.handlers) do
'textinput', 'threaderror', 'update', 'visible', 'gamepadaxis', all_callbacks[#all_callbacks+1] = k
'gamepadpressed', 'gamepadreleased', 'joystickadded', 'joystickaxis', end
'joystickhat', 'joystickpressed', 'joystickreleased', 'joystickremoved'
}
function GS.registerEvents(callbacks) function GS.registerEvents(callbacks)
local registry = {} local registry = {}