using CCNode::setScale(scalefactor) in "initWithTexture" for scaling all the CCSprites in game

I wanted to use Ipad retina Resources in Ipad so to scale down each of the CCSprite I have added following code in the “initWithTexture” so that I don’t have to call the setScale(factor) on every CCSprite I have added to the game.

float factor=CCDirector::sharedDirector()>getContentScaleFactor;
CCNode::setScale;
In appdelegate I set the content factor as the : pDirector
>setContentScaleFactor(screenSize.height/designSize.height);
Game is working fine , I just wanted to know if this way is ok ? Or what would have been your approach for scaling the Ipad Retina images for use in Ipad

Also do I need to add SET_DIRTY_RECURSIVELY() after CCNode::setScale(factor) ? as same thing is done in actual setScale function of CCSPrite.

In the game I’m currently developing, I just set the convenient resolution in CCEGLView::setDesignResolutionSize, all scalings are done by Cocos2d-x automagically.

Thanks for reply Dot …this is what I expect from the cocos2dx , btw I am using 2.1.4 version which one you are using ?
here is the code in AppDelagate, what I am doing wrong ?

// initialize director
CCDirector pDirector = CCDirector::sharedDirector;
CCEGLView
pEGLView = CCEGLView::sharedOpenGLView();
pDirector~~>setOpenGLView;
// turn on display FPS
pDirector~~>setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don’t call this
pDirector~~>setAnimationInterval;
CCSize screenSize = pEGLView~~>getFrameSize();
CCSize designSize;
float screenRatio = screenSize.height/screenSize.width;
std::vectorstd::string searchPaths;
if (screenSize.width > 768)
{
searchPaths.push_back(“ipadRetina”);
designSize=CCSize(1536,2048);
}
else if (screenSize.width > 320)
{
if (screenRatio 1.5f)
{
searchPaths.push_back(“iphoneRetina”);
designSize = CCSize(640,960);
}
else if(screenRatio 1.775f)
{
searchPaths.push_back(“iphoneFive”);
designSize = CCSize(640,1136);
}
else
{
//searchPaths.push_back(“ipad”);
//designSize = CCSize(768,1024);

searchPaths.push_back(“ipadRetina”);
designSize=CCSize(1536,2048);
}
}
else
{
searchPaths.push_back(“iphone”);
designSize = CCSize(320,480);
}

CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionExactFit);
CCFileUtils::sharedFileUtils()>setSearchPaths;
pDirector
>setContentScaleFactor(screenSize.height/designSize.height);
CocosDenshion::SimpleAudioEngine::sharedEngine()>playBackgroundMusic;
// create a scene. it’s an autorelease object
CCScene *pScene = MainMenu::scene;
pDirector
>runWithScene(pScene);

I have not set one design size for all devices opposed to what is suggested in the WIKI but according to the my resources I have to set them for each device .

I don’t know the exact version number of Cocos2d-x I’m using, since I update it from git.
Your code seems to be ok, but setContentScaleFactor looks redundant (at least I don’t use it, and my code works fine). Maybe I’m wrong and someone could correct me.