From de7f10dc69f7d2e7e6e4dbc97b5e8901c0589d62 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 14 Jul 2005 01:14:16 +0000 Subject: Make sure progress bar color fading happens framerate independent. --- src/gui/progressbar.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/gui/progressbar.cpp') 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)); -- cgit v1.2.3-70-g09d2