void DrawMinimapTerrain(SpriteBatch spriteBatch) { for (int y = 0; y < DisplayedWorldView.Height; y++) { for (int x = 0; x < DisplayedWorldView.Width; x++) { Point2D location = new Point2D(x * ZoomLevel, y * ZoomLevel); WorldTile tile = world.GetTile(DisplayedWorldView.X + x + 1, DisplayedWorldView.Y + y + 1); Colour pixelColour = Colour.Black; if (tile.HasWorldObject) { WorldObject worldObject = entities.GetWorldObject(tile.WorldObjectId); pixelColour = worldObject.MinimapColour; } else if (tile.HasTerrain) { Terrain terrain = entities.GetTerrain(tile.TerrainId); pixelColour = terrain.MinimapColour; } DrawMinimapPixel(spriteBatch, pixelColour, location); } } }
void DrawTerrain(SpriteBatch spriteBatch) { Size2D off = new Size2D( (int)((camera.Location.X - (int)camera.Location.X) * GameDefines.MapTileSize), (int)((camera.Location.Y - (int)camera.Location.Y) * GameDefines.MapTileSize)); for (int y = 0; y < Rows; y++) { for (int x = 0; x < Columns; x++) { WorldTile tile = world.GetTile( (int)camera.Location.X + x, (int)camera.Location.Y + y); Sprite sprite = tileSprites[tile.TerrainId]; sprite.Location = new Point2D( (x - 1) * GameDefines.MapTileSize - off.Width, (y - 1) * GameDefines.MapTileSize - off.Height); sprite.Draw(spriteBatch); } } }