Here are two basic functions I wrote which work well, and draw fast.
You can use the circle function like this:
drawEllipse (350, 340, 180,250) ' oval at coordinates 350, 340 with an x radius of 180 and y radius of 250
Or you can change some of the extended features, like so:
drawEllipse (350, 340, 180, 250, 6, 3, DOTTED) ' same as above, but with a higher resolution, thicker line and dotted turned on.
etc...
And the rectangle function is as simple as:
drawl(200,200,190,100) ' draw rectangle from 200,200 and make it 190 pixels wide and 100 pixels high
...but if you want more features, you can get those too:
drawl(200,200,190,100, 2, CORNERS) ' same as above, but draw thicker lines and only draw the corners
etc...
You can paste this code right onto the bottom of your program
or save it in it's own file so that you can just include it in any
program you write.
I hope you like it. ;)
Const NORMAL = 0
Const DOTTED = 1
Function drawEllipse(x:Int,y:Int,xSize:Int,ySize:Int,StepSize:Int = 15, width:Int=1, style:Int = NORMAL)
Local oldlinewidth:Int = GetLineWidth(), dot:Int = 1
SetLineWidth width
Local a:Int = stepSize
Repeat
If dot DrawLine x+xSize*Sin(a), y+ySize*Cos(a),x+xSize*Sin(a-stepSize), y+ySize*Cos(a-stepSize)
a:+stepSize
If style dot = 1-dot
Until a> 360
SetLineWidth oldlinewidth
EndFunction
Const FILL = 3
Const LINE = 2
Const CORNERS = 1
Const BOX = 0
Function drawl(x1:Int,y1:Int,x2:Int,y2:Int,width:Int=1,style:Int = BOX)
Local oldlinewidth:Int = GetLineWidth()
SetLineWidth width
Select style
Case 3
DrawRect x1,y1,x2,y2
Case 2
x2:+x1
y2:+y1
DrawLine x1,y1,x2,y2
Case 1
x2:+x1
y2:+y1
DrawLine (x1,y1,x1+(x2-x1)*.1,y1)
DrawLine (x1,y1,x1,y1+(y2-y1)*.1)
DrawLine (x1,y2-(y2-y1)*.1,x1,y2)
DrawLine (x1,y2,x1+(x2-x1)*.1,y2)
DrawLine (x2,y1,x2-(x2-x1)*.1,y1)
DrawLine (x2,y1,x2,y1+(y2-y1)*.1)
DrawLine (x2,y2-(y2-y1)*.1,x2,y2)
DrawLine (x2,y2,x2-(x2-x1)*.1,y2)
Default
x2:+x1
y2:+y1
DrawLine (x1,y1,x2,y1)
DrawLine (x1,y1,x1,y2)
DrawLine (x1,y2,x2,y2)
DrawLine (x2,y1,x2,y2)
EndSelect
SetLineWidth oldlinewidth
End Function