From 1c8be5b6206b736f271e0af979cc87bcabe91ff0 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 30 Jun 2009 12:26:39 +0200 Subject: [PATCH] invaders: use timer Signed-off-by: Julien Danjou --- lib/invaders.lua.in | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/invaders.lua.in b/lib/invaders.lua.in index 00bcaaa7d..1ca042dfb 100644 --- a/lib/invaders.lua.in +++ b/lib/invaders.lua.in @@ -23,6 +23,7 @@ --}}} local wibox = wibox +local timer = timer local widget = widget local awful = require("awful") local beautiful = require("beautiful") @@ -552,6 +553,13 @@ function run(args) gamedata.running = true end -awful.hooks.timer.register(0.02, shots.handle) -awful.hooks.timer.register(0.03, shots.handle_enemy) -awful.hooks.timer.register(0.01, enemies.handle) +-- Start timers +local t = timer { timeout = 0.02 } +t:add_signal("timeout", shots.handle) +t:start() +local t = timer { timeout = 0.03 } +t:add_signal("timeout", shots.handle_enemy) +t:start() +local t = timer { timeout = 0.01 } +t:add_signal("timeout", enemies.handle) +t:start()