Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::VertexArray change color  (Read 3907 times)

0 Members and 1 Guest are viewing this topic.

linkorMariya

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
sf::VertexArray change color
« 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: sf::VertexArray change color
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::VertexArray change color
« Reply #2 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);
Laurent Gomila - SFML developer

linkorMariya

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: sf::VertexArray change color
« Reply #3 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

 

anything