I am trying to load a tiled map to a hello world project. However I see nothing of the tiled on the simulator - this is what the code looks like
Scene* HelloWorld::createScene()
{
// 'scene' is an autorelease object
auto scene = Scene::create();
// 'layer' is an autorelease object
auto layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
auto visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
//Load paths
std::vector<std::string> searchPaths;
searchPaths.push_back("/Users/zedan/Development/TestCpp/Resources/content/");
FileUtils::getInstance()->setSearchPaths(searchPaths);
cocos2d::TMXTiledMap* tileMap;
tileMap = cocos2d::TMXTiledMap::create("sandbox.tmx");
//tileMap->setPosition(Vec2(0,0));
tileMap->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
this->addChild(tileMap);
return true;
}
The tiled map came as an example with the tiled app. I could see the tileMap object has the objectGroups with content from the file however I dont see anything on the screen any suggestions.This is what the object layer content looks like in Tiled
Any suggestions on why I am not seeing anything on the screen ?