commit inicial

main
fanta 12 months ago
parent ba9123e867
commit 651cbc5c7a

@ -0,0 +1,91 @@
sprite = {}
sprite.img = love.graphics.newImage("sprite4.png")
sprite.width = sprite.img:getWidth( )
sprite.height = sprite.img:getHeight( )
sprite.x = 0
sprite.y = 0
sprite.cropX = 32
sprite.cropY = 64
sprite.radians = 0
sprite.scaleX = 1
sprite.scaleY = 1
sprite.offsetX = 0
sprite.offsetY = 0
sprite.shearingX = 0
sprite.shearingY = 0
sprite.xq = 0
sprite.yq = 0
sprite.hsize = sprite.width
function love.load()
print("1,2,3,4,5,6 - zoom")
print("left,right - set x crop")
print("up, down - set y crop")
print("-,+ - number of horizontal frames")
end
function love.update(dt)
if dt < 1/3 then
love.timer.sleep(1/3 - dt)
end
love.draw()
end
function love.draw()
love.window.setTitle( sprite.cropX )
sprite.quad = love.graphics.newQuad(sprite.xq,sprite.yq, sprite.cropX, sprite.cropY, sprite.width, sprite.height)
love.graphics.draw(sprite.img, sprite.quad, sprite.x, sprite.y, sprite.radians, sprite.scaleX, sprite.scaleY, sprite.offsetX, sprite.offsetY, sprite.shearingX, sprite.shearingY)
if sprite.xq >= sprite.hsize then
sprite.xq = 0
else
sprite.xq = sprite.xq + sprite.cropX
end
end
function love.keypressed(key)
if key == "escape" then
love.event.quit()
end
if key == "up" then
sprite.cropY = sprite.cropY - 1
end
if key == "down" then
sprite.cropY = sprite.cropY + 1
end
if key == "left" then
sprite.cropX = sprite.cropX - 1
end
if key == "right" then
sprite.cropX = sprite.cropX + 1
end
if key == "-" then
sprite.hsize = sprite.hsize - sprite.cropX
end
if key == "+" then
sprite.hsize = sprite.hsize + sprite.cropX
end
if key == "1" then
sprite.scaleX = 1
sprite.scaleY = 1
end
if key == "2" then
sprite.scaleX = 2
sprite.scaleY = 2
end
if key == "3" then
sprite.scaleX = 3
sprite.scaleY = 3
end
if key == "4" then
sprite.scaleX = 4
sprite.scaleY = 4
end
if key == "5" then
sprite.scaleX = 5
sprite.scaleY = 5
end
if key == "6" then
sprite.scaleX = 6
sprite.scaleY = 6
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Loading…
Cancel
Save