Or you can draw the pie like I did in the "
How to draw something like a pie chart" post.
Here is some example code that you can change to draw your radar thing:
SuperStrict
Graphics 800, 600, 0
Local pie1:TPieClock = TPieClock.Create(300, 300, 12, 2, 20000)' centerX, centerY, radius, margin, duration
pie1.start()
Local pie2:TPieClock = TPieClock.Create(500, 300, 124, 10, 10000)' centerX, centerY, radius, margin, duration
pie2.start()
While Not KeyHit(KEY_ESCAPE)
Cls
pie1.update()
pie2.update()
pie1.draw()
pie2.draw()
Flip
Wend
End
Type TPieClock
Field pfX#
Field pfY#
Field pfR#
Field pfMargin#
Field pfAngle# = 0
Field pfCircumference# 'I use this to calculate the correct number of lines to be drawn in the drawSegment() method
' background color
Field piR1% = 70
Field piG1% = 90
Field piB1% = 90
' segment color
Field piR2% = 30
Field piG2% = 170
Field piB2% = 80
' timer values
Field piStart%
Field pfDuration# 'in milliseconds
Function Create:TPieClock(fx#, fy#, fr#, fm# = 0, fDur# = 1000)
Local p:TPieClock = New TPieClock
p.pfX = fx
p.pfY = fy
p.pfR = fr
p.pfMargin = Min(fm, fr-1)
p.pfCircumference = 2 * Pi * (fr-fm)
p.pfDuration = fDur
Return p
End Function
Method start()
piStart = MilliSecs()
End Method
Method update()
Local p# = eTime()
If p>=1 Then
'ok, time's up
p = 1
End If
pfAngle = p * 360
End Method
Method draw()
SetColor(piR1, piG1, piB1)
DrawOval(pfX - pfR, pfY - pfR, pfR * 2, pfR * 2)
drawSegment()
End Method
' draws the segment
Method drawSegment()
SetColor(piR2, piG2, piB2)
Local r# = pfR - pfMargin
Local s# = pfAngle / ((pfAngle/360) * pfCircumference)
' s# = angle Step size; To be sure the While-Wend loop will draw exactly enough lines To cover the segment
Local a# = 0
While a < pfAngle
DrawLine(pfX-0.5, pfY-0.5, pfX-0.5 + Cos(a-90) * r, pfY-0.5 + Sin(a-90) * r, 0)
a:+s
Wend
DrawLine(pfX-0.5, pfY-0.5, pfX-0.5 + Cos(pfAngle-90) * r, pfY-0.5 + Sin(pfAngle-90) * r, 0)
' I draw this line at the exact angle location
End Method
Method eTime#()
Return (MilliSecs() - piStart) / pfDuration
End Method
End Type
Good luck!