26 lines
695 B
Lua
26 lines
695 B
Lua
-- states/main_menu.lua
|
|||
|
|
--
|
||
|
|
-- Options are static (Continue / New game / Load game / Options / Manual /
|
||
|
|
-- Credits / Exit game); `isEnabled` is recomputed in open(), so "Continue" and
|
||
|
|
-- "Load game" are unavailable on a fresh install. Announcing that matters --
|
||
|
|
-- otherwise pressing enter appears to do nothing.
|
||
|
|
|
||
|
|
return {
|
||
|
|
probe = {
|
||
|
|
fn = "keypressed",
|
||
|
|
focus = "selectedOption",
|
||
|
|
list = "optionsList",
|
||
|
|
focusMayBeNil = true, -- nil until open() picks the first enabled option
|
||
|
|
},
|
||
|
|
|
||
|
|
render = function(entry, index, total)
|
||
|
|
local text = entry.title or "?"
|
||
|
|
|
||
|
|
if entry.isEnabled == false then
|
||
|
|
text = text .. ", unavailable"
|
||
|
|
end
|
||
|
|
|
||
|
|
return text .. ", " .. index .. " of " .. total
|
||
|
|
end,
|
||
|
|
}
|