- [NEW] draw_shiny_rect()

- [WIP] Menú d'opcions
This commit is contained in:
2026-04-03 01:08:20 +02:00
parent d45c2fe011
commit 2564c54b3e
4 changed files with 147 additions and 3 deletions

View File

@@ -1,3 +1,80 @@
local shine_step = 1
local shine_wait = 0
local shine_pos = 0
function draw_shiny_rect(x, y, w, h, color, shine_color)
draw.rect(x,y,w,h,color)
local shine_w= 18
-- Convertir el rectangle en una linea en checkpoints
local p0 = 0
local p1 = p0+w-1
local p2 = p1+h
local p3 = p2+w
local p4 = p3+h
-- Punt inicial y final de la recta del brillo
local s0 = shine_step
local s1 = s0+shine_w
local y0 = 0
if s0==p4 then
shine_step=0
draw.line(x, y, x+shine_w, y, shine_color)
elseif s0<p1 then
if s1<p1 then
draw.line(x+s0, y, x+s1, y, shine_color)
elseif s1<p2 then
segment = s1-p1
draw.line(x+s0, y, x+w-1, y, shine_color)
draw.line(x+w-1, y, x+w-1, y+segment, shine_color)
end
elseif s0<p2 then
if s1<p2 then
segment = shine_w
x0 = x+w-1
y0= y+(s0-p1)-1
draw.line(x0, y0, x0, y0+segment, shine_color)
elseif s1<p3 then
segment = s1-p2
x0= x+w-1-segment
y0= y+h-1
draw.line(x0, y0, x0+segment, y0, shine_color)
segment = p2-s0-1
x0= x+w-1
y0= y+(s0-p1)
draw.line(x0, y0, x0, y0+segment, shine_color)
end
elseif s0<p3 then
if s1<p3 then
segment=shine_w
x0 = x+w-1-(s1-p2)
y0 = y+h-1
draw.line(x0, y0, x0+shine_w, y0, shine_color)
elseif s1<p4 then
segment = s1-p3
y0 = y+h-1
draw.line(x,y0,x,y0-segment,shine_color)
segment = p3-s0
y0 = y+h-1
draw.line(x,y0,x+segment,y0,shine_color)
end
elseif s0<p4 then
if s1<p4 then
segment = shine_w
y0 = y+p4-s1
draw.line(x,y0,x,y0+segment,shine_color)
else
segment = s1-p4
draw.line(x,y,x+segment,y,shine_color)
segment = p4-s0
draw.line(x,y,x,y+segment,shine_color)
end
end
shine_step = shine_step+1
end
function arc_text(str, x, y, col)
font.current(font_sf)
draw.text(str,x,y,col)