public virtual void calcBoundingBox(Com.Brashmonkey.Spriter.SpriterRectangle @base ) { this.boundingBox.set(@base); foreach (SpriterObject @object in this.childObjects) { Com.Brashmonkey.Spriter.SpriterPoint[] points = @object.getBoundingBox(); this.boundingBox.left = Math.Min(Math.Min(Math.Min(Math .Min(points[0].x, points[1].x), points[2].x), points[3].x), this.boundingBox.left ); this.boundingBox.right = Math.Max(Math.Max(Math.Max(Math .Max(points[0].x, points[1].x), points[2].x), points[3].x), this.boundingBox.right ); this.boundingBox.top = Math.Max(Math.Max(Math.Max(Math .Max(points[0].y, points[1].y), points[2].y), points[3].y), this.boundingBox.top ); this.boundingBox.bottom = Math.Min(Math.Min(Math.Min(Math .Min(points[0].y, points[1].y), points[2].y), points[3].y), this.boundingBox.bottom ); } foreach (SpriterBone child in this.childBones) { child.calcBoundingBox(boundingBox); this.boundingBox.set(child.boundingBox); } }
public SpriterBone() { this.childBones = new List<SpriterBone>(); this.childObjects = new List<SpriterObject>(); this.boundingBox = new Com.Brashmonkey.Spriter.SpriterRectangle(0, 0, 0, 0); }
/// <summary>Constructs a new SpriterAbstractPlayer object which is able to animate SpriterBone instances and SpriterObject instances. /// </summary> /// <remarks>Constructs a new SpriterAbstractPlayer object which is able to animate SpriterBone instances and SpriterObject instances. /// </remarks> /// <param name="loader"> /// /// <see cref="FileLoader{I}">FileLoader<I> /// </see> /// which you have to implement on your own. /// </param> /// <param name="keyframes"> /// A list of SpriterKeyFrame arrays. See /// <see cref="SpriterKeyFrameProvider.generateKeyFramePool(com.discobeard.spriter.dom.SpriterData, com.discobeard.spriter.dom.Entity) /// ">SpriterKeyFrameProvider.generateKeyFramePool(com.discobeard.spriter.dom.SpriterData, com.discobeard.spriter.dom.Entity) /// </see> /// to get the list. /// Generate these keyframes once to save memory. /// </param> public SpriterAbstractPlayer(FileLoader loader, IList<SpriterAnimation> animations) { this.loader = loader; this.animations = animations; this.rootParent = new SpriterBone(); this.tempParent = new SpriterBone(); this.rootParent.setName("playerRoot"); this.tempParent.setName("playerRoot"); this.lastFrame = new SpriterKeyFrame(); this.lastTempFrame = new SpriterKeyFrame(); this.interpolator = SpriterLinearInterpolator .interpolator; this.players = new List<SpriterAbstractPlayer>(); rect = new SpriterRectangle(0, 0, 0, 0); }