Author Topic: UIFilledSprite for semi-circular bar?  (Read 5732 times)

electrodruid

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 48
    • View Profile
UIFilledSprite for semi-circular bar?
« on: April 09, 2013, 05:51:39 PM »
Hi,

I've got a bar (of the energy/health type variety, not the beverage-selling type). It uses a semicircular sprite - imagine something like the left-hand side of a clock face, where "empty" is 6 o'clock, and it has to fill clockwise up to "full" at 12 o'clock. I'd like to use a UIFilledSprite for this, because seems like the kind of thing they're designed for. Unfortunately, I can't get it to do what I want. With a Radial 180 fill dir, the "pivot point" for the fill is on the left-hand edge of the sprite, i.e at 9 o'clock. I need it to be on the right-hand edge (what would be the centre of the clock face if my sprite was a full circle)for it to look right. Invert Fill doesn't work, since that just inverts the fill vertically, not horizontally. Similarly, a Radial 360 fill doesn't cut it, because the pivot is in the centre of my semicircular sprite. A vertical fill sort of works, but for a curved bar it's not quite right either.

Am I missing something? Is there a way to move the "pivot point" around which the radial fills happen? Or is the only way to waste texture page space by having the sprite take up the space of a full circle and using half of the range of a Radial 360?
« Last Edit: April 09, 2013, 06:15:37 PM by electrodruid »

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: UISlicedSprite for semi-circular bar?
« Reply #1 on: April 09, 2013, 06:06:31 PM »
I think you're talking about UIFilledSprite, that's the correct one for round sprites. Did you try putting this widget inside a Panel and flipping the entire panel? Probably this should work.

electrodruid

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 48
    • View Profile
Re: UIFilledSprite for semi-circular bar?
« Reply #2 on: April 09, 2013, 06:32:29 PM »
Of course I meant UIFilledSprite - stupid me... I've edited the subject and my post to avoid confusing anyone else  ::)

I tried your suggestion but it didn't seem to help. Scaled panel X by -1, which flipped the sprite, but then the pivot point flipped to match (so I was looking at the right-hand side of a clock face, with the fill pivoting around 3 o'clock). I tried inverting the X scale of the sprite, hoping that would display the sprite the way I wanted it whilst leaving the pivot on the right-hand edge, but no luck - it flipped back, the double-negatives in the transforms cancelled out, and I was back where I started.

I guess I could make it work by flipping the actual texture on the texture atlas and then flipping the panel/sprite. It would be a bit weird to make art changes in future though, unless I also flipped all of the textures for the surrounding/background elements so that every matched. Right now I've got it working by having a normal sprite carefully positioned inside a clipping panel, and rotating the sprite to make it fill and empty. It works, but I was hoping that UIFilledSprite might let me do the same thing but more neatly, without having to worry that the alignment has accidentally gone wrong or something.