It is currently April 19th, 2024, 12:46 am

Can I make an Inverted Bar?

Get help with creating, editing & fixing problems with skins
Upgrade
Posts: 5
Joined: March 2nd, 2012, 2:33 am

Can I make an Inverted Bar?

Post by Upgrade »

I'm currently creating a skin based off the HUD of a video game. The character's health will be the CPU measurement.

What I'm doing is inverting the measurements so that when more of the CPU is used, the lower the health. The text display is simple enough: Subtract the normal health by the amount of CPU used.

The BAR is giving me the problem. For example: I need to show that if 25% of the CPU is used, the character's health is 75%. Currently, it appears that 25% of the CPU is related to 25% of the character's health. Thus if my character is at "full health" I am exhausting my computer's resources.

Any tips?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Can I make an Inverted Bar?

Post by jsmorley »

Assuming full health is 100%, What I would do is use Flip=1 so the bar works from right to left instead of left to right. Then use appropriate colors for both BarColor and SolidColor and you can get the correct effect without any tricks or math.

Code: Select all

[MeasureCPU]
Measure=CPU

[MeterCPUBar]
Meter=Bar
MeasureName=MeasureCPU
W=130
H=4
BarColor=150,150,150,255
SolidColor=0,255,0,255
BarOrientation=Horizontal
Flip=1
Since the "background" color is green, and the "bar" color is grey, but working from right to left, it will give a perfect illusion that the actual value being measured is the green background.
3-1-2012 10-06-40 PM.png
If this does not work for you, and there are aesthetic reasons why it may not, (like if you are using an image instead of a color for the bar, or don't want a background for the bar) then you could instead add a measure to reverse the value like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureCPU]
Measure=CPU

[MeasureReverse]
Measure=Calc
Formula=100 - MeasureCPU
MinValue=0
MaxValue=100

[MeterCPUBar]
Meter=Bar
MeasureName=MeasureReverse
BarOrientation=Horizontal
Flip=0
SolidColor=150,150,150,255
BarColor=0,255,0,255
W=130
H=4
The end result of these two examples are visually identical.
You do not have the required permissions to view the files attached to this post.
Upgrade
Posts: 5
Joined: March 2nd, 2012, 2:33 am

Re: Can I make an Inverted Bar?

Post by Upgrade »

Unfortunately, the health bar is a slightly more complicated plus shape.

http://imgur.com/iqigT

Here it is in its current state.

http://imgur.com/jw6ib

I'm overlaying the health bar at full health with the same image at no health then using the BAR function to manipulate the image.

(Note: The character's full health is 125 HP which is why the numbers seem a little off.)
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Can I make an Inverted Bar?

Post by jsmorley »

Oops. I forgot a "general" measure setting that will solve this with one line...

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureCPU]
Measure=CPU
InvertMeasure=1

[MeterCPUBar]
Meter=Bar
MeasureName=MeasureCPU
BarOrientation=Horizontal
Flip=0
SolidColor=150,150,150,255
BarColor=0,255,0,255
W=130
H=4
InvertMeasure=1 will automatically reverse the result of a measure, so instead of returning 20 when 20% of the CPU is used, it will return 80.
Upgrade
Posts: 5
Joined: March 2nd, 2012, 2:33 am

Re: Can I make an Inverted Bar?

Post by Upgrade »

Thank you, that provided the perfect solution.

Now off to calculate the proportions on how well my computer is doing versus actual health in-game.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Can I make an Inverted Bar?

Post by jsmorley »

Given that you want to display text from 0 - 125% instead of what CPU is returning, which is 0 - 100%, I would use the CPU measure as is, with the InvertMeasure=1 on it. Then have another Calc measure to create the modified text for the String meter.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureCPU]
Measure=CPU
InvertMeasure=1

[MeasureMake125%]
Measure=Calc
Formula=MeasureCPU * 1.25

[MeterCPUBar]
Meter=Bar
MeasureName=MeasureCPU
BarOrientation=Horizontal
Flip=0
SolidColor=150,150,150,255
BarColor=0,255,0,255
W=130
H=4

[MeterText]
Meter=String
MeasureName=MeasureMake125%
FontSize=12
FontColor=255,255,255,255
Y=5R