diff --git a/sonic-radiance.love/birb/modules/gui/elements/parent.lua b/sonic-radiance.love/birb/modules/gui/elements/parent.lua index 1d44c39..10af95c 100644 --- a/sonic-radiance.love/birb/modules/gui/elements/parent.lua +++ b/sonic-radiance.love/birb/modules/gui/elements/parent.lua @@ -18,6 +18,10 @@ function GuiElement:new(name, x, y, w, h) self:register() end +function GuiElement:setKeyPressAction(func) + self.func = func +end + function GuiElement:getGui() local scene = core.scenemanager.nextScene or core.scenemanager.currentScene return scene.gui @@ -127,7 +131,9 @@ end -- Handle key press function GuiElement:keypressed(key) - -- Cette fonction ne contient rien par défaut + if (self.func ~= nil) then + self.func(key) + end end -- MOUSE FUNCTIONS