diff --git a/sonic-radiance.love/core/modules/menusystem/flowbox.lua b/sonic-radiance.love/core/modules/menusystem/flowbox.lua index c3d9426..35247c3 100644 --- a/sonic-radiance.love/core/modules/menusystem/flowbox.lua +++ b/sonic-radiance.love/core/modules/menusystem/flowbox.lua @@ -55,6 +55,7 @@ end function FlowBox:update(dt) self:updateView() + self:updateSelectedWidget(dt) end function FlowBox:updateView() diff --git a/sonic-radiance.love/core/modules/menusystem/grid.lua b/sonic-radiance.love/core/modules/menusystem/grid.lua index e1fd8ed..8db8209 100644 --- a/sonic-radiance.love/core/modules/menusystem/grid.lua +++ b/sonic-radiance.love/core/modules/menusystem/grid.lua @@ -140,6 +140,7 @@ end function GridBox:update(dt) self.view.firstSlot = 1 + self:updateSelectedWidget(dt) end -- KEYS FUNCTIONS diff --git a/sonic-radiance.love/core/modules/menusystem/hlistbox.lua b/sonic-radiance.love/core/modules/menusystem/hlistbox.lua index 067de32..1123685 100644 --- a/sonic-radiance.love/core/modules/menusystem/hlistbox.lua +++ b/sonic-radiance.love/core/modules/menusystem/hlistbox.lua @@ -50,6 +50,7 @@ end function HListBox:update(dt) self:updateView() + self:updateSelectedWidget(dt) end function HListBox:updateView() diff --git a/sonic-radiance.love/core/modules/menusystem/listbox.lua b/sonic-radiance.love/core/modules/menusystem/listbox.lua index 19c2ea2..b8e47e7 100644 --- a/sonic-radiance.love/core/modules/menusystem/listbox.lua +++ b/sonic-radiance.love/core/modules/menusystem/listbox.lua @@ -50,6 +50,7 @@ end function ListBox:update(dt) self:updateView() + self:updateSelectedWidget(dt) end function ListBox:updateView() diff --git a/sonic-radiance.love/core/modules/menusystem/parent.lua b/sonic-radiance.love/core/modules/menusystem/parent.lua index 12777e6..4cf9380 100644 --- a/sonic-radiance.love/core/modules/menusystem/parent.lua +++ b/sonic-radiance.love/core/modules/menusystem/parent.lua @@ -158,6 +158,16 @@ end function Menu:update(dt) -- Cette fonction ne contient rien par défaut + self:updateSelectedWidget(dt) +end + +function Menu:updateSelectedWidget(dt) + if (self.widget.selected ~= self.widget.previous) and (self.isActive) then + if (self.widget.list[self.widget.selected] ~= nil) then + self.widget.list[self.widget.selected]:selectAction() + self.widget.previous = self.widget.selected + end + end end -- DRAW FUNCTIONS