//------------------------------------------------------------------ // // TMXOrthoTest // //------------------------------------------------------------------ TMXOrthoTest::TMXOrthoTest() { // // Test orthogonal with 3d camera and anti-alias textures // // it should not flicker. No artifacts should appear // //CCLayerColor* color = LayerColor::create( ccc4(64,64,64,255) ); //addChild(color, -1); TMXTiledMap* map = TMXTiledMap::create("TileMaps/orthogonal-test2.tmx"); addChild(map, 0, kTagTileMap); Size CC_UNUSED s = map->getContentSize(); CCLOG("ContentSize: %f, %f", s.width,s.height); Array * pChildrenArray = map->getChildren(); SpriteBatchNode* child = NULL; Object* pObject = NULL; CCARRAY_FOREACH(pChildrenArray, pObject) { child = (SpriteBatchNode*)pObject; if(!child) break; child->getTexture()->setAntiAliasTexParameters(); }
bool MapLayer::init() { bool bRet = false; do { CC_BREAK_IF(!Layer::init()); Size winSize = Director::getInstance()->getWinSize(); // 初始化地图 TMXTiledMap* map = TMXTiledMap::create("iso-test-zorder.tmx"); map->setPosition((winSize.width - map->getContentSize().width)/2, 0); this->addChild(map, 0, kTagTileMap); // 初始化任务 _tamara = Sprite::create("grossinis_sister1.png"); map->addChild(_tamara, map->getChildren().size()); _tamara->retain(); int mapWidth = map->getMapSize().width * map->getTileSize().width; int mapHeight = map->getMapSize().height * map->getTileSize().height; _tamara->setPosition(mapWidth/2, 112); _tamara->setAnchorPoint(Point(0.5f, 0)); _vmove = -1; _hmove = -1; _stepIndex = -1; _myAstar = new Astar(); this->scheduleUpdate(); auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = CC_CALLBACK_2(MapLayer::onTouchBegan, this); this->_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); bRet = true; } while (0); return bRet; }