Refonte pour utiliser le systeme de GUI #112
1 changed files with 7 additions and 1 deletions
|
@ -18,6 +18,10 @@ function GuiElement:new(name, x, y, w, h)
|
||||||
self:register()
|
self:register()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function GuiElement:setKeyPressAction(func)
|
||||||
|
self.func = func
|
||||||
|
end
|
||||||
|
|
||||||
function GuiElement:getGui()
|
function GuiElement:getGui()
|
||||||
local scene = core.scenemanager.nextScene or core.scenemanager.currentScene
|
local scene = core.scenemanager.nextScene or core.scenemanager.currentScene
|
||||||
return scene.gui
|
return scene.gui
|
||||||
|
@ -127,7 +131,9 @@ end
|
||||||
-- Handle key press
|
-- Handle key press
|
||||||
|
|
||||||
function GuiElement:keypressed(key)
|
function GuiElement:keypressed(key)
|
||||||
-- Cette fonction ne contient rien par défaut
|
if (self.func ~= nil) then
|
||||||
|
self.func(key)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- MOUSE FUNCTIONS
|
-- MOUSE FUNCTIONS
|
||||||
|
|
Loading…
Reference in a new issue