我们的地图用cc.TMXTiledMap方法,会出现渲染效率问题;但是用ccexp.TMXTiledMap方法(fasttiledmap),效率提高了,但是会出现锯齿。如果通过设置每个图素的来去掉锯齿效率就变低。
tmx大小是120选120,每个图素是100x 50;
cc.Tmx的方法在iOS上正常,在android完全不能接受。ccexp.tmx的方法在安卓上在30-40帧;
我只想问,-js里能不能用fastTiledMap……
这段是目前fasttiledmap 的lua 代码:
cc.Director:getInstance():setProjection(cc.DIRECTOR_PROJECTION2_D)
self:addChild(cc.LayerColor:create(ccc3(71,155,215),10000,10000))
--self.titleMap = cc.TMXTiledMap:create("tile_3/tile_100_50.tmx")
-- tt.endTime("nntest1:")
self.titleMap = ccexp.TMXTiledMap:create("tile_final/tile_final.tmx")
-- tt.endTime("nntest2:")
self.mapSize = self.titleMap:getMapSize()
self.tileSize = self.titleMap:getTileSize()
self.mapBoxSize = self.titleMap:getContentSize()
local list = {"layer"}
local pChildrenArray = self.titleMap:getChildren()
local layer = nil
local pObject = nil
local spt = nil
local len = table.getn(pChildrenArray)
for i = 0, len-1, 1 do
pObject = pChildrenArray[i + 1]
layer = pObject
if layer == nil then
break
end
if tolua.type(layer) == "ccexp.TMXLayer" then
local layerSize = layer:getLayerSize();
local layerName = layer:getLayerName()
if table.indexof(list, layerName) then
for w = 0, layerSize.width - 1, 1 do
for h = 0, layerSize.height - 1, 1 do
spt = layer:getTileAt(cc.p(w,h))
if spt then
spt:getTexture():setAntiAliasTexParameters()
end
end
end
end
end
end
原来的tiledmap代码:
self.titleMap = cc.TMXTiledMap:create(“tile_final/tile_final.tmx”)
self.mapSize = self.titleMap:getMapSize()
self.tileSize = self.titleMap:getTileSize()
self.mapBoxSize = self.titleMap:getContentSize()
self.titleMap:setScale(0.4)
self:addChild(self.titleMap)