Surface bigger than screen doesnt work...

theWul

New member
Joined
Nov 13, 2003
Messages
2
Hi.. Im doing the usual:
SurfaceDescription description = new SurfaceDescription();
Bitmap bmp = new Bitmap(mapPath);
map = new Surface(bmp, description, screen);
...
Rectangle sourceRect = new Rectangle(0, 0, map.SurfaceDescription.Width, map.SurfaceDescription.Height);
primary.Draw(destRect, map, sourceRect, DrawFlags.Wait);
...
this runs pretty as long as the image "mapPath" refers to is smaller than my display (1280*1024).
When I use an image with say 3000*3000 it seems to get clipped to screen size although map.SurfaceDescription.Width (and .Height) contain the correct values (3000)...

Think theres only a simple flag missing or so...
 
Im guessing here, but have you tried explicity setting your description.width and .height to your actual map size *before* you create the surface? (I didnt see you do that in your code above.) This is what I do and it works fine for me:

//Setup the _mapSurface
_desc.Clear();
_desc.SurfaceCaps.OffScreenPlain = true;
_desc.Width = NumCellsX*TerrainSquare.TerrainSquareWidth;
_desc.Height = NumCellsY*TerrainSquare.TerrainSquareHeight;
_mapSurface=new Surface(_desc, _surface.Device);

That works for storing a map on a surface thats larger than the screen, and then I just blit the relevent view area onto the main surface:

// Draw the map.
_surface.Draw(GameInProgress.MainMapLeft, GameInProgress.MainMapTop, _mapSurface,
new Rectangle(_leftmostDisplayedRow*TerrainSquare.TerrainSquareWidth,
_topmostDisplayedCol*TerrainSquare.TerrainSquareHeight,
GameMap.NumSquaresToDisplayX*TerrainSquare.TerrainSquareWidth,
GameMap.NumSquaresToDisplayY*TerrainSquare.TerrainSquareHeight));

(The parameters are a little different in the _surface.Draw() Im using than in your .Draw(), but you get the idea....)

Hope that helps. If not, let me know...

-Hiro_Antagonist
 
Back
Top