# Textures have lines between them when zoomed out

These are two screenshots from my new game, a top-down RTS with tiles. The first one is from a normal view with no zoom, the second one is a zoomed out view of the whole map:

In the first image, the tiles are rendered perfectly. However, when I zoom out, some of the tiles are rendered with lines in between them, while others clump into larger groups with their own lines. Here is the code that draws the tiles:

            Rectangle rect;

if ((int)(32 * gameInfo.Game.ZoomFactor) > 0)
{ rect = new Rectangle(0, 0, (int)(32 * gameInfo.Game.ZoomFactor), (int)(32 * gameInfo.Game.ZoomFactor)); }
else
{ rect = new Rectangle(0, 0, 1, 1); }

Texture2D buffer = new Texture2D(this.GraphicsDevice, rect.Width, rect.Height);

for (int x = 0; x < gameInfo.Game.TileMap.GetLength(0); x++)
{
for (int y = 0; y < gameInfo.Game.TileMap.GetLength(1); y++)
{
rect.X = (int)(gameInfo.Game.ZoomFactor * ((x * 32) - gameInfo.Game.ViewOffset.X));
rect.Y = (int)(gameInfo.Game.ZoomFactor * ((y * 32) - gameInfo.Game.ViewOffset.Y));
buffer = EnvironmentTextures.ENTileTextures[gameInfo.Game.TileMap[x, y].TileType];
spriteBatch.Draw(buffer, rect, Color.White);
}
}


The gameInfo.Game.ZoomFactor is a Single which is modified when the scroll wheel is changed, in increments of 0.2f. Has anyone had this problem before, and how can I fix it?

The gaps are caused when you are truncating the rect width and height. Instead of:
rect = new Rectangle(0, 0, (int)(32 * gameInfo.Game.ZoomFactor), (int)(32 * gameInfo.Game.ZoomFactor));

rect = new Rectangle(0, 0, (int)((32 * gameInfo.Game.ZoomFactor) + 0.5), (int)((32 * gameInfo.Game.ZoomFactor) + 0.5));