new useful function, cycleEvent

This commit is contained in:
Eduardo Bart
2012-06-06 17:14:53 -03:00
parent bb1fb939c4
commit 70ea0361b6
6 changed files with 58 additions and 9 deletions

View File

@@ -80,9 +80,6 @@ TopPanel
margin-top: 8
margin-right: 5
@onSetup: |
local updateFunc
updateFunc = function()
cycleEvent(function()
rootWidget:recursiveGetChildById('frameCounter'):setText('FPS: ' .. g_app.getBackgroundPaneFps())
scheduleEvent(updateFunc, 250)
end
addEvent(updateFunc)
end, 250)

View File

@@ -41,6 +41,13 @@ function addEvent(callback, front)
return event
end
function cycleEvent(callback, front)
local event = g_eventDispatcher.cycleEvent(callback, front)
-- must hold a reference to the callback, otherwise it would be collected
event._callback = callback
return event
end
function periodicalEvent(eventFunc, conditionFunc, delay, autoRepeatDelay)
delay = delay or 30