From f9c539a85486a1f60778e76253422229f3c48cf8 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Thu, 11 Dec 2025 20:39:26 +0100 Subject: [PATCH] resume button --- inc/window/window.menu.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/inc/window/window.menu.lua b/inc/window/window.menu.lua index 18e8d22..bbf7765 100644 --- a/inc/window/window.menu.lua +++ b/inc/window/window.menu.lua @@ -28,6 +28,10 @@ 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 @@ -38,17 +42,18 @@ function MenuWindow.configuration() end function MenuWindow.refresh_menu_items() - Context.menu_items = { - {label = "New Game", action = MenuWindow.new_game}, - {label = "Load Game", action = MenuWindow.load_game}, - } + 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