diff --git a/spine-cpp/spine-cpp/include/spine/SkeletonBounds.h b/spine-cpp/spine-cpp/include/spine/SkeletonBounds.h index 5d10f3a4d..c1dc9c62f 100644 --- a/spine-cpp/spine-cpp/include/spine/SkeletonBounds.h +++ b/spine-cpp/spine-cpp/include/spine/SkeletonBounds.h @@ -94,8 +94,22 @@ namespace spine { /// Returns all bounding boxes. Requires a call to update() first. Vector &getBoundingBoxes(); + /// The left edge of the axis aligned bounding box. + float getMinX(); + + /// The bottom edge of the axis aligned bounding box. + float getMinY(); + + /// The right edge of the axis aligned bounding box. + float getMaxX(); + + /// The top edge of the axis aligned bounding box. + float getMaxY(); + + /// The width of the axis aligned bounding box. float getWidth(); + /// The height of the axis aligned bounding box. float getHeight(); private: diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp index 280cffdf3..41400127e 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp @@ -63,7 +63,7 @@ void SkeletonBounds::update(Skeleton &skeleton, bool updateAabb) { Slot *slot = slots[i]; if (!slot->getBone().isActive()) continue; - Attachment *attachment = slot->getAppliedPose().getAttachment(); + Attachment *attachment = slot->_applied->getAttachment(); if (attachment == NULL || !attachment->getRTTI().instanceOf(BoundingBoxAttachment::rtti)) continue; BoundingBoxAttachment *boundingBox = static_cast(attachment); _boundingBoxes.add(boundingBox); @@ -198,6 +198,22 @@ Vector &SkeletonBounds::getBoundingBoxes() { return _boundingBoxes; } +float SkeletonBounds::getMinX() { + return _minX; +} + +float SkeletonBounds::getMinY() { + return _minY; +} + +float SkeletonBounds::getMaxX() { + return _maxX; +} + +float SkeletonBounds::getMaxY() { + return _maxY; +} + float SkeletonBounds::getWidth() { return _maxX - _minX; }