Nuclide
Software Development Kit for id Technology (BETA)
vguiFont Class Reference

Public Member Functions

void vguiFont (void)
 
nonvirtual vguiFont LoadFontFromFile (string)
 
nonvirtual void DrawText (vector vecOrigin, string strText)
 Draw text on the screen at the desired position with a desired font. More...
 
nonvirtual void DrawText_A (vector vecOrigin, string strText, float a)
 Draw alpha-blended text on the screen at the desired position with a desired font. More...
 
nonvirtual void DrawText_RGB (vector vecOrigin, string strText, vector col)
 Draw tinted text on the screen at the desired position with a desired font. More...
 
nonvirtual void DrawText_RGBA (vector vecOrigin, string strText, vector col, float a)
 Draw tinted and alpha blended text on the screen at the desired position with a desired font. More...
 
nonvirtual void DrawRText (vector vecOrigin, string strText)
 Right-aligned variant of DrawText. More...
 
nonvirtual void DrawRText_A (vector vecOrigin, string strText, float a)
 Right-aligned variant of DrawText_A. More...
 
nonvirtual void DrawRText_RGB (vector vecOrigin, string strText, vector col)
 Right-aligned variant of DrawText_RGB. More...
 
nonvirtual void DrawRText_RGBA (vector vecOrigin, string strText, vector col, float a)
 Right-aligned variant of DrawText_RGBA. More...
 
nonvirtual void DrawField (vector vecOrigin, vector vecSize, string strText, alignflags_t iAlignFlags)
 Draws a textfield with line wrapping. More...
 
nonvirtual void DrawFieldAtHeight (vector vecOrigin, vector vecSize, int iTextHeight, string strText, alignflags_t iAlignFlags)
 Draws a textfield with line wrapping at a custom text height. More...
 
nonvirtual string RGBtoHex (vector vecColor)
 Converts a normalized RGB color vector to a hex color string. More...
 
nonvirtual int GetHeight ()
 Returns the height of a specified font in pixels. More...
 
nonvirtual float StringWidth (string strText, bool hasColor)
 Returns the width of a series of characters in pixels. More...
 
nonvirtual float GetID ()
 Get the internal font id. More...
 
nonvirtual void DrawTextScroll (vector vecOrigin, string strText, vector canvasSize)
 
nonvirtual void DrawTextScroll_A (vector vecOrigin, string strText, vector canvasSize, float a)
 
nonvirtual void DrawTextScroll_RGB (vector vecOrigin, string strText, vector canvasSize, vector rgb)
 
nonvirtual void DrawTextScroll_RGBA (vector vecOrigin, string strText, vector canvasSize, vector rgb, float a)
 

Constructor & Destructor Documentation

◆ vguiFont()

void vguiFont::vguiFont ( void  )

Member Function Documentation

◆ DrawField()

void vguiFont::DrawField ( vector  vecOrigin,
vector  vecSize,
string  strText,
alignflags_t  iAlignFlags 
)

Draws a textfield with line wrapping.

Parameters
vecOriginis the absolute starting position.
vecSizeis the total area in pixels that the field takes up on the screen.
strTextis the text to be drawn onto the screen.
fntis the font to be used for rendering the text.
iAlignFlagssets how the text may be aligned.

◆ DrawFieldAtHeight()

void vguiFont::DrawFieldAtHeight ( vector  vecOrigin,
vector  vecSize,
int  iTextHeight,
string  strText,
alignflags_t  iAlignFlags 
)

Draws a textfield with line wrapping at a custom text height.

Parameters
vecOriginis the absolute starting position.
vecSizeis the total area in pixels that the field takes up on the screen.
iTextHeightis the desired text height in pixels.
strTextis the text to be drawn onto the screen.
fntis the font to be used for rendering the text.
iAlignFlagssets how the text may be aligned.

◆ DrawRText()

void vguiFont::DrawRText ( vector  vecOrigin,
string  strText 
)

Right-aligned variant of DrawText.

See also
DrawText

◆ DrawRText_A()

void vguiFont::DrawRText_A ( vector  vecOrigin,
string  strText,
float  a 
)

Right-aligned variant of DrawText_A.

See also
DrawText_A

◆ DrawRText_RGB()

void vguiFont::DrawRText_RGB ( vector  vecOrigin,
string  strText,
vector  col 
)

Right-aligned variant of DrawText_RGB.

See also
DrawText_RGB

◆ DrawRText_RGBA()

void vguiFont::DrawRText_RGBA ( vector  vecOrigin,
string  strText,
vector  col,
float  a 
)

Right-aligned variant of DrawText_RGBA.

See also
DrawText_RGBA

◆ DrawText()

void vguiFont::DrawText ( vector  vecOrigin,
string  strText 
)

Draw text on the screen at the desired position with a desired font.

Parameters
vecOriginis the absolute starting position.
strTextis the text to be drawn.
fntis the font to be used.

◆ DrawText_A()

void vguiFont::DrawText_A ( vector  vecOrigin,
string  strText,
float  a 
)

Draw alpha-blended text on the screen at the desired position with a desired font.

Parameters
vecOriginis the absolute starting position.
strTextis the text to be drawn.
ais the alpha value to blend with.
fntis the font to be used.

◆ DrawText_RGB()

void vguiFont::DrawText_RGB ( vector  vecOrigin,
string  strText,
vector  col 
)

Draw tinted text on the screen at the desired position with a desired font.

Parameters
vecOriginis the absolute starting position.
strTextis the text to be drawn.
colis the normalized color value to tint the text with.
fntis the font to be used.

◆ DrawText_RGBA()

void vguiFont::DrawText_RGBA ( vector  vecOrigin,
string  strText,
vector  col,
float  a 
)

Draw tinted and alpha blended text on the screen at the desired position with a desired font.

Parameters
vecOriginis the absolute starting position.
strTextis the text to be drawn.
colis the normalized color value to tint the text with.
ais the alpha value to blend with.
fntis the font to be used.

◆ DrawTextScroll()

void vguiFont::DrawTextScroll ( vector  vecOrigin,
string  strText,
vector  canvasSize 
)

◆ DrawTextScroll_A()

void vguiFont::DrawTextScroll_A ( vector  vecOrigin,
string  strText,
vector  canvasSize,
float  a 
)

◆ DrawTextScroll_RGB()

void vguiFont::DrawTextScroll_RGB ( vector  vecOrigin,
string  strText,
vector  canvasSize,
vector  rgb 
)

◆ DrawTextScroll_RGBA()

void vguiFont::DrawTextScroll_RGBA ( vector  vecOrigin,
string  strText,
vector  canvasSize,
vector  rgb,
float  a 
)

◆ GetHeight()

int vguiFont::GetHeight ( void  )

Returns the height of a specified font in pixels.

Parameters
fntis the font to be queried.
Returns
is the height of a font in pixels.
See also
StringWidth

◆ GetID()

float vguiFont::GetID ( void  )

Get the internal font id.

The internal font id is only useful for when you want to assign 'drawfont' yourself, or have some other use for it. Those id's are meant to be unique, but may change between vid_reload or other cases where video memory is de-allocated. Overall you should never need to use this, unless you know what you're doing or are porting old code.

Parameters
fntis the font to be queried.
Returns
the internal 'drawfont' id of the specified font.

◆ LoadFontFromFile()

vguiFont vguiFont::LoadFontFromFile ( string  strFile)

◆ RGBtoHex()

string vguiFont::RGBtoHex ( vector  vecColor)

Converts a normalized RGB color vector to a hex color string.

Parameters
vecColoris the normalized input color. E.g. [1.0f, 0.0f, 0.0f]
Returns
is a hex color string. e.g. "^xF00"

◆ StringWidth()

float vguiFont::StringWidth ( string  strText,
bool  hasColor 
)

Returns the width of a series of characters in pixels.

If you have a string with funstring color codes (e.g. ^1 or ^xF00) and want to make sure those are not interpreted as visible characters, set the parameter hasColor to true. Rendering may be more expensive this way, but you should generally cache the result instead of querying it every frame anyway.

The return value is of type float, to be a drop-in replacement for the engine builtin stringwidth().

Parameters
strTextis the text to get the length of.
hasColorhints if funstring color codes are present in the string.
fntis the font used with the text in question.

The documentation for this class was generated from the following file: