How to get mapsize and tilesize from CCTMXTiledMap class ?

How to get mapsize and tilesize from CCTMXTiledMap class ?
0.0 0


I am testing tiled-map game with cocos2d-x, and I want to know how we get the information from the map-level (from .tmx file created with Tiled, map editor tool) in code.
I read tutorial from at the setViewPointCenter() function, and saw that it used
to access the entire tilemap’s size


to access individual tile’s size.

Both are not available in cocos2d-x, but we still can access via other methods I believe. I also tried
to try and get the size (width) of entire tilemap, but no success. The same goes for tilemap’s size as I used

Any suggestion on how we get those property from .tmx file in code ?

Thanks !


To give you a better idea of what I’m asking, I attached the image for the method I’m working on to retrieve values from the .tmx file instead of hard-coded one.
The comment lines are what I’ve tried but it’s not successful and error kicks in.


you can get map size and tile size using getMapSize and getTileSize

CCTMXTiledMap *tileMap = CCTMXTiledMap::tiledMapWithTMXFile(“map.tmx”);
CCSize mapSize = tileMap~~>getMapSize;
CCSize tileSize = tileMap~~>getTileSize();


Thanks so much !

Those interfaces are not included in the online API although I expand all of its member


OK, I forget to add CC_SYNTHESIZE_XXX marcos into doxygen configuration. Fix it. I will upload the new doxygen ASAP.


Greatly appreciated that Walzer ! It’s there now, just check a couple of minutes ago.