#include “TmxGame.h”
#include “AboutScene.h”
Scene* TmxGame::createScene()
{
auto scene = Scene::create();
auto layer = TmxGame::create();
scene->addChild(layer);
return scene;
}
bool TmxGame::init()
{
if (!Layer::init())
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
std::string file = "TileMap.tmx";
auto str = String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str());
tileMap = TMXTiledMap::createWithXML(str->getCString(), "");
backgroung = tileMap->layerNamed("Background");
this->addChild(tileMap, 1);
}
为什么地图还是没显示出来呢 名字都打对了