diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-02-28 03:23:46 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-02-28 03:23:46 +0000 |
commit | aa3f1e097f20695fca6384389f9065a26d29f407 (patch) | |
tree | e3c32476c17f17159793f2c73d92be3f9a91dbbf /src/gui/progressbar.cpp | |
parent | 434bd8ec146b5001f8f20ee893f13ba8ba478be9 (diff) | |
download | mana-client-aa3f1e097f20695fca6384389f9065a26d29f407.tar.gz mana-client-aa3f1e097f20695fca6384389f9065a26d29f407.tar.bz2 mana-client-aa3f1e097f20695fca6384389f9065a26d29f407.tar.xz mana-client-aa3f1e097f20695fca6384389f9065a26d29f407.zip |
Formatting updates.
Diffstat (limited to 'src/gui/progressbar.cpp')
-rw-r--r-- | src/gui/progressbar.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index aa396a70..5ef5e03f 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -25,13 +25,12 @@ #include "gui.h" #include "../resources/resourcemanager.h" -ProgressBar::ProgressBar(float progress, int x, int y, int width, int height, unsigned char red, unsigned green, unsigned char blue) : -gcn::Widget() +ProgressBar::ProgressBar(float progress, int x, int y, int width, int height, + unsigned char red, unsigned green, unsigned char blue): + gcn::Widget(), + red(red), green(green), blue(blue) { setProgress(progress); - Red = red; - Green = green; - Blue = blue; setX(x); setY(y); setWidth(width); @@ -66,7 +65,7 @@ gcn::Widget() colorBar = new Image(); colorBar->create(getWidth() - 8, getHeight() - 8); - colorBar->fillWithColor(Red, Green, Blue); + colorBar->fillWithColor(red, green, blue); colorBar->setAlpha(0.7f); } @@ -79,29 +78,32 @@ ProgressBar::~ProgressBar() void ProgressBar::draw(gcn::Graphics *graphics) { -#ifndef USE_OPENGL int absx, absy; getAbsolutePosition(absx, absy); // We're drawing the bar itself first // Background - dBackground->drawPattern(screen, absx+4, absy+4, getWidth()-8, getHeight()-8); + dBackground->drawPattern(screen, + absx + 4, absy + 4, + getWidth() - 8, getHeight() - 8); + // The corners dTopLeftBorder->draw(screen, absx, absy); - dTopRightBorder->draw(screen, absx+getWidth()-4, absy); - dBottomLeftBorder->draw(screen, absx, absy+getHeight()-4); - dBottomRightBorder->draw(screen, absx+getWidth()-4, absy+getHeight()-4); + dTopRightBorder->draw(screen, absx + getWidth() - 4, absy); + dBottomLeftBorder->draw(screen, absx, absy + getHeight() - 4); + dBottomRightBorder->draw(screen, + absx+getWidth() - 4, absy+getHeight() - 4); // The borders - dTopBorder->drawPattern(screen, absx+4, absy, getWidth()-8, 4); - dBottomBorder->drawPattern(screen, absx+4, absy+getHeight()-4, getWidth()-8, 4); - dLeftBorder->drawPattern(screen, absx, absy+4, 4, getHeight()-8); - dRightBorder->drawPattern(screen, absx+getWidth()-4, absy+4, 4, getHeight()-8); + dTopBorder->drawPattern(screen, absx + 4, absy, getWidth() - 8, 4); + dBottomBorder->drawPattern(screen, absx + 4, absy + getHeight() - 4, + getWidth() - 8, 4); + dLeftBorder->drawPattern(screen, absx, absy + 4, 4, getHeight() - 8); + dRightBorder->drawPattern(screen, absx + getWidth() - 4, absy + 4, + 4, getHeight() - 8); colorBar->draw(screen, 0, 0, absx + 4, absy + 4, - int(progress*float(getWidth()-4)), getHeight() - 8); - -#endif + (int)(progress * float(getWidth() - 4)), getHeight() - 8); } void ProgressBar::setProgress(float progress) @@ -114,17 +116,15 @@ float ProgressBar::getProgress() return progress; } -void ProgressBar::setColor(unsigned char MyRed, unsigned char MyGreen, - unsigned char MyBlue) +void ProgressBar::setColor( + unsigned char newRed, unsigned char newGreen, unsigned char newBlue) { - if ( (Red == MyRed) && (Green == MyGreen) && (Blue == MyBlue) ) - { - // Nothing - } - else + if (!(red == newRed) && (green == newGreen) && (blue == newBlue)) { - Red = MyRed; Green = MyGreen; Blue = MyBlue; - colorBar->fillWithColor(Red, Green, Blue); + red = newRed; + green = newGreen; + blue = newBlue; + colorBar->fillWithColor(red, green, blue); colorBar->setAlpha(0.7f); } } |