N1kS Posted December 10, 2014 Share Posted December 10, 2014 (edited) 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 December 10, 2014 by Guest Link to comment
MTA Team 0xCiBeR Posted December 10, 2014 MTA Team Share Posted December 10, 2014 Nice work! Keep it up! Link to comment
Anubhav Posted December 10, 2014 Share Posted December 10, 2014 Thanks alot, this will make my work 100x easier. BTW: How to install this? This is my first OOP library :3 Link to comment
N1kS Posted December 11, 2014 Author Share Posted December 11, 2014 Just copy all files to your resource and include them in the meta.xml. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now