summaryrefslogtreecommitdiff
path: root/src/gui/progressbar.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-10-09 03:34:45 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-10-09 03:34:45 +0000
commit8bde9095c5840b8d62ebafe11beaed98877d6ac2 (patch)
tree537f717a339d1247cae222eb7a354ea5dbe8babf /src/gui/progressbar.cpp
parenta246c08cef5e4d598fc07a681eb971bfbcf01519 (diff)
downloadmana-8bde9095c5840b8d62ebafe11beaed98877d6ac2.tar.gz
mana-8bde9095c5840b8d62ebafe11beaed98877d6ac2.tar.bz2
mana-8bde9095c5840b8d62ebafe11beaed98877d6ac2.tar.xz
mana-8bde9095c5840b8d62ebafe11beaed98877d6ac2.zip
* Made Sprite into an interface implemented by both FloorItem and Being, which
hook themselves into the map on construction. The improved fringe layer is working as expected now. * Made sure TMW compiles without warnings even when using "-Wconversion -Wshadow -Wcast-qual -Wwrite-strings -ansi -pedantic", lots of cleanups. * Added two new small tilesets that contain the desert tiles that are twice and three times the height of a normal tile. One well in new_3-1 has been converted to use the new double tiles for testing purposes.
Diffstat (limited to 'src/gui/progressbar.cpp')
-rw-r--r--src/gui/progressbar.cpp73
1 files changed, 28 insertions, 45 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index 834ca73a..0863db98 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -35,12 +35,10 @@ int ProgressBar::mInstances = 0;
ProgressBar::ProgressBar(float progress, int x, int y,
unsigned int width, unsigned int height,
- unsigned char red,
- unsigned char green,
- unsigned char blue):
+ Uint8 red, Uint8 green, Uint8 blue):
gcn::Widget(),
- red(red), green(green), blue(blue),
- redToGo(red), greenToGo(green), blueToGo(blue)
+ mRed(red), mGreen(green), mBlue(blue),
+ mRedToGo(red), mGreenToGo(green), mBlueToGo(blue)
{
setProgress(progress);
setX(x);
@@ -88,58 +86,43 @@ 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--;
+ if (mRedToGo > mRed) mRed++;
+ if (mRedToGo < mRed) mRed--;
+ if (mGreenToGo > mGreen) mGreen++;
+ if (mGreenToGo < mGreen) mGreen--;
+ if (mBlueToGo > mBlue) mBlue++;
+ if (mBlueToGo < mBlue) mBlue--;
}
-void ProgressBar::draw(gcn::Graphics *graphics)
+void
+ProgressBar::draw(gcn::Graphics *graphics)
{
- dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0, getWidth(), getHeight(),
- mBorder);
+ dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0,
+ getWidth(), getHeight(),
+ mBorder);
// The bar
- if (progress > 0)
+ if (mProgress > 0)
{
- graphics->setColor(gcn::Color(red, green, blue, 200));
+ graphics->setColor(gcn::Color(mRed, mGreen, mBlue, 200));
graphics->fillRectangle(gcn::Rectangle(4, 4,
- (int)(progress * (getWidth() - 8)), getHeight() - 8));
+ (int)(mProgress * (getWidth() - 8)),
+ getHeight() - 8));
}
}
-void ProgressBar::setProgress(float progress)
+void
+ProgressBar::setProgress(float progress)
{
- if (progress < 0.0f) this->progress = 0.0;
- else if (progress > 1.0f) this->progress = 1.0;
- else this->progress = progress;
+ if (progress < 0.0f) mProgress = 0.0;
+ else if (progress > 1.0f) mProgress = 1.0;
+ else mProgress = progress;
}
-float ProgressBar::getProgress()
+void
+ProgressBar::setColor(Uint8 red, Uint8 green, Uint8 blue)
{
- return progress;
-}
-
-void ProgressBar::setColor(unsigned char red, unsigned char green, unsigned char blue)
-{
- redToGo = red;
- greenToGo = green;
- blueToGo = blue;
-}
-
-unsigned char ProgressBar::getRed()
-{
- return red;
-}
-
-unsigned char ProgressBar::getGreen()
-{
- return green;
-}
-
-unsigned char ProgressBar::getBlue()
-{
- return blue;
+ mRedToGo = red;
+ mGreenToGo = green;
+ mBlueToGo = blue;
}