721
社区成员
发帖
与我相关
我的任务
分享
bool HelloWorld::init()
{
if (!Layer::init())
{
return false;
}
std::string file = "s.tmx";
auto str = String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str());
_tileMap = TMXTiledMap::createWithXML(str->getCString(), "");
_background = _tileMap->layerNamed("Background");
addChild(_tileMap, -1);
return true;
}