[WIP] Scroll a dreta i esquerra suave like cazuelitas de pollo

This commit is contained in:
2026-03-19 01:50:28 +01:00
parent 0d239e7ab0
commit f8669133c4
2 changed files with 29 additions and 7 deletions

View File

@@ -39,10 +39,10 @@ function render_view ( x, y )
local curr_tsurf = surf.target()
local nroom, room_x, room_y, tile_offset_x, tile_offset_y = viewp:tile()
print("COORDS= "..x..", "..y)
print("ROOM= "..nroom)
print("RCOORDS= "..room_x..", "..room_y)
print("TILE_OFF= "..tile_offset_x..", "..tile_offset_y)
-- print("COORDS= "..x..", "..y)
-- print("ROOM= "..nroom)
-- print("RCOORDS= "..room_x..", "..room_y)
-- print("TILE_OFF= "..tile_offset_x..", "..tile_offset_y)
max_tiles_col = (arcade_config.resolucion.width/arcade_config.tiles_width)+1; -- Los que caben en una pantalla y 1 parcial
max_tiles_row = (arcade_config.resolucion.height/arcade_config.tiles_height)+1; -- Los que caben en una pantalla y 1 parcial
@@ -51,6 +51,10 @@ function render_view ( x, y )
curr_room_x = room_x
curr_room_y = room_y
surf.target(map_buffer_extra_V)
surf.cls(16)
surf.target(map_buffer_extra_H)
surf.cls(16)
surf.target(map_buffer)
surf.cls(16)
@@ -85,7 +89,17 @@ function render_view ( x, y )
local toff= arcade_config.tiles_offset
local tw = arcade_config.tiles_width
local th = arcade_config.tiles_height
draw.surf((tile&txr)*tw,toff+(tile>>txr2)*th,tw,th,tx*tw,ty*th)
if tx==0 and ty==max_tiles_row-1 then
surf.target(map_buffer_extra_H)
draw.surf((tile&txr)*tw,toff+(tile>>txr2)*th,tw,th,tx*tw,0)
surf.target(map_buffer)
elseif tx==max_tiles_col-1 then
surf.target(map_buffer_extra_V)
draw.surf((tile&txr)*tw,toff+(tile>>txr2)*th,tw,th,0,ty*th)
surf.target(map_buffer)
else
draw.surf((tile&txr)*tw,toff+(tile>>txr2)*th,tw,th,tx*tw,ty*th)
end
end
tile_x = tile_x+1
@@ -97,6 +111,10 @@ function render_view ( x, y )
surf.source(map_buffer)
surf.target(0)
draw.surf(tile_offset_x,tile_offset_y,viewp.width,viewp.height,0,0,viewp.width,viewp.height)
surf.source(map_buffer_extra_V)
draw.surf(0, tile_offset_y, tile_offset_x, viewp.height, viewp.width-tile_offset_x, 0, tile_offset_x, viewp.height)
surf.source(map_buffer_extra_H)
draw.surf(tile_offset_x, 0,viewp.width,tile_offset_y,0,viewp.height-tile_offset_y,viewp.width,tile_offset_y)
surf.source(curr_ssurf)
surf.source(curr_tsurf)