bit more of refactoring
This commit is contained in:
parent
0b18fcd369
commit
389eaed285
|
@ -31,16 +31,6 @@ function drawEditor()
|
|||
end
|
||||
|
||||
function drawGame()
|
||||
-- saveproof to game resize
|
||||
if game.width ~= love.graphics.getWidth() or game.height ~= love.graphics.getHeight() then
|
||||
Camera.height = game.height
|
||||
Camera.width = game.width
|
||||
Canvas.Darkness:release()
|
||||
Canvas.Darkness = CreateDarkness()
|
||||
love.graphics.setCanvas(Canvas.Darkness)
|
||||
SetDarkness()
|
||||
love.graphics.setCanvas()
|
||||
end
|
||||
|
||||
gameworldDraw()
|
||||
gameworldLighting()
|
||||
|
@ -60,11 +50,18 @@ function drawGame()
|
|||
end
|
||||
|
||||
function gameworldDraw()
|
||||
-- resize proof
|
||||
if game_resize then
|
||||
Camera.height = game.height
|
||||
Camera.width = game.width
|
||||
end
|
||||
|
||||
local pcr, pcg, pcb, pca = love.graphics.getColor()
|
||||
|
||||
love.graphics.scale(game.scale,game.scale)
|
||||
love.graphics.setColor(1,1,1,1)
|
||||
LevelDisplayBackground()
|
||||
|
||||
for _, enty in pairs(LoadedEntities) do
|
||||
enty:HandleAnimation()
|
||||
end
|
||||
|
@ -74,6 +71,15 @@ function gameworldDraw()
|
|||
end
|
||||
|
||||
function gameworldLighting()
|
||||
if game_resize then
|
||||
Canvas.Darkness:release()
|
||||
Canvas.Darkness = CreateDarkness()
|
||||
love.graphics.setCanvas(Canvas.Darkness)
|
||||
SetDarkness()
|
||||
love.graphics.setCanvas()
|
||||
end
|
||||
|
||||
|
||||
-- work on lighting canvas
|
||||
love.graphics.setCanvas(Canvas.Darkness)
|
||||
SetDarkness()
|
||||
|
|
4
main.lua
4
main.lua
|
@ -129,7 +129,11 @@ function love.draw()
|
|||
if game.width ~= love.graphics.getWidth() or game.height ~= love.graphics.getHeight() then
|
||||
game.width = love.graphics.getWidth()
|
||||
game.height = love.graphics.getHeight()
|
||||
game_resize = true
|
||||
else
|
||||
game_resize = false
|
||||
end
|
||||
|
||||
if editor_mode then
|
||||
drawEditor()
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue