Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
' Draw the triangle on the indicated picture box.
Public Sub Sprite_DrawSprite(ByVal pic As PictureBox)
Dim i As Integer
Dim pts(1 To 3) As POINTAPI
' Compute the current corner locations.
For i = 1 To 3
pts(i).x = Cx + PtR(i) * Cos(PtT(i) + Theta)
pts(i).y = Cy + PtR(i) * Sin(PtT(i) + Theta)
Next i
' Draw the triangle.
pic.FillColor = Color
pic.ForeColor = Color
Polygon pic.hdc, pts(1), 3
End Sub
' Initialize the rectangle.
Public Sub InitializeTriangle(ByVal new_cx As Integer, ByVal new_cy As Integer, ByVal new_vx As Integer, ByVal new_vy As Integer, ByVal r1 As Integer, ByVal t1 As Integer, ByVal r2 As Integer, ByVal t2 As Integer, ByVal r3 As Integer, ByVal t3 As Integer, ByVal new_theta As Single, ByVal new_vtheta As Single, ByVal new_color As Long)
Cx = new_cx
Cy = new_cy
Vx = new_vx
Vy = new_vy
PtR(1) = r1
PtT(1) = t1
PtR(2) = r2
PtT(2) = t2
PtR(3) = r3
PtT(3) = t3
Theta = new_theta
Vtheta = new_vtheta
Color = new_color
End Sub
' Add the velocity components to the sprite's
' position components.
Public Sub Sprite_MoveSprite(ByVal xmin As Integer, ByVal xmax As Integer, ByVal ymin As Integer, ByVal ymax As Integer)