TDX: Difference between revisions
(Created page with "<pageclass class="resource" subcaption="Resource"></pageclass> Total DX Library (TDX) is a DX GUI library for MTA:SA which aims to replicate all of the features offered by CEG...") |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 27: | Line 27: | ||
'''Note''': Every TDX GUI element created will be hosted within the parent '''dxlib''' resource. Upon restarting the '''dxlib''' resource any previous GUI will be | '''Note''': Every TDX GUI element created will be hosted within the parent '''dxlib''' resource. Upon restarting the '''dxlib''' resource any previous GUI will be destroyed (meaning user interaction/input will be lost!) - be careful. | ||
Line 76: | Line 76: | ||
='''Functions'''= | ='''Functions'''= | ||
{{TDX_general_functions}} | |||
=== Button === | === Button === | ||
{{TDX_button_functions}} | |||
=== Checkbox === | === Checkbox === | ||
{{TDX_checkbox_functions}} | |||
=== Circle === | === Circle === | ||
{{TDX_circle_functions}} | |||
=== Color Picker === | === Color Picker === | ||
{{TDX_colorpicker_functions}} | |||
=== Image === | === Image === | ||
{{TDX_image_functions}} | |||
=== Input === | === Input === | ||
{{TDX_input_functions}} | |||
=== Radio Button === | === Radio Button === | ||
{{TDX_radiobutton_functions}} | |||
=== Ring === | === Ring === | ||
{{TDX_ring_functions}} | |||
=== Slider === | === Slider === | ||
{{TDX_slider_functions}} | |||
=== Text === | === Text === | ||
{{TDX_text_functions}} | |||
=== Window === | === Window === | ||
{{TDX_window_functions}} | |||
Latest revision as of 20:46, 18 April 2020
Total DX Library (TDX) is a DX GUI library for MTA:SA which aims to replicate all of the features offered by CEGUI - but instead is built upon the existing dxDraw* functions provided by MTA.
Author: LopSided
GitHub: https://github.com/Lpsd/total-dx-lib
Getting Started
It's really simple to implement Total DX Library into your resource/project. Download the latest release from GitHub and drop the dxlib folder from the .zip into your server's resources folder.
Start the dxlib resource and ensure it loads correctly (you should see some output in debugscript).
Next you'll need to import the library into your resource, using the code below. We recommend you put this code inside an onClientResourceStart event for each resource.
loadstring(exports.dxlib:dxLoadFunctions())()
Once the library has been imported, there's no need to use any more exports! You can use all the features documented here as though they were part of MTA itself.
Note: Every TDX GUI element created will be hosted within the parent dxlib resource. Upon restarting the dxlib resource any previous GUI will be destroyed (meaning user interaction/input will be lost!) - be careful.
Example Usage
At the core, TDX is object-oriented, which is great for complex GUI systems. However, procedural style is also supported!
OOP (Object-Oriented) Example:
local window = DxWindow:new(300, 300, 300, 300, "Color Picker") local input = DxInput:new(0, 50, 200, 35, "Lorem Ipsum is simply dummy text of the printing and typesetting industry.") input:setParent(window) input:setCentered(true)
Procedural Example:
local window = dxCreateWindow(300, 300, 300, 300, "Color Picker") local input = dxCreateInput(0, 50, 200, 35, "Lorem Ipsum is simply dummy text of the printing and typesetting industry.") dxSetParent(input, window) dxSetCentered(input, true)
Classes
Below you can find a list of currently supported classes - DxClass (dx-type)
- DxBlank (dx-blank)
- DxButton (dx-button)
- DxCheckbox(dx-checkbox)
- DxCircle (dx-circle)
- DxColorPicker (dx-colorpicker)
- DxImage (dx-image)
- DxInput (dx-input)
- DxRadioButton (dx-radiobutton)
- DxRing (dx-ring)
- DxSlider (dx-slider)
- DxText (dx-text)
- DxWindow (dx-window)
All of these classes inherit the base class, DxElement, which provides many of the available methods for each class.
Functions
- dxAddClickFunction
- dxAddRenderFunction
- dxApplyMask
- dxBringToFront
- dxDestroy
- dxGetAlpha
- dxGetBounds
- dxGetChildren
- dxGetChildrenByType
- dxGetColor
- dxGetGlobalProperty
- dxGetHoverColor
- dxGetIndex
- dxGetInheritedBounds
- dxGetInheritedChildren
- dxGetInheritedChildrenByType
- dxGetInheritedParents
- dxGetMaskTexture
- dxGetNonRootElements
- dxGetObstructingElement
- dxGetParent
- dxGetPosition
- dxGetProperty
- dxGetRootElement
- dxGetRootElements
- dxGetSize
- dxGetText
- dxGetTextColor
- dxGetTexture
- dxGetTopLevelChildren
- dxGetVisible
- dxIsChild
- dxIsFront
- dxIsInheritedChild
- dxIsObstructed
- dxIsObstructedByElement
- dxIsParent
- dxIsRootElement
- dxRemoveClickFunction
- dxRemoveRenderFunction
- dxSendToBack
- dxSetAlpha
- dxSetCentered
- dxSetColor
- dxSetDragArea
- dxSetGlobalProperty
- dxSetHoverColor
- dxSetIndex
- dxSetMaskEnabled
- dxSetParent
- dxSetPosition
- dxSetProperty
- dxSetSize
- dxSetText
- dxSetTextColor
- dxSetVisible
- isMouseOverDxElement
Button
Checkbox
Template:TDX checkbox functions
Circle
Color Picker
Template:TDX colorpicker functions
Image
Input
Radio Button
Template:TDX radiobutton functions
Ring
Slider
Text
Window
Events
- coming soon