Garry's Mod Wiki

Revision Difference

draw.RoundedBox#562470

<function name="RoundedBox" parent="draw" type="libraryfunc"> <description> Draws a rounded rectangle. <note>This function actually draws rectangles with 'gui/cornerX' textures applied to it's rounded corners. It means that this function will fail with any vertex operations, such as model matrices like <page>cam.Start3D2D</page> (corners would be pixelated) or stencil operations. Consider using <page>surface.DrawPoly</page> or <page>mesh</page> library <note>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 <page>cam.Start3D2D</page> (corners would be pixelated) or stencil operations. Consider using <page>surface.DrawPoly</page> or <page>mesh</page> library </note> <rendercontext hook="false" type="2D"></rendercontext> </description> <realm>Client and Menu</realm> <file line="162-L171">lua/includes/modules/draw.lua</file> <args> <arg name="cornerRadius" type="number">Radius of the rounded corners, works best with a multiple of 2. For values 0 or below, <page>surface.DrawRect</page> will be used instead for performance. </arg> <arg name="x" type="number">The x coordinate of the top left of the rectangle.</arg> <arg name="y" type="number">The y coordinate of the top left of the rectangle.</arg> <arg name="width" type="number">The width of the rectangle.</arg> <arg name="height" type="number">The height of the rectangle.</arg> <arg name="color" type="table">The color to fill the rectangle with. Uses the <page>Color</page>.</arg> </args> </function> <example> <code> hook.Add("HUDPaint", "DrawARoundedBox", function() draw.RoundedBox( 4, 50, 50, 100, 100, Color( 255, 255, 255 ) ) end) </code> </example>