add DrawRect helper to LineRenderer, use it in both Radar*Widgets

This commit is contained in:
Chris Forbes
2011-07-11 22:10:09 +12:00
committed by Paul Chote
parent 5af4476cd8
commit 98ebb7c87e
3 changed files with 12 additions and 12 deletions

View File

@@ -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();
}
}