Resource:DGS: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(305 intermediate revisions by 18 users not shown)
Line 1: Line 1:
<pageclass class="resource" subcaption="Resource"></pageclass>
<pageclass class="resource" subcaption="Resource"></pageclass>
[[Image:DGS_Logo.png|400px|thumb|right|DGS Logo By [[User:Allerek|Allerek]]]]
This resource is designed to allow you to create directX GUI's as an alternative to the original MTA:SA GUI functions.


This is a resource designed to allow you create dx gui on the screen instead of the original gui.
<span style="color:#DD2222;text-shadow:black 0em 0em 0.3em;">This wiki is always for the latest DGS version!</span>


'''Full Name''' : Thisdp's DX Graphical User Interface System
<div style="padding:10px; border-radius:2px;font-size:14px;">
'''Full Name''': Thisdp's DirectX Graphical User Interface System (DxGUI Lib)


'''Author''' : thisdp
'''State''': <span style="color:#FFFFFF;text-shadow:black 0em 0em 0.3em;">OpenSource</span> & <span style="color:#55FF55;text-shadow:black 0em 0em 0.3em;">Work in progress</span>


'''State''' : OpenSource (WIP)
'''Github Repo''': https://github.com/thisdp/dgs
 
'''Resource Download''': [https://github.com/thisdp/dgs/releases/latest/download/dgs.zip dgs.zip]
 
'''Server Discord''': https://discord.gg/QEs8q6W
 
'''Current Version''': 3.522
 
'''Update Log''': [https://github.com/thisdp/dgs/releases/tag/3.522 Changes and Updates Log]
 
 
'''Auto Completion & Syntax  Highlight'''
 
Official:
 
'''Latest VSCode Snippets:''' [https://raw.githubusercontent.com/Armisael2k/mtasa-wiki-scrapper/master/functions.json VSCode Snippets (Last Update: Auto every month) By '''motar2k''']
 
 
Use the following command in server console to crawl and generate the latest auto completion (Only support NotePad++/Sublime/VSCode).
*'''g2d -crawl npp/sublime/vscode'''
Or you can use the following link to download completed files instead of crawling by yourself.
*[https://drive.google.com/file/d/1H_PiG2gmEz1AyXqZN4956IVgtZOjgMi6/view?usp=sharing NotePad++]
*[https://drive.google.com/file/d/1_07WBEWjriTTucrNGI7jT-4SknALKG6B/view?usp=sharing Sublime]
*[https://drive.google.com/file/d/1J4qoSjzmXZz7yxHUZ2fExBu3zvCwRESn/view?usp=sharing VSCode (Old)]
 
3rd Party Auto Completion:
*1. [http://www.mediafire.com/file/m6dm7815d5dihax/lua.zip NotePad++ By '''Ahmed Ly''']
*2. [https://marketplace.visualstudio.com/items?itemName=ERAGON.mtasa-dgs-lua Visual Studio Code By '''BW~ERAGON >''' ]
</div>


=Features=
=Features=
'''How it works?'''


*DGS is just like the original gui system that is based on element system. I use a simple way that can make everyone easier to understand.
[[Image:DGSNetStatus.png|300px|thumb|right|DGS Network Monitor]]
*DGS elements are rendered in "onClientRender". There is two or more tables store DGS elements. When "onClientRender" is called, "for" loop will loop and calculate every DGS element.


[[Image:DGSS.png|400px|thumb|right|]]


'''What's different?'''


*This resource is based on dx* functions. It allows us to edit our gui and make it customlization.
'''How does it work?'''
*DGS is based on [[element]] system, which just likes the cegui system. To make everything easy to use and understand, DGS has almost the same usage as CEGUI.
*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'''
'''Update System'''
*It have an update system that can keep your DGS least.
*It have an update system that can inform you of keeping your DGS latest.
*Execute "updatedgs" to check the least version and update your DGS.
*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"




'''Debug'''
'''You Should Know'''
*This project was started from 2014.
*Some of DGS elements 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.
 


*You can enter debug mode by executing the command "debugdgs"
[[Image:Dx_7.PNG|400px|thumb|right|Example DGS Cmd]]


'''Examples scripts'''
*1.https://community.multitheftauto.com/index.php?p=resources&s=details&id=14757 By ([[User:Ahmed Ly|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


'''DGS Type'''


* Button (dgs-dxbutton): A button.
'''Debug'''
* Command (dgs-dxcmd): A command just like one of windows.
* You can enter the debug mode by executing the command "'''debugdgs'''".
* Cyclehitshape (dgs-dxcyclehitshape): A check area that is cycle.
* "'''debugdgs'''": Simple debug mode. For basic information.
* Edit (dgs-dxedit): A edit.
* "'''debugdgs 2 '''": Render debug mode. To see dgs elements' scale with a rainbow border
* Gridlist (dgs-dxgridlist): A grid list.
* "'''debugdgs 3 '''": Tracing debug mode. To trace something for example where the dgs elements' were created, and the tracing mode of some functions will be enabled to show the detail.
* Image (dgs-dximage): A static image.
* Label (dgs-dxlabel): A text label.
* ScrollBar (dgs-dxscrollbar): A scroll bar.
* ScrollPane (dgs-dxscrollpane): A scroll pane.
* Window (dgs-dxwindow): A window.




'''Notice'''
'''Notice'''
*The resource name should be 'dgs'.
*It is recommended to change the resource name to 'dgs'.
*This is a resource and if you want to use the functions it exported, you should add something in front of the function like 'exports.dgs:dgsDxCreateLabel(0,0,0.5,0.1,"text",true)'
*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
*Here is a feasible way for use the export functions:
<syntaxhighlight lang="lua">
label = exports.dgs:dgsCreateLabel(0, 0, 0.5, 0.1, "text", true)
</syntaxhighlight>
*Here is a feasible way to shorten the name of an exported function:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
DGS = exports.dgs --shorten the export function prefix
DGS = exports.dgs --shorten the export function prefix
label = DGS:dgsDxCreateLabel(0,0,0.5,0.1,"text",false) --create a label
label = DGS:dgsCreateLabel(0,0,0.5,0.1,"text",true) --create a label
</syntaxhighlight>
*From the latest version, it no longer needs '''exports.dgs:''', instead we can do
<syntaxhighlight lang="lua">
loadstring(exports.dgs:dgsImportFunction())()-- load functions
label = dgsCreateLabel(0,0,0.5,0.1,"text",true) --create a label
</syntaxhighlight>
'''Object Oriented Programming'''
<syntaxhighlight lang="lua">
loadstring(exports.dgs:dgsImportOOPClass(true))()-- load OOP class
window = dgsWindow(0,0,0.5,0.1,"test",true) --create a window with oop
label = window:dgsLabel(0,0,1,1,"label",true) --create a label inside the window
label.text = "DGS OOP Test" --set text
</syntaxhighlight>
</syntaxhighlight>


='''Client Functions'''=
'''Special thanks to the following for their help (Respect the contributors)''':
*dgsGetPosition
* Axel, Senpai, ZoNe
*dgsSetPosition
* DiGiTal, #Dv^, maksam07
*dgsSetParent
* Scorpyo, Kingleonide, Bullet(.el3tar)
*dgsGetParent
* Allerek, Deihim007, OmarSwaitti(HankVoight)
*dgsGetChild
* FlyingFork, Lettify, Ahmed Ly
*dgsGetChildren
* ᴛᴇᴍᴏɪꜱ, Shady1
*dgsGetSize
*dgsSetSize
*dgsGetType
*dgsSetBottom
*dgsDxGUIGetProperty
*dgsDxGUISetProperty
*dgsDxGUIGetVisible
*dgsDxGUISetVisible
*dgsDxGUIGetEnabled
*dgsDxGUISetEnabled
*dgsDxGUIGetSide
*dgsDxGUISetSide
*dgsDxGUIGetAlpha
*dgsDxGUISetAlpha
*dgsDxGUIGetFont
*dgsDxGUISetFont
*dgsDxGUIGetText
*dgsDxGUISetText
*dgsDxGUICreateFont
*dgsDxGUIBringToFront
*dgsDxGetMouseEnterGUI


==Window==
='''DGS Tips'''=
*dgsDxCreateWindow
*[[DGS Events and GUI Events]]
*dgsDxWindowSetSizable
*[[DGS Functions and GUI Functions]]
*dgsDxWindowSetMovable
*[[DGS Grid List]]
*dgsDxGUICloseWindow
*[[DGS OOP Class]]
*[[DGS Custom Plugin]]
*[[DGS Style System]]
*[[G2D|DGS GUI To DGS]]


==Scroll Pane==
='''DGS Element Properties'''=
*dgsDxCreateScrollPane
{{DGSPROPERTIES}}
*dgsDxScrollPaneGetScrollBar


==Button==
='''Client Functions'''=
*dgsDxCreateButton
{{DGSFUNCTIONS}}
 
==CMD==
*dgsDxCreateCmd
*dgsDxCmdSetMode
*dgsDxEventCmdSetPreName
*outputCmdMessage
*dgsGetCmdEdit
*dgsDxCmdAddEventToWhiteList
*dgsDxCmdRemoveEventFromWhiteList
*dgsDxCmdRemoveAllEvents
*dgsDxCmdIsInWhiteList
*dgsAddCommandHandler
*dgsRemoveCommandHandler
 
==Edit==
*dgsDxCreateEdit
*dgsDxEditMoveCaret
*dgsDxEditGetCaretPosition
*dgsDxEditSetCaretStyle
*dgsDxEditSetWhiteList
*dgsDxEditGetMaxLength
*dgsDxEditSetMaxLength
 
==Image==
*dgsDxCreateImage
*dgsDxImageLoadImage
 
==Label==
*dgsDxCreateLabel
 
==Scroll Bar==
*dgsDxCreateScrollBar
*dgsDxScrollBarSetScrollBarPosition
*dgsDxScrollBarGetScrollBarPosition
*dgsDxScrollBarSetColor
 
==Grid List==
*dgsDxCreateGridList
*dgsDxGridListGetScrollBar
*dgsDxGridListSetColumnRelative
*dgsDxGridListGetColumnRelative
*dgsDxGridListAddColumn
*dgsDxGridListGetColumnCount
*dgsDxGridListRemoveColumn
*dgsDxGridListGetColumnAllLength
*dgsDxGridListGetColumnLength
*dgsDxGridListGetColumnTitle
*dgsDxGridListSetColumnTitle
*dgsDxGridListAddRow
*dgsDxGridListRemoveRow
*dgsDxGridListClearRow
*dgsDxGridListGetRowCount
*dgsDxGridListSetItemText
*dgsDxGridListGetItemText
*dgsDxGridListGetSelectedItem
*dgsDxGridListSetSelectedItem
*dgsDxGridListSetItemColor
*dgsDxGridListGetItemColor
*dgsDxGridListGetItemBackGroundImage
*dgsDxGridListSetItemBackGroundImage
*dgsDxGridListSetRowColor
*dgsDxGridListGetRowColor


=Client Events=
=Client Events=
{{DGSEVENTS}}


=Last=
=Last=
'''Welcome everyone else to made suggestions, tested the script, helped me to finish the wiki, etc'''
'''Everyone is welcome to make suggestions, test the script, help make adjustments/finish the wiki, etc.'''
[[Category:Resource]]
[[Category:Resource]]


[[ZH-CN:Slothbot]]
[[ar:Resource:Dgs]]
[[ZH-CN:Resource:Dgs]]
[[PL:Resource:Dgs]]
[[TR:Resource:Dgs]]

Latest revision as of 18:29, 3 January 2024

DGS Logo By Allerek

This resource is designed to allow you to create directX GUI's as an alternative to the original MTA:SA GUI functions.

This wiki is always for the latest DGS version!

Full Name: Thisdp's DirectX Graphical User Interface System (DxGUI Lib)

State: OpenSource & Work in progress

Github Repo: https://github.com/thisdp/dgs

Resource Download: dgs.zip

Server Discord: https://discord.gg/QEs8q6W

Current Version: 3.522

Update Log: Changes and Updates Log


Auto Completion & Syntax Highlight

Official:

Latest VSCode Snippets: VSCode Snippets (Last Update: Auto every month) By motar2k


Use the following command in server console to crawl and generate the latest auto completion (Only support NotePad++/Sublime/VSCode).

  • g2d -crawl npp/sublime/vscode

Or you can use the following link to download completed files instead of crawling by yourself.

3rd Party Auto Completion:

Features

DGS Network Monitor
DGSS.png


How does it work?

  • DGS is based on element system, which just likes the cegui system. To make everything easy to use and understand, DGS has almost the same usage as CEGUI.
  • 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.
  • Some of DGS elements 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.


Example DGS Cmd

Examples scripts


Debug

  • You can enter the debug mode by executing the command "debugdgs".
  • "debugdgs": Simple debug mode. For basic information.
  • "debugdgs 2 ": Render debug mode. To see dgs elements' scale with a rainbow border
  • "debugdgs 3 ": Tracing debug mode. To trace something for example where the dgs elements' were created, and the tracing mode of some functions will be enabled to show the detail.


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(true))()-- load OOP class
window = dgsWindow(0,0,0.5,0.1,"test",true) --create a window with oop
label = window:dgsLabel(0,0,1,1,"label",true) --create a label inside the window
label.text = "DGS OOP Test" --set text

Special thanks to the following for their help (Respect the contributors):

  • Axel, Senpai, ZoNe
  • DiGiTal, #Dv^, maksam07
  • Scorpyo, Kingleonide, Bullet(.el3tar)
  • Allerek, Deihim007, OmarSwaitti(HankVoight)
  • FlyingFork, Lettify, Ahmed Ly
  • ᴛᴇᴍᴏɪꜱ, Shady1

DGS Tips

DGS Element Properties

General Properties

Unique Properties For DGS Core Elements

Extra Properties For DGS Plugins

Client Functions

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips

Client Events

General

Check Box

Combo Box

Drag'N Drop

Edit

Grid List

Menu

Selector

Mouse

Radio Button

Switch Button

Tab

Animation

Plugin

Media

Color Picker

QRCode

Remote Image

Last

Everyone is welcome to make suggestions, test the script, help make adjustments/finish the wiki, etc.