From ebcf3cc4cc88947f0cf01b5eb4a4189ddff2ad27 Mon Sep 17 00:00:00 2001 From: u0u0 Date: Tue, 8 Dec 2020 10:21:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=A4=84=E7=90=86=E9=BB=91?= =?UTF-8?q?=E7=BA=BF=E7=9A=84=E6=96=B9=E5=BC=8F=EF=BC=8CsetAntiAliasTexPar?= =?UTF-8?q?ameters=E5=8F=AF=E6=8A=91=E5=88=B6=E7=BA=B9=E7=90=86=E6=8A=96?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cocos/2d/CCTMXLayer.cpp | 3 +-- cocos/2d/CCTMXTiledMap.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cocos/2d/CCTMXLayer.cpp b/cocos/2d/CCTMXLayer.cpp index bb96e7d..5948602 100644 --- a/cocos/2d/CCTMXLayer.cpp +++ b/cocos/2d/CCTMXLayer.cpp @@ -429,8 +429,7 @@ Sprite *TMXLayer::createTileSprite(intptr_t z, uint32_t gid) Texture2D *texture = Director::getInstance()->getTextureCache()->getTextureForKey(tilesetImage->sourceImage); Rect rect = tileset->getRectForGID(gid); rect = CC_RECT_PIXELS_TO_POINTS(rect); - // only apply fixArtifacts on TMXOrientationOrtho - Sprite *tile = Sprite::createWithTexture(texture, rect, false, _layerOrientation == TMXOrientationOrtho); + Sprite *tile = Sprite::createWithTexture(texture, rect, false, true); tile->setCameraMask(getCameraMask()); _tileSprites.insert(std::pair(z, tile)); addChild(tile); diff --git a/cocos/2d/CCTMXTiledMap.cpp b/cocos/2d/CCTMXTiledMap.cpp index 92718b3..d4c3f3d 100644 --- a/cocos/2d/CCTMXTiledMap.cpp +++ b/cocos/2d/CCTMXTiledMap.cpp @@ -184,8 +184,7 @@ void TMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo) for(auto it = tilesetInfo->_images.begin(); it != tilesetInfo->_images.end(); ++it) { Texture2D *texture = textureCache->addImage(it->second->sourceImage); CC_ASSERT(texture != nullptr); - // By default all the tiles are aliased, avoid black line. - texture->setAliasTexParameters(); + texture->setAntiAliasTexParameters();// AntiAlias work with Sprite's fixArtifacts it->second->imageSize = texture->getContentSizeInPixels(); texture->retain(); }