Dgs-dxswitchbutton: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Moved to mouseButtons property)
 
(3 intermediate revisions by 2 users not shown)
Line 8: Line 8:


==Properties==
==Properties==
===clickType===
This property determines which button on mouse can change the state of switch button.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"clickType",clickType)</syntaxhighlight>
*'''clickType:''' An integer, available values are as follows:
**'''1:''' Left Mouse Button
**'''2:''' Wheel
**'''3:''' Right Mouse Button
===clip===
===clip===
Whether the clip property is enabled or not. ''Learn More [[dxDrawText]]''
Whether the clip property is enabled or not. ''Learn More [[dxDrawText]]''
Line 65: Line 57:
The cursor image of switch button.
The cursor image of switch button.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"cursorImage",{normalColor,hoverColor,clickColor})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"cursorImage",{normalColor,hoverColor,clickColor})</syntaxhighlight>
*'''normalImage:''' An material of cursor image of the switch button.
*'''normalImage:''' A material of cursor image of the switch button.
*'''hoverImage:''' An material of cursor image of the switch button when the mouse is hovering on it.
*'''hoverImage:''' A material of cursor image of the switch button when the mouse is hovering on it.
*'''clickImage:''' An material of cursor image of the switch button when the mouse is clicked on it.
*'''clickImage:''' A material of cursor image of the switch button when the mouse is clicked on it.


===font===
===font===
Line 77: Line 69:
The background image of switch button when the state is on.
The background image of switch button when the state is on.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"imageOn",{normalImage,hoverImage,clickImage})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"imageOn",{normalImage,hoverImage,clickImage})</syntaxhighlight>
*'''normalImage:''' An material of background image of turned on switch button.
*'''normalImage:''' A material of background image of turned on switch button.
*'''hoverImage:''' An material of background image of turned on switch button when the mouse is hovering on it.
*'''hoverImage:''' A material of background image of turned on switch button when the mouse is hovering on it.
*'''clickImage:''' An material of background image of turned on switch button when the mouse is clicked on it.
*'''clickImage:''' A material of background image of turned on switch button when the mouse is clicked on it.


===imageOff===
===imageOff===
The background image of switch button when the state is off.(
The background image of switch button when the state is off.(
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"imageOff",{normalImage,hoverImage,clickImage})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"imageOff",{normalImage,hoverImage,clickImage})</syntaxhighlight>
*'''normalImage:''' An material of background image of turned off switch button.
*'''normalImage:''' A material of background image of turned off switch button.
*'''hoverImage:''' An material of background image of turned off switch button when the mouse is hovering on it.
*'''hoverImage:''' A material of background image of turned off switch button when the mouse is hovering on it.
*'''clickImage:''' An material of background image of turned off switch button when the mouse is clicked on it.
*'''clickImage:''' A material of background image of turned off switch button when the mouse is clicked on it.


===shadow===
===shadow===
Line 115: Line 107:
**'''1:''' Split background color for turned on and off ( also split images ).
**'''1:''' Split background color for turned on and off ( also split images ).
**'''2:''' Split background color for turned on and off ( not split images ).
**'''2:''' Split background color for turned on and off ( not split images ).
**'''3:''' Do not split background color. Just switch gradually.
**'''4:''' No cursor. Just switch gradually.


===textOn===
===textOn===
Line 147: Line 141:
*'''troughWidth:''' A float of the trough length of switch button.
*'''troughWidth:''' A float of the trough length of switch button.


===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">dgsSetProperty(switchButton,"wordBreak",wordBreak)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"wordBreak",wordBreak)</syntaxhighlight>

Latest revision as of 14:11, 11 June 2023

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

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

Main Functions

Properties

clip

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

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

cursorMoveSpeed

This property determines the cursor moving speed when switch button changes state.

dgsSetProperty(switchButton,"cursorMoveSpeed",cursorMoveSpeed)
  • cursorMoveSpeed: A float of the cursor moving speed when switch button changes state.

cursorWidth

This property determines the cursor width of switch button.

dgsSetProperty(switchButton,"cursorWidth",cursorWidth)
  • cursorWidth: A float of the cursor width of switch button.

cursorLength

This property determines the cursor length of switch button.

dgsSetProperty(switchButton,"cursorLength",cursorLength)
  • cursorLength: A float of the cursor length of switch button.

colorcoded

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

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

colorOn

The color which can be translated by tocolor of the background color when the switch button turns on.

dgsSetProperty(switchButton,"colorOn",{normalColor,hoverColor,clickColor})
  • normalColor: A integer of background color of turned on switch button.
  • hoverColor: A integer of background color of turned on switch button when the mouse is hovering on it.
  • clickColor: A integer of background color of turned on switch button when the mouse is clicked on it.

colorOff

The color which can be translated by tocolor of the background color when the switch button turns off.

dgsSetProperty(switchButton,"colorOff",{normalColor,hoverColor,clickColor})
  • normalColor: A integer of background color of turned off switch button.
  • hoverColor: A integer of background color of turned off switch button when the mouse is hovering on it.
  • clickColor: A integer of background color of turned off switch button when the mouse is clicked on it.

cursorColor

The color which can be translated by tocolor of the cursor color.

dgsSetProperty(switchButton,"cursorColor",{normalColor,hoverColor,clickColor})
  • normalColor: A integer of cursor color of the switch button.
  • hoverColor: A integer of cursor color of the switch button when the mouse is hovering on it.
  • clickColor: A integer of cursor color of the switch button when the mouse is clicked on it.

cursorImage

The cursor image of switch button.

dgsSetProperty(switchButton,"cursorImage",{normalColor,hoverColor,clickColor})
  • normalImage: A material of cursor image of the switch button.
  • hoverImage: A material of cursor image of the switch button when the mouse is hovering on it.
  • clickImage: A material of cursor image of the switch button when the mouse is clicked on it.

font

This is equivalent to dgsSetFont/dgsGetFont. Learn More dxDrawText

dgsSetProperty(switchButton,"font",font)

imageOn

The background image of switch button when the state is on.

dgsSetProperty(switchButton,"imageOn",{normalImage,hoverImage,clickImage})
  • normalImage: A material of background image of turned on switch button.
  • hoverImage: A material of background image of turned on switch button when the mouse is hovering on it.
  • clickImage: A material of background image of turned on switch button when the mouse is clicked on it.

imageOff

The background image of switch button when the state is off.(

dgsSetProperty(switchButton,"imageOff",{normalImage,hoverImage,clickImage})
  • normalImage: A material of background image of turned off switch button.
  • hoverImage: A material of background image of turned off switch button when the mouse is hovering on it.
  • clickImage: A material of background image of turned off switch button when the mouse is clicked on it.

shadow

The shadow text of the switch button.

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

state

This property indicates the state of switch button.

dgsSetProperty(switchButton,"state",state)
  • state: A bool indicates the state of switch button.
    • true: Turns on
    • false: Turns off

stateAnim

This stores the progress of cursor animation, which is not recommend to modify.

dgsSetProperty(switchButton,"stateAnim",stateAnim)
  • stateAnim: A float of the cursor animation progress.

style

This property determines the state of switch button.

dgsSetProperty(switchButton,"style",style)
  • style: Mixed, available values are as follows:
    • false: Default, a switch button with fading color when changing state.
    • 1: Split background color for turned on and off ( also split images ).
    • 2: Split background color for turned on and off ( not split images ).
    • 3: Do not split background color. Just switch gradually.
    • 4: No cursor. Just switch gradually.

textOn

This property stores the text to be shown when the switch button turns on.

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

textOff

This property stores the text to be shown when the switch button turns off.

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

textColorOn

The color which can be translated by tocolor of the text when the switch button turns on.

dgsSetProperty(switchButton,"textColor_t",textColor_t)
  • textColor_t: An integer of the color of the text when the switch button turns on.

textColorOff

The color which can be translated by tocolor of the text when the switch button turns off.(State=false)

dgsSetProperty(switchButton,"textColor_f",textColor_f)
  • textColor_f: An integer of the color of the text when the switch button turns off.

textSize

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

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

troughWidth

This property determines trough length of switch button.

dgsSetProperty(switchButton,"troughWidth",troughWidth)
  • troughWidth: A float of the trough length of switch button.

wordBreak

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

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