diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-14 01:14:16 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-14 01:14:16 +0000 |
commit | de7f10dc69f7d2e7e6e4dbc97b5e8901c0589d62 (patch) | |
tree | 752231f7027684fdef8ae45c27eb35673d7c7364 /src/gui | |
parent | 06111415b117fc47b5b8bf6396d855616778f3b0 (diff) | |
download | mana-de7f10dc69f7d2e7e6e4dbc97b5e8901c0589d62.tar.gz mana-de7f10dc69f7d2e7e6e4dbc97b5e8901c0589d62.tar.bz2 mana-de7f10dc69f7d2e7e6e4dbc97b5e8901c0589d62.tar.xz mana-de7f10dc69f7d2e7e6e4dbc97b5e8901c0589d62.zip |
Make sure progress bar color fading happens framerate independent.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/progressbar.cpp | 19 | ||||
-rw-r--r-- | src/gui/progressbar.h | 5 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index c8d0194a..25a3da01 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -59,6 +59,17 @@ ProgressBar::~ProgressBar() { } +void ProgressBar::logic() +{ + // 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--; +} + void ProgressBar::draw(gcn::Graphics *graphics) { int absx, absy; @@ -87,14 +98,6 @@ void ProgressBar::draw(gcn::Graphics *graphics) // The bar 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)); diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h index d39ae0f9..3e751459 100644 --- a/src/gui/progressbar.h +++ b/src/gui/progressbar.h @@ -47,6 +47,11 @@ class ProgressBar : public gcn::Widget { ~ProgressBar(); /** + * Performs progress bar logic (fading colors) + */ + void logic(); + + /** * Draws the progress bar. */ void draw(gcn::Graphics *graphics); |