feat: add keypressed customization
This commit is contained in:
parent
36b4d16939
commit
70f1fe21e9
1 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue