Non-fill Draw Shapes

BlitzMax Forums/BlitzMax Beginners Area/Non-fill Draw Shapes

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

the '..' are line continuation if you haven't guessed yet.
Anyway, this seems to do the job using standard Bmax commands :
Function Drawrect1( x:Float, y:Float, w:Float,h:Float, fill:Int=True)
	Local origin_x:Float
	Local origin_y:Float
	GetOrigin origin_x,origin_y
	Local handle_x:Float
	Local handle_y:Float
	GetHandle handle_x,handle_y
	Local xy:Float[]=[x,y,x+w,y,x+w,y+h,x,y+h]
	If fill
		DrawPoly xy
	Else
		Local x1:Float=xy[xy.Length-2]
		Local y1:Float=xy[xy.Length-1]
		For Local i:Int=0 Until Len xy Step 2
			Local x2:Float=xy[i]
			Local y2:Float=xy[i+1]
			DrawLine (handle_x + x1 , handle_y + y1 , handle_x + x2 , handle_y + y2) 
			x1=x2
			y1=y2
		Next

	EndIf
End Function
Graphics 800 , 600
drawrect1(100 , 100 , 100 , 100)
drawrect1(10,10,110,110,False)
Flip
WaitKey()