45 lines
927 B
Lua
45 lines
927 B
Lua
scenes = {}
|
|
|
|
local main = {}
|
|
main.selected = 1
|
|
main.options = {
|
|
{text = "Start Game"},
|
|
{text = "Quit"}
|
|
}
|
|
|
|
main.draw = function()
|
|
for i, v in ipairs(main.options) do
|
|
if i == main.selected then
|
|
love.graphics.print({{255, 255, 0}, v.text}, 200, 100 + (15 * i))
|
|
else
|
|
love.graphics.print(v.text, 200, 100 + (15 * i))
|
|
end
|
|
end
|
|
end
|
|
|
|
main.keypressed = function(key)
|
|
if key == "up" then
|
|
main.selected = main.selected + 1
|
|
if main.selected > #main.options then
|
|
main.selected = 1
|
|
end
|
|
elseif key == "down" then
|
|
main.selected = main.selected - 1
|
|
if main.selected < 1 then
|
|
main.selected = #main.options
|
|
end
|
|
elseif key == "return" then
|
|
local next = main.options[main.selected].next_scene
|
|
if next then
|
|
table.insert(scenes, next)
|
|
else
|
|
table.remove(scenes)
|
|
end
|
|
end
|
|
end
|
|
|
|
main.update = function(dt)
|
|
end
|
|
|
|
table.insert(scenes, main)
|
|
return scenes
|