add skybox
This commit is contained in:
parent
062ea9e6e0
commit
d7baac52c9
BIN
assets/cats.png
Normal file
BIN
assets/cats.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
20
main.lua
20
main.lua
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user