fix: don't update menus keycheck during transition

Fixes #88
This commit is contained in:
Kazhnuz 2021-04-18 15:09:44 +02:00
parent df4ef549d6
commit 37d685a7ea
3 changed files with 22 additions and 2 deletions

View file

@ -201,7 +201,11 @@ function MenuSystem:update(dt)
v:update(dt)
v:updateWidgets(dt)
end
end
end
function MenuSystem:keycheck()
if (self.isActive) then
if self.menus[self.focusedMenu] ~= nil then
-- Only check buttons if the current focused menu is actually active
if self.menus[self.focusedMenu].isActive then
@ -213,6 +217,7 @@ function MenuSystem:update(dt)
end
end
end
end
-- MOUSE FUNCTIONS

View file

@ -89,6 +89,15 @@ function Scene:updateDialog(dt)
end
end
function Scene:updateMenus(dt)
if (self.menusystem ~= nil) then
self.menusystem:update(dt)
if (core.screen:isActive()) then
self.menusystem:keycheck()
end
end
end
-- MOUSE FUNCTIONS
-- Make the scene support the pointer
@ -153,6 +162,12 @@ function Scene:drawDialog(dt)
end
end
function Scene:drawMenus()
if (self.menusystem ~= nil) then
self.menusystem:draw()
end
end
-- INPUT FUNCTIONS
-- Handle inputs from keyboard/controllers

View file

@ -81,7 +81,7 @@ function SceneManager:update(dt)
self.currentScene:updateStart(dt)
self.currentScene:setKeys()
self.currentScene.assets:update(dt)
self.currentScene.menusystem:update(dt)
self.currentScene:updateMenus(dt)
self.currentScene:updateWorld(dt)
self.currentScene:update(dt)
self.currentScene:updateEnd(dt)
@ -131,7 +131,7 @@ function SceneManager:draw()
self.currentScene:drawStart()
self.currentScene:drawWorld()
self.currentScene:draw()
self.currentScene.menusystem:draw()
self.currentScene:drawMenus()
self.currentScene:drawEnd()
self.controller.screen:drawTransition()
self.currentScene:drawOverTransition()