Use RgbaColorRenderer in TargetLineRenderable.
This commit is contained in:
@@ -43,11 +43,12 @@ namespace OpenRA.Graphics
|
|||||||
if (!waypoints.Any())
|
if (!waypoints.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var iz = 1 / wr.Viewport.Zoom;
|
||||||
var first = wr.ScreenPxPosition(waypoints.First());
|
var first = wr.ScreenPxPosition(waypoints.First());
|
||||||
var a = first;
|
var a = first;
|
||||||
foreach (var b in waypoints.Skip(1).Select(pos => wr.ScreenPxPosition(pos)))
|
foreach (var b in waypoints.Skip(1).Select(pos => wr.ScreenPxPosition(pos)))
|
||||||
{
|
{
|
||||||
Game.Renderer.WorldLineRenderer.DrawLine(a, b, color);
|
Game.Renderer.WorldRgbaColorRenderer.DrawLine(a, b, iz, color);
|
||||||
DrawTargetMarker(wr, color, b);
|
DrawTargetMarker(wr, color, b);
|
||||||
a = b;
|
a = b;
|
||||||
}
|
}
|
||||||
@@ -55,22 +56,15 @@ namespace OpenRA.Graphics
|
|||||||
DrawTargetMarker(wr, color, first);
|
DrawTargetMarker(wr, color, first);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawTargetMarker(WorldRenderer wr, Color c, float2 location)
|
public static void DrawTargetMarker(WorldRenderer wr, Color color, float2 location)
|
||||||
{
|
{
|
||||||
var miz = -1 / wr.Viewport.Zoom;
|
var iz = 1 / wr.Viewport.Zoom;
|
||||||
var tl = new float2(miz, miz);
|
var offset = new float2(iz, iz);
|
||||||
var br = -tl;
|
var tl = location - offset;
|
||||||
var bl = new float2(tl.X, br.Y);
|
var br = location + offset;
|
||||||
var tr = new float2(br.X, tl.Y);
|
Game.Renderer.WorldRgbaColorRenderer.FillRect(tl, br, color);
|
||||||
|
|
||||||
var wlr = Game.Renderer.WorldLineRenderer;
|
|
||||||
wlr.DrawLine(location + tl, location + tr, c);
|
|
||||||
wlr.DrawLine(location + tr, location + br, c);
|
|
||||||
wlr.DrawLine(location + br, location + bl, c);
|
|
||||||
wlr.DrawLine(location + bl, location + tl, c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void RenderDebugGeometry(WorldRenderer wr) { }
|
public void RenderDebugGeometry(WorldRenderer wr) { }
|
||||||
public Rectangle ScreenBounds(WorldRenderer wr) { return Rectangle.Empty; }
|
public Rectangle ScreenBounds(WorldRenderer wr) { return Rectangle.Empty; }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user