4
0

resume button

This commit is contained in:
2025-12-11 20:39:26 +01:00
parent a777241d7a
commit f9c539a854

View File

@@ -28,6 +28,10 @@ function MenuWindow.save_game()
Context.save_game() -- This function will be created in Context Context.save_game() -- This function will be created in Context
end end
function MenuWindow.resume_game()
GameWindow.set_state(WINDOW_GAME)
end
function MenuWindow.exit() function MenuWindow.exit()
exit() exit()
end end
@@ -38,17 +42,18 @@ function MenuWindow.configuration()
end end
function MenuWindow.refresh_menu_items() function MenuWindow.refresh_menu_items()
Context.menu_items = { Context.menu_items = {} -- Start with an empty table
{label = "New Game", action = MenuWindow.new_game},
{label = "Load Game", action = MenuWindow.load_game},
}
if Context.game_in_progress then 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}) table.insert(Context.menu_items, {label = "Save Game", action = MenuWindow.save_game})
end 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 = "Configuration", action = MenuWindow.configuration})
table.insert(Context.menu_items, {label = "Exit", action = MenuWindow.exit}) table.insert(Context.menu_items, {label = "Exit", action = MenuWindow.exit})
Context.selected_menu_item = 1 -- Reset selection after refreshing Context.selected_menu_item = 1 -- Reset selection after refreshing
end end