I tried to create a simple and elegant layout to experiment with. This layout displays a background image and a list of available games on the main screen. When selecting a game, a menu should appear with the options "Play", "Manual" and "Video".
But do I think something is missing, or is the code completely wrong?
// Configurações
local bg = fe.add_artwork("backdrop", fe.add_image(bg_image)) // nome da imagem de fundo
local font_name = "Roboto Regular" // nome da fonte
local font_size = 20 // tamanho da fonte
local title_offset_y = 80 // distância do título em relação ao topo
local item_height = 40 // altura de cada item da lista
local item_spacing = 10 // espaçamento entre os itens da lista
local menu_options = [ ["Jogar", "emulator", "[name]"],
["Manual", "exec", "[rompath]/manual.pdf"],
["Vídeo", "exec", "[rompath]/video.mp4"]
]
// Imagem de fundo
local bg = fe.add_artwork("backdrop", bg_image)
bg.preserve_aspect_ratio = true
bg.trigger = Transition.EndNavigation
bg.post_trigger = Transition.ToNewVideo
// Título
local title = fe.add_text("[Title]", 0, title_offset_y, fe.layout.width, font_size*2, font_name, font_size*2, 0xffffffff, Effect.Fade)
title.word_wrap = true
title.align = Align.Center
title.trigger = Transition.EndNavigation
title.post_trigger = Transition.ToNewVideo
// Lista de jogos
local list = fe.add_list("romlist", 0, title_offset_y + title.height + item_spacing, fe.layout.width, fe.layout.height - (title_offset_y + title.height + item_spacing), font_name, font_size, 0xffffffff, Effect.Fade)
list.spacing = item_spacing
list.trigger = Transition.EndNavigation
list.post_trigger = Transition.ToNewVideo
// Ações
list.on_change = function( selected_item ) {
title.set_text( selected_item.parent.get_name( selected_item ) )
}
list.on_select = function( selected_item ) {
local sel = fe.do_menu(menu_options, "Menu")
if (sel == -1) fe.exit()
fe.do_action(sel)
}