VG_TEXT(3)

NAME
VG_Text - agar-vg text entity

SYNOPSIS

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

DESCRIPTION
VG_Text is a VG(3) node class which displays a text label. The position and orientation of the label is described by two points.

INTERFACE
VG_Text * VG_TextNew(VG_Node *parent, VG_Point *p1, VG_Point *p2)

void VG_TextString(VG_Text *vg, const char *text)

void VG_TextPrintf(VG_Text *vg, const char *fmt, ...)

void VG_TextAlignment(VG_Text *vt, enum vg_alignment alignment)

void VG_TextFontFace(VG_Text *vt, const char *face)

void VG_TextFontSize(VG_Text *vt, int points)

void VG_TextFontFlags(VG_Text *vt, Uint flags)

void VG_TextSubstObject(VG_Text *vt, AG_Object *obj)

The VG_TextNew() function creates a new text entity attached to parent. The text will be aligned with a line described by the points p1 and p2.

The functions VG_TextString() and VG_TextPrintf() change the text associated with the element. A NULL argument will result in no text being displayed.

VG_TextAlignment() specifies the alignment of the text:

    enum vg_alignment {
    	VG_ALIGN_TL, VG_ALIGN_TC, VG_ALIGN_TR,
    	VG_ALIGN_ML, VG_ALIGN_MC, VG_ALIGN_MR,
    	VG_ALIGN_BL, VG_ALIGN_BC, VG_ALIGN_BR
    };

VG_TextFontFace() sets the font face to use in rendering the text (for example, the "algue" built-in, or a font filename). See AG_Text(3) for details.

VG_TextFontSize() sets the size of the font in points. VG_TextFontFlags() sets various text rendering options, as documented in AG_Text(3).

The VG_TextSubstObject() function enables run-time substitution of AG_Variable(3) references in the text. Before the text is rendered to the display, references of the form "$(foo)" will be substituted for the contents of the variable ‘foo’ of object obj.

SEE ALSO
VG(3), VG_Point(3)

HISTORY
The VG_Text class first appeared in Agar 1.3.3.