SFML community forums
Help => Graphics => Topic started by: 5gum on July 08, 2014, 09:30:15 pm
-
Hey,
I wanna create a replay button with the functions of the SFML. I think, everyone knows how it looks like. (Round arrow)
So I've created a CircleShape, made the FillColor transparent and the OutLine colored.
But then I got a problem, the circle is still a full circle and not a segment (On the end of the segment I create the triangle of the arrow).
Is there any function which can help me?
Thanks - and sorry for my bad English :D
5gum
PS: What's your bet for Brasil vs Germany today? I think 2:1 for GER after extra time ;D
-
My library Thor (http://www.bromeon.ch/libraries/thor/index.html) might help you.
Two possibilities, of which I'd recommend the first one, even if it's minimally more effort:
- thor::ConcaveShape can be used to form shapes and fill them with a color and outline. You would then just have to compute the points.
- thor::Arrow is a straight arrow. You can concatenate multiple of them to have a round arrow (one has arrow style, the other ones have line style).
-
Thor (http://www.bromeon.ch/libraries/thor/index.html) does seem your best bet. If you wanted to create it manually, you'd need to use a Vertex Array with sf::TriangleStrip (http://www.sfml-dev.org/tutorials/2.1/graphics-vertex-array.php#primitive-types).
If the inside can be filled with the colour behind instead of it needing to be transparent, you could use the sf::TrianglesFan to create a "slice" and then a smaller one (or just a circle) to create the hole. That said, if you can block out with colour, you could just draw over the outline you already had with the background colour :)
Failing that, you could use this (http://www.sfml-dev.org/tutorials/2.1/graphics-sprite.php) ;)