diff options
-rw-r--r-- | src/gui/progressbar.cpp | 20 | ||||
-rw-r--r-- | src/gui/progressbar.h | 1 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index 47225acd..c8d0194a 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -35,6 +35,9 @@ ProgressBar::ProgressBar(float progress, int x, int y, int width, int height, setY(y); setWidth(width); setHeight(height); + redToGo = red; + greenToGo = green; + blueToGo = blue; // Load dialog title bar image ResourceManager *resman = ResourceManager::getInstance(); @@ -82,7 +85,16 @@ void ProgressBar::draw(gcn::Graphics *graphics) 4, getHeight() - 8); // The bar - if (progress > 0) { + if (progress > 0) + { + // Smoothly changing the color for a nicer effect. + if (redToGo > red ) red++; + if (redToGo < red ) red--; + if (greenToGo > green ) green++; + if (greenToGo < green ) green--; + if (blueToGo > blue ) blue++; + if (blueToGo < blue ) blue--; + graphics->setColor(gcn::Color(red, green, blue, 200)); graphics->fillRectangle(gcn::Rectangle(4, 4, (int)(progress * (getWidth() - 8)), getHeight() - 8)); @@ -103,7 +115,7 @@ float ProgressBar::getProgress() void ProgressBar::setColor(int red, int green, int blue) { - this->red = red; - this->green = green; - this->blue = blue; + this->redToGo = red; + this->greenToGo = green; + this->blueToGo = blue; } diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h index abfbe92d..d39ae0f9 100644 --- a/src/gui/progressbar.h +++ b/src/gui/progressbar.h @@ -93,6 +93,7 @@ class ProgressBar : public gcn::Widget { private: float progress; int red, green, blue; + int redToGo, greenToGo, blueToGo; // Bar Images Image *dBackground; |