Line x1,y1,x2,y2
Parameters
|
x1 - x coordinate of the line's start point y1 - y coordinate of the line's start point x2 - x coordinate of the line's end point y2 - y coordinate of the line's end point |
Description
|
Draws a straight line between two points in the current drawing colour. A one-pixel-wide line from x1,y1 to x2,y2, in the colour set by Color, on the current buffer. Lines are the workhorse of vector-style looks - radar sweeps, laser beams, wireframes, graphs, debug rays - and a quick way to sketch level geometry before art exists. Coordinates respect the current Origin and drawing is clipped to the Viewport, so lines can run off screen safely. There is no thickness option; for a fat line draw a thin Rect, or several parallel lines. See also: Plot, Rect, Oval, Color. |
Example
; Line Example ; ------------ Graphics 640,480,0,2 SetBuffer BackBuffer() SeedRnd MilliSecs() ; Scatter some radar blips Dim blipx(4),blipy(4) For i=0 To 4 a=Rand(0,359) d=Rand(40,170) blipx(i)=320+Cos(a)*d blipy(i)=240+Sin(a)*d Next angle#=0 While Not KeyDown(1) Cls ; Radar rings Color 0,80,0 Oval 140,60,360,360,0 Oval 200,120,240,240,0 Oval 260,180,120,120,0 ; Cross hairs drawn with Line Line 140,240,500,240 Line 320,60,320,420 ; Blips Color 255,80,80 For i=0 To 4 Oval blipx(i)-3,blipy(i)-3,6,6,1 Next ; The rotating radar sweep - one Line from the centre outwards angle=angle+2 Color 0,255,0 Line 320,240,320+Cos(angle)*180,240+Sin(angle)*180 Color 255,255,255 Text 0,0,"Esc: exit" Text 0,20,"Line 320,240,"+Int(320+Cos(angle)*180)+","+Int(240+Sin(angle)*180) Flip Wend End
Index