/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { // Even if there is nothing new to draw for main window, we might still need to draw for the shadow textures. if (DrawTrackDB != null && Properties.Settings.Default.showInset) { drawAreaInset.DrawShadowTextures(DrawTrackDB.DrawTracks, DrawColors.colorsNormal.ClearWindowInset); } // if there is nothing to draw, be done. if (--skipDrawAmount > 0) { return; } GraphicsDevice.Clear(DrawColors.colorsNormal.ClearWindow); if (DrawTrackDB == null) { return; } spriteBatch.Begin(); if (drawTerrain != null) { drawTerrain.Draw(DrawArea); } drawWorldTiles.Draw(DrawArea); DrawArea.DrawTileGrid(); if (drawTerrain != null) { drawTerrain.DrawPatchLines(DrawArea); } DrawTrackDB.DrawRoads(DrawArea); DrawTrackDB.DrawTracks(DrawArea); DrawTrackDB.DrawTrackHighlights(DrawArea, true); DrawTrackDB.DrawJunctionAndEndNodes(DrawArea); if (Properties.Settings.Default.showInset) { drawAreaInset.DrawBackground(DrawColors.colorsNormal.ClearWindowInset); //drawTrackDB.DrawTracks(drawAreaInset); //replaced by next line drawAreaInset.DrawShadowedTextures(); DrawTrackDB.DrawTrackHighlights(drawAreaInset, false); drawAreaInset.DrawBorder(Color.Red, DrawArea); drawAreaInset.DrawBorder(Color.Black); } if (DrawMultiplePaths != null) { DrawMultiplePaths.Draw(DrawArea); } if (DrawPATfile != null && Properties.Settings.Default.showPATfile) { DrawPATfile.Draw(DrawArea); } if (PathEditor != null && Properties.Settings.Default.showTrainpath) { PathEditor.Draw(DrawArea); } DrawTrackDB.DrawRoadTrackItems(DrawArea); DrawTrackDB.DrawTrackItems(DrawArea); DrawTrackDB.DrawItemHighlights(DrawArea); CalculateFPS(gameTime); statusBarControl.Update(this, DrawArea.MouseLocation); drawScaleRuler.Draw(); drawLongitudeLatitude.Draw(DrawArea.MouseLocation); DebugWindow.DrawAll(); spriteBatch.End(); base.Draw(gameTime); skipDrawAmount = maxSkipDrawAmount; }