From Multi Theft Auto: Wiki
Jump to navigation Jump to search

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


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.


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.")

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)


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.



Template:TDX button functions


Template:TDX checkbox functions


Template:TDX circle functions

Color Picker

Template:TDX colorpicker functions


Template:TDX image functions


Template:TDX input functions

Radio Button

Template:TDX radiobutton functions


Template:TDX ring functions


Template:TDX slider functions


Template:TDX text functions


Template:TDX window functions


  • coming soon