SFML community forums

Help => Graphics => Topic started by: Megatron on July 05, 2011, 02:30:54 am

Title: Curving a sprite/shape
Post by: Megatron on July 05, 2011, 02:30:54 am
I was wondering if it's possible to curve a sprite in a radial manner? I'm asking as I'm trying to make a straight line curve into a circular shape on one end? Here's an example of what I mean.

This is a template for displaying character information in battle:

(http://garyoak.com/images/StatBars.png)

I have a green HP bar that fills the bottom bar of the template like so:

(http://garyoak.com/images/CharStats.png)

I would like to be able to wrap that bar along the loop. I know I could create the gradient bar itself with the loop shape, but that doesn't help when I need to change the subrect/scale of the gradient bar to show a loss of HP for the character.

Do I need to do direct OpenGL calls to do that? Could someone help me out, I'd appreciate it.

I'm using SFML 2 from the start of June if that matters.

Thanks
Title: Curving a sprite/shape
Post by: aquaglow on July 05, 2011, 12:34:00 pm
I believe this is on the "To Do" list for v2:
https://github.com/SFML/SFML/issues/1

Someone describes a method of masking here by overriding draw and using the OpenGL API Directly, might be helpful: http://www.sfml-dev.org/wiki/en/sources/masking_using_alpha_and_blending