Garry's Mod Wiki

draw.RoundedBox

  draw.RoundedBox( number cornerRadius, number x, number y, number width, number height, table color )

Description

Draws a rounded rectangle.

This function actually draws rectangles with 'gui/cornerX' textures applied to it's rounded corners. It means that this function will fail (or will be drawn not as expected) with any vertex operations, such as model matrices like cam.Start3D2D (corners would be pixelated) or stencil operations. Consider using surface.DrawPoly or mesh library
This is a rendering function that requires a 2d rendering context.

This means that it will only work in 2d Rendering Hooks.

Arguments

1 number cornerRadius
Radius of the rounded corners, works best with a multiple of 2.

For values 0 or below, surface.DrawRect will be used instead for performance.

2 number x
The x coordinate of the top left of the rectangle.
3 number y
The y coordinate of the top left of the rectangle.
4 number width
The width of the rectangle.
5 number height
The height of the rectangle.
6 table color
The color to fill the rectangle with. Uses the Color.

Example

hook.Add("HUDPaint", "DrawARoundedBox", function() draw.RoundedBox( 4, 50, 50, 100, 100, Color( 255, 255, 255 ) ) end)