The central pipeline lints where the old inline one did not, and it aborts on any warning. Nothing here was actually wrong: 166 of the 243 warnings were the TIC-80 API and the game's own globals being undeclared, which is what .luacheckrc is for — the same shape impostor already uses. The rest was trailing whitespace on 14 lines, now stripped. INPUT_KEY_X is unused but kept: it belongs to the LEFT/RIGHT/A/B/X/Y set and removing it would leave a gap in the mapping, so luacheck is told to allow the family. Verified locally by merging the sources the way the pipeline does and running luacheck over the result: 0 warnings, 0 errors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
61 lines
1.8 KiB
Lua
61 lines
1.8 KiB
Lua
function MenuWindow.draw()
|
|
UI.draw_top_bar("Main Menu")
|
|
UI.draw_menu(Context.menu_items, Context.selected_menu_item, 108, 70)
|
|
end
|
|
|
|
function MenuWindow.update()
|
|
Context.selected_menu_item = UI.update_menu(Context.menu_items, Context.selected_menu_item)
|
|
|
|
if Input.menu_confirm() then
|
|
local selected_item = Context.menu_items[Context.selected_menu_item]
|
|
if selected_item and selected_item.action then
|
|
selected_item.action()
|
|
end
|
|
end
|
|
end
|
|
|
|
function MenuWindow.new_game()
|
|
Context.new_game() -- This function will be created in Context
|
|
GameWindow.set_state(WINDOW_GAME)
|
|
end
|
|
|
|
function MenuWindow.load_game()
|
|
Context.load_game() -- This function will be created in Context
|
|
GameWindow.set_state(WINDOW_GAME)
|
|
end
|
|
|
|
function MenuWindow.save_game()
|
|
Context.save_game() -- This function will be created in Context
|
|
end
|
|
|
|
function MenuWindow.resume_game()
|
|
GameWindow.set_state(WINDOW_GAME)
|
|
end
|
|
|
|
function MenuWindow.exit()
|
|
exit()
|
|
end
|
|
|
|
function MenuWindow.configuration()
|
|
ConfigurationWindow.init()
|
|
GameWindow.set_state(WINDOW_CONFIGURATION)
|
|
end
|
|
|
|
function MenuWindow.refresh_menu_items()
|
|
Context.menu_items = {} -- Start with an empty table
|
|
|
|
if Context.game_in_progress then
|
|
table.insert(Context.menu_items, {label = "Resume Game", action = MenuWindow.resume_game})
|
|
table.insert(Context.menu_items, {label = "Save Game", action = MenuWindow.save_game})
|
|
end
|
|
|
|
table.insert(Context.menu_items, {label = "New Game", action = MenuWindow.new_game})
|
|
table.insert(Context.menu_items, {label = "Load Game", action = MenuWindow.load_game})
|
|
table.insert(Context.menu_items, {label = "Configuration", action = MenuWindow.configuration})
|
|
table.insert(Context.menu_items, {label = "Exit", action = MenuWindow.exit})
|
|
|
|
Context.selected_menu_item = 1 -- Reset selection after refreshing
|
|
end
|
|
|
|
|