Programmerare, skeptiker, sekulärhumanist, antirasist.
Författare till bok om C64 och senbliven lantis.
Röstar pirat.
2009-11-06
The basic syntax for drawing lines is this: Use the Line instruction, pass a start coordinate (X1 and Y1) and an end coordinate (X2 and Y2) and a color. This example draws a line across the picture:
//Set image size and background color. Clear 400x300 #ffffff //Simple line. Line #000000 X1:0 Y1:0 X2:400 Y2:300
The coordinates can be given in an alternative nameless format. This is useful when drawing multiple lines with one single line instruction. This code draws a red U-shape.
//Set image size and background color. Clear 400x300 #ffffff //Polyline Line #ff0000 (10,10) (10,290) (390,290) (390,10)
To close this shape, you can add the (10,10) coordinate to the end of this line, telling Monkeybone to draw a line from (390,10) to the startpoint at (10,10), or you can add the AutoClose argument. This code draws a red rectangle:
//Set image size and background color. Clear 400x300 #ffffff //Polyline Line #ff0000 (10,10) (10,290) (390,290) (390,10) AutoClose
To draw a filled rectangle instead of a rectangle contour, use the Filled argument instead of the AutoClose argument. This code draws a yellow box with black outline:
//Set image size and background color. Clear 400x300 #ffffff //Polyline Line #ffff00 (10,10) (10,290) (390,290) (390,10) Filled Line #000000 (10,10) (10,290) (390,290) (390,10) AutoClose
Categories: General
Tags: Monkeybone
Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!
Leave a Reply