HD image for both Retina and Normal?

Hello, I am new to cocos2d-x. I was using cocos2d for iphone before.
In cocos2d, I was just use

if( ! [director enableRetinaDisplay:YES] ){
CCLOG (@“Retina Display Not supported”);
[director setContentScaleFactor:2.0];
}

then the high res 960*640 image will be scale to right size for 480*320 resolution auto in 3GS and keep HD in iphone4 automatically. And this can reduce the size of the project that I can only put the hd image and I don’t need to add "hd" after the file name.
But how can I do it in cocos2d-x?
if){
pDirector
>setContentScaleFactor(2.0);
}

I tried this but the image scale wrong. Then I change it to pDirector->setContentScaleFactor(1.0); The position of the node is correct but the image still not scale well;

Would anyone can help me to solve this problem?

Lastly, sorry for poor English because I come from Hong Kong :frowning:

May be it is a bug, we will check it.
#946 is created to check it.

I was looking for a smooth way to transition from normal display to Retina and vice versa without any Retina specific code and without duplicated image resources like ‘-hd’ files.
Paul Chan’s way looks like the best way to keep just one set of image resources for both Retina and normal display. And it’s just one statement of code!
I haven’t used Cocos2d but I just dived into Cocos2d-x directly. But I think if this is possible in Cocos2d, it could be possible in Cocos2d-x as well. I hope that it is just a bug and can be fixed soon.

I was looking for a smooth way to transition from normal display to Retina and vice versa without any Retina specific code and without duplicated image resources like ‘-hd’ files.
Paul Chan’s way looks like the best way to keep just one set of image resources for both Retina and normal display. And it’s just one statement of code!
I haven’t used Cocos2d but I just dived into Cocos2d-x directly. But I think if this is possible in Cocos2d, it could be possible in Cocos2d-x as well. I hope that it is just a bug and can be fixed soon.

Not sure if it the same problem, but may be this would help - http://www.cocos2d-x.org/boards/7/topics/5823

Re Dmitry:

Change the code of cocos2d-x class is a way to solve the problem too. But I think if the method is okay in cocos2d-iphone, cocos2d-x may not fail with same code too. If it really is a bug, solve it can let all cocos2d-x user mix both retina and normal image easily and save time of modify.

It seems that cocos2d 2.0 has already fixed this and would be really a useful to have this in cocos2d-x.

May be it could be done with a preprocessor directive and in case if somebody wants to keep an old non-logical and not-normal way then, they could disable.

I think I find the solution.
Could any people help me to do more test?
The pull request is https://github.com/cocos2d/cocos2d-x/pull/727.

Sorry for late reply, I am testing the code on iOS.

I won’t found anythings wrong at this moment. I hope there are others can help to test other platform.

If I found anythings wrong I will post the bug at here.

Thank you for fixing:)

Thank you for testing.

It works here well! Also iOS.

I started working on iPad version of a game and it trying to find a way to:

  1. Scale everything twice or slightly more (but preferably not by scaling every scene separately, but to do in once for everything)
  2. Force to use HD images instead of normal
  3. Make sure that TTF labels are generated in HD quality but not SD and scaled up (as it would be on retina display).

Is there any standard way of doing this?

It seems that this kind of patch needs to be applied to Android as well. Because there is an issue that Android cannot use HD images when an app is auto-scaled. (http://www.cocos2d-x.org/boards/10/topics/2100).
In Android, it has same symptom of HD images getting twice bigger with auto-scale feature. It looks identical problem with this post, even though the internal implementation is probably somewhat different in Android.
When I change ‘canSetContentScaleFactor()’ to return true in ‘CCEGLView_android.cpp’ and call ‘pDirector~~>setContentScaleFactor’ same as above, the sprites are drawn with proper size but the viewport is not right and auto-scaling is not working.
I figured out that ’setContentScaleFactor’ in ’CCEGLView_android.cpp’ should not change ’m_fScreenScaleFactor’, because conceptually this value is not related to content scaling. This value is for auto-scaling screen. The content scale factor is being handled only by CCDirector.
Once I commented out the one line in ’setContentScaleFactor’ and changed ’canSetContentScaleFactor’ to return true, auto-scaled Android app draws HD images well after ’pDirector~~>setContentScaleFactor(2.0)’.
Can you confirm this?