proc name: onResize (/client/verb/onResize)
usr: Arcane Addict (/mob/pl)
src: Arcane Addict (/client)
usr.loc: the grass (1,1,1) (/turf/grass)
call stack:
Arcane Addict (/client): onResize("\[\[id]]", "\[\[size]]")
var
view_width
view_height
buffer_x
buffer_y
map_zoom
verb
onResize(map as text|null, size as text|null)
set hidden = 1
set instant = 1
var/list/sz = splittext(size,"x")
var/map_width = text2num(sz[1]), map_height = text2num(sz[2])
map_zoom = 1
view_width = ceil(map_width/TILE_WIDTH)
if(!(view_width%2)) ++view_width
view_height = ceil(map_height/TILE_HEIGHT)
if(!(view_height%2)) ++view_height
while(view_width*view_height>MAX_VIEW_TILES)
view_width = ceil(map_width/TILE_WIDTH/++map_zoom)
if(!(view_width%2)) ++view_width
view_height = ceil(map_height/TILE_HEIGHT/map_zoom)
if(!(view_height%2)) ++view_height
buffer_x = floor((view_width*TILE_WIDTH - map_width/map_zoom)/2)
buffer_y = floor((view_height*TILE_HEIGHT - map_height/map_zoom)/2)
src.view = "[view_width]x[view_height]"
//winset(src,map,"zoom=[map_zoom];")
proc
InitView()
set waitfor = 0
var/list/l = params2list(winget(src,":map","id;size;"))
onResize(l["id"],l["size"])