Code archives/Graphics/DrawTriangle()

This code has been declared by its author to be Public Domain code.

Download source code

DrawTriangle() by drnmr2006
example:
DrawTriangle(0,0,30,50)
Sorry, you can't rotate.. wrote this in about five minutes.
Function DrawTriangle(x:Int,y:Int,length:Int,height:Int)
	toppointx = length/2+x'top point y is just y
	leftpointy = y+height'left point x is just x
	rightpointx = x+length
	rightpointy = y+height
	DrawLine toppointx,y,x,leftpointy
	DrawLine x,leftpointy,rightpointx,rightpointy
	DrawLine rightpointx,rightpointy,toppointx,y
EndFunction

Comments

None.

Code Archives Forum