Cocos2dx使用 TexturePacker导出的.plist

CCSpriteFrameCache* cache = CCSpriteFrameCache::sharedSpriteFrameCache();
    cache->addSpriteFramesWithFile("test.plist", "test.png");
    
    /* 创建Sprite */
    CCSprite* s1 = CCSprite::createWithSpriteFrame(cache->spriteFrameByName("g_good.png"));
    
    s1->setPosition(ccp(100, 100));
    addChild(s1);
    
    CCSprite* s2 = CCSprite::createWithSpriteFrame(cache->spriteFrameByName("musicBtn.png"));
    
    s2->setPosition(ccp(300, 300));
    addChild(s2);

你可能感兴趣的:(Cocos2dx使用 TexturePacker导出的.plist)