SFML community forums

Help => Graphics => Topic started by: linkorMariya on July 23, 2016, 03:19:31 pm

Title: sf::VertexArray change color
Post by: linkorMariya on July 23, 2016, 03:19:31 pm
/.../
std::list<sf::VertexArray*>   path_to_stars;
std::list<sf::VertexArray*>::iterator   it_path;

/.../

path_to_stars.push_back(new sf::VertexArray(sf::Lines, 2));

path_to_stars.back()->append(sf::Vector2f((*it)->star.getPosition()));
path_to_stars.back()->append(sf::Vector2f((*it2)->star.getPosition()));
path_to_stars.back()[1]->color(sf::Color(255, 255, 255, 255)) //wrong
path_to_stars.back()->color(sf::Color(255, 255, 255, 255)) //wrong
 

I know only how to change the color of the line by points, but hove i can change color in this situation?
Title: AW: sf::VertexArray change color
Post by: eXpl0it3r on July 23, 2016, 03:40:17 pm
In which situation? I don't really understand what you're trying to communicate with the given code.
Title: Re: sf::VertexArray change color
Post by: Laurent on July 23, 2016, 04:26:35 pm
When expressions become too complex, don't hesitate to decompose them in order to understand the intermediate types involved.

sf::VertexArray* va = path_to_stars.back();
sf::Vertex* v = (*va)[0];
v->color = sf::Color(255, 255, 255, 255);
Title: Re: sf::VertexArray change color
Post by: linkorMariya on July 25, 2016, 10:34:23 pm
When expressions become too complex, don't hesitate to decompose them in order to understand the intermediate types involved.

sf::VertexArray* va = path_to_stars.back();
sf::Vertex* v = (*va)[0];
v->color = sf::Color(255, 255, 255, 255);
Thank you so much