SFML community forums
Help => Graphics => Topic started by: Bill_n on July 26, 2010, 08:04:38 am
-
I can set the background displayed to blue just fine using Clear(sf::Color(0,0,255)).
I'm trying to set a shape's color to blue by using the Shape::SetColor method as follows:
crit.getShape().SetColor(sf::Color(0,0,255));
crit is an object that has a sf::Shape member variable, accessed by the following function:
sf::Shape& Critter::getShape()
{
return shape;
}
and shape is instantiated in the object's constructor as follows:
shape = sf::Shape::Circle(0, 0, 15, sf::Color(128, 128, 0, 255));
When I try to set the shape's color to blue, it yields a black circle. If I set it to (0,0,255,123) it yields a grey circle when viewed against a white background.
Is there some blending mode of the Shape that is interfering with my attempt?
(255,0,0) yields red :)
(0,255,0) yields green :)
(0,0,255) yields black :?:
(255,255,0) and (255,255,0) both yield yellow :!:
This seems to indicate to me there's some sort of masking going on that is ignoring blue component, but i have no idea where to look for this
-
The color that you pass to the Shape::Circle function is assigned to the shape's points. This is not the global shape color (inherited from sf::Drawable), these two are separate and modulated when the shape is drawn. So you should leave the shape's points with a white color, and play only with the global color (SetColor).
-
The color that you pass to the Shape::Circle function is assigned to the shape's points. This is not the global shape color (inherited from sf::Drawable), these two are separate and modulated when the shape is drawn. So you should leave the shape's points with a white color, and play only with the global color (SetColor).
OK, thanks for the clarification. It's a bit confusing because the Circle constructor's color argument is just described as "Color used to fill the circle" in the docs.
-
I know, I should add something to the doc to make it less confusing :)