Dgs-dxlabel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(19 intermediate revisions by 2 users not shown)
Line 4: Line 4:


==Main Functions==
==Main Functions==
*[[dgsDxGUISetProperty]]
*[[dgsSetProperty]]
*[[dgsDxGUIGetProperty]]
*[[dgsGetProperty]]


==Properties==
==Properties==
===text===
===alignment===
This is equivalent to [[dgsDxGUISetText]]/[[dgsDxGUIGetText]].
Alignment of the text within the label.
<syntaxhighlight lang="lua">dgsDxGUISetProperty(label,"text",text)</syntaxhighlight>
 
*'''text''' : A string of the text of the label.
The functions as follows are based on this property.
 
[[dgsLabelSetHorizontalAlign]]/[[dgsLabelGetHorizontalAlign]]
 
[[dgsLabelSetVerticalAlign]]/[[dgsLabelGetVerticalAlign]]
<syntaxhighlight lang="lua">dgsSetProperty(label,"alignment",{alignX,alignY})</syntaxhighlight>
*'''alignX:''' Horizontal alignment of the text within the label. Can be "left", "center" or "right".
*'''alignY:''' Vertical alignment of the text within the label. Can be "top", "center" or "bottom".
 
===clip===
Whether the clip property is enabled or not. ''Learn More [[dxDrawText]]''
<syntaxhighlight lang="lua">dgsSetProperty(label,"clip",clip)</syntaxhighlight>
*'''clip:''' If set to true, the parts of the text that don't fit within the bounding box will be cut off.


===textcolor===
===colorCoded===
The color which can be translated by [[tocolor]] of the text of the label.
Whether the color code is enabled or not. ''Learn More [[dxDrawText]]''
<syntaxhighlight lang="lua">dgsDxGUISetProperty(label,"textcolor",textcolor)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(label,"colorCoded",colorCoded)</syntaxhighlight>
*'''textcolor''' : An integer of the color of the text of the label.
*'''colorCoded:''' Set to true to enable embedded #FFFFFF color codes.


===textsize===
===font===
The scale of the text of the label. ''Learn More [[dxDrawText]]''
This is equivalent to [[dgsSetFont]]/[[dgsGetFont]]. ''Learn More [[dxDrawText]]''
<syntaxhighlight lang="lua">dgsDxGUISetProperty(label,"textsize",{scaleX,scaleY})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(label,"font",font)</syntaxhighlight>
*'''scaleX''' : A float of the 2D X scale of the text of the label.
*'''font:''' A string or a [[Element/DX_font|dx font element]] of the text font of the label.
*'''scaleY''' : A float of the 2D Y scale of the text of the label.


===shadow===
===shadow===
The shadow text of the label.
The shadow text of the label.
<syntaxhighlight lang="lua">dgsDxGUISetProperty(label,"shadow",{offsetX,offsetY,color})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(label,"shadow",{offsetX,offsetY,color,outline})</syntaxhighlight>
*'''offsetX''' : A float of the 2D X offset of the shadow text of the label.
*'''offsetX:''' A float of the 2D X offset of the shadow text of the label.
*'''offsetY''' : A float of the 2D Y offset of the shadow text of the label.
*'''offsetY:''' A float of the 2D Y offset of the shadow text of the label.
*'''color''' : An integer of the color of the shadow text of the label.
*'''color:''' An integer of the color of the shadow text of the label.
===font===
*'''outline:''' An integer of the outline style of the shadow text.
This is equivalent to [[dgsDxGUISetFont]]/[[dgsDxGUIGetFont]]. ''Learn More [[dxDrawText]]''
 
<syntaxhighlight lang="lua">dgsDxGUISetProperty(label,"font",font)</syntaxhighlight>
===subPixelPositioning===
*'''font''' : A [[Element/DX_font|dx font element]] of the text font of the label.
This property determines whether the '''subPixelPositioning''' is enabled or not, by default, it is disable. ''Learn More [[dxDrawText]]''
 
'''subPixelPositioning''' Will make positioning and resizing animation looks better, but you should know, it may blur your static text with unrounded position and size, or alignment.
 
If you are using dgs animation library, you'd better turn this on.
<syntaxhighlight lang="lua">dgsSetProperty(label,"subPixelPositioning",subPixelPositioning)</syntaxhighlight>
*'''subPixelPositioning:''' A bool indicates whether to enable subPixelPositioning or not.
 
===text===
This is equivalent to [[dgsSetText]]/[[dgsGetText]].
<syntaxhighlight lang="lua">dgsSetProperty(label,"text",text)</syntaxhighlight>
*'''text:''' A string of the text of the label.
 
===textColor===
The color which can be translated by [[tocolor]] of the text of the label.
<syntaxhighlight lang="lua">dgsSetProperty(label,"textColor",textColor)</syntaxhighlight>
*'''textColor:''' An integer of the color of the text of the label.


===wordbreak===
===textOffset===
Whether the word-break is enabled or not. ''Learn More [[dxDrawText]]''
The offset of the text on label.
<syntaxhighlight lang="lua">dgsDxGUISetProperty(label,"wordbreak",wordbreak)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(label,"textOffset",{offsetX,offsetY,relative})</syntaxhighlight>
*'''wordbreak''' : If set to true, the text will wrap to a new line whenever it reaches the right side of the bounding box. If false, the text will always be completely on one line.
*'''offsetX''' : A float of the 2D X offset relative to the position of the label, depends on '''relative'''.
*'''offsetY''' : A float of the 2D Y offset relative to the position of the label, depends on '''relative'''.
*'''relative''' : A bool of whether the offset is relative or absolute.


===colorcoded===
===textSize===
Whether the color code is enabled or not. ''Learn More [[dxDrawText]]''
The scale of the text of the label. ''Learn More [[dxDrawText]]''
<syntaxhighlight lang="lua">dgsDxGUISetProperty(label,"colorcoded",colorcoded)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(label,"textSize",{scaleX,scaleY})</syntaxhighlight>
*'''colorcoded''' : Set to true to enable embedded #FFFFFF color codes.
*'''scaleX:''' A float of the 2D X scale of the text of the label.
*'''scaleY:''' A float of the 2D Y scale of the text of the label.


===clip===
===wordBreak===
Whether the clip property is enabled or not. ''Learn More [[dxDrawText]]''
Whether the word-break is enabled or not. ''Learn More [[dxDrawText]]''
<syntaxhighlight lang="lua">dgsDxGUISetProperty(label,"clip",clip)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(label,"wordBreak",wordBreak)</syntaxhighlight>
*'''clip''' : If set to true, the parts of the text that don't fit within the bounding box will be cut off.
*'''wordBreak:''' If set to true, the text will wrap to a new line whenever it reaches the right side of the bounding box. If false, the text will always be completely on one line.


===rightbottom===
Alignment of the text within the label
<syntaxhighlight lang="lua">dgsDxGUISetProperty(label,"rightbottom",{alignX,alignY})</syntaxhighlight>
*'''alignX''' : Horizontal alignment of the text within the label. Can be "left", "center" or "right".
*'''alignY''' : Vertical alignment of the text within the label. Can be "top", "center" or "bottom".
==See Also==
==See Also==
{{DGSPROPERTIES}}
{{DGSPROPERTIES}}

Latest revision as of 09:01, 14 June 2022

DGS Properties is always used to change the gui style and make it more fantastic.

This page shows the properties of dgs-dxlabel that you could use.

Main Functions

Properties

alignment

Alignment of the text within the label.

The functions as follows are based on this property.

dgsLabelSetHorizontalAlign/dgsLabelGetHorizontalAlign

dgsLabelSetVerticalAlign/dgsLabelGetVerticalAlign

dgsSetProperty(label,"alignment",{alignX,alignY})
  • alignX: Horizontal alignment of the text within the label. Can be "left", "center" or "right".
  • alignY: Vertical alignment of the text within the label. Can be "top", "center" or "bottom".

clip

Whether the clip property is enabled or not. Learn More dxDrawText

dgsSetProperty(label,"clip",clip)
  • clip: If set to true, the parts of the text that don't fit within the bounding box will be cut off.

colorCoded

Whether the color code is enabled or not. Learn More dxDrawText

dgsSetProperty(label,"colorCoded",colorCoded)
  • colorCoded: Set to true to enable embedded #FFFFFF color codes.

font

This is equivalent to dgsSetFont/dgsGetFont. Learn More dxDrawText

dgsSetProperty(label,"font",font)

shadow

The shadow text of the label.

dgsSetProperty(label,"shadow",{offsetX,offsetY,color,outline})
  • offsetX: A float of the 2D X offset of the shadow text of the label.
  • offsetY: A float of the 2D Y offset of the shadow text of the label.
  • color: An integer of the color of the shadow text of the label.
  • outline: An integer of the outline style of the shadow text.

subPixelPositioning

This property determines whether the subPixelPositioning is enabled or not, by default, it is disable. Learn More dxDrawText

subPixelPositioning Will make positioning and resizing animation looks better, but you should know, it may blur your static text with unrounded position and size, or alignment.

If you are using dgs animation library, you'd better turn this on.

dgsSetProperty(label,"subPixelPositioning",subPixelPositioning)
  • subPixelPositioning: A bool indicates whether to enable subPixelPositioning or not.

text

This is equivalent to dgsSetText/dgsGetText.

dgsSetProperty(label,"text",text)
  • text: A string of the text of the label.

textColor

The color which can be translated by tocolor of the text of the label.

dgsSetProperty(label,"textColor",textColor)
  • textColor: An integer of the color of the text of the label.

textOffset

The offset of the text on label.

dgsSetProperty(label,"textOffset",{offsetX,offsetY,relative})
  • offsetX : A float of the 2D X offset relative to the position of the label, depends on relative.
  • offsetY : A float of the 2D Y offset relative to the position of the label, depends on relative.
  • relative : A bool of whether the offset is relative or absolute.

textSize

The scale of the text of the label. Learn More dxDrawText

dgsSetProperty(label,"textSize",{scaleX,scaleY})
  • scaleX: A float of the 2D X scale of the text of the label.
  • scaleY: A float of the 2D Y scale of the text of the label.

wordBreak

Whether the word-break is enabled or not. Learn More dxDrawText

dgsSetProperty(label,"wordBreak",wordBreak)
  • wordBreak: If set to true, the text will wrap to a new line whenever it reaches the right side of the bounding box. If false, the text will always be completely on one line.

See Also

General Properties

Unique Properties For DGS Core Elements

Extra Properties For DGS Plugins