SFML community forums

Help => Graphics => Topic started by: Austech on January 18, 2010, 12:43:58 am

Title: Set the outline color of a shape?
Post by: Austech on January 18, 2010, 12:43:58 am
Hello, sorry if there's an answer on the tutorials, but I couldn't seem to find what I'm looking for. I have a rectangle, and I'm trying to figure out how to change the outline color. There's a "SetColor" function but apparently no "SetOutlineColor" function. Maby it's named differently or something. So my question is if there's a way to set the outline color of a rectangle?

Thanks in advanced.  :wink:
Title: Set the outline color of a shape?
Post by: gsaurus on January 18, 2010, 02:48:49 am
To change the outline colour of the entire shape you have to change the outline colour of each of it's vertexes.


Have a look on the tutorial:
http://www.sfml-dev.org/tutorials/1.5/graphics-shape.php

Example:

Code: [Select]

// create rectangle with a green outline with width 5
sf::Shape rect1 = sf::Shape::Rectangle(100, 100, 200, 200, sf::Color::Red, 5.f, sf::Color::Green);
(...)
// change second point outline:
rect1.SetPointOutlineColor(1,sf::Color::Yellow);