bit more of refactoring

This commit is contained in:
lustlion 2022-01-18 14:02:56 +01:00
parent 0b18fcd369
commit 389eaed285
2 changed files with 20 additions and 10 deletions

View File

@ -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()

View File

@ -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