当前位置: 代码迷 >> Iphone >> cocos2d,CCRenderTexture的小疑点
  详细解决方案

cocos2d,CCRenderTexture的小疑点

热度:208   发布时间:2016-04-25 06:42:19.0
cocos2d,CCRenderTexture的小问题
-(CCSprite *)spriteWithColor:(ccColor4F)bgColor textureSize:(float)textureSize {

// 1: Create new CCRenderTexture
CCRenderTexture *rt = [CCRenderTexture renderTextureWithWidth:textureSize height:textureSize];

// 2: Call CCRenderTexture:begin
[rt beginWithClear:bgColor.r g:bgColor.g b:bgColor.b a:bgColor.a];

// 3: Draw into the texture
// We'll add this later

// 4: Call CCRenderTexture:end
[rt end];

// 5: Create a new Sprite from the texture
return [CCSprite spriteWithTexture:rt.sprite.texture];

}
最后那个rt.sprite.texture如果用C++写,应该怎么改,谢谢大神啊

------解决方案--------------------
CCSprite::spriteWithTexture(rt->getSprite()->getTexture());