Ipad Cocos2D中renderTexture上的帧集
我是cocos2D新手,我想在其中画一些线,我试图从中实现它 我对里面的框架有问题。我用下面的代码设置背景图像 CCSprite*background=[CCSprite spriteWithFile:imgPath rect:frame] 其中,imgPath是设置为CCSprite的图像文件的路径,frame是视图边界。CCSprite的框架还可以,现在我添加了Ipad Cocos2D中renderTexture上的帧集,ipad,cocos2d-iphone,Ipad,Cocos2d Iphone,我是cocos2D新手,我想在其中画一些线,我试图从中实现它 我对里面的框架有问题。我用下面的代码设置背景图像 CCSprite*background=[CCSprite spriteWithFile:imgPath rect:frame] 其中,imgPath是设置为CCSprite的图像文件的路径,frame是视图边界。CCSprite的框架还可以,现在我添加了 [background addChild: [LineDrawingClass node]]; 然后,我使用以下代码片段向L
[background addChild: [LineDrawingClass node]];
然后,我使用以下代码片段向LineDrawingClass添加了一个CCRenderTexture实例
renderTexture.anchorPoint=ccp(0,0)renderTexture.position=ccp(自宽*0.5f,自高*0.5f) 然后我将renderTexture添加到LineDrawingClass 我得到的是CCSprite的背景设置为正确的帧,没有问题,但是renderTexture的帧设置为CCSprite下方大约五个像素 我还将锚点设置为 renderTexture.anchorPoint=ccp(0.5f,0.5f) 但是renderTexture的origin.y仍然存在滞后 请参阅所附图片以供参考。有人能指出错误并纠正我renderTexture的帧正好在CCSprite的帧之上(现在是5px滞后于origin.y)吗
尝试将纹理的高度设置得稍大一点,例如,如果480是您的高度,则将其设置为580或更大,以符合您的要求
renderTexture.position = ccp(self.width * 0.5f, (self.height + 100) * 0.5f);
这是因为一些定位问题。我反复听说CCRenderTexture有一些补偿问题。据我所知,这似乎是cocos2d中的一个bug。