- inifile added, beginning Game Jolt integreation
- gamestates moved into their own directory
- paused state that is auto-fired when window loses focus
This commit is contained in:
Paul Liverman
2015-02-10 00:18:45 -08:00
parent 361247ccac
commit 46bad9539d
9 changed files with 296 additions and 75 deletions

41
src/gamestates/paused.lua Normal file
View File

@@ -0,0 +1,41 @@
local paused = {}
local previousState, screenshot
function paused:enter(previous, screenImageData)
previousState = previous
screenshot = love.graphics.newImage(screenImageData)
end
function paused:draw()
-- draw the screenshot
love.graphics.setColor(255, 255, 255)
love.graphics.draw(screenshot)
-- draw a partial transparency black to fade out the screenshot
love.graphics.setColor(0, 0, 0, 200)
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
-- print info
love.graphics.setNewFont(40)
love.graphics.setColor(255, 255, 255)
love.graphics.printf("Paused", 0, love.graphics.getHeight() * 2/5 - 20, love.graphics.getWidth(), "center")
love.graphics.setNewFont(20)
love.graphics.printf("(Press Esc to resume.)", 0, love.graphics.getHeight() * 3/5 - 10, love.graphics.getWidth(), "center")
end
---[[
function paused:mousepressed(x, y, button)
if button == "l" then
Gamestate.pop("UNPAUSED")
end
end
--]]
function paused:keypressed(key, unicode)
if key == " " then
Gamestate.pop("UNPAUSED")
elseif key == "escape" then
Gamestate.pop("UNPAUSED")
end
end
return paused