add skybox

This commit is contained in:
PeaAshMeter 2025-08-11 03:23:25 +03:00
parent 062ea9e6e0
commit d7baac52c9
2 changed files with 18 additions and 2 deletions

BIN
assets/cats.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@ -36,9 +36,25 @@ function love.update(dt)
Tree.controls:cache()
end
function love.draw()
Tree.level.camera:attach()
local function coverTransform(img, containerW, containerH)
local iw, ih = img:getWidth(), img:getHeight()
local scale = math.max(containerW / iw, containerH / ih)
local sw, sh = iw * scale, ih * scale
local offsetX = (containerW - sw) * 0.5
local offsetY = (containerH - sh) * 0.5
return scale, offsetX, offsetY, sw, sh
end
function love.draw()
local scale, ox, oy = coverTransform(Tree.assets.files.cats, love.graphics.getWidth(), love.graphics.getHeight())
love.graphics.push()
love.graphics.translate(ox, oy)
love.graphics.scale(scale, scale)
love.graphics.draw(Tree.assets.files.cats, 0, 0)
love.graphics.pop()
Tree.level.camera:attach()
for y = 0, height - 1 do
for x = 0, width - 1 do
love.graphics.draw(Grass, Tilemap[x][y], x, y,