- (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];
Former code, and then a question. . The tangled history. .
Is this function returns the square brackets what is translated into C + + / C is something, I am a novice just learning objc, Big Brother Big Sister help ~ ~
Reply:
Come on people ah. . .
Reply:
[CCSprite spriteWithTexture: rt.sprite.texture];
JAVA equivalent was
CCSprite.spriteWithTexture (rt.sprite.texture)
Returns have to be a wizard object. There rt This skin does not know if you understand the code?
Reply:
I do not know what rt.sprite.texture is ah, and I will not java. . . Not learn it. .
Cocos2d this is something I do not know you will not
Reply:
I suggest that you first learn objective-c syntax foundation. Learning cocos2d .. the game is not so easy to do too
Reply:
rt.sprite.texture is rt.sprite.texture This is rt attributes. .
Rt of the front has been defined.
Reply:
The foundation is there. . Sister. . (It should be the sister)
I do, may not say it, I did not get cocos2d, I put the code into cocos2d cocos2d-x, and then do not know how that rt of property should be changed. . . Tangled up, if you will teach teach me, I have a tangled history. .
Reply:
Reply:
Basic grammar no problem, it should be well understood ah:
return [CCSprite spriteWithTexture: rt.sprite.texture];
Returns an instance of an object CCSprit class;
spriteWithTexture: is a convenient method to initialize this class,
[CCSprite spriteWithTexture: rt.sprite.texture]
Can be understood as the first target after initializationThe object is then assigned rt.sprite.texture texure property
rt.sprit.texture should know, this is the point of writing expressions, oc classic wording is [[rt sprit] texure]
Reply:
return CCSprite :: spriteWithTexture (rt-> getSprite () -> getTexture ());
Also thank you, this should be a positive solution, I want. . . I mainly want to say something in C + +, do not know what the corresponding C + + statement is what
Thank you ~ ~
No comments:
Post a Comment