CCTMXLayer-Bug on Retina-Device

CCTMXLayer-Bug on Retina-Device
0.0 0


Hi there,

we’ve found a strange behaviour when using the CCTMXLayer and enabled Retina-Display-Mode. When running on a Retina-Device, it seems the TMX-Layer gets the wrong texture-positions for tiles that reside in the second row of the tile-sheet (they are drawn black). However, the same Application works fine when running on a non-Retina-Device.

I’m not sure if this is the right place to fix this behavior, but changing the following line seemed to fix it for us.

in CCTMXLayer::setupTiles() (CCTMXLayer.cpp, Line 147) we changed

m_pTileSet->m_tImageSize = m_pobTextureAtlas->getTexture()->getContentSizeInPixels();


m_pTileSet->m_tImageSize = m_pobTextureAtlas->getTexture()->getContentSize();

Now CCTMXLayer::rectForGID() finds the correct position for the rect and the tiles are displayed correctly.



The same code in cocos2d-iphone.
I think it is a bug.
Thank you for your work.