Skip to content

melon.thirdparty.roundedboxes

garryspins edited this page Feb 27, 2026 · 3 revisions

melon.thirdparty.RoundedBoxes


Important

This module is undocumented, realm information might not be accurate.

melon.thirdparty

Functions

melon.thirdparty.RoundedBoxes.RoundedBox

shared link
melon.thirdparty.RoundedBoxes.RoundedBox(radius: number, x: number, y: number, w: number, h: number, bl: number, tl: number, tr: number, br: number, detail: number) -> table

Argument and Return information

Arguments

# Name Type Description
1 radius number Radius of the rounded box
2 x number X position of the box
3 y number Y position of the box
4 w number W of the box
5 h number H of the box
6 bl number Should the bottom left be rounded independently, if so how much
7 tl number Should the top left be rounded independently, if so how much
8 tr number Should the top right be rounded independently, if so how much
9 br number Should the bottom right be rounded independently, if so how much
10 detail number Number of vertices to put on edges, defaults to 1 for perfect quality, raise this number for how many vertices to skip.

Returns

# Name Type Description
1 poly table Polygon to be drawn with surface.DrawPoly

Generates a rounded box polygon

local mat = Material("vgui/gradient-l")
local PANEL = vgui.Register("RoundedGradient", {}, "Panel")
function PANEL:PerformLayout(w, h)
    self.background = melon.thirdparty.RoundedBoxes.RoundedBox(w / 4, 0, 0, w, h)
end
function PANEL:Paint(w, h)
    draw.NoTexture()
    surface.SetDrawColor(0, 89, 161)
    surface.DrawPoly(self.background)
    surface.SetMaterial(mat)
    surface.SetDrawColor(0, 140, 255)
    surface.DrawPoly(self.background)
end  

Clone this wiki locally