🔒 Locked
Timers
Advertisement
Original Post
Does Windows have a limitation to Timers? I seemed to be experiencing problems. I am currently in the middle
of a project, it''s a shoot-em up. I am trying to use the timers to set-off the alien attacks. Basically something
like this:-
If(TimerA->Timer(200)==true)LaunchA=true;
Now, the starnge thing is, this is OK for the first wave of aliens, but as soon as another wave appears(at the same
time) the timing seems to go alittle wrong. Animation frames begin to skip, the aliens are not consistantly apart, rogue
aliens which belong to another set of aliens appear on the end of the waves.
Maybe it''s my method of programming and they way I''m calling them in. I tried the same thing using the ''for'' loop
to create a kind of timer and that workd OK. However, the ''for'' loop will be inconsistant as different machines
will take different amount of time to execute the ''for'' loop.
So any help will be appreciated.
Thanks
Indy
Indsoft
I''m not totally sure about this... but, I think that the total number of timers that you can create would be equal to the number of windows that your system can create. I looked in MSDN and have not found anything to back up my assumption.
I would preclude using the windows timer in place of your own timer. I have written a class that utilizes GetTickCount().
The tickcount is set at boot time and wraps around when the computer is running 49.7 contiuous days.
Dave "Dak Lozar" Loeser
I would preclude using the windows timer in place of your own timer. I have written a class that utilizes GetTickCount().
The tickcount is set at boot time and wraps around when the computer is running 49.7 contiuous days.
Dave "Dak Lozar" Loeser
Goir,
What do you recommend to use instead?
Dak,
I think your assumption is right. I read up on the Timers in a Windows reference book, and it doesn''t give a max figure.
However, I think I''ve managed to get rid of the problem.
Thanks you guys...
Indy.
PS Goir - still give me your recommendation, I''m very interested.
What do you recommend to use instead?
Dak,
I think your assumption is right. I read up on the Timers in a Windows reference book, and it doesn''t give a max figure.
However, I think I''ve managed to get rid of the problem.
Thanks you guys...
Indy.
PS Goir - still give me your recommendation, I''m very interested.
"Kill the Timer" and use instead
DWORD timeGetTime(void);
The function returns the time elapsed in milliseconds from Windows start.
You can modify the resolution (I dont remember how) but the default resolution is good enough (1ms about).
NOTE: remember to link with Winmm.lib (WINdows MultiMedia)
DWORD timeGetTime(void);
The function returns the time elapsed in milliseconds from Windows start.
You can modify the resolution (I dont remember how) but the default resolution is good enough (1ms about).
NOTE: remember to link with Winmm.lib (WINdows MultiMedia)
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement