02-15-2003, 05:50 AM
How can I create a progress bar effect you know those that have a rectangle and another rectangle moving inside.
02-15-2003, 07:50 AM
Hello. Well, that's rather simple problem.
You would like to draw a progress bar - so
1. first draw the background rectangle (let's say in white color) :
glVertex2f(x + width, y);
glVertex2f(x + width, y + height);
glVertex2f(x. y + height);
where x, y - are starting coordinates of bottom left corner
width, height - size of the bar
2. draw current progress rectangle
now we draw second rectangle showing percent of our progress
progress = value / max_value;
As you can see progress is from 0 to 1.
Width of our progress rectangle would be now = progress * width (of previous rectangle)
so we draw
And that would be all. There are of course many ways of doing such bar. Probably you would like to add a percent counter etc... But that's isn't also any problem...
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.