Touch location issue with 2.0.3

Hello
Bug : Touch Area
Platform : Win32

I have just updated my game to Cocos2dx 2.0.3. All the menu buttons are in the right positions but all the touch areas are off by hundred of pixels to the bottom/left. I changed back to 2.0.2 and everything is Ok.

Thanks
Dac

Did you add some special codes?
Because all samples work correctly.

Hi,
You can test this bug by create new project on Win32 (cocos2d-x 2.0.3) and uncomment
pDirector->enableRetinaDisplay(true);
the close button become unclickable.

Hey - just wanted to say that I’m experiencing the same issue. It only occurs when you run on Windows with retina mode enabled.

I’m currently having to use this code:

CCTouch* pTouch = (CCTouch*)pTouches->anyObject();
CCPoint location = pTouch->getLocation();

#ifdef WIN32
    location.y -= 160;      
    location = ccpMult(location, CCDirector::sharedDirector()->getContentScaleFactor());
#endif

to manually adjust touch locations to be the same as on iOS.

Thank you

Oh, retina mode is designed for ios only. I haven’t tested it on Windows and android.
Ming has added a better solution for multi resolution in the next version, enableRetina() will be deprecated.

Is there documentation yet about the new multi-resolution solution replacing enableRetina? Is it the “design resolution size” thing that I’ve seen around in the code?

Walzer Wang wrote:

Oh, retina mode is designed for ios only. I haven’t tested it on Windows and android.
Ming has added a better solution for multi resolution in the next version, enableRetina() will be deprecated.

Many of us are using Visual Studio for development (xCode is too ugly and stupid sometimes), so we need to build/run project on windows. I have consts_win32.h file, where I can just uncomment/comment one of 5 first lines to launch win application in appropriate mode.

//#define DEVICE_IPAD
//#define DEVICE_IPAD_RETINA
//#define DEVICE_IPHONE
#define DEVICE_IPHONE_RETINA
//#define DEVICE_IPHONE_5
//#define DEVICE_ANDROID_CUSTOM_FROM_CONFIG
>
#ifdef DEVICE_IPHONE_5
#define WIN32_SCREEN_RESOLUTION_X 640
#define WIN32_SCREEN_RESOLUTION_Y 1136
#endif
>
#ifdef DEVICE_IPAD
#define WIN32_SCREEN_RESOLUTION_X 768
#define WIN32_SCREEN_RESOLUTION_Y 1024
#endif
>
#ifdef DEVICE_IPAD_RETINA
#define WIN32_SCREEN_RESOLUTION_X 768
#define WIN32_SCREEN_RESOLUTION_Y 1024
#endif
>
#ifdef DEVICE_IPHONE
#define WIN32_SCREEN_RESOLUTION_X 320
#define WIN32_SCREEN_RESOLUTION_Y 480
#endif
>
#ifdef DEVICE_IPHONE_RETINA
#define WIN32_SCREEN_RESOLUTION_X 320
#define WIN32_SCREEN_RESOLUTION_Y 480
#endif

In AppDelegate:

CCEGLView::sharedOpenGLView()->setDesignResolutionSize(WIN32_SCREEN_RESOLUTION_X, WIN32_SCREEN_RESOLUTION_Y, kResolutionNoBorder);
>
#ifdef DEVICE_IPHONE_RETINA
CCDirector::sharedDirector()->enableRetinaDisplay(true);
CCFileUtils::sharedFileUtils()->setResourceDirectory(“iphonehd”);
#endif
>
#ifdef DEVICE_IPHONE
CCDirector::sharedDirector()->enableRetinaDisplay(false);
CCFileUtils::sharedFileUtils()->setResourceDirectory(“iphone”);
#endif

This approach worked like a charm in previous cocos versions, but since 2.0.3 it’s not working.
Sprites and everything works fine, but touches are broken.