├── dxGUI ├── colorpicker.png ├── Rectangle.lua ├── Image.lua ├── CursorManager.lua ├── ImageSection.lua ├── TextBordered.lua ├── shaders │ ├── blur.fx │ ├── gradient.fx │ ├── circle.fx │ ├── tex_matrix.fx │ └── hud_mask.fx ├── Circle.lua ├── RenderTarget.lua ├── Text.lua ├── TextShadowed.lua ├── Bar.lua ├── Tabs.lua ├── Button.lua ├── Checkbox.lua ├── DxConstructionMasked.lua ├── Gradient.lua ├── dxInput.lua ├── Cursor.lua ├── Slider.lua ├── Blur.lua ├── baseClass.lua ├── TextLines.lua ├── Edit.lua ├── DxConstruction.lua ├── List.lua ├── Anim.lua └── Map.lua ├── README.md ├── meta.xml ├── classutils.lua ├── utilits.lua └── LICENSE /dxGUI/colorpicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheNormalnij/MTA-dxGUI/HEAD/dxGUI/colorpicker.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MTA-dxGUI 2 | Cool and powerfull dxGUI library for MTA 3 | 4 | See [wiki](https://github.com/TheNormalnij/MTA-dxGUI/wiki) for details 5 | -------------------------------------------------------------------------------- /dxGUI/Rectangle.lua: -------------------------------------------------------------------------------- 1 | dxGUI.baseClass:subclass{ 2 | type = 'rectangle'; 3 | color = 0xFF000000; 4 | postGUI = false; 5 | 6 | draw = function( self ) 7 | dxDrawRectangle( self.x, self.y, self.w, self.h, self.color, self.postGUI ) 8 | end; 9 | 10 | setPostGUI = function( self, state ) 11 | if state == true or state == false then 12 | self.postGUI = state 13 | end 14 | end; 15 | } -------------------------------------------------------------------------------- /dxGUI/Image.lua: -------------------------------------------------------------------------------- 1 | dxGUI.baseClass:subclass{ 2 | type = 'image'; 3 | rotation = 0; 4 | rotationCenterOffsetX = 0; 5 | rotationCenterOffsetY = 0; 6 | color = 0xFFFFFFFF; 7 | postGUI = false; 8 | 9 | draw = function( self ) 10 | dxDrawImage( self.x, self.y, self.w, self.h, self.image, self.rotation, 11 | self.rotationCenterOffsetX, self.rotationCenterOffsetY, self.color, self.postGUI ) 12 | end; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /dxGUI/CursorManager.lua: -------------------------------------------------------------------------------- 1 | 2 | local guiWithCursor = {} 3 | 4 | CursorManager = { 5 | 6 | addGui = function( guiObject ) 7 | if not CursorManager.isGuiRequireCursor( guiObject ) then 8 | table.insert( guiWithCursor, guiObject ) 9 | end 10 | showCursor( true ) 11 | end; 12 | 13 | removeGui = function( guiObject ) 14 | if table.removeValue( guiWithCursor, guiObject ) 15 | and #guiWithCursor == 0 16 | and isCursorShowing() 17 | then 18 | showCursor( false ) 19 | end 20 | end; 21 | 22 | isGuiRequireCursor = function( guiObject ) 23 | return table.find( guiWithCursor, guiObject ) 24 | end; 25 | 26 | } -------------------------------------------------------------------------------- /dxGUI/ImageSection.lua: -------------------------------------------------------------------------------- 1 | dxGUI.baseClass:subclass{ 2 | type = 'imageSection'; 3 | u = 0; 4 | v = 0; 5 | 6 | rotation = 0; 7 | rotationCenterOffsetX = 0; 8 | rotationCenterOffsetY = 0; 9 | color = 0xFFFFFFFF; 10 | postGUI = false; 11 | 12 | create = function( self ) 13 | self.us = self.us or self.w 14 | self.vs = self.vs or self.h 15 | return self 16 | end; 17 | 18 | draw = function( self ) 19 | dxDrawImageSection( self.x, self.y, self.w, self.h, self.u, self.v, self.us, self.vs, self.image, self.rotation, 20 | self.rotationCenterOffsetX, self.rotationCenterOffsetY, self.color, self.postGUI ) 21 | end; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /dxGUI/TextBordered.lua: -------------------------------------------------------------------------------- 1 | -- from https://wiki.multitheftauto.com/wiki/DxDrawBorderedText 2 | dxGUI.text:subclass{ 3 | type = 'textBordered'; 4 | outline = 2; 5 | 6 | draw = function( self ) 7 | for oX = (self.outline * -1), self.outline do 8 | for oY = (self.outline * -1), self.outline do 9 | dxDrawText(self.text, self.x + oX, self.y + oY, self.x + self.w + oX, self.y + self.h + oY, 0xFF000000, self.scale, self.font, self.alignX, self.alignY, self.clip, self.wordBreak, self.postGUI, self.colorCoded) 10 | end 11 | end 12 | dxDrawText (self.text, self.x, self.y, self.x + self.w, self.y + self.h, self.color, self.scale, self.font, self.alignX, self.alignY, self.clip, self.wordBreak, self.postGUI, self.colorCoded) 13 | end; 14 | } 15 | -------------------------------------------------------------------------------- /dxGUI/shaders/blur.fx: -------------------------------------------------------------------------------- 1 | texture texture0; 2 | float factor; 3 | 4 | sampler Sampler0 = sampler_state 5 | { 6 | Texture = (texture0); 7 | AddressU = MIRROR; 8 | AddressV = MIRROR; 9 | }; 10 | 11 | struct PSInput 12 | { 13 | float2 TexCoord : TEXCOORD0; 14 | }; 15 | 16 | float4 PixelShader_Background(PSInput PS) : COLOR0 17 | { 18 | float4 sum = tex2D(Sampler0, PS.TexCoord); 19 | for (float i = 1; i < 3; i++) { 20 | sum += tex2D(Sampler0, float2(PS.TexCoord.x, PS.TexCoord.y + (i * factor))); 21 | sum += tex2D(Sampler0, float2(PS.TexCoord.x, PS.TexCoord.y - (i * factor))); 22 | sum += tex2D(Sampler0, float2(PS.TexCoord.x - (i * factor), PS.TexCoord.y)); 23 | sum += tex2D(Sampler0, float2(PS.TexCoord.x + (i * factor), PS.TexCoord.y)); 24 | } 25 | sum /= 9; 26 | sum.a = 1.0; 27 | return sum; 28 | } 29 | 30 | technique complercated 31 | { 32 | pass P0 33 | { 34 | PixelShader = compile ps_2_0 PixelShader_Background(); 35 | } 36 | } 37 | 38 | technique simple 39 | { 40 | pass P0 41 | { 42 | Texture[0] = texture0; 43 | } 44 | } -------------------------------------------------------------------------------- /dxGUI/shaders/gradient.fx: -------------------------------------------------------------------------------- 1 | // 2 | // Gradient shader - gradient.fx 3 | // 4 | 5 | float2 gradientVector = float2( 1, 1 ); 6 | float4 sGradientFromColor = float4( 0, 0, 0, 0 ); 7 | float4 sGradientToColor = float4( 1, 1, 1, 1 ); 8 | 9 | //------------------------------------------------------------------------------------------ 10 | // PixelShaderFunction 11 | // 1. Read from PS structure 12 | // 2. Process 13 | // 3. Return pixel color 14 | //------------------------------------------------------------------------------------------ 15 | float4 PixelShaderFunction( float4 Diffuse : COLOR0, float2 TexCoord : TEXCOORD0) : COLOR0 16 | { 17 | return ( sGradientFromColor + ( sGradientToColor - sGradientFromColor ) * length( TexCoord * gradientVector ) ) * Diffuse; 18 | } 19 | 20 | //------------------------------------------------------------------------------------------ 21 | // Techniques 22 | //------------------------------------------------------------------------------------------ 23 | technique tec0 24 | { 25 | pass P0 26 | { 27 | PixelShader = compile ps_2_0 PixelShaderFunction(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /meta.xml: -------------------------------------------------------------------------------- 1 | 2 | true 3 | 4 | 5 | 6 |