Open-Terrarium/pause.lua

66 lines
1.7 KiB
Lua
Raw Normal View History

2017-07-18 04:29:28 -04:00
--the pause menu
pause = false
2017-08-04 04:22:05 -04:00
--menu items
pause_menu_items = {
"GRAPHICS",
"VOLUME",
"WORLD",
"EXIT"
}
2017-08-04 04:32:42 -04:00
pause_menu_submenu = nil
function pause_game()
local x, y = love.mouse.getPosition( )
local starter_y = 250
local ier = 0
pause_menu_submenu = nil
for _,item in pairs(pause_menu_items) do
if x > love.graphics.getWidth( )/2-(fontbig:getWidth(item)/2)-2 and love.graphics.getWidth( )/2-(fontbig:getWidth(item)/2)-2 +fontbig:getWidth(item) and
y > starter_y-9+(ier*100) and y < starter_y-9+(ier*100) + fontbig:getHeight(item) then
pause_menu_submenu = item
end
ier = ier + 1
end
--starter_y-9+(ier*100),fontbig:getWidth(item), fontbig:getHeight(item)
end
2017-08-04 04:18:05 -04:00
2017-08-04 03:34:38 -04:00
function render_pause_menu()
2017-08-04 04:18:05 -04:00
--menu title
love.graphics.setColor(255,255,255,255)
2017-08-04 03:40:48 -04:00
love.graphics.setFont(hugefont)
2017-08-04 04:18:05 -04:00
love.graphics.print("GAME MENU", love.graphics.getWidth( )/2-(hugefont:getWidth("GAME MENU")/2),50)
--directories
2017-08-04 04:22:05 -04:00
local starter_y = 250
local ier = 0
for _,item in pairs(pause_menu_items) do
2017-08-04 04:32:42 -04:00
--selection
if pause_menu_submenu == item then
love.graphics.setColor(255,0,0,255)
love.graphics.rectangle( "fill", love.graphics.getWidth( )/2-(fontbig:getWidth(item)/2)-5, starter_y-9+(ier*100)-5,fontbig:getWidth(item)+10, fontbig:getHeight(item)+10 )
end
--
2017-08-04 04:22:05 -04:00
love.graphics.setColor(255,255,255,255)
2017-08-04 04:32:42 -04:00
love.graphics.rectangle( "fill", love.graphics.getWidth( )/2-(fontbig:getWidth(item)/2)-2, starter_y-9+(ier*100),fontbig:getWidth(item), fontbig:getHeight(item) )
2017-08-04 04:22:05 -04:00
---
love.graphics.setColor(0,0,0,255)
love.graphics.setFont(fontbig)
2017-08-04 04:32:42 -04:00
love.graphics.print(item, love.graphics.getWidth( )/2-(fontbig:getWidth(item)/2),starter_y+(ier*100))
2017-08-04 04:22:05 -04:00
ier = ier + 1
end
2017-08-04 04:32:42 -04:00
love.graphics.setColor(100,100,100,255)
2017-07-18 04:29:28 -04:00
end