|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
-(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]; } |
Incoming search terms:
- ccrendertexture begin
- create dynamic textures with ccrendertexture cocos2dx
Tagged with: cocos2d • iPhone • objectivec
Like this post? Subscribe to my RSS feed and get loads more!




Leave a Reply