61 lines
2.0 KiB
Lua
61 lines
2.0 KiB
Lua
|
function PauseUI()
|
||
|
--Parameters
|
||
|
local pauseWidth = 640
|
||
|
local pauseHeight = 480
|
||
|
local pauseX = (game.width/2)-(pauseWidth/2)
|
||
|
local pauseY = (game.height/2)-(pauseHeight/2)
|
||
|
local mouse_x, mouse_y = love.mouse.getPosition()
|
||
|
|
||
|
--Base items
|
||
|
love.graphics.setColor(0,0,0,0.3)
|
||
|
love.graphics.rectangle("fill", 0, 0, game.width, game.height)
|
||
|
love.graphics.setColor(1,1,1,1)
|
||
|
love.graphics.rectangle("fill", pauseX, pauseY, pauseWidth, pauseHeight)
|
||
|
--Close buttom
|
||
|
love.graphics.setColor(1,0,0,1)
|
||
|
love.graphics.rectangle("fill", pauseX+pauseWidth-40, pauseY+10, 30, 30)
|
||
|
if love.mouse.isDown(1) then
|
||
|
if mouse_x >= pauseX+pauseWidth-40
|
||
|
and mouse_y >= pauseY+10
|
||
|
and mouse_x <= pauseX+pauseWidth-10
|
||
|
and mouse_y <= pauseY+40 then
|
||
|
do_pause = false
|
||
|
end
|
||
|
end
|
||
|
if pausepage == 1 then
|
||
|
--Game list button
|
||
|
love.graphics.setColor(0.5,0.5,0.5,1)
|
||
|
love.graphics.rectangle("fill", pauseX+(pauseWidth/2)-150, pauseY+100, 300, 40)
|
||
|
love.graphics.setColor(0,0.5,0.5,1)
|
||
|
love.graphics.printf("GAMES", pauseX+(pauseWidth/2), pauseY+100, 150, "left",0,3)
|
||
|
if love.mouse.isDown(1) then
|
||
|
if mouse_x >= pauseX+(pauseWidth/2)-150
|
||
|
and mouse_y >= pauseY+100
|
||
|
and mouse_x <= pauseX+(pauseWidth/2)+150
|
||
|
and mouse_y <= pauseY+140 then
|
||
|
pausepage = 2
|
||
|
end
|
||
|
end
|
||
|
elseif pausepage == 2 then
|
||
|
--Back button
|
||
|
love.graphics.setColor(0.5,0.5,0.5,1)
|
||
|
love.graphics.rectangle("fill", pauseX+10, pauseY+10, 30, 30)
|
||
|
love.graphics.setColor(0,0,0,1)
|
||
|
love.graphics.printf("<", pauseX+10, pauseY+10, 30, "left", 0, 2)
|
||
|
if love.mouse.isDown(1) then
|
||
|
if mouse_x >= pauseX+10
|
||
|
and mouse_y >= pauseY+10
|
||
|
and mouse_x <= pauseX+40
|
||
|
and mouse_y <= pauseY+40 then
|
||
|
pausepage = 1
|
||
|
end
|
||
|
end
|
||
|
love.graphics.setColor(1,1,1,1)
|
||
|
for i=1,2 do
|
||
|
for j=1,3 do
|
||
|
love.graphics.draw(image.cartridge.nancy, j*110, i*85, 0, 100/image.cartridge.nancy:getPixelWidth(), 80/image.cartridge.nancy:getPixelHeight())
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|