summaryrefslogtreecommitdiff
path: root/src/gui/progressbar.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-01 00:07:47 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-01 00:07:47 +0000
commit17de81fb71b4f91d2e0897f802a36df5630f1eaa (patch)
treea8d6444c8f4da24918228eb7566204aa5dded4a9 /src/gui/progressbar.cpp
parente9a413d772c608f4ceba2953fabea643a02e0266 (diff)
downloadmana-17de81fb71b4f91d2e0897f802a36df5630f1eaa.tar.gz
mana-17de81fb71b4f91d2e0897f802a36df5630f1eaa.tar.bz2
mana-17de81fb71b4f91d2e0897f802a36df5630f1eaa.tar.xz
mana-17de81fb71b4f91d2e0897f802a36df5630f1eaa.zip
Changed around recent additions to Image class a bit and fixed OpenGL compile.
Diffstat (limited to 'src/gui/progressbar.cpp')
-rw-r--r--src/gui/progressbar.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index 5ef5e03f..178f7d30 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -63,17 +63,18 @@ ProgressBar::ProgressBar(float progress, int x, int y, int width, int height,
dBottomLeftBorder->setAlpha(1.0f);
dBottomRightBorder->setAlpha(1.0f);
- colorBar = new Image();
- colorBar->create(getWidth() - 8, getHeight() - 8);
- colorBar->fillWithColor(red, green, blue);
- colorBar->setAlpha(0.7f);
+ colorBar = Image::create(getWidth() - 8, getHeight() - 8);
+ if (colorBar) {
+ colorBar->fillWithColor(red, green, blue);
+ colorBar->setAlpha(0.7f);
+ }
}
ProgressBar::~ProgressBar()
{
- #ifndef USE_OPENGL
- //SDL_FreeSurface(ColorBar);
- #endif
+ if (colorBar) {
+ delete colorBar;
+ }
}
void ProgressBar::draw(gcn::Graphics *graphics)
@@ -102,8 +103,10 @@ void ProgressBar::draw(gcn::Graphics *graphics)
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);
+ if (colorBar) {
+ colorBar->draw(screen, 0, 0, absx + 4, absy + 4,
+ (int)(progress * float(getWidth() - 4)), getHeight() - 8);
+ }
}
void ProgressBar::setProgress(float progress)