Even though Eric wants you to figure it out on your own and Bryk told you how to do it in language neautral terms, I'm going to tell you in Esdeedoublian which is my own language:
Three static or global variables:
- FPS 'Holds the number of frames counted since the last second
- LastTime 'Holds the time when we last started the count
- Count 'Holds the number of frames we've gone through since the last second
Next is the function we call each frame
Sub CountFPS()
If CurrentTime() - LastTime >= 1000 Then FPS = Count Count = 1 LastTime = CurrentTime() Else Count = Count + 1 End If
End Sub
Looking back now that actually looks like VB, not Esdeedoublian :\