@jesson55 写道:
先上代码:
self.soilRender_ = cc.RenderTexture:create(1136, 768);
self.soilRender_:setPosition(480,320);
self.container_:addChild(self.soilRender_,1);
self.soilRender_:setLocalZOrder(3);--添加土可擦除层到,刷新图层里 local soil2 = cc.Sprite:create("puzzle/texture/puzzle_soil1.png"); soil2:setPosition(1136/2,768/2); self.soilRender_:begin(); soil2:visit(); self.soilRender_:endToLua();
在手指移动的时候调用self:renderBgDraw_(x,y);
-- 背景绘图
function PuzzleDiggingView:renderBgDraw_(x,y)
if self.soilRender_ then
local draw = cc.DrawNode:create();
local fRadius = 25;
local nCount = 100;
local coef = 2*math.pi/nCount;
local circle = {};
for i=1,nCount do
local rads = i*coef;
local fx = fRadius * math.cos(rads);
local fy = fRadius * math.sin(rads);
local pos = cc.p(fx,fy);
circle[i] = pos;
end
draw:drawPolygon(circle, nCount, cc.c4f(0, 0, 0, 0), 0, cc.c4f(0, 0, 0, 0));
self.soilRender_:begin();
draw:retain();
draw:setPosition(x+54,y+26);
draw:setBlendFunc(cc.blendFunc(gl.GL_ONE, gl.GL_ZERO));
draw:visit();
self.soilRender_:endToLua();
end
end在win 下用 cocos模拟器测试,鼠标滑动的时候 面数最多达到2000
用cocos studio 打包APK 在安卓手机端测试 面数达到30000多,超级卡哪位大神帮忙看下,是什么问题
帖子: 1
参与者: 1