home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "FlakeAni"
- Option Explicit
-
- #If Win32 Then
- Declare Function GetTickCount Lib "kernel32" () As Long
- #Else
- Declare Function GetTickCount Lib "User" () As Long
- #End If
-
- ' ************************************************
- ' Pause until GetTickCount shows the indicated
- ' time. This is accurate to within one clock tick
- ' (55 ms), not counting variability in DoEvents
- ' and Windows itself.
- ' ************************************************
- Sub WaitTill(next_time As Long)
- Do
- DoEvents
- Loop While GetTickCount() < next_time
- End Sub
-
- ' ************************************************
- ' Return the arc tangent of y/x taking into
- ' account the proper quadrant.
- ' ************************************************
- Function Arctan2(x As Single, y As Single)
- Const PI = 3.14159
- Const PI_OVER_2 = PI / 2
-
- Dim theta As Single
-
- If x = 0 Then
- If y > 0 Then
- Arctan2 = PI_OVER_2
- Else
- Arctan2 = -PI_OVER_2
- End If
- Else
- theta = Atn(y / x)
- If x < 0 Then theta = PI + theta
- Arctan2 = theta
- End If
- End Function
-
-
-
-