diff --git a/OpenRA.Game/Graphics/LineRenderer.cs b/OpenRA.Game/Graphics/LineRenderer.cs index 51898a96d6..2183973325 100644 --- a/OpenRA.Game/Graphics/LineRenderer.cs +++ b/OpenRA.Game/Graphics/LineRenderer.cs @@ -40,6 +40,16 @@ namespace OpenRA.Graphics } } + public void DrawRect( float2 tl, float2 br, Color c ) + { + var tr = new float2( br.X, tl.Y ); + var bl = new float2( tl.X, br.Y ); + DrawLine( tl, tr, c, c ); + DrawLine( tl, bl, c, c ); + DrawLine( tr, br, c, c ); + DrawLine( bl, br, c, c ); + } + public void DrawLine( float2 start, float2 end, Color startColor, Color endColor ) { Renderer.CurrentBatchRenderer = this; diff --git a/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs b/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs index 1595b5236a..ca8ee8f410 100755 --- a/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs @@ -150,13 +150,8 @@ namespace OpenRA.Mods.RA.Widgets { var tl = CellToMinimapPixel(new int2((int)(Game.viewport.Location.X/Game.CellSize), (int)(Game.viewport.Location.Y/Game.CellSize))); var br = CellToMinimapPixel(new int2((int)((Game.viewport.Location.X + Game.viewport.Width)/Game.CellSize), (int)((Game.viewport.Location.Y + Game.viewport.Height)/Game.CellSize))); - var tr = new int2(br.X, tl.Y); - var bl = new int2(tl.X, br.Y); Game.Renderer.EnableScissor((int)mapRect.Left, (int)mapRect.Top, (int)mapRect.Width, (int)mapRect.Height); - Game.Renderer.LineRenderer.DrawLine(Game.viewport.Location + tl, Game.viewport.Location + tr, Color.White, Color.White); - Game.Renderer.LineRenderer.DrawLine(Game.viewport.Location + tr, Game.viewport.Location + br, Color.White, Color.White); - Game.Renderer.LineRenderer.DrawLine(Game.viewport.Location + br, Game.viewport.Location + bl, Color.White, Color.White); - Game.Renderer.LineRenderer.DrawLine(Game.viewport.Location + bl, Game.viewport.Location + tl, Color.White, Color.White); + Game.Renderer.LineRenderer.DrawRect(Game.viewport.Location + tl, Game.viewport.Location + br, Color.White); Game.Renderer.DisableScissor(); } } diff --git a/OpenRA.Mods.RA/Widgets/RadarWidget.cs b/OpenRA.Mods.RA/Widgets/RadarWidget.cs index ea3710b86b..754acb0875 100755 --- a/OpenRA.Mods.RA/Widgets/RadarWidget.cs +++ b/OpenRA.Mods.RA/Widgets/RadarWidget.cs @@ -139,13 +139,8 @@ namespace OpenRA.Mods.RA.Widgets { var tl = CellToMinimapPixel(new int2((int)(Game.viewport.Location.X/Game.CellSize), (int)(Game.viewport.Location.Y/Game.CellSize))); var br = CellToMinimapPixel(new int2((int)((Game.viewport.Location.X + Game.viewport.Width)/Game.CellSize), (int)((Game.viewport.Location.Y + Game.viewport.Height)/Game.CellSize))); - var tr = new int2(br.X, tl.Y); - var bl = new int2(tl.X, br.Y); Game.Renderer.EnableScissor((int)mapRect.Left, (int)mapRect.Top, (int)mapRect.Width, (int)mapRect.Height); - Game.Renderer.LineRenderer.DrawLine(Game.viewport.Location + tl, Game.viewport.Location + tr, Color.White, Color.White); - Game.Renderer.LineRenderer.DrawLine(Game.viewport.Location + tr, Game.viewport.Location + br, Color.White, Color.White); - Game.Renderer.LineRenderer.DrawLine(Game.viewport.Location + br, Game.viewport.Location + bl, Color.White, Color.White); - Game.Renderer.LineRenderer.DrawLine(Game.viewport.Location + bl, Game.viewport.Location + tl, Color.White, Color.White); + Game.Renderer.LineRenderer.DrawRect(Game.viewport.Location + tl, Game.viewport.Location + br, Color.White); Game.Renderer.DisableScissor(); } }