Files
impostor/inc/window/window.game.lua
Zoltan Timar c9db82cce7
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/pr/woodpecker Pipeline was successful
feat: added minigames (button_mash, rhythm, ddr), correction in makefiles readline, placed games in init.context
2026-02-12 16:31:03 +01:00

40 lines
1.2 KiB
Lua

function GameWindow.draw()
local currentScreenData = Context.screens[Context.current_screen]
UI.draw_top_bar(currentScreenData.name)
end
function GameWindow.update()
if Input.menu_back() then
Context.active_window = WINDOW_MENU
MenuWindow.refresh_menu_items()
return
end
if Input.select() then
if Context.current_screen == #Context.screens then
Context.current_screen = 1
else
Context.current_screen = Context.current_screen + 1
end
end
if Input.player_interact() then
-- Get the current screen's NPCs
local currentScreenData = Context.screens[Context.current_screen]
if currentScreenData and currentScreenData.npcs and #currentScreenData.npcs > 0 then
-- For now, interact with the first NPC on the screen
-- TODO: Add proximity detection to find nearest NPC
local npc = currentScreenData.npcs[1]
PopupWindow.show_menu_dialog(npc, {
{label = "Talk to", action = NPC.talk_to},
{label = "Fight", action = NPC.fight},
{label = "Go back", action = NPC.go_back}
}, WINDOW_POPUP)
end
end
end
function GameWindow.set_state(new_state)
Context.active_window = new_state
-- Add any state-specific initialization/cleanup here later if needed
end