Forums » C# Framework » Issue with CCSprite opacity and Text color »
| Raghu S | Issue with CCSprite opacity and Text color | ||
|---|---|---|---|
|
Added by Raghu S over 1 year ago
hi,
CCLabelTTF testMessage = CCLabelTTF.labelWithString( "Hello Text ", "HUDFont", 15 );
testMessage .Color = new ccColor3B( 255, 255, 0 );
In the above code no matter what value we set to blue value, nothing seems to happen. only colors i can set for the text is either Black, Green or Red. Is there any other method to set color to text? this is another issue I'm unable to figure out. When we use opacity with the sprite used in progressTimer nothing seems to happen! here is the code i have used
CCProgressTimer progressBar= CCProgressTimer.progressWithFile("SampleImage");
progressBar.Type = CCProgressTimerType.kCCProgressTimerTypeHorizontalBarLR;
progressBar.position = new CCPoint( windowSize.width / 2, windowSize.height-8 );
progressBar.Sprite.Opacity = 10; // should have made the Sprite mostly transparent. But this does not happen!
addChild( progressBar, 102 );
I have tried varying the value of opacity but it doesn't seem to work. please provide some suggestions.. Thanks |
||
| Evgeniy Rojkov | RE: Issue with CCSprite opacity and Text color | ||
|
Added by Evgeniy Rojkov over 1 year ago
i recommend do not use CCLabelTTF |
||
| Raghu S | RE: Issue with CCSprite opacity and Text color | ||
|
Added by Raghu S over 1 year ago
will give it a try. Thanks for the reply. Can you please guide me about the other issue? |
||
| RongHong Huang | RE: Issue with CCSprite opacity and Text color | ||
|
Added by RongHong Huang over 1 year ago
Hi, Raghu, i have changed the CCSprite opacity and the Text color, and they worked well. about opacity, you could set it to 100, 10 is too small, and you could see nothing, because they are nearly transparent. |
||
| Raghu S | RE: Issue with CCSprite opacity and Text color | ||
|
Added by Raghu S over 1 year ago
Thanks for the reply everyone. As for the question Guess i didn't frame it right!? Well, like you said setting opacity to 10 must have made the object almost transparent but the problem is for me it stays opaque no matter what value i set. I have tried applying transperancy to a CCSprite it had worked as intended. The problem which i encountered occurs when sprite is used with CCProgressTimer. Thanks for the reply, i will check the new files and report back |
||
| Raghu S | RE: Issue with CCSprite opacity and Text color | ||
|
Added by Raghu S about 1 year ago
I used the recent code. Problem still exists |
||
| xin li | RE: Issue with CCSprite opacity and Text color | ||
|
Added by xin li about 1 year ago
Like me in to this problem |
||
| Filipe Lemos | RE: Issue with CCSprite opacity and Text color | ||
|
Added by Filipe Lemos about 1 year ago
The label color issue comes from cocos2d-xna/textures/CCTexture2D.cs in the line: app.spriteBatch.DrawString(font, text, new Vector2(0, 0), Color.YellowGreen, 0.0f, origin, scale, SpriteEffects.None, 0.0f);should use Color.White instead. |
(1-7/7)