Add ISpriteSequence.Bounds and Animation(WithOffset).ScreenBounds.

The bounds define the smallest Rectangle that covers all frames within a sequence.
This commit is contained in:
Paul Chote
2017-12-05 16:26:44 +00:00
committed by reaperrr
parent 85c5259361
commit 041431d966
4 changed files with 53 additions and 1 deletions

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
namespace OpenRA.Graphics
{
@@ -44,6 +45,14 @@ namespace OpenRA.Graphics
return Animation.Render(center, offset, z, pal, scale);
}
public Rectangle ScreenBounds(Actor self, WorldRenderer wr, float scale)
{
var center = self.CenterPosition;
var offset = OffsetFunc != null ? OffsetFunc() : WVec.Zero;
return Animation.ScreenBounds(wr, center, offset, scale);
}
public static implicit operator AnimationWithOffset(Animation a)
{
return new AnimationWithOffset(a, null, null, null);