RoundedRectangle: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Useful Function}} <lowercasetitle></lowercasetitle> __NOTOC__ This function is make a rounded rectangle. ==Syntax== <syntaxhighlight lang="lua">bool roundedRectangle ( floa...") |
No edit summary |
||
Line 52: | Line 52: | ||
</section> | </section> | ||
Written by: ExTasY | Written by: ExTasY[https://wiki.multitheftauto.com/wiki/User:Extasy] |
Revision as of 20:38, 2 February 2019
This function is make a rounded rectangle.
Syntax
bool roundedRectangle ( float startX, float startY, float width, float height [, int tocolor ( int red, int green, int blue [, int alpha = 255 ] ) , bool postGUI = false ] )
Exmaple
Click to collapse [-]
Client sidelocal sx, sy = guiGetScreenSize() roundedRectangle(sx/2, sy/2, 100, 100, tocolor(0,0,0,200)) function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 0, 0, 200); end if (not bgColor) then bgColor = borderColor; end dxDrawRectangle(x, y, w, h, bgColor, postGUI); dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI); dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI); dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI); dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI); end end
Code
Click to collapse [-]
Both sidefunction roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 0, 0, 200); end if (not bgColor) then bgColor = borderColor; end dxDrawRectangle(x, y, w, h, bgColor, postGUI); dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI); dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI); dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI); dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI); end end
Written by: ExTasY[1]