setVertexLineStyle()

Purpose

Set the draw style for a vertex line

Description

Used to change the colour and thickness of a vertex line in a shape drawn with drawShape()

Syntax

setVertexLineStyle( shape, vertex, thickness, tint )

Arguments

shape Handle which stores the shape in question

vertex Integer index of the desired vertex (begins at 0, clockwise)

thickness Float describing the thickness (in pixels) of the line through the supplied vertex

tint Vector (RGBA) to set the colour of the line through the supplied vertex

Example

gw = gWidth()
gh = gHeight()

shape = createBox( gw/2, gh/2, gw/3, gh/3 )

array verts[numVerts( shape )] = [
    .col = {},
    .thickness = 1
]

cols = [
    red, 
    green,
    blue,
    pink
]

for i = 0 to numVerts( shape ) loop
    verts[i].col = cols[i]
    setVertexColour( shape, i, verts[i].col )
repeat

selected = 0
c = controls( 0 )
oldc = controls( 0 )

loop
    clear( bisque )
    c = controls( 0 )

    if c.right and !oldc.right then
        selected += 1
    endif
    if c.left and !oldc.left then
        selected -= 1
    endif
    if selected >= numVerts( shape ) then
        selected = 0
    endif
    if selected < 0 then
        selected = numVerts(shape) - 1
    endif

    verts[selected].thickness += c.ry

    for i = 0 to numVerts( shape ) loop
        setVertexLineStyle( shape, i, verts[i].thickness, verts[i].col )
    repeat

    oldc = c

    drawShape( shape )

    ink( grey )
    printAt( 0, 0, "Use left and right directional buttons to select a vertex" )
    printAt( 0, 2, "Use right control stick up and down to adjust selected vertex line thickness" )
    update()
+repeat

Associated Commands

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