Ok, i am trying to draw a custom slider bar in c++ using dx9. I have a sprite that is 1 pixel wide to use as the progress bar fill texture, The lengh of the progress bar is 128 pixels.
I am calling the function like:
DrawSlider(int x, int y, int max, int fill)
x = x location
y = y location
max = max value of progress bar instance
fill = amount of fill to add to bar to show value.
my math is failing me but i believe i need two for loops in this function:
1 loop to fill the steps and 1 loop to add the steps to the bar.
void DrawSlider(int x, int y, int max, int fill)
int step = 128 / max;
for(int i = 0; i <= max; i++)
for(int j = 0; j <=step; j++)
remember my sprite is 1 pixel wide.
Ok, sorry if i wasnt clear enough. Let's say for example, I want the slider bar to be a min value of 0 and max value of 100. I want to draw 75% of the min/max which would be 75. My slider bar is 128 pixels wide, So i would need to draw 96 pixels for fill (fill is 1 pixel wide) to draw the slider at 75%. I am having trouble coding this though.
Example picture of slider: http://i.imgur.com/5oUv6tb.png