Difference between revisions of "TDX"

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(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...")
 
Line 76: Line 76:
  
 
='''Functions'''=
 
='''Functions'''=
* coming soon
+
{{TDX_general_functions}}
  
  
 
=== Button ===
 
=== Button ===
* coming soon
+
{{TDX_button_functions}}
  
  
 
=== Checkbox ===
 
=== Checkbox ===
* coming soon
+
{{TDX_checkbox_functions}}
  
  
 
=== Circle ===
 
=== Circle ===
* coming soon
+
{{TDX_circle_functions}}
  
  
 
=== Color Picker ===
 
=== Color Picker ===
* coming soon
+
{{TDX_colorpicker_functions}}
  
  
 
=== Image ===
 
=== Image ===
* coming soon
+
{{TDX_image_functions}}
  
  
 
=== Input ===
 
=== Input ===
* coming soon
+
{{TDX_input_functions}}
  
  
 
=== Radio Button ===
 
=== Radio Button ===
* coming soon
+
{{TDX_radiobutton_functions}}
  
  
 
=== Ring ===
 
=== Ring ===
* coming soon
+
{{TDX_ring_functions}}
  
  
 
=== Slider ===
 
=== Slider ===
* coming soon
+
{{TDX_slider_functions}}
  
  
 
=== Text ===
 
=== Text ===
* coming soon
+
{{TDX_text_functions}}
  
  
 
=== Window ===
 
=== Window ===
* coming soon
+
{{TDX_window_functions}}
  
  

Revision as of 17:22, 21 March 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 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:

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


Button

Template:TDX button functions


Checkbox

Template:TDX checkbox functions


Circle

Template:TDX circle functions


Color Picker

Template:TDX colorpicker functions


Image

Template:TDX image functions


Input

Template:TDX input functions


Radio Button

Template:TDX radiobutton functions


Ring

Template:TDX ring functions


Slider

Template:TDX slider functions


Text

Template:TDX text functions


Window

Template:TDX window functions


Events

  • coming soon