createPoly()
Purpose
Creates a polygon to be drawn with drawShape()
Description
Creates a polygon with centre origin to be drawn at the specified x and y location with the specified dimensions and number of points
Syntax
shape = createPoly( point1, point2, ... pointN )
shape = createPoly( points )
Arguments
shape Handle to store the newly created shape
point1 Position vector for the first point of the polygon
point2 Position vector for the the second point of the polygon
pointN Position vector for the Nth point of the polygon (you can create any number of points)
points Array of vectors describing the desired points of the polygon
Example
// draw a multicoloured irregular 4 sided polygon on screen
w = gwidth()
h = gheight()
points = [
{ w / 3, h / 3 },
{ w - w / 3, h / 3 },
{ w - w / 4, h / 1.5 },
{ w / 8, h / 2.5 }
]
cols = [
red,
green,
blue,
bisque
]
shape_1 = createPoly( points )
for i = 0 to len( cols ) loop
setVertexColour( shape_1, i, cols[i] )
repeat
drawShape( shape_1 )
update()
sleep( 3 )
Associated Commands
copyShape(), createBox(), createCircle(), createCurve(), createLine(), createLineStrip(), createStar(), createTriangle(), deleteShape(), drawShape(), getShapeBounds(), getShapeLocation(), getShapeRotation(), getShapeScale(), getShapeTint(), getVertex(), getVertexColour(), getVertexLineColour(), getVertexLineThickness(), joinShapes(), moveShape(), numVerts(), rotateShape(), scaleShape(), setShapeColour(), setShapeLineStyle(), setShapeRotation(), setShapeScale(), setShapeScaleModeLocal(), setShapeTint(), setVertex(), setVertexColour(), setVertexLineStyle()