feat(menu): add update function when selected

It allow the engine to add an action that'll done each step on selected
widget
This commit is contained in:
Kazhnuz 2020-10-03 14:32:41 +02:00
parent cf396e9464
commit 68da70f7bf
2 changed files with 8 additions and 1 deletions

View file

@ -146,7 +146,7 @@ function Menu:resize(x,y,w,h)
end
function Menu:destroy()
self.destroyed = true
self.isDestroyed = true
end
function Menu:updateWidgetsOrder()
@ -168,6 +168,9 @@ function Menu:updateSelectedWidget(dt)
self.widget.previous = self.widget.selected
end
end
if (self.widget.list[self.widget.selected] ~= nil) then
self.widget.list[self.widget.selected]:updateSelected(dt)
end
end
-- DRAW FUNCTIONS

View file

@ -89,6 +89,10 @@ function BaseWidget:selectAction()
-- Do nothing
end
function BaseWidget:updateSelected(dt)
-- Do nothing
end
-- DRAW WIDGETS
-- Draw the widget