Sliced game loop into game, gameworld and editor. added editor keybind for palette.
This commit is contained in:
42
data/scripts/gameworld.lua
Normal file
42
data/scripts/gameworld.lua
Normal file
@@ -0,0 +1,42 @@
|
||||
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
|
||||
LevelDisplayForeground()
|
||||
|
||||
love.graphics.setColor(pcr, pcg, pcb, pca)
|
||||
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()
|
||||
DoLights()
|
||||
DoBorder()
|
||||
-- apply to game canvas
|
||||
love.graphics.setColor(1,1,1,1)
|
||||
love.graphics.setCanvas()
|
||||
love.graphics.scale(1,1)
|
||||
DrawDarkness()
|
||||
end
|
||||
Reference in New Issue
Block a user