@Rikifive
Why don't you simply move the fill's X position to the right depending on the (bar's width - fill width)?
That is the "effective left filling gauge" you wanted.
Admiralac was close enough, but he forgot to subtract the fill width from the gauge's width. That is what needs to be added to the X position of the fill gauge, not the fill's width directly.
In case you want to try it out:
This is just a very simple gauge method which fills the gauge from the right to the left with gradients.
Can be used in any window class (if it is put in Window_Base, that is).
Based on the fill rate, we shift the X position of the fill gauge to the right, so that it seems that the gauge fills from the right to the left, but behind the scenes, it still fills from the left to the right, just it's position changes.
You can alter it however you want, to add borders for it by simply playing around with the X, Y width and height properties of the back and fill gauges if you want.
I also have no idea why would anyone alter the Y in that way (meaning that "gauge_y" thing I see everywhere, even in the default methods) inside the gauge method...
There is absolutely no point doing that, adding line_height to it and all those stuffs. It actually breaks the Y position you want to set your gauge at, and you will always have to account for all those stuffs going on with the Y position in the method itself, which makes it pretty annoying.
Why don't you simply move the fill's X position to the right depending on the (bar's width - fill width)?
That is the "effective left filling gauge" you wanted.
Admiralac was close enough, but he forgot to subtract the fill width from the gauge's width. That is what needs to be added to the X position of the fill gauge, not the fill's width directly.
In case you want to try it out:
class Window_Base < Window def draw_gauge_left(x,y,w,h,rate,color1,color2) fill_w = [(w * rate).to_i, w].min # Maxing the fill width to the gauge width set. new_x = x + [w - fill_w, 0].max # Setting the fill's X pos based on it's fill rate. contents.fill_rect(x,y,w,h,Color.new(0,0,0,80)) # Gauge back. contents.gradient_fill_rect(new_x,y,fill_w,h,color1,color2) # Gauge fill. endend
Can be used in any window class (if it is put in Window_Base, that is).
Based on the fill rate, we shift the X position of the fill gauge to the right, so that it seems that the gauge fills from the right to the left, but behind the scenes, it still fills from the left to the right, just it's position changes.
You can alter it however you want, to add borders for it by simply playing around with the X, Y width and height properties of the back and fill gauges if you want.
I also have no idea why would anyone alter the Y in that way (meaning that "gauge_y" thing I see everywhere, even in the default methods) inside the gauge method...
There is absolutely no point doing that, adding line_height to it and all those stuffs. It actually breaks the Y position you want to set your gauge at, and you will always have to account for all those stuffs going on with the Y position in the method itself, which makes it pretty annoying.