This commit is contained in:
@@ -90,45 +90,45 @@ end
|
||||
--- @param[opt] bg_color number The background fill color (default: Config.colors.dark_grey).<br/>
|
||||
--- @param[opt] border_color number The border color (default: Config.colors.white).<br/>
|
||||
--- @param[opt] center_text boolean Whether to center each line inside the box. Defaults to false.<br/>
|
||||
local function draw_rounded_rect_fill(x, y, w, h, radius, color)
|
||||
local inner_w = w - radius * 2
|
||||
local inner_h = h - radius * 2
|
||||
local function draw_rounded_rect_fill(x, y, w, h, corner_radius, color)
|
||||
local inner_w = w - corner_radius * 2
|
||||
local inner_h = h - corner_radius * 2
|
||||
if inner_w > 0 and inner_h > 0 then
|
||||
rect(x + radius, y + radius, inner_w, inner_h, color)
|
||||
rect(x + corner_radius, y + corner_radius, inner_w, inner_h, color)
|
||||
end
|
||||
if inner_w > 0 and radius > 0 then
|
||||
rect(x + radius, y, inner_w, radius, color)
|
||||
rect(x + radius, y + h - radius, inner_w, radius, color)
|
||||
if inner_w > 0 and corner_radius > 0 then
|
||||
rect(x + corner_radius, y, inner_w, corner_radius, color)
|
||||
rect(x + corner_radius, y + h - corner_radius, inner_w, corner_radius, color)
|
||||
end
|
||||
if radius > 0 and inner_h > 0 then
|
||||
rect(x, y + radius, radius, inner_h, color)
|
||||
rect(x + w - radius, y + radius, radius, inner_h, color)
|
||||
if corner_radius > 0 and inner_h > 0 then
|
||||
rect(x, y + corner_radius, corner_radius, inner_h, color)
|
||||
rect(x + w - corner_radius, y + corner_radius, corner_radius, inner_h, color)
|
||||
end
|
||||
for row = 0, radius - 1 do
|
||||
for col = 0, radius - 1 do
|
||||
if col + row >= radius - 1 then
|
||||
pix(x + radius - 1 - col, y + radius - 1 - row, color)
|
||||
pix(x + w - radius + col, y + radius - 1 - row, color)
|
||||
pix(x + radius - 1 - col, y + h - radius + row, color)
|
||||
pix(x + w - radius + col, y + h - radius + row, color)
|
||||
for row = 0, corner_radius - 1 do
|
||||
for col = 0, corner_radius - 1 do
|
||||
if col + row >= corner_radius - 1 then
|
||||
pix(x + corner_radius - 1 - col, y + corner_radius - 1 - row, color)
|
||||
pix(x + w - corner_radius + col, y + corner_radius - 1 - row, color)
|
||||
pix(x + corner_radius - 1 - col, y + h - corner_radius + row, color)
|
||||
pix(x + w - corner_radius + col, y + h - corner_radius + row, color)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function draw_rounded_rect_border(x, y, w, h, radius, color)
|
||||
line(x + radius, y, x + w - radius - 1, y, color)
|
||||
line(x + radius, y + h - 1, x + w - radius - 1, y + h - 1, color)
|
||||
line(x, y + radius, x, y + h - radius - 1, color)
|
||||
line(x + w - 1, y + radius, x + w - 1, y + h - radius - 1, color)
|
||||
pix(x + radius - 1, y + 1, color)
|
||||
pix(x + 1, y + radius - 1, color)
|
||||
pix(x + w - radius, y + 1, color)
|
||||
pix(x + w - 2, y + radius - 1, color)
|
||||
pix(x + radius - 1, y + h - 2, color)
|
||||
pix(x + 1, y + h - radius, color)
|
||||
pix(x + w - radius, y + h - 2, color)
|
||||
pix(x + w - 2, y + h - radius, color)
|
||||
local function draw_rounded_rect_border(x, y, w, h, corner_radius, color)
|
||||
line(x + corner_radius, y, x + w - corner_radius - 1, y, color)
|
||||
line(x + corner_radius, y + h - 1, x + w - corner_radius - 1, y + h - 1, color)
|
||||
line(x, y + corner_radius, x, y + h - corner_radius - 1, color)
|
||||
line(x + w - 1, y + corner_radius, x + w - 1, y + h - corner_radius - 1, color)
|
||||
pix(x + corner_radius - 1, y + 1, color)
|
||||
pix(x + 1, y + corner_radius - 1, color)
|
||||
pix(x + w - corner_radius, y + 1, color)
|
||||
pix(x + w - 2, y + corner_radius - 1, color)
|
||||
pix(x + corner_radius - 1, y + h - 2, color)
|
||||
pix(x + 1, y + h - corner_radius, color)
|
||||
pix(x + w - corner_radius, y + h - 2, color)
|
||||
pix(x + w - 2, y + h - corner_radius, color)
|
||||
end
|
||||
|
||||
function UI.draw_textbox(text, box_x, box_y, box_w, box_h, scroll_y, color, bg_color, border_color, center_text)
|
||||
|
||||
Reference in New Issue
Block a user