Tdx: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Initial page creation)
 
(Blanked the page)
Tag: Blanking
 
Line 1: Line 1:
<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 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 [https://github.com/Lpsd/total-dx-lib/releases 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.
<syntaxhighlight lang="lua">
loadstring(exports.dxlib:dxLoadFunctions())()
</syntaxhighlight>
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 re-created (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: '''
<syntaxhighlight lang="lua">
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)
</syntaxhighlight>
'''Procedural Example: '''
<syntaxhighlight lang="lua">
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)
</syntaxhighlight>
=== 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'''=
* coming soon
=== Button ===
* coming soon
=== Checkbox ===
* coming soon
=== Circle ===
* coming soon
=== Color Picker ===
* coming soon
=== Image ===
* coming soon
=== Input ===
* coming soon
=== Radio Button ===
* coming soon
=== Ring ===
* coming soon
=== Slider ===
* coming soon
=== Text ===
* coming soon
=== Window ===
* coming soon
='''Events'''=
* coming soon

Latest revision as of 20:21, 19 March 2020