PDA

View Full Version : [?]How draw something every 5sec and keep it drawn for 2sec



arthurprs
16-09-2007, 10:17 PM
How draw something every 5sec for 2sec {so 3 sec interval}

im using sdl so i have acess to SDL_getticks that is similar to gettickcount

any ideia how to do that ?

czar
17-09-2007, 01:56 AM
Presumably you have a timer that fire up sometimes? Well why not make a simple object that include a variable

Show : boolean
Switch : longint

Show := false;
switch := TimeGetTime+ 3000;


in you loop

if TimeGetTime > switch then
begin
Show := not Show ;
if not show then switch := TimeGetTime+ 2000
else switch := TimeGetTime+ 3000;
end;

arthurprs
17-09-2007, 04:55 PM
thx it work