SHVDN  v3
An ASI plugin for Grand Theft Auto V, which allows running scripts written in any .NET language in-game. Developed by crosire https://github.com/crosire/scripthookvdotnet/
GTA.UI.TextElement Class Reference
Inheritance diagram for GTA.UI.TextElement:
GTA.UI.IElement

Public Member Functions

 TextElement (string caption, PointF position, float scale)
 Initializes a new instance of the TextElement class used for drawing text on the screen. More...
 
 TextElement (string caption, PointF position, float scale, Color color)
 Initializes a new instance of the TextElement class used for drawing text on the screen. More...
 
 TextElement (string caption, PointF position, float scale, Color color, Font font)
 Initializes a new instance of the TextElement class used for drawing text on the screen. More...
 
 TextElement (string caption, PointF position, float scale, Color color, Font font, Alignment alignment)
 Initializes a new instance of the TextElement class used for drawing text on the screen. More...
 
 TextElement (string caption, PointF position, float scale, Color color, Font font, Alignment alignment, bool shadow, bool outline)
 Initializes a new instance of the TextElement class used for drawing text on the screen. More...
 
 TextElement (string caption, PointF position, float scale, Color color, Font font, Alignment alignment, bool shadow, bool outline, float wrapWidth)
 Initializes a new instance of the TextElement class used for drawing text on the screen. More...
 
virtual void Draw ()
 Draws the TextElement this frame. More...
 
virtual void Draw (SizeF offset)
 Draws the TextElement this frame at the specified offset. More...
 
virtual void ScaledDraw ()
 Draws the TextElement this frame using the width returned in Screen.ScaledWidth. More...
 
virtual void ScaledDraw (SizeF offset)
 Draws the TextElement this frame at the specified offset using the width returned in Screen.ScaledWidth. More...
 

Static Public Member Functions

static float GetStringWidth (string text, Font font=Font.ChaletLondon, float scale=1.0f)
 Measures how many pixels in the horizontal axis the string will use when drawn More...
 
static float GetScaledStringWidth (string text, Font font=Font.ChaletLondon, float scale=1.0f)
 Measures how many pixels in the horizontal axis the string will use when drawn More...
 

Properties

bool Enabled [get, set]
 Gets or sets a value indicating whether this TextElement will be drawn. More...
 
Color Color [get, set]
 Gets or sets the color of this TextElement. More...
 
PointF Position [get, set]
 Gets or sets the position of this TextElement. More...
 
float Scale [get, set]
 Gets or sets the scale of this TextElement. More...
 
Font Font [get, set]
 Gets or sets the font of this TextElement. More...
 
string Caption [get, set]
 Gets or sets the text to draw in this TextElement. More...
 
Alignment Alignment [get, set]
 Gets or sets the alignment of this TextElement. More...
 
bool Shadow [get, set]
 Gets or sets a value indicating whether this TextElement is drawn with a shadow effect. More...
 
bool Outline [get, set]
 Gets or sets a value indicating whether this TextElement is drawn with an outline. More...
 
float WrapWidth [get, set]
 Gets or sets the maximum size of the TextElement before it wraps to a new line. More...
 
bool Centered [get, set]
 Gets or sets a value indicating whether the alignment of this TextElement is centered. See Alignment More...
 
float Width [get]
 Measures how many pixels in the horizontal axis this TextElement will use when drawn against a 1280 pixel base More...
 
float ScaledWidth [get]
 Measures how many pixels in the horizontal axis this TextElement will use when drawn against a ScaledWidth pixel base More...
 
- Properties inherited from GTA.UI.IElement
bool Enabled [get, set]
 Gets or sets a value indicating whether this IElement will be drawn. More...
 
Color Color [get, set]
 Gets or sets the color of this IElement. More...
 
PointF Position [get, set]
 Gets or sets the position of this IElement. More...
 
bool Centered [get, set]
 Gets or sets a value indicating whether this IElement should be positioned based on its center or top left corner More...
 

Constructor & Destructor Documentation

◆ TextElement() [1/6]

GTA.UI.TextElement.TextElement ( string  caption,
PointF  position,
float  scale 
)

Initializes a new instance of the TextElement class used for drawing text on the screen.

Parameters
captionThe TextElement to draw.
positionSet the Position on screen where to draw the TextElement.
scaleSets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.

◆ TextElement() [2/6]

GTA.UI.TextElement.TextElement ( string  caption,
PointF  position,
float  scale,
Color  color 
)

Initializes a new instance of the TextElement class used for drawing text on the screen.

Parameters
captionThe TextElement to draw.
positionSet the Position on screen where to draw the TextElement.
scaleSets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.
colorSet the Color used to draw the TextElement.

◆ TextElement() [3/6]

GTA.UI.TextElement.TextElement ( string  caption,
PointF  position,
float  scale,
Color  color,
Font  font 
)

Initializes a new instance of the TextElement class used for drawing text on the screen.

Parameters
captionThe TextElement to draw.
positionSet the Position on screen where to draw the TextElement.
scaleSets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.
colorSet the Color used to draw the TextElement.
fontSets the Font used when drawing the text.

◆ TextElement() [4/6]

GTA.UI.TextElement.TextElement ( string  caption,
PointF  position,
float  scale,
Color  color,
Font  font,
Alignment  alignment 
)

Initializes a new instance of the TextElement class used for drawing text on the screen.

Parameters
captionThe TextElement to draw.
positionSet the Position on screen where to draw the TextElement.
scaleSets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.
colorSet the Color used to draw the TextElement.
fontSets the Font used when drawing the text.
alignmentSets the Alignment used when drawing the text, GTA.UI.Alignment.Left,GTA.UI.Alignment.Center or GTA.UI.Alignment.Right.

◆ TextElement() [5/6]

GTA.UI.TextElement.TextElement ( string  caption,
PointF  position,
float  scale,
Color  color,
Font  font,
Alignment  alignment,
bool  shadow,
bool  outline 
)

Initializes a new instance of the TextElement class used for drawing text on the screen.

Parameters
captionThe TextElement to draw.
positionSet the Position on screen where to draw the TextElement.
scaleSets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.
colorSet the Color used to draw the TextElement.
fontSets the Font used when drawing the text.
alignmentSets the Alignment used when drawing the text, GTA.UI.Alignment.Left,GTA.UI.Alignment.Center or GTA.UI.Alignment.Right.
shadowSets whether or not to draw the TextElement with a Shadow effect.
outlineSets whether or not to draw the TextElement with an Outline around the letters.

◆ TextElement() [6/6]

GTA.UI.TextElement.TextElement ( string  caption,
PointF  position,
float  scale,
Color  color,
Font  font,
Alignment  alignment,
bool  shadow,
bool  outline,
float  wrapWidth 
)

Initializes a new instance of the TextElement class used for drawing text on the screen.

Parameters
captionThe TextElement to draw.
positionSet the Position on screen where to draw the TextElement.
scaleSets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.
colorSet the Color used to draw the TextElement.
fontSets the Font used when drawing the text.
alignmentSets the Alignment used when drawing the text, GTA.UI.Alignment.Left,GTA.UI.Alignment.Center or GTA.UI.Alignment.Right.
shadowSets whether or not to draw the TextElement with a Shadow effect.
outlineSets whether or not to draw the TextElement with an Outline around the letters.
wrapWidthSets how many horizontal pixel to draw before wrapping the TextElement on the next line down.

Member Function Documentation

◆ Draw() [1/2]

virtual void GTA.UI.TextElement.Draw ( )
virtual

Draws the TextElement this frame.

Implements GTA.UI.IElement.

◆ Draw() [2/2]

virtual void GTA.UI.TextElement.Draw ( SizeF  offset)
virtual

Draws the TextElement this frame at the specified offset.

Parameters
offsetThe offset to shift the draw position of this TextElement using a 1280*720 pixel base.

Implements GTA.UI.IElement.

◆ GetScaledStringWidth()

static float GTA.UI.TextElement.GetScaledStringWidth ( string  text,
Font  font = Font.ChaletLondon,
float  scale = 1.0f 
)
static

Measures how many pixels in the horizontal axis the string will use when drawn

Parameters
textThe string of text to measure.
fontThe GTA.UI.Font of the textu to measure.
scaleSets a sclae value for increasing or decreasing the size of the text, default value 1.0f - no scaling.
Returns
The amount of pixels scaled by the pixel width base return in Screen.ScaledWidth

◆ GetStringWidth()

static float GTA.UI.TextElement.GetStringWidth ( string  text,
Font  font = Font.ChaletLondon,
float  scale = 1.0f 
)
static

Measures how many pixels in the horizontal axis the string will use when drawn

Parameters
textThe string of text to measure.
fontThe GTA.UI.Font of the textu to measure.
scaleSets a sclae value for increasing or decreasing the size of the text, default value 1.0f - no scaling.
Returns
The amount of pixels scaled on a 1280 pixel width base

◆ ScaledDraw() [1/2]

virtual void GTA.UI.TextElement.ScaledDraw ( )
virtual

Draws the TextElement this frame using the width returned in Screen.ScaledWidth.

Implements GTA.UI.IElement.

◆ ScaledDraw() [2/2]

virtual void GTA.UI.TextElement.ScaledDraw ( SizeF  offset)
virtual

Draws the TextElement this frame at the specified offset using the width returned in Screen.ScaledWidth.

Parameters
offsetThe offset to shift the draw position of this TextElement using a Screen.ScaledWidth*720 pixel base.

Implements GTA.UI.IElement.

Property Documentation

◆ Alignment

Alignment GTA.UI.TextElement.Alignment
getset

Gets or sets the alignment of this TextElement.

The alignment:Left, Center, Right Justify

◆ Caption

string GTA.UI.TextElement.Caption
getset

Gets or sets the text to draw in this TextElement.

The caption.

◆ Centered

bool GTA.UI.TextElement.Centered
getset

Gets or sets a value indicating whether the alignment of this TextElement is centered. See Alignment

true if centered; otherwise, false.

◆ Color

Color GTA.UI.TextElement.Color
getset

Gets or sets the color of this TextElement.

The color.

◆ Enabled

bool GTA.UI.TextElement.Enabled
getset

Gets or sets a value indicating whether this TextElement will be drawn.

true if enabled; otherwise, false.

◆ Font

Font GTA.UI.TextElement.Font
getset

Gets or sets the font of this TextElement.

The GTA Font use when drawing.

◆ Outline

bool GTA.UI.TextElement.Outline
getset

Gets or sets a value indicating whether this TextElement is drawn with an outline.

true if outline; otherwise, false.

◆ Position

PointF GTA.UI.TextElement.Position
getset

Gets or sets the position of this TextElement.

The position scaled on a 1280*720 pixel base.

If ScaledDraw is called, the position will be scaled by the width returned in Screen.ScaledWidth.

◆ Scale

float GTA.UI.TextElement.Scale
getset

Gets or sets the scale of this TextElement.

The scale usually a value between ~0.5 and 3.0, Default = 1.0

◆ ScaledWidth

float GTA.UI.TextElement.ScaledWidth
get

Measures how many pixels in the horizontal axis this TextElement will use when drawn against a ScaledWidth pixel base

◆ Shadow

bool GTA.UI.TextElement.Shadow
getset

Gets or sets a value indicating whether this TextElement is drawn with a shadow effect.

true if shadow; otherwise, false.

◆ Width

float GTA.UI.TextElement.Width
get

Measures how many pixels in the horizontal axis this TextElement will use when drawn against a 1280 pixel base

◆ WrapWidth

float GTA.UI.TextElement.WrapWidth
getset

Gets or sets the maximum size of the TextElement before it wraps to a new line.

The width of the TextElement.


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