# [HELP] dxDrawRoundedRectangle

## Recommended Posts

Hello guys, I'm trying to draw rounded rectangle on my script, but the question is, is there a way to modify the curvature of the corners? I mean, there's default curvature, but I would change it. Long time ago, there was a function which has an argument to modify this.

This is the code I'm using:

```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```

Well, I know already about dgs' library, but the question is, is there any drawing function which makes the same? I mean, not using shaders.

i have good code

its will give you good think

```function DrawRoundedRectangle(x, y, rx, ry, color, radius)
rx = rx - radius * 2
ry = ry - radius * 2

if (rx >= 0) and (ry >= 0) then
dxDrawRectangle(x, y, rx, ry, color)

-- bar
dxDrawRectangle(x, y + ry, rx, radius, color)
dxDrawRectangle(x + rx, y, radius, ry, color)

dxDrawCircle(x, y, radius, 180, 270, color, color, 7)
dxDrawCircle(x + rx, y, radius, 270, 360, color, color, 7)
dxDrawCircle(x + rx, y + ry, radius, 0, 90, color, color, 7)
dxDrawCircle(x, y + ry, radius, 90, 180, color, color, 7)
end
end```

OH, THAT IS WHAT I'M SEARCHING FOR!!

SOLVED

I mean.. you can just take the shader

32 minutes ago, thisdp said:

I mean.. you can just take the shader

i am try to take a shader but XD i cant say that

Edited by iwalidza
1 hour ago, iwalidza said:

i am try to take a shader but XD i cant say that

The reason why I use shader is that with dx functions, I will get a non-smooth round rectangle XD

Edited by thisdp
10 hours ago, thisdp said:

The reason why I use shader is that with dx functions, I will get a non-smooth round rectangle XD

This is so annoying as pixles, I didn't know how to take yours and didn't know how to make one

• 1

## Create an account

Register a new account