feat(examples): add a way to add argument to examples scenes in mainmenu
This commit is contained in:
parent
a7821e8f48
commit
f9ba042089
1 changed files with 7 additions and 5 deletions
|
@ -66,8 +66,9 @@ function MainMenu:addSubMenu(name, fullname)
|
||||||
SubMenuWidget(self, name, "main", "back", 1)
|
SubMenuWidget(self, name, "main", "back", 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainMenu:addScene(submenu, scene, fullname)
|
function MainMenu:addScene(submenu, scene, fullname, arg1, arg2, arg3, arg4, arg5)
|
||||||
SceneWidget(self, submenu, scene, fullname)
|
local args = {arg1, arg2, arg3, arg4, arg5}
|
||||||
|
SceneWidget(self, submenu, scene, fullname, args)
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainMenu:draw()
|
function MainMenu:draw()
|
||||||
|
@ -104,8 +105,9 @@ end
|
||||||
|
|
||||||
-- Scene widget :: switch scene
|
-- Scene widget :: switch scene
|
||||||
|
|
||||||
function SceneWidget:new(scene, menu, newscene, fullname)
|
function SceneWidget:new(scene, menu, newscene, fullname, args)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
|
self.args = args
|
||||||
local widgetmenu = self.scene.menusystem.menus[menu]
|
local widgetmenu = self.scene.menusystem.menus[menu]
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets.fonts["medium"]
|
||||||
self.newscene = newscene
|
self.newscene = newscene
|
||||||
|
@ -115,7 +117,7 @@ end
|
||||||
|
|
||||||
function SceneWidget:action()
|
function SceneWidget:action()
|
||||||
core.scenemanager:storeCurrentScene("mainmenu")
|
core.scenemanager:storeCurrentScene("mainmenu")
|
||||||
self.newscene()
|
self.newscene(self.args[1], self.args[2], self.args[3], self.args[4], self.args[5])
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Exit Widget : exit the examples
|
-- Exit Widget : exit the examples
|
||||||
|
|
Loading…
Reference in a new issue