Search code examples
c++cocos2d-xtile

Tilemap looks small


I am new to tilemap on cocos2d-x c++ and I created a tilemap on Tiled 50x50 tiles with 32 x 32 pixels per tile. And I added to the screen.

However, what I see on the screen is not what I excepted. The tiles look really small on a 480 x 320 screen.

My Image

It looks like 3.2 x 3.2 pixels per tile instead of 32 x 32. Anyone had any idea why this would happen?

Thanks in advance!


Solution

  • This is likely a bug of tilemap in cocos2d-x due to the change of resolution. You can try scaling the map up like this:

    _map = cocos2d::experimental::TMXTiledMap::create("tile.tmx");
    auto director = Director::getInstance();
    _map->setScale(director->getContentScaleFactor());