Resource:Dgs
From Multi Theft Auto: Wiki
(Redirected from Dgs)
This resource is designed to allow you to create directX GUI's as an alternative to the original MTA:SA GUI functions.
Full Name: Thisdp's DirectX Graphical User Interface System (DxGUI Lib)
Author: thisdp
State: OpenSource & Work in progress
GitHub Source: https://github.com/thisdp/dgs/tree/master
Server Discord: https://discord.gg/QEs8q6W
Features
How does it work?
- DGS is based on element system, which just likes the cegui system. To make DGS easier to use and understand, I choose to follow the usage of cegui's.
- DGS supports OOP syntax, if you don't like POP, then use OOP instead. But you should know that OOP is slower than POP.
- DGS elements are rendered in the event "onClientRender". When "onClientRender" is called, every DGS elements will be looped and calculated.
What's different from cegui?
- This resource is based on dx* functions, so its style will be more flexible than cegui, which means you can define the style by yourself.
- The latest Style System enables developer to define their own style such as changing color, loading images and even loading shaders with dgs elements on the server instead of using a lot of dgsSetProperty/dgsSetProperties.
Update System
- It have an update system that can inform you of keeping your DGS latest.
- When a newer version has been released, it will detecte the version changing periodically and then notice you.
- Execute command "updatedgs" to check the least version and update your DGS.
- Also, you can check the version of DGS by inputting the command "dgsver"
You Should Know
- This project was started from 2014.
- Scroll Pane, Grid List, Combo Box, Memo and Edit Box use Render Target, which means if you don't have enough video memory, Render Target won't be created, and therefore those dgs elements won't be shown.
Examples scripts
- 1.https://community.multitheftauto.com/index.php?p=resources&s=details&id=14757 By (Ahmed Ly ,Mahmod Algeriany)
- 2. Also File test.lua its have more Examples You can See it .
- 3. This Video show you how to play a video by using Dgs https://www.youtube.com/watch?v=ZIq24zS5byI
Auto Completion
- 1. Link: http://www.mediafire.com/file/m6dm7815d5dihax/lua.zip By Ahmed Ly
- 2. Note: You must put it in file Notepad++\plugins\APIs.
- 3. Not all of DGS Functions are added, but the rest will be added soon.
Debug
- You can enter the debug mode by executing the command "debugdgs".
DGS Type
- 3D Text(dgs-dx3dtext): A 3D Text.
- 3D Interface (dgs-dx3dinterface): A 3D Interface.
- Arrow List (dgs-arrowlist): An arrow list.
- Browser (dgs-browser) : A dgs browser.
- Button (dgs-dxbutton): A button.
- Combo Box (dgs-dxcombobox + dgs-dxcombobox-Box) : A combo box.
- Check Box (dgs-dxcheckbox) : A check box that with 3 states (checked, unchecked and indeterminate).
- Detect Area (dgs-dxdetectarea): A custom detect area.
- Edit (dgs-dxedit): An edit.
- Ellipse Detect Area (dgs-dxeda): An oval detect area.
- Gridlist (dgs-dxgridlist): A grid list.
- Image (dgs-dximage): A dynamic image.
- Label (dgs-dxlabel): A text label.
- Media Browser (dgs-dxmedia) : A media browser that is used to load video/audio/gif.
- Memo (dgs-dxmemo): A memo.
- Progress Bar (dgs-dxprogressbar): A Progress Bar.
- Radio Button (dgs-dxradiobutton): A Radio Button.
- ScrollBar (dgs-dxscrollbar): A scroll bar.
- ScrollPane (dgs-dxscrollpane): A scroll pane.
- Switch Button(dgs-dxswitchbutton): A switch button.
- Tab Panel (dgs-dxtabpanel + dgs-dxtab) : A tab panel.
- Window (dgs-dxwindow): A window.
Notice
- It is recommended to change the resource name to 'dgs'.
- This is a resource, if you want to use the functions exported by this resource, you should use an exported function prefix (exports.dgs:) call in your code, such as
label = exports.dgs:dgsCreateLabel(0, 0, 0.5, 0.1, "text", true)
- Here is a feasible way to shorten the name of an exported function:
DGS = exports.dgs --shorten the export function prefix label = DGS:dgsCreateLabel(0,0,0.5,0.1,"text",true) --create a label
- From the latest version, it no longer needs exports.dgs:, instead we can do
loadstring(exports.dgs:dgsImportFunction())()-- load functions label = dgsCreateLabel(0,0,0.5,0.1,"text",true) --create a label
Object Oriented Programming
loadstring(exports.dgs:dgsImportOOPClass())()-- load OOP class window = DGSClass:createWindow(0,0,0.5,0.1,"test",true) --create a window with oop label = window:createLabel(0,0,1,1,"label",true) --create a label inside the window label.text = "DGS OOP Test" --set text
Want to talk to us?
- Join Discord Server: https://discord.gg/QEs8q6W
Special thanks to the following for their help (Respect the contributors):
- Axel: Gives some tips and provide some functions.
- Senpai: Helps with wiki.
- ZoNe: Helps with wiki.
- DiGiTal: Helps with wiki.
- #Dv^: Helps with wiki.
- maksam07: Suggestions, BUG Fixing and coding.
- Scorpyo: Debug and Suggestions.
- Kingleonide: Debug, Suggestions and Code Edit.
- Bullet(.el3tar): Makes video course of dgs for Arabic language.
- Allerek: DGS Logo Design, Wiki writing(PL).
- Deihim007: Helps with wiki, Gives suggestions.
- OmarSwaitti(HankVoight):Helps with wiki, Gives suggestions.
Special thanks to:
- Ahmed Ly: Helps write wiki, release auto completion for N++.
DGS Tips
- DGS Events and GUI Events
- DGS Functions and GUI Functions
- DGS Grid List
- DGS OOP Class
- DGS Style System
- DGS GUI To DGS
DGS Element Properties
General Properties
Unique Properties
- dgs-dx3dinterface
- dgs-dx3dtext
- dgs-dxarrowlist
- dgs-dxbutton
- dgs-dxcheckbox
- dgs-dxcombobox
- dgs-dxeda
- dgs-dxedit
- dgs-dxgridlist
- dgs-dximage
- dgs-dxlabel
- dgs-dxmemo
- dgs-dxprogressbar
- dgs-dxradiobutton
- dgs-dxscrollbar
- dgs-dxscrollpane
- dgs-dxswitchbutton
- dgs-dxtabpanel
- dgs-dxtab
- dgs-dxwindow
Client Functions
- dgsGetPosition
- dgsSetPosition
- dgsSetParent
- dgsGetParent
- dgsGetChild
- dgsGetChildren
- dgsGetSize
- dgsSetSize
- dgsGetType
- dgsSetLayer
- dgsGetLayer
- dgsSetCurrentLayerIndex
- dgsGetCurrentLayerIndex
- dgsGetLayerElements
- dgsGetProperty
- dgsSetProperty
- dgsSetPropertyInherit
- dgsGetProperties
- dgsSetProperties
- dgsGetVisible
- dgsSetVisible
- dgsGetEnabled
- dgsSetEnabled
- dgsGetSide
- dgsSetSide
- dgsGetAlpha
- dgsSetAlpha
- dgsGetFont
- dgsSetFont
- dgsGetText
- dgsSetText
- dgsGetPostGUI
- dgsSetPostGUI
- dgsGetInputEnabled
- dgsSetInputEnabled
- dgsGetInputMode
- dgsSetInputMode
- dgsFocus
- dgsBlur
- dgsCreateFont
- dgsBringToFront
- dgsMoveToBack
- dgsGetScreenSize
- dgsGetCursorPosition
- dgsGetMouseEnterGUI
- dgsGetMouseLeaveGUI
- dgsSetSystemFont
- dgsGetSystemFont
- dgsGetDxGUINoParent
- dgsGetDxGUIFromResource
- dgsGetFocusedGUI
- dgsGetExportedFunctionName
- dgsImportFunction
- dgsImportOOPClass
- dgsG2DLoadHooker
- dgsSetRenderSetting
- dgsGetRenderSetting
- dgsSimulateClick
- dgsGetRootElement
- dgsAddMoveHandler
- dgsRemoveMoveHandler
- dgsIsMoveHandled
- dgsAddSizeHandler
- dgsRemoveSizeHandler
- dgsIsSizeHandled
- dgsAttachElemetns
- dgsDetachElements
- dgsElementIsAttached
- dgsSetDoubleClickInterval
- dgsGetDoubleClickInterval
Multi Language Supports
- dgsTranslationTableExists
- dgsSetTranslationTable
- dgsAttachToTranslation
- dgsDetachFromTranslation
- dgsSetAttachTranslation
- dgsGetTranslationName
Animation
- dgsAnimTo
- dgsIsAniming
- dgsStopAniming
- dgsMoveTo
- dgsIsMoving
- dgsStopMoving
- dgsSizeTo
- dgsIsSizing
- dgsStopSizing
- dgsAlphaTo
- dgsIsAlphaing
- dgsStopAlphaing
- dgsAddEasingFunction
- dgsRemoveEasingFunction
- dgsEasingFunctionExists
3D Interface
- dgsCreate3DInterface
- dgs3DInterfaceGetBlendMode
- dgs3DInterfaceSetBlendMode
- dgs3DInterfaceGetPosition
- dgs3DInterfaceSetPosition
- dgs3DInterfaceGetSize
- dgs3DInterfaceSetSize
- dgs3DInterfaceGetResolution
- dgs3DInterfaceSetResolution
- dgs3DInterfaceAttachToElement
- dgs3DInterfaceIsAttached
- dgs3DInterfaceDetachFromElement
- dgs3DInterfaceSetAttachedOffsets
- dgs3DInterfaceGetAttachedOffsets
- dgs3DInterfaceSetRotation
- dgs3DInterfaceGetRotation
3D Text
- dgsCreate3DText
- dgs3DTextGetDimension
- dgs3DTextSetDimension
- dgs3DTextGetInterior
- dgs3DTextSetInterior
- dgs3DTextAttachToElement
- dgs3DTextIsAttached
- dgs3DTextDetachFromElement
- dgs3DTextSetAttachedOffsets
- dgs3DTextGetAttachedOffsets
Arrow List
- dgsCreateArrowList
- dgsArrowListAddItem
- dgsArrowListRemoveItem
- dgsArrowListSetItemText
- dgsArrowListGetItemText
- dgsArrowListSetItemValue
- dgsArrowListGetItemValue
- dgsArrowListSetItemRange
- dgsArrowListGetItemRange
- dgsArrowListSetItemTranslationTable
- dgsArrowListGetItemTranslationTable
- dgsArrowListSetItemStep
- dgsArrowListGetItemStep
- dgsArrowListGetItemTranslatedValue
- dgsArrowListClear
Browser
Button
Check Box
- dgsCreateCheckBox
- dgsCheckBoxGetSelected
- dgsCheckBoxSetSelected
- dgsCheckBoxSetHorizontalAlign
- dgsCheckBoxGetHorizontalAlign
- dgsCheckBoxSetVerticalAlign
- dgsCheckBoxGetVerticalAlign
Combo Box
- dgsCreateComboBox
- dgsComboBoxAddItem
- dgsComboBoxRemoveItem
- dgsComboBoxSetItemText
- dgsComboBoxGetItemText
- dgsComboBoxGetItemCount
- dgsComboBoxClear
- dgsComboBoxSetSelectedItem
- dgsComboBoxGetSelectedItem
- dgsComboBoxSetItemColor
- dgsComboBoxGetItemColor
- dgsComboBoxGetState
- dgsComboBoxSetState
- dgsComboBoxGetBoxHeight
- dgsComboBoxSetBoxHeight
- dgsComboBoxGetScrollBar
- dgsComboBoxSetScrollPosition
- dgsComboBoxGetScrollPosition
- dgsComboBoxSetCaptionText
- dgsComboBoxGetCaptionText
Edit
- dgsCreateEdit
- dgsEditMoveCaret
- dgsEditGetCaretPosition
- dgsEditSetCaretPosition
- dgsEditSetCaretStyle
- dgsEditGetCaretStyle
- dgsEditSetWhiteList
- dgsEditGetMaxLength
- dgsEditSetMaxLength
- dgsEditSetReadOnly
- dgsEditGetReadOnly
- dgsEditSetMasked
- dgsEditGetMasked
- dgsEditSetUnderlined
- dgsEditGetUnderlined
- dgsEditSetHorizontalAlign
- dgsEditSetVerticalAlign
- dgsEditGetHorizontalAlign
- dgsEditGetVerticalAlign
- dgsEditSetAlignment
- dgsEditGetAlignment
- dgsEditInsertText
- dgsEditDeleteText
- dgsEditGetPartOfText
- dgsEditClearText
- dgsEditReplaceText
- dgsEditSetTypingSound
- dgsEditGetTypingSound
- dgsEditSetPlaceHolder
- dgsEditGetPlaceHolder
- dgsEditAddAutoComplete
- dgsEditRemoveAutoComplete
- dgsEditSetAutoComplete
- dgsEditGetAutoComplete
Ellipse Detect Area
Detect Area
Grid List
- dgsCreateGridList
- dgsGridListGetScrollBar
- dgsGridListSetScrollPosition
- dgsGridListGetScrollPosition
- dgsGridListSetHorizontalScrollPosition
- dgsGridListGetHorizontalScrollPosition
- dgsGridListSetVerticalScrollPosition
- dgsGridListGetVerticalScrollPosition
- dgsGridListResetScrollBarPosition
- dgsGridListSetColumnRelative
- dgsGridListGetColumnRelative
- dgsGridListAddColumn
- dgsGridListGetColumnCount
- dgsGridListRemoveColumn
- dgsGridListGetColumnAllWidth
- dgsGridListGetColumnHeight
- dgsGridListSetColumnHeight
- dgsGridListGetColumnWidth
- dgsGridListSetColumnWidth
- dgsGridListAutoSizeColumn
- dgsGridListGetColumnTitle
- dgsGridListSetColumnTitle
- dgsGridListGetColumnFont
- dgsGridListSetColumnFont
- dgsGridListAddRow
- dgsGridListRemoveRow
- dgsGridListClearRow
- dgsGridListClearColumn
- dgsGridListClear
- dgsGridListGetRowCount
- dgsGridListSetItemText
- dgsGridListGetItemText
- dgsGridListGetSelectedItem
- dgsGridListSetSelectedItem
- dgsGridListSetItemColor
- dgsGridListGetItemColor
- dgsGridListSetItemData
- dgsGridListGetItemData
- dgsGridListSetItemImage
- dgsGridListGetItemImage
- dgsGridListRemoveItemImage
- dgsGridListGetRowBackGroundImage
- dgsGridListSetRowBackGroundImage
- dgsGridListSetRowBackGroundColor
- dgsGridListGetRowBackGroundColor
- dgsGridListSetRowAsSection
- dgsGridListSelectItem
- dgsGridListItemIsSelected
- dgsGridListSetMultiSelectionEnabled
- dgsGridListGetMultiSelectionEnabled
- dgsGridListSetSelectionMode
- dgsGridListGetSelectionMode
- dgsGridListGetSelectedCount
- dgsGridListGetSelectedItems
- dgsGridListSetSelectedItems
- dgsGridListSetSortFunction
- dgsGridListSetAutoSortEnabled
- dgsGridListGetAutoSortEnabled
- dgsGridListSetSortEnabled
- dgsGridListGetSortEnabled
- dgsGridListSetSortColumn
- dgsGridListGetSortColumn
- dgsGridListGetEnterColumn
- dgsGridListSort
- dgsGridListSetNavigationEnabled
- dgsGridListGetNavigationEnabled
Image
- dgsCreateImage
- dgsImageSetImage
- dgsImageGetImage
- dgsImageSetUVSize
- dgsImageGetUVSize
- dgsImageSetUVPosition
- dgsImageGetUVPosition
Memo
- dgsCreateMemo
- dgsMemoMoveCaret
- dgsMemoSeekPosition
- dgsMemoGetScrollBar
- dgsMemoSetScrollPosition
- dgsMemoGetScrollPosition
- dgsMemoSetHorizontalScrollPosition
- dgsMemoGetHorizontalScrollPosition
- dgsMemoSetVerticalScrollPosition
- dgsMemoGetVerticalScrollPosition
- dgsMemoSetCaretPosition
- dgsMemoGetCaretPosition
- dgsMemoSetCaretStyle
- dgsMemoGetCaretStyle
- dgsMemoSetReadOnly
- dgsMemoGetReadOnly
- dgsMemoGetPartOfText
- dgsMemoDeleteText
- dgsMemoInsertText
- dgsMemoClearText
- dgsMemoSetTypingSound
- dgsMemoGetTypingSound
- dgsMemoGetLineCount
- dgsMemoSetWordWarpState
- dgsMemoGetWordWarpState
- dgsMemoSetScrollBarState
- dgsMemoGetScrollBarState
Label
- dgsCreateLabel
- dgsLabelSetColor
- dgsLabelGetColor
- dgsLabelSetHorizontalAlign
- dgsLabelGetHorizontalAlign
- dgsLabelSetVerticalAlign
- dgsLabelGetVerticalAlign
- dgsLabelGetTextExtent
- dgsLabelGetFontHeight
Progress Bar
- dgsCreateProgressBar
- dgsProgressBarGetProgress
- dgsProgressBarSetProgress
- dgsProgressBarGetMode
- dgsProgressBarSetMode
- dgsProgressBarGetStyle
- dgsProgressBarSetStyle
- dgsProgressBarGetStyleProperty
- dgsProgressBarGetStyleProperties
- dgsProgressBarSetStyleProperty
Radio Button
- dgsCreateRadioButton
- dgsRadioButtonGetSelected
- dgsRadioButtonSetSelected
- dgsRadioButtonSetHorizontalAlign
- dgsRadioButtonGetHorizontalAlign
- dgsRadioButtonSetVerticalAlign
- dgsRadioButtonGetVerticalAlign
Scroll Bar
- dgsCreateScrollBar
- dgsScrollBarSetScrollPosition
- dgsScrollBarGetScrollPosition
- dgsScrollBarSetCursorLength
- dgsScrollBarGetCursorLength
- dgsScrollBarSetGrades
- dgsScrollBarGetGrades
- dgsScrollBarSetLocked
- dgsScrollBarGetLocked
Scroll Pane
- dgsCreateScrollPane
- dgsScrollPaneGetScrollBar
- dgsScrollPaneSetScrollPosition
- dgsScrollPaneGetScrollPosition
- dgsScrollPaneSetHorizontalScrollPosition
- dgsScrollPaneGetHorizontalScrollPosition
- dgsScrollPaneSetVerticalScrollPosition
- dgsScrollPaneGetVerticalScrollPosition
- dgsScrollPaneSetScrollBarState
- dgsScrollPaneGetScrollBarState
Switch Button
- dgsCreateSwitchButton
- dgsSwitchButtonGetState
- dgsSwitchButtonSetState
- dgsSwitchButtonSetText
- dgsSwitchButtonGetText
Tab Panel
- dgsCreateTabPanel
- dgsCreateTab
- dgsGetSelectedTab
- dgsSetSelectedTab
- dgsTabPanelGetTabFromID
- dgsTabPanelMoveTab
- dgsTabPanelGetTabID
- dgsDeleteTab
Window
- dgsCreateWindow
- dgsWindowSetSizable
- dgsWindowSetMovable
- dgsWindowGetSizable
- dgsWindowGetMovable
- dgsCloseWindow
- dgsWindowSetCloseButtonEnabled
- dgsWindowGetCloseButtonEnabled
- dgsWindowSetCloseButtonSize
- dgsWindowGetCloseButtonSize
- dgsWindowGetCloseButton
Plugin
Media Browser
- dgsCreateMediaBrowser
- dgsMediaLoadMedia
- dgsMediaGetMediaPath
- dgsMediaClearMedia
- dgsMediaIsStreamMedia
- dgsMediaPlay
- dgsMediaPause
- dgsMediaStop
- dgsMediaSetSize
- dgsMediaSetFilled
- dgsMediaGetFilled
- dgsMediaSetFullScreen
- dgsMediaGetDuration
- dgsMediaGetCurrentPosition
- dgsMediaSetCurrentPosition
- dgsMediaGetLooped
- dgsMediaSetLooped
Rounded Rectangle
- dgsCreateRoundRect
- dgsRoundRectSetTexture
- dgsRoundRectSetRadius
- dgsRoundRectGetRadius
- dgsRoundRectSetColor
- dgsRoundRectGetColor
- dgsRoundRectSetColorOverwritten
- dgsRoundRectGetColorOverwritten
Color Picker
- dgsCreateColorPicker
- dgsColorPickerSetColor
- dgsColorPickerGetColor
- dgsBindToColorPicker
- dgsUnbindFromColorPicker
- dgsColorPickerCreateComponentSelector
- dgsColorPickerGetComponentSelectorValue
- dgsColorPickerSetComponentSelectorValue
Blur Box
Effect 3D
Client Events
- onDgsArrowListValueChange
- onDgsBlur
- onDgsCheckBoxChange
- onDgsComboBoxStateChange
- onDgsComboBoxSelect
- onDgsCreate
- onDgsDestroy
- onDgsEditPreSwitch
- onDgsEditSwitched
- onDgsEditAccepted
- onDgsElementRender
- onDgsElementMove
- onDgsElementSize
- onDgsFocus
- onDgsGridListItemDoubleClick
- onDgsGridListSelect
- onDgsMouseClick
- onDgsMouseClickDown
- onDgsMouseClickUp
- onDgsMouseDrag
- onDgsMouseDoubleClick
- onDgsMouseDown
- onDgsMouseEnter
- onDgsMouseLeave
- onDgsMouseMove
- onDgsMouseUp
- onDgsMouseWheel
- onDgsRadioButtonChange
- onDgsPositionChange
- onDgsPreRender
- onDgsRender
- onDgsElementScroll
- onDgsSizeChange
- onDgsTabPanelTabSelect
- onDgsTabSelect
- onDgsTextChange
- onDgsWindowClose
Plugin
Media
- onDgsMediaPlay
- onDgsMediaPause
- onDgsMediaStop
- onDgsMediaDurationGet
- onDgsMediaTimeUpdate
- onDgsMediaBrowserReturn
Color Picker
Last
Everyone is welcome to make suggestions, test the script, help make adjustments/finish the wiki, etc.