LINE [(x1 , y1)] – (x2, y2) [,c [,B[F]]]
Draws a line or box on the video screen.
x1,y1 and x2,y2 specify the beginning and end points of a line.
‘c’ specifies the color and defaults to the default foreground color if not specified. It can also be -1 to invert the pixels.
(x1, y1) is optional and if omitted the last drawing point will be used.
The optional B will draw a box with the points (x1,y1) and (x2,y2) at opposite corners. The optional BF will draw a box and fill the interior.
Example code that uses the box capabilities of the LINE command:
1 2 3 4 5 6 7 8 9 |
MODE 3 CLS FOR a = 1 to 40 LINE (RND()*480 , RND()*432) - (RND()*480, RND()*432), RND()*6+1, B ' Version with fill 'LINE (RND()*480 , RND()*432) - (RND()*480, RND()*432), RND()*6+1, BF NEXT a |
Two outputs of program that draws boxes on screen.
Using lines to write a name in cursive.
Code for cursive name example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
COLOR 0, 7 CLS For loop = 1 to 50 ' Jos point 1 and 2 LINE (96+ RND()*2 , 208+ RND()*2) - (90+ RND()*2, 224+ RND()*2) ' Jos 3-50 For a = 1 to 48 if loop = 1 then pause 80 READ x : READ y LINE - (x + RND()*2, y + RND()*2) next a ' ette point 1 and 2 LINE (246+ RND()*2 , 240+ RND()*2) - (270+ RND()*2, 236+ RND()*2) ' ette 3-42 For a = 1 to 40 if loop = 1 then pause 80 READ x : READ y LINE - (x + RND()*2, y + RND()*2) next a ' Cross tt LINE (306+ RND()*2 , 120+ RND()*2) - (456+ RND()*2, 104+ RND()*2) RESTORE Next loop 'Jos points 3-50 DATA 84,240, 72,256, 60,260 DATA 48,256, 39,240, 36,216, 42,176, 48,144 DATA 66,88, 84,56, 102,32, 126,8, 141,4 DATA 150,8, 159,32, 162,72, 162,120, 156,184 DATA 144,264, 132,320, 114,360, 96,388, 84,396 DATA 72,400, 60,400, 48,384, 42,360, 48,336 DATA 54,312, 72,280, 120,224, 198,152, 198,188 DATA 192,208, 186,224, 177,236, 172,224, 180,192 DATA 198,152, 201,184, 210,188, 222,180, 258,136 DATA 258,208, 252,232, 246,240, 228,216, 219,184 'ette points 3-42 DATA 288,208, 297,184, 300,168 DATA 300,152, 297,144, 284,168, 276,184, 273,208 DATA 282,224, 288,236, 294,240, 306,232, 321,208 DATA 333,176, 354,96, 345,176, 342,200, 342,224 DATA 351,232, 366,208, 378,176, 396,96, 384,176 DATA 378,200, 381,224, 390,232, 408,224, 426,208 DATA 438,184, 447,160, 447,136, 444,124, 438,128 DATA 426,144, 417,176, 414,200, 417,224, 432,240 DATA 456,244, 474,240 |
VGA screen resolution is 480 horizontal by 432 vertical in modes 1-3, and 240×416 in mode 4. PAL composite is 304 by 216 and NTSC composite is 304 by 180.
See also:
BLIT
CIRCLE
CLR$
CLS
COLOR
LOCATE
MM.HPOS
MM.HRES
MM.VPOS
MM.VRES
MODE
PIXEL
POS
PRESET
PRINT @
PSET
SCANLINE
SPRITE
Leave a Reply