Fix IDE0032
This commit is contained in:
committed by
Pavel Penev
parent
e64c0a35c5
commit
98c4eaca83
@@ -18,8 +18,6 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public class TextAnnotationRenderable : IRenderable, IFinalizedRenderable
|
||||
{
|
||||
readonly SpriteFont font;
|
||||
readonly WPos pos;
|
||||
readonly int zOffset;
|
||||
readonly Color color;
|
||||
readonly Color bgDark;
|
||||
readonly Color bgLight;
|
||||
@@ -28,8 +26,8 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public TextAnnotationRenderable(SpriteFont font, WPos pos, int zOffset, Color color, Color bgDark, Color bgLight, string text)
|
||||
{
|
||||
this.font = font;
|
||||
this.pos = pos;
|
||||
this.zOffset = zOffset;
|
||||
Pos = pos;
|
||||
ZOffset = zOffset;
|
||||
this.color = color;
|
||||
this.bgDark = bgDark;
|
||||
this.bgLight = bgLight;
|
||||
@@ -42,25 +40,25 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
ChromeMetrics.Get<Color>("TextContrastColorLight"),
|
||||
text) { }
|
||||
|
||||
public WPos Pos => pos;
|
||||
public int ZOffset => zOffset;
|
||||
public WPos Pos { get; }
|
||||
public int ZOffset { get; }
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new TextAnnotationRenderable(font, pos, zOffset, color, text); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new TextAnnotationRenderable(font, pos + vec, zOffset, color, text); }
|
||||
public IRenderable WithZOffset(int newOffset) { return new TextAnnotationRenderable(font, Pos, ZOffset, color, text); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new TextAnnotationRenderable(font, Pos + vec, ZOffset, color, text); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
public void Render(WorldRenderer wr)
|
||||
{
|
||||
var screenPos = wr.Viewport.WorldToViewPx(wr.ScreenPosition(pos)) - 0.5f * font.Measure(text).ToFloat2();
|
||||
var screenPos = wr.Viewport.WorldToViewPx(wr.ScreenPosition(Pos)) - 0.5f * font.Measure(text).ToFloat2();
|
||||
font.DrawTextWithContrast(text, screenPos, color, bgDark, bgLight, 1);
|
||||
}
|
||||
|
||||
public void RenderDebugGeometry(WorldRenderer wr)
|
||||
{
|
||||
var size = font.Measure(text).ToFloat2();
|
||||
var screenPos = wr.Viewport.WorldToViewPx(wr.ScreenPosition(pos));
|
||||
var screenPos = wr.Viewport.WorldToViewPx(wr.ScreenPosition(Pos));
|
||||
Game.Renderer.RgbaColorRenderer.DrawRect(screenPos - 0.5f * size, screenPos + 0.5f * size, 1, Color.Red);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user