Files
cacaus-arcade/data/opcions.lua
JailGamer ca0393046e [FIX] Sistema de navegació entre pantalles (flow)
- Optimitzat el logo. Ara necessita menys memòria aprofitant les funcions de paleta
2026-04-03 15:29:44 +02:00

61 lines
1.9 KiB
Lua

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
-- Tornar
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
-- Tornar desde qualsevol lloc
flow:next()
end
end
function opcions_show()
opcions_draw()
opcions_update()
end
function opcions_end()
print("opcions_end")
-- flow:restore()
flow:finish()
end
flow:registrar("opcions",{opcions_init, opcions_show, opcions_end})