Enforce a line length limit.

This commit is contained in:
RoosterDragon
2015-03-11 23:57:41 +00:00
parent 721ba5e9c3
commit 1515ac54f6
34 changed files with 156 additions and 57 deletions

View File

@@ -82,8 +82,15 @@ namespace OpenRA.Widgets
return ThumbRect.Contains(mi.Location);
}
float ValueFromPx(int x) { return MinimumValue + (MaximumValue - MinimumValue) * (x - 0.5f * RenderBounds.Height) / (RenderBounds.Width - RenderBounds.Height); }
protected int PxFromValue(float x) { return (int)(0.5f * RenderBounds.Height + (RenderBounds.Width - RenderBounds.Height) * (x - MinimumValue) / (MaximumValue - MinimumValue)); }
float ValueFromPx(int x)
{
return MinimumValue + (MaximumValue - MinimumValue) * (x - 0.5f * RenderBounds.Height) / (RenderBounds.Width - RenderBounds.Height);
}
protected int PxFromValue(float x)
{
return (int)(0.5f * RenderBounds.Height + (RenderBounds.Width - RenderBounds.Height) * (x - MinimumValue) / (MaximumValue - MinimumValue));
}
public override Widget Clone() { return new SliderWidget(this); }

View File

@@ -82,7 +82,9 @@ namespace OpenRA.Widgets
TextureChannel.Alpha);
var scale = Math.Min((float)RenderBounds.Width / video.Width, (float)RenderBounds.Height / video.Height * AspectRatio);
videoOrigin = new float2(RenderBounds.X + (RenderBounds.Width - scale * video.Width) / 2, RenderBounds.Y + (RenderBounds.Height - scale * video.Height * AspectRatio) / 2);
videoOrigin = new float2(
RenderBounds.X + (RenderBounds.Width - scale * video.Width) / 2,
RenderBounds.Y + (RenderBounds.Height - scale * video.Height * AspectRatio) / 2);
// Round size to integer pixels. Round up to be consistent with the scale calcuation.
videoSize = new float2((int)Math.Ceiling(video.Width * scale), (int)Math.Ceiling(video.Height * AspectRatio * scale));

View File

@@ -184,7 +184,8 @@ namespace OpenRA.Widgets
}
else if (o.TargetLocation != CPos.Zero)
{
world.AddFrameEndTask(w => w.Add(new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash")));
world.AddFrameEndTask(w => w.Add(
new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash")));
flashed = true;
}
}