setShapeTint()
Purpose
Applies a tint (colour) to a shape
Description
Used to apply a colour vector (RGBA) to a shape drawn with drawShape()
Syntax
setShapeTint( shape, tint )
Arguments
shape Handle which stores the shape in question
tint RGBA vector which describes the colour to be applied to the supplied shape
Example
gw = gWidth()
gh = gHeight()
tint = white
press = false
shape = createTriangle( gw / 3, gh / 3, gw - gw / 3, gh / 3, gw / 2, gh - gh / 4 )
cols = [ red, green, blue ]
for i = 0 to len( cols ) loop
setVertexColour( shape, i, cols[i] )
repeat
loop
clear()
j = controls( 0 )
if j.a and !press then
tint = { random( 1.0 ), random( 1.0 ), random( 1.0 ), 1 }
setShapeTint( shape, tint )
press = true
endif
if !j.a then
press = false
endif
drawShape( shape )
printAt( 0, 0, "Press the A button to change the shape tint" )
printAt( 0, 2, "Current tint colour RGBA vector: ", tint )
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(), setVertex(), setVertexColour(), setVertexLineStyle()