标签:scale9 sprite extensions capinsets 独立开发者er
CCSpriteFrameCache * cache = CCSpriteFrameCache::sharedSpriteFrameCache();
cache->addSpriteFramesWithFile("Plist.plist");
CCSprite *room = CCSprite::createWithSpriteFrameName("6.png");
CCPoint oPoint = room->getContentSize();/* 66,27 */
room->setPosition(ccp(100, 100));
room->setScale(4.0f);
addChild(room);
Scale9Sprite *poScale9Sprite1 = Scale9Sprite::createWithSpriteFrameName("6.png");
poScale9Sprite1->setPosition(ccp(100, 300));
poScale9Sprite1->setContentSize(CCSizeMake(oPoint.x * 4, oPoint.y * 4));
addChild(poScale9Sprite1);
Scale9Sprite *poScale9Sprite2 = Scale9Sprite::createWithSpriteFrameName("6.png");
poScale9Sprite2->setPosition(ccp(100, 500));
poScale9Sprite2->setCapInsets(CCRect(3,3,oPoint.x - 3, oPoint.y - 3));
poScale9Sprite2->setContentSize(CCSizeMake(oPoint.x * 4, oPoint.y * 4));
addChild(poScale9Sprite2);
#include "../extensions/cocos-ext.h"
USING_NS_CC_EXT;
参考文章:
cocos2dx 3.x Scale9Sprite的认识
cocos2dx基础篇(12)——点九图CCScale9Sprite
版权声明:本文为博主原创文章,未经博主允许不得转载。
【独立开发者er Cocos2d-x实战 005】使用Cocos2dx Scale9Sprite使用
标签:scale9 sprite extensions capinsets 独立开发者er
原文地址:http://blog.csdn.net/chenqiai0/article/details/46832761