07.03.2013, 22:08
You need to align the box left, and then use percentages (very easy maths).
If the width is set to 100 then it's fairly obvious - width == the percentage. If the bar is 125 wide, you need to work out what one percent is.
125/100 = 1.25
1.25 for every percent.
If you want it to be half full (50 percent), 50 x 1.25 = 62.5.
Width = full_width / 100 * percentage;
If a textdraw's alignment is centered the Y axis becomes the X axis.
If the width is set to 100 then it's fairly obvious - width == the percentage. If the bar is 125 wide, you need to work out what one percent is.
125/100 = 1.25
1.25 for every percent.
If you want it to be half full (50 percent), 50 x 1.25 = 62.5.
Width = full_width / 100 * percentage;
Quote:


