mirror of
https://github.com/libretro/lutro-platformer.git
synced 2025-02-20 00:43:54 +00:00
Stop using the unsupported graphics.drawt
This commit is contained in:
parent
5045238c88
commit
d968db3fb1
19
anim.lua
19
anim.lua
@ -25,10 +25,21 @@ function animation:update(dt)
|
||||
end
|
||||
|
||||
function animation:draw(x, y)
|
||||
lutro.graphics.drawt(
|
||||
local id = math.floor(self.timer / self.period + 1)
|
||||
local tw = self.width
|
||||
local th = self.height
|
||||
local sw = self.image:getWidth()
|
||||
local sh = self.image:getHeight()
|
||||
|
||||
local q = lutro.graphics.newQuad(
|
||||
((id-1)%(sw/tw))*tw,
|
||||
math.floor((id-1)/(sw/tw))*tw,
|
||||
tw, th,
|
||||
sw, sh)
|
||||
|
||||
lutro.graphics.draw(
|
||||
self.image,
|
||||
x, y,
|
||||
self.width, self.height,
|
||||
self.timer / self.period + 1
|
||||
q,
|
||||
x, y
|
||||
)
|
||||
end
|
||||
|
23
tiled.lua
23
tiled.lua
@ -27,14 +27,23 @@ function tiled_draw_layer(layer)
|
||||
local data = layer.data
|
||||
for j = 1, #data do
|
||||
local id = data[j]
|
||||
local y = math.floor((j-1) / layer.width) * map.tileheight
|
||||
local x = ((j-1) % layer.width) * map.tilewidth
|
||||
local t = tiled_get_tileset(map, id)
|
||||
|
||||
if (id > 0) then
|
||||
lutro.graphics.drawt(t.surface, x, y,
|
||||
map.tilewidth, map.tileheight,
|
||||
id - t.firstgid+1)
|
||||
local y = math.floor((j-1) / layer.width) * map.tileheight
|
||||
local x = ((j-1) % layer.width) * map.tilewidth
|
||||
local t = tiled_get_tileset(map, id)
|
||||
local tw = map.tilewidth
|
||||
local th = map.tileheight
|
||||
local sw = t.surface:getWidth()
|
||||
local sh = t.surface:getHeight()
|
||||
local tid = id - t.firstgid+1
|
||||
|
||||
local q = lutro.graphics.newQuad(
|
||||
((tid-1)%(sw/tw))*tw,
|
||||
math.floor((tid-1)/(sw/tw))*tw,
|
||||
tw, th,
|
||||
sw, sh)
|
||||
|
||||
lutro.graphics.draw(t.surface, q, x, y)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user