Ah, so you want a grid of 16 "thumbnails" showing different perspectives of the 2D scene all at once? This is going to be a bit tricky because you're going to have to define 16 viewports and draw to them all separately. I suggest using a User Defined Type in conjunction with an array to approach this. Off the top of my head (untested), but it should point you in the correct direction:
rem ------------------------------------------------------------
rem Initialise
rem ------------------------------------------------------------
InitViewport()
rem ------------------------------------------------------------
rem Main loop
rem ------------------------------------------------------------
rem start of main loop
repeat
rem control viewports
ControlViewport()
rem refresh screen
sync
rem end of main loop
until escapekey()
rem end program
end
rem ------------------------------------------------------------
rem Constants
rem ------------------------------------------------------------
#constant ViewportMax 15
#constant ImagesPerViewport 15
rem ------------------------------------------------------------
rem User Defined Types
rem ------------------------------------------------------------
rem vector 2
type vec2
x as integer
y as integer
endtype
rem viewport UDT
type ViewportAT
active as integer
pos as vec2
endtype
rem image array type
type ViewportImageAT
pos as vec2
img as word
endtype
rem ------------------------------------------------------------
rem Initialise
rem ------------------------------------------------------------
function InitViewport()
rem ------------------------------------------------------------
rem Global variables
rem ------------------------------------------------------------
rem ------------------------------------------------------------
rem Global arrays
rem ------------------------------------------------------------
global dim Viewport(ViewportMax) as ViewportAT
global dim ViewportIMG(ViewportMax , ImagesPerViewport) as ViewportImageAT
endfunction
function CreateViewport(index , x , y)
rem make sure not active
if Viewport(index).active > 0 then exitfunction
rem create viewport
Viewport(index).active = 1
Viewport(index).pos.x = x
Viewport(index).pos.y = y
endfunction
function DestroyViewport(index)
rem local variables
local n as integer
rem make sure active
if Viewport(index).active = 0 then exitfunction
rem destroy viewport
Viewport(index).active = 0
for n = 0 to ImagesPerViewport
ViewportIMG(index , n).img = 0
next n
endfunction
function AddImageToViewport(viewport , img , x , y)
rem local variables
local n as integer
rem make sure active
if Viewport(viewport).active = 0 then exitfunction
rem add image
if image exist(img)
for n = 0 to ImagesPerViewport
if ViewportIMG(viewport , n).img = 0 then exit
next n
if n < ImagesPerViewport + 1
ViewportIMG(viewport , n).img = img
ViewportIMG(viewport , n).pos.x = x
ViewportIMG(viewport , n).pos.y = y
endif
endif
endfunction
function RemoveImageFromViewport(viewport , img)
rem local variables
local n as integer
rem make sure active
if viewport(viewport).active = 0 then exitfunction
rem find image
for n = 0 to ImagesPerViewport
if ViewportIMG(viewport , n).img = img then exit
next n
rem no success
if n = ImagesPerViewport + 1 then exitfunction
rem remove image
Viewport(viewport , n).img = 0
endfunction
function DrawViewport()
rem local variables
local n as integer
local i as integer
rem loop through all active viewports
for n = 0 to ViewportMax
if Viewport(n).active = 1
rem draw images to viewport
for i = 0 to ImagesPerViewport
if ViewportIMG(n , i).img > 0 then paste image ViewportIMG(n , i).img , ViewportIMG(n , i).pos.x + Viewport(n).pos.x , ViewportIMG(n , i).pos.y + Viewport(n).pos.y , 1
next i
endif
next n
endfunction
CreateViewport() will create a viewport with the index
index at the position
x,y.
DestroyViewport() will destroy the viewport with the index
index
AddImageToViewport() will add an existing image to the viewport to be drawn with the offset x , y.
RemoveImageFromViewport() will remove an image from a viewport
ControlViewport() will draw all active viewports.
Note that the images you add to each viewport should be smaller than the viewports size (so if your screen is 1024x768 and you have 16 viewports, the maximum width of a viewport can be 1024/4 = 256. Images you add can't be larger, or it will overlap with other viewports)
TheComet