RoundedRectangle: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(→Code) |
||
Line 32: | Line 32: | ||
==Code== | ==Code== | ||
<section name=" | <section name="Client side" class="client" show="true"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI) | function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI) |
Revision as of 17:02, 5 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 [-]
Client 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]