Problem with setContentScaleFactor functions

Problem with setContentScaleFactor functions
0.0 0



I have a problem with usage setContentScaleFactor function in my iOS project. I’m try to scale my game for iPhone 3. It looks like
NSString *deviceType = [UIDevice currentDevice].model;
NSLog("deive name is %“,deviceType);
if([deviceType isEqualToString:"iPad"] || [deviceType isEqualToString:”iPad Simulator"] ){
else {
if([[UIScreen mainScreen] respondsToSelector:NSSelectorFromString(`“scale”)]){
if ([[UIScreen mainScreen] scale] < 1.1){
if ([[UIScreen mainScreen] scale] > 1.9){
//retina display


This is code from applicationdidFinishLaunchingWithOptions functions in

So, setContentScaleFactor(0.5) does not make game content less. Contrary, this function making content big.

Can someone help me![](?

Thank you very much)


hi. I think you have the wrong idea (totally wrong I guess) on how to implement the different resolutions on iOS. There is a tutorial about this in the wiki of this website.

The basic idea is: you enable the retina display, and if the device doesn’t support it will not obviously enable it. Then you have to have a version for retina and non retina devices. For instance:


and then load the sprite this way:

CCSprite* coolSprite = CCSprite::create(“sprite.png”) <- Notice that you just ask for “sprite.png”. Then cocos2d-x will load the necessary asset for you.

More info in the wiki.

Good luck.

Cheers from Catalonia



As i understood, you offer to me create different sprites for different devices. Is there really no other way? My application working good with iPod and iPad devices.
I have a problem only with iPhone. I was trying to enable retina display, but it did not help. i think (but may be it really wrong) that setContentScaleFactor function will help
me to scale game content. But if i use this function with parameter=2.0 i have the same result as if i was trying to use it with parameter=0.5. I dont understand what happening!

Thank you


I understood the advice, but I can not afford to have the different set of content for different devices. I really want to get advice as soon as possible about another way how to solve the problem.
Please, help me.


Don’t enable retina on ipad3 and use your iPad assets??!


Martyn Korbut wrote:

But if i use this function with parameter=2.0 i have the same result as if i was trying to use it with parameter=0.5. I dont understand what happening!

I’m experiencing the same behavior here and I can’t understand why.
I’m trying to port a BB10 game (design resolution: 1280x768, landscape mode) to iOS (frame resolution: 960x640, landscape mode). I expected that setting the content scale factor to (float)960/1280 would automatically resize all the sprites and coordinates on the fly to make them fit the smaller resolution, but it turns out it actually makes them bigger (although the ratio is < 1.0).

Does anyone know what’s going on here?



Not sure if you still have this issue (the last comment guy)
But I was just looking around into the ContentScaleFactor and found you were misunderstanding things.

Haven’t tried myself but I guess that’s how things are here. (Purely logical, just need to think over what’s happening inside)

You are confusing the frameSize with the resource Size.

If you look into the AppDelegate.cpp,

if (frameSize.height > mediumResource.size.height) { CCFileUtils::sharedFileUtils()->setResourceDirectory(; pDirector->setContentScaleFactor(largeResource.size.height/designResolutionSize.height); } // if the frame's height is larger than the height of small resource size, select medium resource. else if (frameSize.height > smallResource.size.height) { CCFileUtils::sharedFileUtils()->setResourceDirectory(; pDirector->setContentScaleFactor(mediumResource.size.height/designResolutionSize.height); } // if the frame's height is smaller than the height of medium resource size, select small resource. else { CCFileUtils::sharedFileUtils()->setResourceDirectory(; pDirector->setContentScaleFactor(smallResource.size.height/designResolutionSize.height); }

What cocos2d would ussually do in your case is

768 / 1280 = 0.6 (768 -> Check the appmacros.h)

And what you are doing is

960 / 1280 = 0.75.

And so you see everything getting bigger.

Going to try this myself tomorrow :slight_smile: