core/menusystem: only send key presses to an active menu

This commit is contained in:
Kazhnuz 2019-02-15 18:51:57 +01:00
parent a51eb1d64e
commit e5e12714fb

View file

@ -34,9 +34,12 @@ function MenuSystem:update(dt)
end
if self.menus[self.focusedMenu] ~= nil then
for k,v in pairs(self.keys) do
if self.keys[k].isPressed then
self.menus[self.focusedMenu]:keyreleased(k)
-- Only check buttons if the current focused menu is actually active
if self.menus[self.focusedMenu].isActive then
for k,v in pairs(self.keys) do
if self.keys[k].isPressed then
self.menus[self.focusedMenu]:keyreleased(k)
end
end
end
end