Projects > cpp > Issues > Bug #2492

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

Cocos2d-x V3 - Tilemap Image Source Path

Bug #2492 [Rejected]
ricardo 2013-08-06 22:41 . Updated over 10 years ago

Issue reported by Daniel Bartley here:

The issue is with TMXTiledMap in release 3.0alpha0-pre.

The source image used in the tmx file should be relative to the that file, but in this version CCTMXLayer looks in the main resource folder.

The error occurs in the file CCTMXLayer.cpp, TMXLayer::initWithTilesetInfo(TMXTilesetInfo tilesetInfo, TMXLayerInfolayerInfo, TMXMapInfo *mapInfo)

Version 3:

texture = TextureCache::getInstance()->addImage(tilesetInfo->_sourceImage.c_str());

Version 2 (worked properly):

texture = CCTextureCache::sharedTextureCache()->addImage(tilesetInfo->m_sSourceImage.c_str());

m_sSourceImage contained the full path to the image file, where _sourceImage only has the file name.

The code to reproduce the problem is simply:

map = TMXTiledMap::create("tmx/level1.tmx");

Note: The tmx file and image file have to be in a sub-folder to reproduce the error, if you move the tmx and source image into the main resource folder it works.

ricardo 2013-08-06 22:47
  • Project changed from cocos2d-x to cpp
ricardo 2013-08-06 22:47
  • Target version set to 3.0-alpha0
zhangxm 2013-08-22 03:28
  • Assignee set to boyu0
boyu0 2013-08-28 07:57
  • Status changed from New to Closed
  • % Done changed from 0 to 100

This bug is in the version 3.0alpha0-pre, and it fixed at the commit:

boyu0 2013-08-28 08:09
  • Status changed from Closed to Rejected
  • % Done changed from 100 to 0

Atom PDF

Start date:2013-08-06
Due date:
% Done:


Category:all, blackberry
Target version:3.0-alpha0