sokoban.love/0021-draw_menu

38 lines
1.1 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, 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)
if Current_pane.filename then
if has_local_modifications(Current_pane.filename) then
x, y = stash_button(x, y, r)
x, y = revert_button(x, y, r)
elseif can_be_unstashed(Current_pane) then
x, y = unstash_button(x, y, r)
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