Hello, I'm wonder how to use the tickcount thing in DX, becasue timers are way to slow, I need it to calculate time between different actions, such as camera movements
Thanks
Printable View
Hello, I'm wonder how to use the tickcount thing in DX, becasue timers are way to slow, I need it to calculate time between different actions, such as camera movements
Thanks
Direct X shouldn't really make any difference in how you use get tick count. Timer controls are pretty accurate down to 10 milliseconds after that they degrade.
Function GameLoop()
Dim LastCount As Long
Dim ThisCount As Long
LastCount = GetTickCount
Do
ThisCount = GetTickCount
If ThisCount - LastCount >= Interval Then
'Timer Function
End If
ThisCount = GetTickCount
If ThisCount - LastCount >= Interval2 Then
'Timer Function
End If
DoEvents
Loop
End Function
Yeah, use the GetTickCount() API call.
Z.
Doesn't DX8 have the DX.TickCount() function anymore? Does the same, eliminates the need to declare the function :)
Hello, thank you for your help, but could you please tell me how I declare the TickCount API?
Thanks!
I declared everything now, but this doesn't work
Sub GameLoop()
Dim LastCount As Long
Dim ThisCount As Long
LastCount = GetTickCount
Do
ThisCount = GetTickCount
If ThisCount - LastCount >= 3500 Then
MoveGuyForward
End If
ThisCount = GetTickCount
If ThisCount - LastCount >= 2000 Then
MoveGuyBackwords
End If
DoEvents
Loop
End Sub
I want to move guy forward for 3.5 seconds,and after move backwords for 2 seconds, but nothing works, what's wrong, plz help!
Thanks
Thanks
Code:Sub GameLoop()
Dim LastCount As Long
Dim ThisCount As Long
LastCount = GetTickCount
Do Until ThisCount - LastCount <= 3500
MoveGuyForward
ThisCount = GetTickCount
DoEvents
Loop
LastCount = GetTickCount
Do Until ThisCount - LastCount <= 2000
MoveGuyBackwords
ThisCount = GetTickCount
DoEvents
Loop
End Sub