45 lines
849 B
Lua
45 lines
849 B
Lua
Darkness = {}
|
|
Canvas = {}
|
|
|
|
function Darkness.Create()
|
|
Darkness.width = game.width/game.scale
|
|
Darkness.height = game.height/game.scale
|
|
Canvas.Darkness = love.graphics.newCanvas(
|
|
Darkness.width,
|
|
Darkness.height
|
|
)
|
|
end
|
|
|
|
function Darkness.Recreate()
|
|
Canvas.Darkness:release()
|
|
Darkness.Create()
|
|
end
|
|
|
|
function Darkness.Reset()
|
|
love.graphics.setCanvas(Canvas.Darkness)
|
|
love.graphics.setBlendMode("replace")
|
|
love.graphics.setColor(0.1,0.1,0.1,1)
|
|
love.graphics.rectangle(
|
|
"fill",
|
|
0,
|
|
0,
|
|
Darkness.width,
|
|
Darkness.height
|
|
)
|
|
love.graphics.setCanvas()
|
|
end
|
|
|
|
function Darkness.DrawStart()
|
|
Darkness.Reset()
|
|
love.graphics.setCanvas(Canvas.Darkness)
|
|
end
|
|
|
|
function Darkness.DrawEnd()
|
|
love.graphics.setCanvas()
|
|
love.graphics.setBlendMode("alpha")
|
|
love.graphics.setColor(1,1,1,1)
|
|
love.graphics.draw(Canvas.Darkness)
|
|
end
|
|
|
|
Darkness.Create()
|