carousel.love/0021-draw_menu

57 lines
1.5 KiB
Plaintext

draw_menu = function()
love.graphics.setFont(Font)
App.color(Menu_background)
love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bottom)
-- settings button on right
local r = settings_button(Safe_width-5)
local x, y = Menu_left+5, Menu_top+5
-- main menu on left
App.color(White)
love.graphics.print(Current_pane_index, x+5, Menu_top+5+2)
App.color(Normal_color)
x = x+5 + Font:getWidth(tostring(Current_pane_index)) + 10
x = run_button(x, y)
x = stop_button(x, y)
-- assume screen will always be wide enough to print this far without overflow
if not Overflow_button then
local w = Font:getWidth('code')+10
local w2 = Font:getWidth('>>')+10
if x+w+10+w2+10 < r then
App.color{r=0.5, g=0.5, b=0.5}
love.graphics.print('code', x, y)
x = x+w+10
end
end
if Show_code then
x, y = hide_code_button(x, y, r)
else
x, y = show_code_button(x, y, r)
end
x, y = save_button(x, y, r)
x, y = load_button(x, y, r)
x, y = paste_button(x, y, r)
x, y = copy_button(x, y, r)
x, y = clear_pane_button(x, y, r)
if not Overflow_button then
local w = Font:getWidth('screen')+10
local w2 = Font:getWidth('>>')+10
if x+w+10+w2+10 < r then
App.color{r=0.5, g=0.5, b=0.5}
love.graphics.print('screen', x, y)
x = x+w+10
end
end
x, y = new_pane_button(x, y, r)
x, y = delete_pane_button(x, y, r)
-- nav buttons along sides
if Current_pane_index > 1 then
previous_pane_button()
end
if Current_pane_index < #Panes then
next_pane_button(Menu_left + Safe_width)
end
if Show_menu == 'settings' then
draw_settings_menu()
end
end