there is now a win screen

main
Simon Kellet 2 months ago
parent 7b68420027
commit e83ee4ec64
  1. 34
      Win/DrawWin.lua
  2. 1
      Win/UpdateWin.lua

@ -0,0 +1,34 @@
local function winner()
local width = love.graphics.getWidth()
local height = love.graphics.getHeight()
local opacity = 0.3
local s = ""
if _G.P1_WIN then
s = "P1 Win! R - Restart"
end
if _G.P2_WIN then
s = "P2 Win! R - Restart"
end
if _G.P1_WIN or _G.P2_WIN then
-- Overlay
DrawGame() --Draw a single frame of the game
love.graphics.setColor(0.1, 0.1, 0.1, opacity) --overlay opaque img
love.graphics.rectangle("fill", 0, 0, width, height)
-- Who won text
local sw, sh = MenuFont:getWidth(s), GameFont:getHeight(s)
local centreX = width / 2
local centreY = height / 2
love.graphics.setFont(MenuFont)
love.graphics.setColor(1, 1, 1) -- white
love.graphics.print(s, centreX - sw / 2, centreY - sh / 2)
end
end
function DrawWin()
winner()
love.graphics.setColor(255, 255, 255) -- reset colours
end

@ -0,0 +1 @@
function UpdateWin(dt) end
Loading…
Cancel
Save