createLine()

Purpose

Create a line

Description

Creates a line between two supplied points on screen to be drawn with drawShape()

Syntax

shape = createLine( x1, y1, x2, y2 )

Arguments

shape Handle which stores the newly created line

x1 Horizontal screen position of the first point in the line

y1 Vertical screen position of the first point in the line

x2 Horizontal screen position of the second point in the line

y2 Vertical screen position of the second point in the line

Example

gw = gwidth()
gh = gheight()

points = [
    [{gw/3, gh/3}, {gw - gw/3, gh - gh/3}],
    [{gw/3, gh - gh/3}, {gw - gw/3, gh/3}]
]

shapes = [
    createLine(points[0][0].x, points[0][0].y, points[0][1].x, points[0][1].y),
    createLine(points[1][0].x, points[1][0].y, points[1][1].x, points[1][1].y)
]

setShapeColour(shapes[0], white)
setShapeColour(shapes[1], white)

loop
    clear()
    for i = 0 to len(shapes) loop
        drawShape(shapes[i])
    repeat  
    update()
repeat

Associated Commands

copyShape(), createBox(), createCircle(), createCurve(), createLineStrip(), createPoly(), 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()