[WIP] En l'scroll
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
title=Cacaus Arcade
|
title=Cacaus Arcade
|
||||||
config=cacaus_arcade
|
config=cacaus_arcade
|
||||||
width=576
|
width=256
|
||||||
height=288
|
height=192
|
||||||
zoom=3
|
zoom=3
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ function render_view ( hab, x ,y )
|
|||||||
|
|
||||||
surf.source(map_buffer)
|
surf.source(map_buffer)
|
||||||
surf.target(0)
|
surf.target(0)
|
||||||
print(hab)
|
local vrx, vry = viewp:roomXY(hab)
|
||||||
viewp.roomXY(hab)
|
print(hab.." "..vrx.." "..vry)
|
||||||
draw.surf(viewp.x,viewp.y,viewp.width,viewp.height,0,0,viewp.width,viewp.height)
|
draw.surf(viewp.x-vrx,viewp.y-vry,viewp.width,viewp.height,0,0,viewp.width,viewp.height)
|
||||||
|
|
||||||
surf.source(curr_ssurf)
|
surf.source(curr_ssurf)
|
||||||
surf.source(curr_tsurf)
|
surf.source(curr_tsurf)
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ 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 = 1024
|
|
||||||
local map_buffer_height = 1024
|
|
||||||
map_buffer=surf.new(map_buffer_width, map_buffer_height)
|
map_buffer=surf.new(map_buffer_width, map_buffer_height)
|
||||||
fade.init()
|
fade.init()
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function viewport.new()
|
|||||||
position=viewport.position,
|
position=viewport.position,
|
||||||
print=viewport.print,
|
print=viewport.print,
|
||||||
room=viewport.coord2room,
|
room=viewport.coord2room,
|
||||||
roomXY=viewport.room2coord }
|
roomXY= viewport.room2coord }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -29,20 +29,21 @@ function viewport:coord2room ()
|
|||||||
return calc_room
|
return calc_room
|
||||||
end
|
end
|
||||||
|
|
||||||
function viewport:room2coord ( room )
|
function viewport:room2coord ( _room )
|
||||||
local tw = arcade_config.tiles_width
|
local tw = arcade_config.tiles_width
|
||||||
local th = arcade_config.tiles_height
|
local th = arcade_config.tiles_height
|
||||||
local cols = mapa_room_cols
|
local cols = mapa_room_cols
|
||||||
local rows = mapa_room_rows
|
local rows = mapa_room_rows
|
||||||
local rooms_per_floor = mapa_rooms_per_piso
|
local rooms_per_floor = mapa_rooms_per_piso
|
||||||
|
|
||||||
local x = (room % rooms_per_floor) * cols * tw
|
local x = (_room % rooms_per_floor) * cols * tw
|
||||||
local y = math.floor(room/rooms_per_floor) * rows * th
|
local y = math.floor(_room/rooms_per_floor) * rows * th
|
||||||
|
|
||||||
local room_center_x_offset = (cols * tw) >> 1
|
local room_center_x_offset = (cols * tw) >> 1
|
||||||
local room_center_y_offset = (rows * th) >> 1
|
local room_center_y_offset = (rows * th) >> 1
|
||||||
|
|
||||||
return x+room_center_x_offset, y+room_center_y_offset
|
-- return x+room_center_x_offset, y+room_center_y_offset
|
||||||
|
return x, y
|
||||||
end
|
end
|
||||||
|
|
||||||
function viewport:position(x, y)
|
function viewport:position(x, y)
|
||||||
|
|||||||
Reference in New Issue
Block a user