Jump to content

[REL] DxDrawing Library


N1kS

Recommended Posts

Hello guys!

I want to produce my Dx library. Small example:

local Rectangle, Text 
  
addCommandHandler( "create", 
    function() 
        showCursor(true) 
        -- Creating rectangle 
        Rectangle = Dx:createRectangle ( 0, 0, 300, 300, { 255, 255, 255 }, 150, false ); 
        -- Set rectangle position at the center of the screen 
        Rectangle:setPosition( "center", "center" ); 
        -- Creating some text in the center of the rectangle 
        local RectangleWidth = Rectangle:getWidth() 
        local RectangleHeight = Rectangle:getHeight() 
        Text = Dx:createText( "DxDrawing lib works good!", 0, 0, RectangleWidth, RectangleHeight, { 255, 0, 0 }, 255, 1, "default-bold", "center", "center", false, false, false, Rectangle ); 
        -- Do some events for Rectangle 
        -- On clicking on the rectangle 
        Rectangle.OnClick = function( Button, State, X, Y ) 
                      outputChatBox( "You clicked on the rectangle!" ); 
                      outputChatBox( "Button: "..Button..", state: "..State ); 
                    end 
        -- On mouse enter on rectangle 
        Rectangle.OnMouseEnter = function() 
                          outputChatBox( "You entered mouse to rectangle!" ); 
                        end 
        -- On mouse leave from rectangle 
        Rectangle.OnMouseLeave = function() 
                          outputChatBox( "You leaved mouse from rectangle!" ); 
                        end  
    end 
) 
  
addCommandHandler ("destroy", 
    function() 
        -- Destroy rectangle and all childs! 
        Rectangle:destroy(); 
    end 
) 

Download and get acquainted with the syntax you can in the my repo. I hope that someone might find this resource necessary. Thanks for attention.

Repository link:

https://github.com/niks123123/DxDrawing

Edited by Guest
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...