draw_line(VECTOR* pos, COLOR* color, var alpha)
draw_line3d(VECTOR* pos, COLOR* color, var alpha)
Draws a 2D or 3D line to a given position with the given color and transparency.
Parameters:
pos - End position of the line, either in XY screen
coordinates (draw_line) or in XYZ level coordinates (draw_line3d,
A7 ). The start position is the position of the last line draw call.
color - BGR end color of the line. The start color
is the color of the last line draw call. The line is drawn in
a smooth transition between the start and the end color. If NULL is given, no
line is drawn, but the position is set for the start of the next line.
alpha - End transparency of the line, 0..100. The line is
drawn in a smooth transition between the start and the end transparency.
Speed:
Fast
Remarks:
- The line is only visible in the next frame. For displaying a steady line,
use a while ... wait(1) loop.
- Every 3D line is using a particle, so adjust max_particles if
you need many lines.
-
The bmap_rendertarget function can be used to draw the line onto a bitmap.
Example:
function draw_red_rect(x1,y1,x2,y2)
{
while(1)
{
draw_line(vector(x1,y1,0),NULL,100); // move to first corner
draw_line(vector(x2,y1,0),vector(0,0,255),100);
draw_line(vector(x2,y2,0),vector(0,0,255),100);
draw_line(vector(x1,y2,0),vector(0,0,255),100);
draw_line(vector(x1,y1,0),vector(0,0,255),100);
wait(1);
}
}
See also:
draw_text, draw_point3d,
draw_quad, bmap_rendertarget
► latest
version online