2014-03-05 22 views
0

我使用cocostudio和出口從它的場景中它導出一個的.plist在cocos2d-x的iOS遊戲使用JSON,png格式和以.json文件。該場景是在iphone工作正常怎麼辦縮放視網膜3.5英寸,但比例是不是在iPad和iphone.How完美的,我們縮放控制,而使用以.json和導入完整的場景UIN在init函數不同勢設備 我寫同時使用C++

CCNode *pFishJoyScene = SceneReader::sharedSceneReader()->createNodeWithSceneFile("FishJoy2.json"); 
this->addChild(pFishJoyScene);    
cocos2d::extension::ActionManager::shareManager()->playActionByName("startMenu_1.json","Animation1"); 

早些時候我曾經使用CCSize winsize = CCDirector :: sharedDirector() - > getwinSize();使用這個我用來縮放所有的東西。

但在JSON我們不需要,因爲我們正在創造cocostudio.Please場景告訴我如何控制不同的設備縮放寫這個的情況下,同時使用以.json

我採取樣品示例從 https://github.com/chukong/CocoStudioSamples

我跑在上面的示例在名爲DemoFishingjoy.If運行在不同的設備此示例項目它會導致結垢problems.Please幫助

回答

0

好項目答案是,無論我把它的場景或任何不論我是否可以在node.Just規模的節點,一切都會perfect.For例如

CCNode *pFishJoyScene = SceneReader::sharedSceneReader()->createNodeWithSceneFile("FishJoy2.json"); 
this->addChild(pFishJoyScene); 
cocos2d::extension::ActionManager::shareManager()->playActionByName("startMenu_1.json","Animation1"); 

CCSprite *bg=CCSprite::create("startMenuBG.png"); 
float rX=winSize.width/bg->getContentSize().width; 
float rY = winSize.height/bg->getContentSize().height; 


pFishJoyScene->setScaleX(rX); 
pFishJoyScene->setScaleY(rY); 

然後你會在它的作品完美

任何設備看到
0
I hope this will help you.for scaling in skeletonAnimation setScaleX() and setScaleY() are used 

     CCSkeletonAnimation* skeletonAnimRun = CCSkeletonAnimation::createWithFile("horse.json", "horse.atlas"); 
      skeletonAnimRun->setAnimation("run", true); 
      skeletonAnimRun->timeScale = 1.0f; 
      skeletonAnimRun->setScaleX(.2f); 
      skeletonAnimRun->setScaleY(.2f); 
      skeletonAnimRun->setPosition(x/5, y/2); 
      skeletonAnimRun->setSkin("black"); 
      skeletonAnimRun->setSlotsToSetupPose(); 
      addChild(skeletonAnimRun,10);