2022-01-22 22:10:21 +00:00
|
|
|
function GameworldDrawPrepare()
|
2022-01-19 15:13:13 +00:00
|
|
|
if game_resize then
|
|
|
|
Camera.height = game.height
|
|
|
|
Camera.width = game.width
|
|
|
|
end
|
2022-01-22 22:10:21 +00:00
|
|
|
pcr, pcg, pcb, pca = love.graphics.getColor()
|
2022-01-19 15:13:13 +00:00
|
|
|
love.graphics.scale(game.scale,game.scale)
|
|
|
|
love.graphics.setColor(1,1,1,1)
|
2022-01-22 22:10:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function GameworldDrawEnd()
|
|
|
|
love.graphics.setColor(pcr, pcg, pcb, pca)
|
|
|
|
pcr, pcg, pcb, pca = nil, nil, nil, nil
|
|
|
|
end
|
|
|
|
|
|
|
|
function GameworldDrawBackground()
|
|
|
|
-- obscure a bit
|
|
|
|
love.graphics.setColor(0.7,0.7,0.7)
|
|
|
|
for i = 1, #LevelTiles do
|
|
|
|
for j = 1, #LevelTiles[i] do
|
|
|
|
if LevelTiles[i][j].id ~= 0 then
|
|
|
|
|
|
|
|
local depth = TileGetDepth(LevelTiles[i][j])
|
|
|
|
DrawTile(
|
|
|
|
LevelTiles[i][j],
|
|
|
|
tileProperties.scale * j * tileProperties.width + tileProperties.scale * (levelProperties.offset.x - tileProperties.width) - Camera.pos.x,
|
|
|
|
tileProperties.scale * i * tileProperties.height + tileProperties.scale * (levelProperties.offset.y - tileProperties.height) - Camera.pos.y,
|
|
|
|
"background"
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-01-19 15:13:13 +00:00
|
|
|
|
2022-01-22 22:10:21 +00:00
|
|
|
function GameworldDrawParticles()
|
|
|
|
love.graphics.setColor(0.7,0.7,0.7)
|
2022-01-19 23:53:59 +00:00
|
|
|
for _, particle in pairs(LoadedParticles) do
|
|
|
|
particle:HandleAnimation()
|
|
|
|
end
|
2022-01-22 22:10:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function GameworldDrawEntities()
|
|
|
|
love.graphics.setColor(1,1,1)
|
2022-01-19 15:13:13 +00:00
|
|
|
for _, enty in pairs(LoadedEntities) do
|
|
|
|
enty:HandleAnimation()
|
|
|
|
end
|
2022-01-22 22:10:21 +00:00
|
|
|
end
|
2022-01-19 15:13:13 +00:00
|
|
|
|
2022-01-22 22:10:21 +00:00
|
|
|
function GameworldDrawForeground()
|
|
|
|
love.graphics.setColor(1,1,1)
|
|
|
|
for i = 1, #LevelTiles do
|
|
|
|
for j = 1, #LevelTiles[i] do
|
|
|
|
if LevelTiles[i][j].id ~= 0 then
|
|
|
|
|
|
|
|
local depth = TileGetDepth(LevelTiles[i][j])
|
|
|
|
DrawTile(
|
|
|
|
LevelTiles[i][j],
|
|
|
|
tileProperties.scale * j * tileProperties.width + tileProperties.scale * (levelProperties.offset.x - tileProperties.width) - Camera.pos.x,
|
|
|
|
tileProperties.scale * i * tileProperties.height + tileProperties.scale * (levelProperties.offset.y - tileProperties.height) - Camera.pos.y,
|
|
|
|
"foreground"
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-01-19 15:13:13 +00:00
|
|
|
end
|
|
|
|
|
2022-01-22 22:10:21 +00:00
|
|
|
function GameworldDrawLighting()
|
2022-01-19 15:13:13 +00:00
|
|
|
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()
|
|
|
|
DoLights()
|
|
|
|
DoBorder()
|
|
|
|
-- apply to game canvas
|
|
|
|
love.graphics.setColor(1,1,1,1)
|
|
|
|
love.graphics.setCanvas()
|
|
|
|
love.graphics.scale(1,1)
|
|
|
|
DrawDarkness()
|
|
|
|
end
|