Major iPhone Retina Bug

Major iPhone Retina Bug
0.0 0



I’m using the latest version of Cocos2D-x to build a game for android, ipad and iphone.

I only have one set of images stored in a sprite sheet along with its corresponding xml file (NO -hd or @2x suffix).

I use the iPad resolution as a reference and then scale the sprites and position them according to their relational width/height in comparison to the iPad’s.

This works for all Android devices and the original iPhone. However for retina iPhone the images are severly pixelated due to the engine’s automatic scaling down then up for all images.

I solved this for previous versions of the engine using the following:

  1. Enable Retina Mode.

  2. Manually scale all sprites by 2.

This worked perfect with the 2.0 version I downloaded two months ago, but when I downloaded a newer version last week the behaviour became different…

Enabling retina mode was enough for the iPhone to display correctly sized images without the need to scale everything by 2.

Unfortunately though, not all sprites are visible now.

My design is that of menus that are created then displayed one at a time. The first of such is two buttons asking you for the language. Upon clicking one of these CCMOVE scrolls this menu away and a new one CCMOVEs its way.

The first menu is always visible (along with the background), but the other menus which are out of the screen at first are never visible! I can click on them and observe behaviour but they are not seen.

Did I explain the problem clearly enough? Anybody know anything that could help?



I guess your code is wrong.

This approach works fine:



There’s something wrong with the how the textures are being loaded.

The first time I call createWithSpriteFrameName() it works but if I call it a second time I get invisible sprites.

I tried the method you used which is a replacement of using enableretinadisplay(), but I still get invisible sprites.

This only occurs for iPhone retina if I use either enableretinadisplay() or CCEGLView::sharedOpenGLView()->setDesignResolutionSize.