- [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

61
data/opcions.lua Normal file
View File

@@ -0,0 +1,61 @@
local menu_sel = 0
function opcions_init()
flow:add_path({opcions_show, opcions_end})
flow:next()
end
function opcions_draw()
surf.cls(16)
draw_shiny_rect(56,(56+(20*menu_sel)),146,18,14,15)
-- if (not parpadeig) then draw.rect(28*o2aX,(28+(10*menu_sel))*o2aX,73*o2aX,9*o2aX,13) end
arc_text("MÚSICA", 60, 60, 14); arc_text(music.enabled() and "SI" or "NO",91*o2aX,30*o2aX,15)
arc_text("", 60, 80, 14); arc_text(sound.enabled() and "SI" or "NO",91*o2aX,40*o2aX,15)
arc_text("REDEFINIR TECLAT", 60, 100, 14)
arc_text("REDEFINIR GAMEPAD", 60, 120, 14)
arc_text("TORNAR", 60, 140, 14)
end
function opcions_update()
if key.press(keyShoot) or key.press(key.SPACE) or pad.press(pad.A) or pad.press(btnShoot) then
if menu_sel==0 then
music.enabled(not music.enabled())
if music.enabled() then music.play(audio_main_song) end
elseif menu_sel==1 then
sound.enabled(not sound.enabled())
elseif menu_sel==2 then
menu_count=0
menu_state=update_redefine_keys_menu
elseif menu_sel==3 then
menu_count=0
menu_state=update_redefine_pad_menu
else
-- menu_count=0
-- menu_sel=0
-- menu_state=update_main_menu
flow:next()
end
elseif key.press(keyDown) or key.press(key.DOWN) or pad.press(pad.DOWN) or pad.press(btnDown) then
menu_sel=menu_sel+1
if menu_sel==5 then menu_sel=0 end
elseif key.press(keyUp) or key.press(key.UP) or pad.press(pad.UP) or pad.press(btnUp) then
menu_sel=menu_sel-1
if menu_sel==-1 then menu_sel=4 end
elseif key.press(key.ESCAPE) or pad.press(btnPause) then
-- menu_count=0
-- menu_sel=0
-- menu_state=update_main_menu
flow:next()
end
end
function opcions_show()
opcions_draw()
opcions_update()
end
function opcions_end()
print("opcions_end")
flow:restore()
end