Dgs-dxbutton: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:


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


==Properties==
==Properties==
===image===
===image===
Require [texture/shader] that can be used as the background of button.
Require [texture/shader] that can be used as the background of button.
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"image",{defimg,hovimg,cliimg})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"image",{defimg,hovimg,cliimg})</syntaxhighlight>
*'''defimg:''' A texture/shader element of the background of the button ( neither selected nor clicked by mouse ). ( You can pass a nil value to disable this image option )
*'''defimg:''' A texture/shader element of the background of the button ( neither selected nor clicked by mouse ). ( You can pass a nil value to disable this image option )
*'''hovimg:''' A texture/shader element of the background of the button which is selected. ( You can pass a nil value to disable this image option )
*'''hovimg:''' A texture/shader element of the background of the button which is selected. ( You can pass a nil value to disable this image option )
Line 17: Line 17:
===color===
===color===
The color which can be translated by [[tocolor]] of the background of the button.
The color which can be translated by [[tocolor]] of the background of the button.
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"color",{defcolor,hovcolor,clicolor})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"color",{defcolor,hovcolor,clicolor})</syntaxhighlight>
*'''defcolor:''' An integer of the color of the background of the button ( neither selected nor clicked by mouse ).
*'''defcolor:''' An integer of the color of the background of the button ( neither selected nor clicked by mouse ).
*'''hovcolor:''' An integer of the color of the background of the button which is selected.
*'''hovcolor:''' An integer of the color of the background of the button which is selected.
Line 23: Line 23:


===text===
===text===
This is equivalent to [[dgsDxGUISetText]]/[[dgsDxGUIGetText]].
This is equivalent to [[dgsSetText]]/[[dgsGetText]].
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"text",text)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"text",text)</syntaxhighlight>
*'''text''' : A string of the text of the button.
*'''text''' : A string of the text of the button.


===textcolor===
===textcolor===
The color which can be translated by [[tocolor]] of the text of the button.
The color which can be translated by [[tocolor]] of the text of the button.
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"textcolor",textcolor)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"textcolor",textcolor)</syntaxhighlight>
*'''textcolor''' : An integer of the color of the text of the button.
*'''textcolor''' : An integer of the color of the text of the button.


===textsize===
===textsize===
The scale of the text of the button. ''Learn More [[dxDrawText]]''
The scale of the text of the button. ''Learn More [[dxDrawText]]''
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"textsize",{scaleX,scaleY})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"textsize",{scaleX,scaleY})</syntaxhighlight>
*'''scaleX''' : A float of the 2D X scale of the text of the button.
*'''scaleX''' : A float of the 2D X scale of the text of the button.
*'''scaleY''' : A float of the 2D Y scale of the text of the button.
*'''scaleY''' : A float of the 2D Y scale of the text of the button.
Line 40: Line 40:
===shadow===
===shadow===
The shadow text of the button.
The shadow text of the button.
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"shadow",{offsetX,offsetY,color})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"shadow",{offsetX,offsetY,color})</syntaxhighlight>
*'''offsetX''' : A float of the 2D X offset of the shadow text of the button.
*'''offsetX''' : A float of the 2D X offset of the shadow text of the button.
*'''offsetY''' : A float of the 2D Y offset of the shadow text of the button.
*'''offsetY''' : A float of the 2D Y offset of the shadow text of the button.
*'''color''' : An integer of the color of the shadow text of the button.
*'''color''' : An integer of the color of the shadow text of the button.
===font===
===font===
This is equivalent to [[dgsDxGUISetFont]]/[[dgsDxGUIGetFont]]. ''Learn More [[dxDrawText]]''
This is equivalent to [[dgsSetFont]]/[[dgsGetFont]]. ''Learn More [[dxDrawText]]''
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"font",font)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"font",font)</syntaxhighlight>
*'''font''' : A [[Element/DX_font|dx font element]] of the text font of the button.
*'''font''' : A [[Element/DX_font|dx font element]] of the text font of the button.


===clickoffset===
===clickoffset===
The offset indicates that how much the text of the button will shift when it is clicked.
The offset indicates that how much the text of the button will shift when it is clicked.
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"clickoffset",{offsetX,offsetY})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"clickoffset",{offsetX,offsetY})</syntaxhighlight>
*'''offsetX''' : A float of the 2D X offset relative to the position of the button.
*'''offsetX''' : A float of the 2D X offset relative to the position of the button.
*'''offsetY''' : A float of the 2D Y offset relative to the position of the button.
*'''offsetY''' : A float of the 2D Y offset relative to the position of the button.
Line 57: Line 57:
===clickType===
===clickType===
This indicates that which button of the mouse can have effect on the button.
This indicates that which button of the mouse can have effect on the button.
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"clickType",clickType)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"clickType",clickType)</syntaxhighlight>
*'''clickType''' : If set to 1, only "Left Mouse Button" can do. If set to 2, only "Right Mouse Button" can do. Otherwise it will be both.
*'''clickType''' : If set to 1, only "Left Mouse Button" can do. If set to 2, only "Right Mouse Button" can do. Otherwise it will be both.


===wordbreak===
===wordbreak===
Whether the word-break is enabled or not. ''Learn More [[dxDrawText]]''
Whether the word-break is enabled or not. ''Learn More [[dxDrawText]]''
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"wordbreak",wordbreak)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"wordbreak",wordbreak)</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.
*'''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.


===colorcoded===
===colorcoded===
Whether the color code is enabled or not. ''Learn More [[dxDrawText]]''
Whether the color code is enabled or not. ''Learn More [[dxDrawText]]''
<syntaxhighlight lang="lua">dgsDxGUISetProperty(button,"colorcoded",colorcoded)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(button,"colorcoded",colorcoded)</syntaxhighlight>
*'''colorcoded''' : Set to true to enable embedded #FFFFFF color codes.
*'''colorcoded''' : Set to true to enable embedded #FFFFFF color codes.


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

Revision as of 14:46, 12 February 2018

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

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

Main Functions

Properties

image

Require [texture/shader] that can be used as the background of button.

dgsSetProperty(button,"image",{defimg,hovimg,cliimg})
  • defimg: A texture/shader element of the background of the button ( neither selected nor clicked by mouse ). ( You can pass a nil value to disable this image option )
  • hovimg: A texture/shader element of the background of the button which is selected. ( You can pass a nil value to disable this image option )
  • cliimg: A texture/shader element of the background of the button which is clicked. ( You can pass a nil value to disable this image option )

color

The color which can be translated by tocolor of the background of the button.

dgsSetProperty(button,"color",{defcolor,hovcolor,clicolor})
  • defcolor: An integer of the color of the background of the button ( neither selected nor clicked by mouse ).
  • hovcolor: An integer of the color of the background of the button which is selected.
  • clicolor: An integer of the color of the background of the button which is clicked.

text

This is equivalent to dgsSetText/dgsGetText.

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

textcolor

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

dgsSetProperty(button,"textcolor",textcolor)
  • textcolor : An integer of the color of the text of the button.

textsize

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

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

shadow

The shadow text of the button.

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

font

This is equivalent to dgsSetFont/dgsGetFont. Learn More dxDrawText

dgsSetProperty(button,"font",font)

clickoffset

The offset indicates that how much the text of the button will shift when it is clicked.

dgsSetProperty(button,"clickoffset",{offsetX,offsetY})
  • offsetX : A float of the 2D X offset relative to the position of the button.
  • offsetY : A float of the 2D Y offset relative to the position of the button.

clickType

This indicates that which button of the mouse can have effect on the button.

dgsSetProperty(button,"clickType",clickType)
  • clickType : If set to 1, only "Left Mouse Button" can do. If set to 2, only "Right Mouse Button" can do. Otherwise it will be both.

wordbreak

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

dgsSetProperty(button,"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.

colorcoded

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

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

rightbottom

Alignment of the text within the button

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

See Also

General Properties

Unique Properties For DGS Core Elements

Extra Properties For DGS Plugins