Specify sprite positions as center pos + offset. Fixes #3611.

This commit is contained in:
Paul Chote
2013-08-01 21:10:33 +12:00
parent 8f5a1333d2
commit cdef41adb4
5 changed files with 34 additions and 18 deletions

View File

@@ -245,6 +245,13 @@ namespace OpenRA.Graphics
return new float[] {c*vec.X, c*vec.Y, c*vec.Z, 1};
}
public int2 ScreenPxOffset(WVec vec)
{
// Round to nearest pixel
var px = ScreenVector(vec);
return new int2((int)Math.Round(px[0]), (int)Math.Round(px[1] - px[2]));
}
public float ScreenZPosition(WPos pos, int zOffset) { return (pos.Y + pos.Z + zOffset)*Game.CellSize/1024f; }
}
}