Resource:DxLibrary
This page is marked for deletion. | |
Actions: Delete (Administrators) - Discuss - What links here - Category
|
This is a Direct X (DX) library made by xXMADEXx. This is a resource that allows you to create DX elements, so you can use DX functions (rectangles/text/etc...) like GUI Elements.
Export Functions - Creating The Elements
This function is used to create the rectangle (window).
Syntax
element dxCreateRectangle ( int x, int y, int width, int height [, string heading="", int color=white, bool postGUI=false ] )
Required Arguments
- x: The position where the window will create on the X axis
- y: The position where the window will create on the Y axis
- width: The width of the window
- height: The height of the window
Optional Arguments
- heading: The text that will appear at the top of the window
- color: The color of the window using tocolor.
- postGUI: Create it over GUI's
Returns
The function returns an element of a DX window if it was created, false if otherwise.
addCommandHandler ( "makerectangle", function ( ) if ( isElement ( myRec ) ) then destroyElement ( myRec ) return end myRec = dxCreateRectangle ( 50, 50, 200, 130, "This is my rectangle", true ) end )
This function is used to create text labels.
Syntax
element dxCreateLabel ( int x, int y, int width, int height, string text [, dx_element parent=nil, int color=white] )
Required Arguments
- x: The position where the label will create on the X axis
- y: The position where the label will create on the Y axis
- width: The width of the label area
- height: The height of the label area
- text: The text that you want to display
Optional Arguments
- parent: The parent of the text label (Note: MUST BE A DX ELEMENT)
- color: The color of the text label using tocolor.
Returns
The function returns an element of a DX text label if it was created, false if otherwise.
addCommandHandler ( "makelabel", function ( ) if ( isElement ( myLabel ) ) then destroyElement ( myLabel ) return end myLabel = dxCreateLabel ( 50, 50, 200, 130, "This is my text label" ) end )
This function is used to create check boxes.
Syntax
element dxCreateCheckBox ( int x, int y, int width, int height [, string text="", dx_element parent=nil, bool checked=false] )
Required Arguments
- x: The position where the checkbox will create on the X axis
- y: The position where the checkbox will create on the Y axis
- width: The width of the checkbox area
- height: The height of the checkbox area
Optional Arguments
- text: The text that will appear next to the checkbox
- parent: The parent of the checkbox (Note: MUST BE A DX ELEMENT)
- checked: The state of the checkbox being checked when it's created
Returns
The function returns an element of a DX check box if it was created, false if otherwise.
addCommandHandler ( "makecheck", function ( ) if ( isElement ( myCheck ) ) then destroyElement ( myCheck ) return end myCheck = dxCreateCheckBox ( 50, 50, 200, 130, "This is a text box", nil, true ) end )
This function is used to create progress bars.
Syntax
element dxCreateProgressBar ( int x, int y, int width, int height [, dx_element parent=nil, int progress=0 ] )
Required Arguments
- x: The position where the progress bar will create on the X axis
- y: The position where the progress bar will create on the Y axis
- width: The width of the progress bar area
- height: The height of the progress bar area
Optional Arguments
- parent: The parent of the progress bar (Note: MUST BE A DX ELEMENT)
- progress: The pre-defined progress of the bar, when created
Returns
The function returns an element of a DX text label if it was created, false if otherwise.
addCommandHandler ( "makeprogress", function ( ) if ( isElement ( myProgress ) ) then destroyElement ( myProgress ) return end myProgress = dxCreateProgressBar ( 50, 50, 200, 130, nil, math.random ( 0, 100 ) ) end )
Export Functions - Chaning Your Elements
This function gives you the text of a dx element This function works for: lables, windows, checkboxes
Syntax
string dxGetText ( dx_element element )
Required Arguments
- element: The element of the text you want to get
Returns
This function returns a string of the text if it was successfully gotten, false if otherwise.
local myCheck = dxCreateCheckBox ( 50, 50, 200, 130, "This is a check box", nil, true ) addCommandHandler ( "theText", function ( ) outputChatBox ( tostring ( dxGetText ( myCheck ) ) ) end )
This function gives you the text of a dx element This function works for: All DX elements
Syntax
bool dxGetVisible ( dx_element element )
Required Arguments
- element: The element that you want to get the visibility of
Returns
This function returns true if the dx element is visible, false if otherwise
local myCheck = dxCreateCheckBox ( 50, 50, 200, 130, "This is a check box", nil, true ) addCommandHandler ( "theText", function ( ) outputChatBox ( tostring ( dxGetVisible ( myCheck ) ) ) end )
This function gives you the size of a dx element. This function works for: All DX elements
Syntax
int width, int height dxGetSize ( dx_element element )
Required Arguments
- element: The element that you want to get the size of
Returns
It returns two integers, the width and the height if the size was successfully, false if otherwise
local myCheck = dxCreateCheckBox ( 50, 50, 200, 130, "This is a check box", nil, true ) addCommandHandler ( "theText", function ( ) local width, height = dxGetSize ( myCheck ) outputChatBox ( "Width: "..width.." | Height: "..height ) end )