[WIP] Scroll a dreta i esquerra suave like cazuelitas de pollo
This commit is contained in:
@@ -39,10 +39,10 @@ function render_view ( x, y )
|
|||||||
local curr_tsurf = surf.target()
|
local curr_tsurf = surf.target()
|
||||||
|
|
||||||
local nroom, room_x, room_y, tile_offset_x, tile_offset_y = viewp:tile()
|
local nroom, room_x, room_y, tile_offset_x, tile_offset_y = viewp:tile()
|
||||||
print("COORDS= "..x..", "..y)
|
-- print("COORDS= "..x..", "..y)
|
||||||
print("ROOM= "..nroom)
|
-- print("ROOM= "..nroom)
|
||||||
print("RCOORDS= "..room_x..", "..room_y)
|
-- print("RCOORDS= "..room_x..", "..room_y)
|
||||||
print("TILE_OFF= "..tile_offset_x..", "..tile_offset_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_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
|
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_x = room_x
|
||||||
curr_room_y = room_y
|
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.target(map_buffer)
|
||||||
surf.cls(16)
|
surf.cls(16)
|
||||||
|
|
||||||
@@ -85,7 +89,17 @@ function render_view ( x, y )
|
|||||||
local toff= arcade_config.tiles_offset
|
local toff= arcade_config.tiles_offset
|
||||||
local tw = arcade_config.tiles_width
|
local tw = arcade_config.tiles_width
|
||||||
local th = arcade_config.tiles_height
|
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
|
end
|
||||||
|
|
||||||
tile_x = tile_x+1
|
tile_x = tile_x+1
|
||||||
@@ -97,6 +111,10 @@ function render_view ( x, y )
|
|||||||
surf.source(map_buffer)
|
surf.source(map_buffer)
|
||||||
surf.target(0)
|
surf.target(0)
|
||||||
draw.surf(tile_offset_x,tile_offset_y,viewp.width,viewp.height,0,0,viewp.width,viewp.height)
|
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_ssurf)
|
||||||
surf.source(curr_tsurf)
|
surf.source(curr_tsurf)
|
||||||
|
|||||||
@@ -16,9 +16,13 @@ function mini.init()
|
|||||||
-- buffer per a 3x3 habitacions
|
-- buffer per a 3x3 habitacions
|
||||||
-- local map_buffer_width = 3*mapa_room_cols*arcade_config.tiles_width
|
-- local map_buffer_width = 3*mapa_room_cols*arcade_config.tiles_width
|
||||||
-- local map_buffer_height = 3*mapa_room_rows*arcade_config.tiles_height
|
-- local map_buffer_height = 3*mapa_room_rows*arcade_config.tiles_height
|
||||||
local map_buffer_width = arcade_config.surface.width+2*arcade_config.tiles_width
|
-- local map_buffer_width = arcade_config.surface.width+2*arcade_config.tiles_width
|
||||||
local map_buffer_height = arcade_config.surface.height+2*arcade_config.tiles_height
|
local map_buffer_width = arcade_config.surface.width
|
||||||
|
-- local map_buffer_height = arcade_config.surface.height+2*arcade_config.tiles_height
|
||||||
|
local map_buffer_height = arcade_config.surface.height
|
||||||
map_buffer=surf.new(map_buffer_width,map_buffer_height)
|
map_buffer=surf.new(map_buffer_width,map_buffer_height)
|
||||||
|
map_buffer_extra_V=surf.new(arcade_config.tiles_width,map_buffer_height)
|
||||||
|
map_buffer_extra_H=surf.new(map_buffer_width,arcade_config.tiles_height)
|
||||||
fade.init()
|
fade.init()
|
||||||
|
|
||||||
textsf=surf.new(arcade_config.org_resolucion.width,arcade_config.org_resolucion.height)
|
textsf=surf.new(arcade_config.org_resolucion.width,arcade_config.org_resolucion.height)
|
||||||
|
|||||||
Reference in New Issue
Block a user