timer update

This commit is contained in:
p.kosyh 2010-01-21 08:17:05 +00:00
parent b2a5cf808e
commit a731ee538c
2 changed files with 9 additions and 6 deletions

View file

@ -2173,7 +2173,7 @@ int game_loop(void)
while ((rc = input(&ev, 1)) == AGAIN); while ((rc = input(&ev, 1)) == AGAIN);
if (rc == -1) {/* close */ if (rc == -1) {/* close */
break; break;
} else if (curgame_dir && (ev.type == KEY_DOWN || ev.type == KEY_UP) } else if (curgame_dir && (ev.type == KEY_DOWN || ev.type == KEY_UP)
&& !game_input((ev.type == KEY_DOWN), ev.sym)) { && !game_input((ev.type == KEY_DOWN), ev.sym)) {
; /* all is done in game_input */ ; /* all is done in game_input */
} else if (((ev.type == KEY_DOWN) || (ev.type == KEY_UP)) && } else if (((ev.type == KEY_DOWN) || (ev.type == KEY_UP)) &&

View file

@ -6,11 +6,14 @@ stead = {
io = io, io = io,
call_top = 0, call_top = 0,
cctx = { txt = nil, self = nil }, cctx = { txt = nil, self = nil },
timer = function(s) timer = function()
return false if type(timer) == 'table' and type(timer.callback) == 'function' then
return timer:callback();
end
return
end, end,
input = function(s) input = function(pressed, event)
return false return
end, end,
} }
@ -1816,7 +1819,7 @@ function delete(v)
allocator:delete(v); allocator:delete(v);
end end
timer = obj { timer = obj { -- timer calls stead.timer callback
nam = 'timer', nam = 'timer',
ini = function(s) ini = function(s)
if s._timer ~= nil and s._timer ~= 0 then if s._timer ~= nil and s._timer ~= 0 then