Fixed SpriteRenderer offset bug.

This commit is contained in:
huwpascoe
2014-08-20 00:21:53 +01:00
parent 6fcd4c3605
commit 7d96a6ac96
2 changed files with 4 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ namespace OpenRA.Graphics
public readonly TextureChannel channel;
public readonly float2 size;
public readonly float2 offset;
public readonly float2 fractionalOffset;
readonly float2[] textureCoords;
public Sprite(Sheet sheet, Rectangle bounds, TextureChannel channel)
@@ -37,6 +38,8 @@ namespace OpenRA.Graphics
this.size = new float2(bounds.Size);
this.blendMode = blendMode;
this.fractionalOffset = offset / this.size;
var left = (float)(bounds.Left) / sheet.Size.Width;
var top = (float)(bounds.Top) / sheet.Size.Height;
var right = (float)(bounds.Right) / sheet.Size.Width;