sonic-radiance/sonic-radiance.love/scenes/debug/menu/menu.lua

48 lines
1.1 KiB
Lua
Raw Normal View History

2020-08-01 10:31:09 +02:00
local commons = require "scenes.debug.commons.menu"
local menu = {}
menu.commons = commons
menu.ExitWidget = commons.DebugWidget:extend()
menu.ShowBackgroundWidget = commons.DebugWidget:extend()
2020-08-02 09:59:47 +02:00
menu.SaveWidget = commons.DebugWidget:extend()
menu.LoadWidget = commons.DebugWidget:extend()
2020-08-01 10:31:09 +02:00
-- ExitWidget
function menu.ExitWidget:new(scene, menuName)
menu.ExitWidget.super.new(self, scene, menuName, "Exit")
end
function menu.ExitWidget:action()
love.event.quit("000")
end
-- ShowBackground
function menu.ShowBackgroundWidget:new(scene, menuName)
menu.ShowBackgroundWidget.super.new(self, scene, menuName, "Show Background")
end
function menu.ShowBackgroundWidget:action()
self.scene.menusystem:deactivate()
end
2020-08-02 09:59:47 +02:00
-- Save game
function menu.SaveWidget:new(scene, menuName)
menu.ShowBackgroundWidget.super.new(self, scene, menuName, "Save game")
end
function menu.SaveWidget:action()
game:write()
end
-- Save game
function menu.LoadWidget:new(scene, menuName, slot)
menu.ShowBackgroundWidget.super.new(self, scene, menuName, "Load file " .. slot)
self.slot = slot
end
function menu.LoadWidget:action()
game:read(self.slot)
end
2020-08-01 10:31:09 +02:00
return menu