Don't zoom UI lines when pixel doubling.

This commit is contained in:
Paul Chote
2013-10-14 23:42:45 +13:00
parent 44dd801f16
commit 84bb78060f
5 changed files with 22 additions and 16 deletions

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Graphics
var dest = wr.ScreenPosition(pos + length);
var oldWidth = wlr.LineWidth;
wlr.LineWidth = width;
wlr.LineWidth = wr.Viewport.Zoom * width;
wlr.DrawLine(src, dest, color, color);
wlr.LineWidth = oldWidth;
}

View File

@@ -61,6 +61,10 @@ namespace OpenRA.Graphics
if (length - skip < 4)
return;
var wlr = Game.Renderer.WorldLineRenderer;
var oldWidth = wlr.LineWidth;
wlr.LineWidth = wr.Viewport.Zoom;
// Start of the first line segment is the tail of the list - don't smooth it.
var curPos = trail[idx(next - skip - 1)];
var curCell = curPos.ToCPos();
@@ -73,12 +77,14 @@ namespace OpenRA.Graphics
var nextColor = Exts.ColorLerp(i * 1f / (length - 4), color, Color.Transparent);
if (!world.FogObscures(curCell) && !world.FogObscures(nextCell))
Game.Renderer.WorldLineRenderer.DrawLine(wr.ScreenPosition(curPos), wr.ScreenPosition(nextPos), curColor, nextColor);
wlr.DrawLine(wr.ScreenPosition(curPos), wr.ScreenPosition(nextPos), curColor, nextColor);
curPos = nextPos;
curCell = nextCell;
curColor = nextColor;
}
wlr.LineWidth = oldWidth;
}
public void RenderDebugGeometry(WorldRenderer wr) {}

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Graphics
{
var vb = renderer.GetTempVertexBuffer();
vb.SetData(vertices, nv);
renderer.SetLineWidth(LineWidth * Game.Zoom);
renderer.SetLineWidth(LineWidth);
renderer.DrawBatch(vb, 0, nv, PrimitiveType.LineList);
});
renderer.Device.SetBlendMode(BlendMode.None);

View File

@@ -158,8 +158,8 @@ namespace OpenRA.Graphics
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 u = new float2(4f / Viewport.Zoom, 0);
var v = new float2(0, 4f / Viewport.Zoom);
var wlr = Game.Renderer.WorldLineRenderer;
wlr.DrawLine(tl + u, tl, c, c);
@@ -204,8 +204,8 @@ namespace OpenRA.Graphics
public void DrawTargetMarker(Color c, float2 location)
{
var tl = new float2(-1, -1);
var br = new float2(1, 1);
var tl = new float2(-1 / Viewport.Zoom, -1 / Viewport.Zoom);
var br = new float2(1 / Viewport.Zoom, 1 / Viewport.Zoom);
var bl = new float2(tl.X, br.Y);
var tr = new float2(br.X, tl.Y);

View File

@@ -76,8 +76,8 @@ namespace OpenRA.Traits
var value = extraBar.GetValue();
if (value != 0)
{
xy.Y += 4;
Xy.Y += 4;
xy.Y += (int)(4 / wr.Viewport.Zoom);
Xy.Y += (int)(4 / wr.Viewport.Zoom);
DrawSelectionBar(wr, self, xy, Xy, extraBar.GetValue(), extraBar.GetColor());
}
}
@@ -93,9 +93,9 @@ namespace OpenRA.Traits
var c = Color.FromArgb(128, 30, 30, 30);
var c2 = Color.FromArgb(128, 10, 10, 10);
var p = new float2(0, -4);
var q = new float2(0, -3);
var r = new float2(0, -2);
var p = new float2(0, -4 / wr.Viewport.Zoom);
var q = new float2(0, -3 / wr.Viewport.Zoom);
var r = new float2(0, -2 / wr.Viewport.Zoom);
var barColor2 = Color.FromArgb(255, barColor.R / 2, barColor.G / 2, barColor.B / 2);
@@ -119,9 +119,9 @@ namespace OpenRA.Traits
var c = Color.FromArgb(128, 30, 30, 30);
var c2 = Color.FromArgb(128, 10, 10, 10);
var p = new float2(0, -4);
var q = new float2(0, -3);
var r = new float2(0, -2);
var p = new float2(0, -4 / wr.Viewport.Zoom);
var q = new float2(0, -3 / wr.Viewport.Zoom);
var r = new float2(0, -2 / wr.Viewport.Zoom);
var healthColor = (health.DamageState == DamageState.Critical) ? Color.Red :
(health.DamageState == DamageState.Heavy) ? Color.Yellow : Color.LimeGreen;