public void DrawBackground(SpriteBatch spriteBatch)
{
//Draw the background (quad)
//int tiles;
int tiles;
MegaTileLOD LODtiles = MegaTileLOD.getRangePow2(level.cameraOperator.Zoom * 4+1);
float alpha = (float)(LODtiles.current - LODtiles.low) / (float)((LODtiles.high - LODtiles.low)*0.5f);
if (alpha > 1.0f)
{
alpha = 1.0f;
}
tiles = LODtiles.high;
spriteBatch.Draw(megaTileType.BackgroundTexture, bounds, Color.White);
for(int i=0;i<tiles;i++)
{
for (int j=0;j<tiles;j++)
{
spriteBatch.Draw(megaTileType.BackgroundTexture, new Rectangle(bounds.X + i * bounds.Width / tiles, bounds.Y + j * bounds.Height / tiles, bounds.Width / tiles, bounds.Height / tiles),new Color(Color.White,alpha));
}
}
tiles = LODtiles.low;
for (int i = 0; i < tiles; i++)
{
for (int j = 0; j < tiles; j++)
{
spriteBatch.Draw(megaTileType.BackgroundTexture, new Rectangle(bounds.X + i * bounds.Width / tiles, bounds.Y + j * bounds.Height / tiles, bounds.Width / tiles, bounds.Height / tiles), new Color(Color.White, 1f-alpha));
}
}
//Draw west road
if (westRoad)
{
spriteBatch.Draw(megaTileType.RoadVerticalTexture, westRoadBounds, Color.White);
}
//Draw north road
if (northRoad)
{
spriteBatch.Draw(megaTileType.RoadHorizontalTexture, northRoadBounds, Color.White);
}
//Draw intersection
if (intersection)
{
spriteBatch.Draw(megaTileType.Road4WayTexture, intersectionBounds, Color.White);
}
}