# Curved HUD box's

How can I make rounded or circular HUD box’s?

**[Draw.RoundedBox

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Draw.RoundedBox)** or **[Draw.RoundedBoxEx

I know how to draw HUD, i specifically want to know how to create a box that bends, curves, or is circular.

So do you want to bend shapes like this?

http://dl.dropbox.com/u/1217587/To%20Host/bent%20box.png

It was realy necesary to upload a image wich say " Bent this motherf*****! ??
And Another Romanian guy

Yes, it was necessary, because if that is what he really wants, I might be able to present him a solution.

I smell the involvement of complex math. I’ll be watching, as I’m wondering how this would be possible too.

Also: Sup deathmatch.

Also can I possibly add to this? I’m wondering how to make angled boxes. Pretty sure it’s unpossible, but you never know. I’d really like to draw my own stuff instead of using roundedbox. Roundedbox’s corners are rasters and they pixelate if you make the corners too round.

For everything, there are polygons.
With some 6th grade math, you can get almost any shape into a polygon and scale it up.

Also, to bend things, I suspect that morphing could be used.

So you’re saying I can draw polygons on the viewport? How? I’m pretty new to HUD scripting.

EDIT: Holy shit **[Surface.DrawPoly

With enough vertices, JeffDOA, I’m sure you could make curved objects like that. Or you could probably use some complex math to generate vertices along the desired curve FOR you. Work smart, not hard.

Yea something like that, explain your solution pls

You cannot use polygons to draw konkav objects.

What you all are talking about doesn’t work.

http://cloud.steampowered.com/ugc/594708803549441540/9D2DB4BB54BFFD9EDA24F96FC31DF7530592BE75/

Do I win a prize?

[lua]
– Simple concave polygon vertices
local concave = {}
concave[1] = { x = (ScrW() / 2) - 200, y = (ScrH() / 2) }
concave[2] = { x = (ScrW() / 2) + 200, y = (ScrH() / 2) }
concave[3] = { x = (ScrW() / 2) + 200, y = (ScrH() / 2) - 150 }
concave[4] = { x = (ScrW() / 2), y = (ScrH() / 2) - 100 }
concave[5] = { x = (ScrW() / 2) - 200, y = (ScrH() / 2) - 150 }

surface.SetDrawColor(255, 0, 0, 255)
surface.DrawPoly(concave)
end)
[/lua]

I always got pretty fucked up rendering errors when doing konvex polys, also:

Wiki said something else.

Have to use a mirrored reference since garry took down the wiki.

Maybe valve changed something.

The wiki has been wrong/outdated before. I just clearly created a concave polygon successfully using surface.DrawPoly()

[editline]hm, what?[/editline]
What sorts of rendering errors? The only thing I think would be truly affected is textures being applied to the polygon

The poly just went plain invisible once it got konvex.

That is very peculiar. Are you sure it was below the 256 vertices limit? How complex was it? Do you still have the code?

The limit just clamps not makes it invisible, and it the attempt of making more then half of a circle.

My bet is that you’re doing it wrong. Don’t worry, you aren’t alone. I have to ask you though, to make your shit invisible… Was zum Teufel machen sie?

This kind of shit happens every day, but apply it to GLua. Summary of Lua question forums, right?

A half-circle isn’t a concave polygon (it’s convex), and it only says the surface.DrawPoly() may not work properly with concave polygons. Your example should’ve worked. Not trying to be an ass, but I think you just did it wrong.

[editline]aw shit[/editline]
Actually, I’m also retarded, because a circle, even a semi-circle, isn’t a polygon.

I was talking about more than half a circle, as in 3/4 of a circle. which is convex-concav.

Also, Bel Irkalli, that was pretty dumb.