diff options
Diffstat (limited to 'src/gui/progressbar.cpp')
-rw-r--r-- | src/gui/progressbar.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index e9e3f1b9..a1083db3 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -23,6 +23,7 @@ #include "progressbar.h" #include "../graphics.h" +#include "../main.h" #include "../resources/resourcemanager.h" ImageRect ProgressBar::mBorder; @@ -96,15 +97,21 @@ void ProgressBar::draw(gcn::Graphics *graphics) int x, y; getAbsolutePosition(x, y); - ((Graphics*)graphics)->drawImageRect(x, y, getWidth(), getHeight(), + dynamic_cast<Graphics*>(graphics)->drawImageRect(x, y, getWidth(), getHeight(), mBorder); // The bar if (progress > 0) { graphics->setColor(gcn::Color(red, green, blue, 200)); - graphics->fillRectangle(gcn::Rectangle(4, 4, + if (useOpenGL) { + dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle(gcn::Rectangle(4, 4, (int)(progress * (getWidth() - 8)), getHeight() - 8)); + } + else { + dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle(gcn::Rectangle(4, 4, + (int)(progress * (getWidth() - 8)), getHeight() - 8)); + } } } |