IMP-133: re-added have_a_coffee discussion, fixed text readability, fixed centering of texts, new system.ui functions for drawing in contour, fixed ddr types, fixed meter drawing #48

Merged
mr.two merged 2 commits from chore/imp-133-improve-readability into develop 2026-04-09 14:41:44 +00:00
3 changed files with 41 additions and 41 deletions
Showing only changes of commit e797377ec1 - Show all commits

View File

@@ -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)

View File

@@ -306,19 +306,19 @@ local arrow_rotations = { down = 0, right = 1, up = 2, left = 3 }
local function draw_arrow(x, y, direction, color)
local size = 14
local half = size / 2
local center_x, center_y = x + half, y + half
local pivot_x, pivot_y = x + half, y + half
local steps = arrow_rotations[direction] or 0
local head_left_x, head_left_y = rotate(x, y + half, center_x, center_y, steps)
local head_tip_x, head_tip_y = rotate(x + half, y + size, center_x, center_y, steps)
local head_right_x, head_right_y = rotate(x + size, y + half, center_x, center_y, steps)
local head_left_x, head_left_y = rotate(x, y + half, pivot_x, pivot_y, steps)
local head_tip_x, head_tip_y = rotate(x + half, y + size, pivot_x, pivot_y, steps)
local head_right_x, head_right_y = rotate(x + size, y + half, pivot_x, pivot_y, steps)
tri(head_left_x, head_left_y,
head_tip_x, head_tip_y,
head_right_x, head_right_y, color)
local stem_top_x, stem_top_y = rotate(x + half - 3, y, center_x, center_y, steps)
local stem_bot_x, stem_bot_y = rotate(x + half + 3, y + half, center_x, center_y, steps)
local stem_top_x, stem_top_y = rotate(x + half - 3, y, pivot_x, pivot_y, steps)
local stem_bot_x, stem_bot_y = rotate(x + half + 3, y + half, pivot_x, pivot_y, steps)
local stem_x = math.min(stem_top_x, stem_bot_x)
local stem_y = math.min(stem_top_y, stem_bot_y)
local stem_w = math.abs(stem_bot_x - stem_top_x)