Extract shared constants in Draw*Bar and DrawSelectionBox.

This commit is contained in:
Paul Chote
2013-10-14 23:35:05 +13:00
parent 483120ea20
commit 44dd801f16
2 changed files with 35 additions and 26 deletions

View File

@@ -155,20 +155,22 @@ namespace OpenRA.Graphics
var bounds = a.Bounds.Value;
var tl = pos + new float2(bounds.Left, bounds.Top);
var tr = pos + new float2(bounds.Right, bounds.Top);
var bl = pos + new float2(bounds.Left, bounds.Bottom);
var br = pos + new float2(bounds.Right, bounds.Bottom);
var tr = new float2(br.X, tl.Y);
var bl = new float2(tl.X, br.Y);
var u = new float2(4f, 0);
var v = new float2(0, 4f);
var wlr = Game.Renderer.WorldLineRenderer;
wlr.DrawLine(tl, tl + new float2(4, 0), c, c);
wlr.DrawLine(tl, tl + new float2(0, 4), c, c);
wlr.DrawLine(tr, tr + new float2(-4, 0), c, c);
wlr.DrawLine(tr, tr + new float2(0, 4), c, c);
wlr.DrawLine(tl + u, tl, c, c);
wlr.DrawLine(tl, tl + v, c, c);
wlr.DrawLine(tr, tr - u, c, c);
wlr.DrawLine(tr, tr + v, c, c);
wlr.DrawLine(bl, bl + new float2(4, 0), c, c);
wlr.DrawLine(bl, bl + new float2(0, -4), c, c);
wlr.DrawLine(br, br + new float2(-4, 0), c, c);
wlr.DrawLine(br, br + new float2(0, -4), c, c);
wlr.DrawLine(bl, bl + u, c, c);
wlr.DrawLine(bl, bl - v, c, c);
wlr.DrawLine(br, br - u, c, c);
wlr.DrawLine(br, br - v, c, c);
}
public void DrawRollover(Actor unit)