Bigger spawn points, numbers within.
This commit is contained in:
@@ -90,6 +90,19 @@ namespace OpenRA.Graphics
|
||||
DrawLine(new float2(r.Left, y), new float2(r.Right, y), color, color);
|
||||
}
|
||||
|
||||
public void FillEllipse(RectangleF r, Color color)
|
||||
{
|
||||
var a = (r.Right - r.Left) / 2;
|
||||
var b = (r.Bottom - r.Top) / 2;
|
||||
var xc = (r.Right + r.Left) / 2;
|
||||
var yc = (r.Bottom + r.Top) / 2;
|
||||
for (var y = r.Top; y <= r.Bottom; y++)
|
||||
{
|
||||
var dx = a * System.Convert.ToSingle(System.Math.Sqrt(1 - (y - yc) * (y - yc) / b / b));
|
||||
DrawLine(new float2(xc - dx, y), new float2(xc + dx, y), color, color);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetViewportParams(Size screen, float zoom, float2 scroll)
|
||||
{
|
||||
shader.SetVec("Scroll", (int)scroll.X, (int)scroll.Y);
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace OpenRA
|
||||
public static float2 operator *(float2 b, float a) { return new float2(a * b.X, a * b.Y); }
|
||||
public static float2 operator *( float2 a, float2 b ) { return new float2( a.X * b.X, a.Y * b.Y ); }
|
||||
public static float2 operator /( float2 a, float2 b ) { return new float2( a.X / b.X, a.Y / b.Y ); }
|
||||
public static float2 operator /(float2 a, float b) { return new float2(a.X / b, a.Y / b); }
|
||||
|
||||
public static bool operator ==(float2 me, float2 other) { return (me.X == other.X && me.Y == other.Y); }
|
||||
public static bool operator !=(float2 me, float2 other) { return !(me == other); }
|
||||
|
||||
@@ -117,15 +117,19 @@ namespace OpenRA.Widgets
|
||||
var owned = colors.ContainsKey(p);
|
||||
var pos = ConvertToPreview(p);
|
||||
var sprite = ChromeProvider.GetImage("lobby-bits", owned ? "spawn-claimed" : "spawn-unclaimed");
|
||||
var offset = new int2(-sprite.bounds.Width/2, -sprite.bounds.Height/2);
|
||||
var offset = new int2(sprite.bounds.Width, sprite.bounds.Height) / 2;
|
||||
|
||||
if (owned)
|
||||
WidgetUtils.FillRectWithColor(new Rectangle(pos.X + offset.X + 2, pos.Y + offset.Y + 2, 12, 12), colors[p]);
|
||||
WidgetUtils.FillEllipseWithColor(new Rectangle(pos.X - offset.X + 1, pos.Y - offset.Y + 1, sprite.bounds.Width - 2, sprite.bounds.Height - 2), colors[p]);
|
||||
|
||||
Game.Renderer.RgbaSpriteRenderer.DrawSprite(sprite, pos + offset);
|
||||
Game.Renderer.Fonts[ChromeMetrics.Get<string>("SpawnFont")].DrawTextWithContrast(Convert.ToString(spawnPoints.IndexOf(p) + 1), new int2(pos.X + offset.X + 4, pos.Y + offset.Y - 15), ChromeMetrics.Get<Color>("SpawnColor"), ChromeMetrics.Get<Color>("SpawnContrastColor"), 2);
|
||||
Game.Renderer.RgbaSpriteRenderer.DrawSprite(sprite, pos - offset);
|
||||
var fonts = Game.Renderer.Fonts[ChromeMetrics.Get<string>("SpawnFont")];
|
||||
var number = Convert.ToString(spawnPoints.IndexOf(p) + 1);
|
||||
offset = fonts.Measure(number) / 2;
|
||||
offset.Y += 1; // Does not center well vertically for some reason
|
||||
fonts.DrawTextWithContrast(number, pos - offset, ChromeMetrics.Get<Color>("SpawnColor"), ChromeMetrics.Get<Color>("SpawnContrastColor"), 1);
|
||||
|
||||
if ((pos - Viewport.LastMousePos).LengthSquared < 64)
|
||||
if (((pos - Viewport.LastMousePos).ToFloat2() * offset.ToFloat2()).LengthSquared < 1)
|
||||
TooltipSpawnIndex = spawnPoints.IndexOf(p) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,11 @@ namespace OpenRA.Widgets
|
||||
Game.Renderer.LineRenderer.FillRect(new RectangleF(r.X, r.Y, r.Width, r.Height), c);
|
||||
}
|
||||
|
||||
public static void FillEllipseWithColor(Rectangle r, Color c)
|
||||
{
|
||||
Game.Renderer.LineRenderer.FillEllipse(new RectangleF(r.X, r.Y, r.Width, r.Height), c);
|
||||
}
|
||||
|
||||
public static int[] GetBorderSizes(string collection)
|
||||
{
|
||||
var images = new[] { "border-t", "border-b", "border-l", "border-r" };
|
||||
|
||||
Reference in New Issue
Block a user