summaryrefslogtreecommitdiff
path: root/src/gui/progressbar.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2008-04-26 00:13:11 +0000
committerYohann Ferreira <bertram@cegetel.net>2008-04-26 00:13:11 +0000
commita6731dd30a4ab7b2b19af18295293c13895b664d (patch)
tree44a6bd6b34e9995298d19a44b6019ab3235b7563 /src/gui/progressbar.cpp
parentba366046e31523664b2deab4d48d9962aa8bac7e (diff)
downloadmana-client-a6731dd30a4ab7b2b19af18295293c13895b664d.tar.gz
mana-client-a6731dd30a4ab7b2b19af18295293c13895b664d.tar.bz2
mana-client-a6731dd30a4ab7b2b19af18295293c13895b664d.tar.xz
mana-client-a6731dd30a4ab7b2b19af18295293c13895b664d.zip
Made smooth color changing and smooth progress optional.
Diffstat (limited to 'src/gui/progressbar.cpp')
-rw-r--r--src/gui/progressbar.cpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index 07b01eef..90a85478 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -39,6 +39,8 @@ ProgressBar::ProgressBar(float progress,
mRedToGo(red), mGreenToGo(green), mBlueToGo(blue)
{
mProgressToGo = mProgress = 0.0f;
+ mSmoothProgress = mSmoothColorChange = true;
+
setProgress(progress);
setWidth(width);
setHeight(height);
@@ -82,17 +84,31 @@ ProgressBar::~ProgressBar()
void ProgressBar::logic()
{
- // Smoothly changing the color for a nicer effect.
- if (mRedToGo > mRed) mRed++;
- if (mRedToGo < mRed) mRed--;
- if (mGreenToGo > mGreen) mGreen++;
- if (mGreenToGo < mGreen) mGreen--;
- if (mBlueToGo > mBlue) mBlue++;
- if (mBlueToGo < mBlue) mBlue--;
-
- // Smoothly showing the progressbar changes.
- if (mProgressToGo > mProgress) mProgress = mProgress + 0.005f;
- if (mProgressToGo < mProgress) mProgress = mProgress - 0.005f;
+ if (mSmoothColorChange)
+ {
+ // Smoothly changing the color for a nicer effect.
+ if (mRedToGo > mRed) mRed++;
+ if (mRedToGo < mRed) mRed--;
+ if (mGreenToGo > mGreen) mGreen++;
+ if (mGreenToGo < mGreen) mGreen--;
+ if (mBlueToGo > mBlue) mBlue++;
+ if (mBlueToGo < mBlue) mBlue--;
+ }
+ else
+ {
+ mRed = mRedToGo;
+ mGreen = mGreenToGo;
+ mBlue = mBlueToGo;
+ }
+
+ if (mSmoothProgress)
+ {
+ // Smoothly showing the progressbar changes.
+ if (mProgressToGo > mProgress) mProgress = mProgress + 0.005f;
+ if (mProgressToGo < mProgress) mProgress = mProgress - 0.005f;
+ }
+ else
+ mProgress = mProgressToGo;
}
void