I would really like to use the standard CCTMXTiledMap in cocos2d-x but I find that for larger maps it is just too slow. The main problem being that it makes no attempt to limit drawing only visible tiles.
HKTMXTiledMap is suppose to address that but is only available for cocos2d-iphone (http://www.hkasoftware.com/fileserve/HKTMXTiledMap/cocos2d2.1/).
I have attached four files (zipped) that I have converted to work in cocos2d-x. Use it the way you would CCTMXTiledMap.
I no longer have time to work on this right now so I am hoping that someone else can take over. There are two problems:
- “OpenGL error 0x0500” errors. They don’t stop it from working, but should be addressed.
- It does not seem to return the correct gid based on screen coords. I only tested this quickly.
Keep in mind that I have done absolutely nothing to optimize it, just got it to compile/run so there are a number of ways it can be improved.
Please share your changes as you make them for everyone’s benefit.
HKTMXTiledMap.zip (10.9 KB)