feat(examples): add a way to add argument to examples scenes in mainmenu

This commit is contained in:
Kazhnuz 2019-07-12 23:35:04 +02:00
parent a7821e8f48
commit f9ba042089

View file

@ -66,8 +66,9 @@ function MainMenu:addSubMenu(name, fullname)
SubMenuWidget(self, name, "main", "back", 1)
end
function MainMenu:addScene(submenu, scene, fullname)
SceneWidget(self, submenu, scene, fullname)
function MainMenu:addScene(submenu, scene, fullname, arg1, arg2, arg3, arg4, arg5)
local args = {arg1, arg2, arg3, arg4, arg5}
SceneWidget(self, submenu, scene, fullname, args)
end
function MainMenu:draw()
@ -104,8 +105,9 @@ end
-- Scene widget :: switch scene
function SceneWidget:new(scene, menu, newscene, fullname)
self.scene = scene
function SceneWidget:new(scene, menu, newscene, fullname, args)
self.scene = scene
self.args = args
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
self.newscene = newscene
@ -115,7 +117,7 @@ end
function SceneWidget:action()
core.scenemanager:storeCurrentScene("mainmenu")
self.newscene()
self.newscene(self.args[1], self.args[2], self.args[3], self.args[4], self.args[5])
end
-- Exit Widget : exit the examples