function init_menu() -- add pause menu items first menuitem(1, "save game", save_game) menuitem(2, "erase save data", clear_save) menu_cursor = 0 menu_map = { [0] = nil, [1] = nil, [2] = save_game } end function menu_input() if btnp(5) then menu_mode = false end -- todo: implement an actual menu control end function draw_menu() menu_draw_inventory() menu_draw_options() end function menu_draw_inventory() rectfill(0,0,64,64,1) rect(0,0,64,64,5) local inv_cursor = 0 for k,v in pairs(inventory) do if v > 0 then spr(k, 8, 8+inv_cursor*8) print(v, 18, 8+inv_cursor*8, 15) end end end function menu_draw_options() rectfill(80, 0, 127, 64, 1) rect(80, 0, 127, 64, 5) cursor(96, 8) color(15) print("eat") print("build") print("save") -- cursor print("->", 84, 8+menu_cursor*6) end