|
-
Feb 14th, 2002, 09:06 PM
#1
Thread Starter
Addicted Member
I have a timer problem.....
Hello, I have a problem with timing, I made an animation in DD and I don't want to use a timer control, but if I don't use a timer, and put my animation code in the main loop, the animation loops too fast! How can I fix this?
Thanks
BTW: The only reason I don't want to use timer control is because I heard that on win2k and XP the timing is different and therefore the program won't run propely, is this true?
Thanks again.
-
Feb 14th, 2002, 09:28 PM
#2
Good Ol' Platypus
Well the Timer control sucks anyway, try using GetTickCount API:
VB Code:
Dim D As Long
Dim C As Long
D = GetTickCount
C = 1000 / 30 '(30 = FPS you'd like to achieve for your animation, updating)
Do
DoEvents
If GetTickCount - D >= C Then
D = GetTickCount
UpdateAnimation
End If
DrawAnimation
Loop
That's a basic Do...DoEvents...Loop code block. Feel free to experiment with that!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 14th, 2002, 09:36 PM
#3
Before I begin, timers are bad. Dont use them for animations, etc.
Anyway, yes, on 2k, and XP, the timing is different. You have greater accuracy(within 10ms, instead of, say, 30ms). Regardless, if you put 1000ms as the timer elapsed time, it will fire at ABOUT that time, give or take ~30ms, on Win9x, or ~10ms on 2k or XP. That is the difference. That said, dont use timers. They will make your life a living hell. Use a standard game loop(like the one Sas posted above), and you will be much happier.
Z.
-
Feb 15th, 2002, 07:52 AM
#4
Thread Starter
Addicted Member
YES!!!!
It worked!!!! I LOVE YOU MAN! lol!
Thanks a lot!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|