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

Author Topic: Circular segment  (Read 4057 times)

0 Members and 2 Guests are viewing this topic.

5gum

  • Newbie
  • *
  • Posts: 27
    • View Profile
Circular segment
« 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

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Circular segment
« Reply #1 on: July 08, 2014, 09:48:11 pm »
My library Thor 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).
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Circular segment
« Reply #2 on: July 09, 2014, 01:14:13 am »
Thor does seem your best bet. If you wanted to create it manually, you'd need to use a Vertex Array with sf::TriangleStrip.

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  ;)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything