mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
Added getTextureAtlas method when not using AtlasAttachmentLoader.
This commit is contained in:
parent
6bbce812f8
commit
3f3449ca99
@ -53,6 +53,8 @@ Draws a skeleton.
|
||||
- (id) initWithFile:(NSString*)skeletonDataFile atlas:(Atlas*)atlas scale:(float)scale;
|
||||
- (id) initWithFile:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile scale:(float)scale;
|
||||
|
||||
- (CCTextureAtlas*) getTextureAtlas:(RegionAttachment*)regionAttachment;
|
||||
|
||||
// --- Convenience methods for common Skeleton_* functions.
|
||||
- (void) updateWorldTransform;
|
||||
|
||||
|
||||
@ -143,7 +143,7 @@
|
||||
Slot* slot = _skeleton->slots[i];
|
||||
if (!slot->attachment || slot->attachment->type != ATTACHMENT_REGION) continue;
|
||||
RegionAttachment* attachment = (RegionAttachment*)slot->attachment;
|
||||
CCTextureAtlas* regionTextureAtlas = (CCTextureAtlas*)attachment->rendererObject;
|
||||
CCTextureAtlas* regionTextureAtlas = [self getTextureAtlas:attachment];
|
||||
if (regionTextureAtlas != textureAtlas) {
|
||||
if (textureAtlas) {
|
||||
[textureAtlas drawQuads];
|
||||
@ -200,6 +200,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (CCTextureAtlas*) getTextureAtlas:(RegionAttachment*)regionAttachment {
|
||||
return (CCTextureAtlas*)((AtlasRegion*)regionAttachment->rendererObject)->page->rendererObject;
|
||||
}
|
||||
|
||||
- (CGRect) boundingBox {
|
||||
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
|
||||
float scaleX = self.scaleX;
|
||||
|
||||
@ -135,7 +135,7 @@ void CCSkeleton::draw () {
|
||||
Slot* slot = skeleton->slots[i];
|
||||
if (!slot->attachment || slot->attachment->type != ATTACHMENT_REGION) continue;
|
||||
RegionAttachment* attachment = (RegionAttachment*)slot->attachment;
|
||||
CCTextureAtlas* regionTextureAtlas = (CCTextureAtlas*)((AtlasRegion*)attachment->rendererObject)->page->rendererObject;
|
||||
CCTextureAtlas* regionTextureAtlas = getTextureAtlas(attachment);
|
||||
if (regionTextureAtlas != textureAtlas) {
|
||||
if (textureAtlas) {
|
||||
textureAtlas->drawQuads();
|
||||
@ -192,6 +192,10 @@ void CCSkeleton::draw () {
|
||||
}
|
||||
}
|
||||
|
||||
CCTextureAtlas* CCSkeleton::getTextureAtlas (RegionAttachment* regionAttachment) const {
|
||||
return (CCTextureAtlas*)((AtlasRegion*)regionAttachment->rendererObject)->page->rendererObject;
|
||||
}
|
||||
|
||||
CCRect CCSkeleton::boundingBox () {
|
||||
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
|
||||
float scaleX = getScaleX();
|
||||
|
||||
@ -83,7 +83,8 @@ public:
|
||||
|
||||
protected:
|
||||
CCSkeleton ();
|
||||
void setSkeletonData (SkeletonData *skeletonData, bool ownsSkeletonData);
|
||||
void setSkeletonData (SkeletonData* skeletonData, bool ownsSkeletonData);
|
||||
cocos2d::CCTextureAtlas* getTextureAtlas (RegionAttachment* regionAttachment) const;
|
||||
|
||||
private:
|
||||
bool ownsSkeletonData;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user