mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +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 atlas:(Atlas*)atlas scale:(float)scale;
|
||||||
- (id) initWithFile:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile scale:(float)scale;
|
- (id) initWithFile:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile scale:(float)scale;
|
||||||
|
|
||||||
|
- (CCTextureAtlas*) getTextureAtlas:(RegionAttachment*)regionAttachment;
|
||||||
|
|
||||||
// --- Convenience methods for common Skeleton_* functions.
|
// --- Convenience methods for common Skeleton_* functions.
|
||||||
- (void) updateWorldTransform;
|
- (void) updateWorldTransform;
|
||||||
|
|
||||||
|
|||||||
@ -143,7 +143,7 @@
|
|||||||
Slot* slot = _skeleton->slots[i];
|
Slot* slot = _skeleton->slots[i];
|
||||||
if (!slot->attachment || slot->attachment->type != ATTACHMENT_REGION) continue;
|
if (!slot->attachment || slot->attachment->type != ATTACHMENT_REGION) continue;
|
||||||
RegionAttachment* attachment = (RegionAttachment*)slot->attachment;
|
RegionAttachment* attachment = (RegionAttachment*)slot->attachment;
|
||||||
CCTextureAtlas* regionTextureAtlas = (CCTextureAtlas*)attachment->rendererObject;
|
CCTextureAtlas* regionTextureAtlas = [self getTextureAtlas:attachment];
|
||||||
if (regionTextureAtlas != textureAtlas) {
|
if (regionTextureAtlas != textureAtlas) {
|
||||||
if (textureAtlas) {
|
if (textureAtlas) {
|
||||||
[textureAtlas drawQuads];
|
[textureAtlas drawQuads];
|
||||||
@ -200,6 +200,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (CCTextureAtlas*) getTextureAtlas:(RegionAttachment*)regionAttachment {
|
||||||
|
return (CCTextureAtlas*)((AtlasRegion*)regionAttachment->rendererObject)->page->rendererObject;
|
||||||
|
}
|
||||||
|
|
||||||
- (CGRect) boundingBox {
|
- (CGRect) boundingBox {
|
||||||
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
|
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
|
||||||
float scaleX = self.scaleX;
|
float scaleX = self.scaleX;
|
||||||
|
|||||||
@ -135,7 +135,7 @@ void CCSkeleton::draw () {
|
|||||||
Slot* slot = skeleton->slots[i];
|
Slot* slot = skeleton->slots[i];
|
||||||
if (!slot->attachment || slot->attachment->type != ATTACHMENT_REGION) continue;
|
if (!slot->attachment || slot->attachment->type != ATTACHMENT_REGION) continue;
|
||||||
RegionAttachment* attachment = (RegionAttachment*)slot->attachment;
|
RegionAttachment* attachment = (RegionAttachment*)slot->attachment;
|
||||||
CCTextureAtlas* regionTextureAtlas = (CCTextureAtlas*)((AtlasRegion*)attachment->rendererObject)->page->rendererObject;
|
CCTextureAtlas* regionTextureAtlas = getTextureAtlas(attachment);
|
||||||
if (regionTextureAtlas != textureAtlas) {
|
if (regionTextureAtlas != textureAtlas) {
|
||||||
if (textureAtlas) {
|
if (textureAtlas) {
|
||||||
textureAtlas->drawQuads();
|
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 () {
|
CCRect CCSkeleton::boundingBox () {
|
||||||
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
|
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
|
||||||
float scaleX = getScaleX();
|
float scaleX = getScaleX();
|
||||||
|
|||||||
@ -83,7 +83,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
CCSkeleton ();
|
CCSkeleton ();
|
||||||
void setSkeletonData (SkeletonData *skeletonData, bool ownsSkeletonData);
|
void setSkeletonData (SkeletonData* skeletonData, bool ownsSkeletonData);
|
||||||
|
cocos2d::CCTextureAtlas* getTextureAtlas (RegionAttachment* regionAttachment) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool ownsSkeletonData;
|
bool ownsSkeletonData;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user