My google-fu may be weak today, but is there a way to create a nifty progress bar that changes color as it progresses (i.e. red when health is low, green when at full health)? I read the progress bar example, but that stretches a static image, obviously, so it’s not quite what I’m looking for. I looked in Nifty’s manual as well, and read about effects, and the closest I could come up with was the pulsateColor effect, but that’s not all that helpful since I want to have control based on a variable and not a bar that flashes over time.
Take the progress bar example that stretches a static image but change that image depending on the current value. So just write some pixels with the right color into that texture and update it.
You could do it using ImagePainter to modify the image…
…or you could do it by swapping the image yourself.
…or you may be able to do something with an ImageOverlay.
In HeroDex we have bars that change colour buts its abrupt transition (green, yellow, red) in those cases we switch the image being displayed (by modifying the image element).
@zarch said:
You could do it using ImagePainter to modify the image...
…or you could do it by swapping the image yourself.
…or you may be able to do something with an ImageOverlay.
In HeroDex we have bars that change colour buts its abrupt transition (green, yellow, red) in those cases we switch the image being displayed (by modifying the image element).
My first thought was to switch out images, but I wanted something smoother. I can’t believe I didn’t even think to just make the image in Java ;O . Anyways, I’m still curious as to whether there is anything “built-in” for this.