Add menu
This commit is contained in:
parent
cdaedc8be3
commit
c4b11071e5
40
main.p8
40
main.p8
@ -68,27 +68,27 @@ __gfx__
|
|||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
fffffffff000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0ff0000fff00000000000000000000000000000000000ff00000000000fff0000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0ff00000ff000ffff00ffff00fff00ffff000ff0fff00f00fffff000000fff000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0ff0000ff000f000ff00ff0000f00f000ff0ffff00ff000ff000f00000fff0000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0ff0fff000000000ff00ff0000f0ff000ff00ff000ff000ff0000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0ff00ff000000fffff000ff00f00fffffff00ff000ff000ffff00000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0ff000ff0000f000ff000ff00f00ff0000000ff000ff00000ffff000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0ff0000ff00ff000ff0000f0f000ff0000000ff000ff0000000ff000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0ff00000ff0ff00fff0000fff0000ff000f00ff000ff000f000ff000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
ffff0000fff0fff0fff0000f000000ffff00ffff00fff00fffff0000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
fffffffff0000000000000000000000000fff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0ff0000fff0000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0ff00000ff000ffff00000ffff00000fff0ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0ff0000ff000ff00ff000ff00ff000ff00fff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0ff0fff0000ff0000ff0ff0000ff0ff0000ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0ff00ff0000ff0000ff0ff0000ff0ff0000ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0ff000ff000ff0000ff0ff0000ff0ff0000ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0ff0000ff00ff0000ff0ff0000ff0ff0000ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0ff00000ff00ff00ff000ff00ff000ff00fff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
ffff0000fff00ffff00000ffff00000fff0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
@ -1,19 +1,81 @@
|
|||||||
state_menu=klass()
|
state_menu=klass()
|
||||||
function state_menu:init()
|
function state_menu:init()
|
||||||
|
self.selection=1
|
||||||
|
self.options={
|
||||||
|
menu_option:new(function() return "excavate" end,function()
|
||||||
|
main.state_manager:push(state_excavate_menu:new())
|
||||||
|
end),
|
||||||
|
menu_option:new(function() return "archaeology" end,function()
|
||||||
|
end),
|
||||||
|
menu_option:new(),
|
||||||
|
menu_option:new(function() return "music" end,function()
|
||||||
|
end),
|
||||||
|
menu_option:new(function() return "reset data" end,function()
|
||||||
|
end)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
function state_menu:enter() end
|
function state_menu:enter() end
|
||||||
function state_menu:exit(new_top) end
|
function state_menu:exit(new_top) end
|
||||||
|
|
||||||
function state_menu:reenter() end
|
function state_menu:reenter()
|
||||||
|
self.selection=1
|
||||||
|
end
|
||||||
function state_menu:suspend() end
|
function state_menu:suspend() end
|
||||||
|
|
||||||
function state_menu:update()
|
function state_menu:update()
|
||||||
-- if (btnp(0)) self.outcome="menu" self.done=true
|
if (btnp(0) or btnp(4)) self.options[self.selection]:cb()
|
||||||
-- if (btnp(4)) self.outcome="restart" self.done=true
|
|
||||||
|
local vel=0
|
||||||
|
if (btnp(2)) vel-=1
|
||||||
|
if (btnp(3)) vel+=1
|
||||||
|
if vel!=0 then
|
||||||
|
while true do
|
||||||
|
self.selection=(self.selection+vel-1)%#self.options+1
|
||||||
|
if (self.options[self.selection].cb!=nil) break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function state_menu:draw()
|
function state_menu:draw()
|
||||||
cls(13)
|
cls(13)
|
||||||
print("i am the menu",1,55,7)
|
local optionsh=1
|
||||||
print("i kinda suck",1,61,7)
|
for o in all(self.options) do
|
||||||
print("i'll get better later",1,67,7)
|
optionsh+=2
|
||||||
|
if (o.cb) optionsh+=4
|
||||||
|
end
|
||||||
|
local totalh=optionsh+32
|
||||||
|
local y=128-totalh-1--64-totalh\2
|
||||||
|
spr(64,68,y,7,3)
|
||||||
|
y+=22
|
||||||
|
line(68,y,126,y,15)
|
||||||
|
y+=2
|
||||||
|
local optionsy=y+1
|
||||||
|
rectfill(68,y,126,y+optionsh-1,4)
|
||||||
|
y+=optionsh+1
|
||||||
|
line(68,y,126,y,15)
|
||||||
|
y+=2
|
||||||
|
print("by pyrex & nyeo",68,y,15)
|
||||||
|
|
||||||
|
local y1=y
|
||||||
|
|
||||||
|
local x=69
|
||||||
|
y=optionsy
|
||||||
|
for i=1,#self.options do
|
||||||
|
local o=self.options[i]
|
||||||
|
if (self.selection==i) spr(71,x-7+cos(time())*0.5,y)
|
||||||
|
local fg=13
|
||||||
|
if (o.cb) fg=15
|
||||||
|
if o.name then
|
||||||
|
print(o.name(),x,y,fg)
|
||||||
|
y+=6
|
||||||
|
else
|
||||||
|
line(x-1,y,x+57,y,fg)
|
||||||
|
y+=2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
menu_option=klass()
|
||||||
|
function menu_option:init(name,cb)
|
||||||
|
self.name=name
|
||||||
|
self.cb=cb
|
||||||
end
|
end
|
@ -34,5 +34,5 @@ tutorial={
|
|||||||
function() return watcher:new(progression[5]) end,
|
function() return watcher:new(progression[5]) end,
|
||||||
function() return watcher:new(progression[6]) end,
|
function() return watcher:new(progression[6]) end,
|
||||||
function() return watcher:new(progression[7]) end,
|
function() return watcher:new(progression[7]) end,
|
||||||
completion_stage=99--3
|
completion_stage=3
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user