60 lines
2.1 KiB
Plaintext
60 lines
2.1 KiB
Plaintext
draw_menu = function()
|
|
App.color(Menu_background)
|
|
love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bottom)
|
|
App.color(Normal_color)
|
|
local x = Menu_left+5
|
|
love.graphics.print(Current_pane_index, x, Menu_top+5)
|
|
x = x + App.width(tostring(Current_pane_index)) + 5
|
|
-- main buttons
|
|
x = run_button(x)
|
|
-- settings button on right
|
|
local w = App.width('settings')
|
|
button(Global_state, 'settings', {x=Safe_width-w-10-5, y=Menu_top+5, w=w+10, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
|
|
icon = function(p)
|
|
App.color(Normal_color)
|
|
love.graphics.rectangle('line', p.x,p.y, p.w,p.h, 2,2)
|
|
love.graphics.print('settings', p.x+5,p.y+2)
|
|
end,
|
|
onpress1 = function()
|
|
print('settings')
|
|
end,
|
|
})
|
|
-- nav buttons along sides
|
|
if Current_pane_index > 1 then
|
|
button(Global_state, 'left', {x=0, y=Menu_bottom, w=Menu_left+30, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2},
|
|
icon = function(p)
|
|
App.color{r=0.4,g=0.4,b=0.4}
|
|
love.graphics.polygon('fill', Menu_left+5, App.screen.height/2, Menu_left+25, App.screen.height/2-10, Menu_left+25, App.screen.height/2+10)
|
|
end,
|
|
onpress1 = function()
|
|
Current_pane_index = Current_pane_index-1
|
|
Current_pane = Panes[Current_pane_index]
|
|
end,
|
|
})
|
|
end
|
|
local r = Menu_left + Safe_width
|
|
if Current_pane_index == #Panes then
|
|
button(Global_state, 'right', {x=r-30, y=Menu_bottom, w=100, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2},
|
|
icon = function(p)
|
|
App.color{r=0.4,g=0.4,b=0.4}
|
|
love.graphics.print('+', r-25, App.screen.height/2-10)
|
|
end,
|
|
onpress1 = function()
|
|
table.insert(Panes, new_pane())
|
|
Current_pane_index = Current_pane_index+1
|
|
Current_pane = Panes[Current_pane_index]
|
|
end,
|
|
})
|
|
else
|
|
button(Global_state, 'right', {x=r-30, y=Menu_bottom, w=100, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2},
|
|
icon = function(p)
|
|
App.color{r=0.4,g=0.4,b=0.4}
|
|
love.graphics.polygon('fill', r-25, App.screen.height/2-10, r-25, App.screen.height/2+10, r-5, App.screen.height/2)
|
|
end,
|
|
onpress1 = function()
|
|
Current_pane_index = Current_pane_index+1
|
|
Current_pane = Panes[Current_pane_index]
|
|
end,
|
|
})
|
|
end
|
|
end |