Hi
If what you mean is take like several bitmap files and draw them onto one screen, the best way to do that would be to place them all in 1 bitmap before hand to simplify things, like if you have a picture of a guy walking, you would store all the frames of him walking in one bitmap file.
Code:
Dim dx As New DirectX7
Dim lpDD As DirectDraw7
Dim ddsPrimarySurface As DirectDrawSurface7
Dim ddsSurface As DirectDrawSurface7
Dim ddsd As DDSURFACEDESC2
Dim ddClip As DirectDrawClipper
' create directdraw
Set lpDD = dx.DirectDrawCreate("")
' setting to window mode
Call lpDD.SetCooperativeLevel(frmMain.hWnd, DDSCL_NORMAL)
ddsd.lFlags = DDSD_CAPS
ddsd.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE
' create primary surface where you will blt to
Set ddsPrimarySurface = lpDD.CreateSurface(ddsd)
' now set up DirectDrawSurfaceDescription for a surface we will load the bitmap into
ddsd.lFlags = DDSD_CAPS
ddsd.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
ddsd.lFlags = DDSD_HEIGHT Or DDSD_WIDTH
Set ddsSurface = lpDD.CreateSurfaceFromFile(BITMAP FILE, ddsd)
' now set a clipper so we stay within the picturebox
Set ddClip = lpDD.CreateClipper(0)
' this is how you get it to blt in a picture box
ddClip.SetHWnd picture1.hWnd
ddsPrimarySurface.SetClipper ddClip
now after you have set up directx you can blit it into a picture box by
Code:
call ddsPrimarySurface.blt(DestRect, ddsSurface, SourceRect, DDBLT_WAIT)
then to be able to scroll the map and draw all the tiles
if you've gone through and done an MapArray(# of X tiles, # of Y tiles) and filled each spot with what type of tile you want blitted there, you can make something like
Code:
yy = 0
xx = 0
' the DestRect will be where its suppose to be placed, according to the OffSets, since we have a clipper, we'll just start blitting at whatever values the offsets are at
' so
DestRect.top = YOffset
DestRect.left = XOffset
for x = CurrentXSpot to CurrentXSpot +
HowManyTilesCanBeDisplayedHorizontally, NOTE you'll need to check and make sure it doesn't exceed the # of X tiels
yy = 0
for y = CurrentYSpot to CurrentYSpot + TilesVertically
' then just blit it here
' tricker part, where you'll need to figure how many pixels over you need to adjust, see below FIRST
' SourceRect, should be the rectangle you want to blt, say the guy
DestRect.top = DestRect.top + TILE_HEIGHT
DestRect.left = DestRect.left + TILE_WIDTH
DestRect.right = DestRect.left + TILE_WIDTH
DestRect.bottom = DestRect.top + TILE_HEIGHT
' Source Rect would be what tile you wanted blitted at the cordinates
call ddsPrimarySurface.blt(DestRect, ddsSurface, SourceRect(CurrentXSpot, CurrentYSpot), DDBLT_WAIT)
yy = yy + 1
next y
xx = xx + 1
next x
to make an offset
everytime say you press the right arrow key, you can have the XOffSet move 1 pixel, so you need a variable
Code:
' these should be globals for your form
dim XOffSet as integer, YOffSet as integer
so to move the pixel over everytime you press right arrow key
XOffSet = XOffSet - 1 ' to move right
' you'll need to see if XOffSet equals a whole tile
if XOffSet = -TILE_WIDTH then ' when moving right
XOffSet = 0
CurrentXSpot = CurrentXSpot + 1 ' so we moved over a bit
end if
' thats just to move right, but you get the idea, and you should be able to figure out the rest going left, up and down
' also you would want to make sure they don't keep going past the boundaries of the map
Hope that helps you