I'm working on a game which should have a constant height(480.0) and because so I wrote that code below.. what's wrong with it is that I have sprite sheets power of 2s for sd here're normal images, for hd - double size and for iPad retina - 4 times bigger; so in this case when I draw my sprites from scene images are not correctly drawn.. And I guess that's because CCSpriteFrame is using CC_ContentScaleFactor() to calculate frame of a image and it cut's wrong frame..
does anybody has any idea how to solve it? :?
CCSize designResolutionSize = CCSize(320,480);
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
pEGLView->setDesignResolutionSize(designResolutionSize.width,
designResolutionSize.height,
kResolutionFixedHeight);
CCSize size = CCEGLView::sharedOpenGLView()->getFrameSize();
std::vector<std::string> res;
if(size.width >= 2048 || size.height >= 2048){
res.push_back("ipadhd");
}
else if(size.width >= 960 || size.height >= 960){
res.push_back("hd");
}
else {
res.push_back("sd");
}
CCFileUtils::sharedFileUtils()->setSearchPaths(res);
CCDirector::sharedDirector()->setContentScaleFactor(size.height / designResolutionSize.height);
Thanks, George..