上渲染紋理設置我是新來cocos2D上,我想畫在它的線條,我試圖從here框架在cocos2d
實現我有一個問題,它設定的框架。我通過下面的代碼設置背景圖像
CCSprite * background = [CCSprite spriteWithFile:imgPath rect:frame];
其中imgPath是設置爲CCSprite的圖像文件的路徑,frame是視圖邊界。 CCSprite的幀是確定現在我加入
[background addChild: [LineDrawingClass node]];
然後,我添加一個CCRenderTexture實例的LineDrawingClass用下面的代碼剪
renderTexture.anchorPoint = CCP(0,0);
renderTexture.position = ccp(self.width * 0.5f,self.height * 0.5f);
然後我加渲染紋理到LineDrawingClass
什麼我是CCSprite的背景設置爲正確的幀,沒有問題,但渲染紋理的框架設置CCSprite下方約五個像素。
我還錨點設置爲
renderTexture.anchorPoint = CCP(0.5F,0.5F);
但renderTexture origin.y的滯後仍然存在。
請參閱附圖以供參考。有人可以指出這個錯誤,並糾正我說renderTexture的框架正好在CCSprite的框架上(現在它的起源爲5px)。
我一再聽說CCRenderTexture有一些偏移問題。據我所知,這看起來是cocos2d中的一個bug。 – LearnCocos2D