<-- Back to AG_Intro.3


#include <agar/core.h>
#include <agar/gui.h>
#include <agar/vg.h>


VG_Line is a VG(3) node class which describes a line segment in terms of two points.


VG_Line * VG_LineNew (VG_Node *parent, VG_Point *p1, VG_Point *p2)

void VG_LineThickness (VG_Line *vl, Uint8 thickness)

void VG_LineStipple (VG_Line *vl, Uint16 pattern)

void VG_LineEndpointStyle (VG_Line *vl, enum vg_endpoint_style style, ...)

The VG_LineNew() function creates a new line segment entity attached to parent. The p1 and p2 arguments define the endpoints.

VG_LineThickness() defines the thickness of the line in pixels (default = 1 pixel). Note that the line thickness parameter does not influence proximity queries used by "select" tools. it only affects rendering, so very thick lines should be rendered as VG_Polygon(3) instead.

VG_LineStipple() defines a 16-bit, OpenGL-style stipple pattern (default is 0xffff). The order in which bits are used is undefined and depends on order of rendering.

By default, thick lines are rendered using a square endpoint style. VG_LineEndpointStyle() specifies the style of endpoints to use in rendering the line. Acceptable values include:
enum vg_line_endpoint {
	VG_LINE_SQUARE,		/* Square endpoint */
	VG_LINE_BEVELED,	/* Beveled endpoint */
	VG_LINE_ROUNDED,	/* Rounded endpoint (circular) */
	VG_LINE_MITERED		/* Mitered endpoint */

If VG_LINE_MITERED is used, VG_LineEndpointStyle() expects a following Uint8 argument describing the miter length in pixels.


VG(3), VG_Point(3)


The VG_Line class first appeared in Agar 1.3.3.