fixed broken UiOverlay

This commit is contained in:
Chris Forbes
2009-10-11 10:54:09 +13:00
parent 0eee005d52
commit cdf56c278f
3 changed files with 7 additions and 6 deletions

View File

@@ -82,5 +82,6 @@ namespace OpenRa
public float2 Round() { return new float2((float)Math.Round(X), (float)Math.Round(Y)); }
public override string ToString() { return string.Format("({0},{1})", X, Y); }
public int2 ToInt2() { return new int2((int)X, (int)Y); }
}
}

View File

@@ -95,11 +95,11 @@ namespace OpenRa.Game
Button = e.Button,
Event = MouseInputEvent.Move,
Location = new int2(e.Location)
});
if (game.controller.orderGenerator != null)
game.controller.orderGenerator.PrepareOverlay(game,
new int2(e.Location.X / 24, e.Location.Y / 24));
});
if (game.controller.orderGenerator != null)
game.controller.orderGenerator.PrepareOverlay(game,
((1 / 24f) * (new float2(e.Location) + game.viewport.Location)).ToInt2());
}
protected override void OnMouseUp(MouseEventArgs e)

View File

@@ -49,7 +49,7 @@ namespace OpenRa.Game
for (int i = 0; i < width; i++)
for (int j = 0; j < height; j++)
spriteRenderer.DrawSprite(passableAt(position.X + i, position.Y + j) ? buildOk : buildBlocked,
24 * (position + new int2(i, j)) + game.viewport.Location, 0);
24 * (position + new int2(i, j)), 0);
spriteRenderer.Flush();
}