diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/browserbox.cpp | 35 | ||||
-rw-r--r-- | src/gui/gui.cpp | 21 | ||||
-rw-r--r-- | src/gui/listbox.cpp | 12 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 11 | ||||
-rw-r--r-- | src/gui/progressbar.cpp | 10 | ||||
-rw-r--r-- | src/gui/scrollarea.cpp | 78 |
6 files changed, 23 insertions, 144 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 52a13763..504fb987 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -211,14 +211,7 @@ void BrowserBox::draw(gcn::Graphics* graphics) if (mOpaque) { graphics->setColor(gcn::Color(BGCOLOR)); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight())); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight())); - } + graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight())); } if (mSelectedLink >= 0) @@ -226,26 +219,12 @@ void BrowserBox::draw(gcn::Graphics* graphics) if ((mHighMode == BACKGROUND) || (mHighMode == BOTH)) { graphics->setColor(gcn::Color(HIGHLIGHT)); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle( - gcn::Rectangle( - mLinks[mSelectedLink].x1, - mLinks[mSelectedLink].y1, - mLinks[mSelectedLink].x2 - mLinks[mSelectedLink].x1, - mLinks[mSelectedLink].y2 - mLinks[mSelectedLink].y1 - )); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle( - gcn::Rectangle( - mLinks[mSelectedLink].x1, - mLinks[mSelectedLink].y1, - mLinks[mSelectedLink].x2 - mLinks[mSelectedLink].x1, - mLinks[mSelectedLink].y2 - mLinks[mSelectedLink].y1 - )); - } + graphics->fillRectangle(gcn::Rectangle( + mLinks[mSelectedLink].x1, + mLinks[mSelectedLink].y1, + mLinks[mSelectedLink].x2 - mLinks[mSelectedLink].x1, + mLinks[mSelectedLink].y2 - mLinks[mSelectedLink].y1 + )); } if ((mHighMode == UNDERLINE) || (mHighMode == BOTH)) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 033ed3df..bd6a9ba4 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -181,16 +181,8 @@ void Gui::logic() void Gui::draw() { - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(guiGraphics)->pushClipArea(guiTop->getDimension()); - guiTop->draw((gcn::OpenGLGraphics*)guiGraphics); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(guiGraphics)->pushClipArea(guiTop->getDimension()); - guiTop->draw((gcn::SDLGraphics*)guiGraphics); - } + guiGraphics->pushClipArea(guiTop->getDimension()); + guiTop->draw(mGraphics); int mouseX, mouseY; Uint8 button = SDL_GetMouseState(&mouseX, &mouseY); @@ -201,14 +193,7 @@ void Gui::draw() guiGraphics->drawImage(mMouseCursor, mouseX - 5, mouseY - 2); } - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(guiGraphics)->popClipArea(); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(guiGraphics)->popClipArea(); - } + guiGraphics->popClipArea(); } void Gui::mousePress(int mx, int my, int button) diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index fee67cbd..0dd9203c 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -48,16 +48,8 @@ void ListBox::draw(gcn::Graphics *graphics) // Draw rectangle below the selected list element if (mSelected >= 0) { - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle( - gcn::Rectangle(0, fontHeight * mSelected, getWidth(), fontHeight)); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle( - gcn::Rectangle(0, fontHeight * mSelected, getWidth(), fontHeight)); - } + graphics->fillRectangle( + gcn::Rectangle(0, fontHeight * mSelected, getWidth(), fontHeight)); } // Draw the list elements diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index c6069821..b4ef3491 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -88,18 +88,9 @@ void Minimap::draw(gcn::Graphics *graphics) { // Player dot graphics->setColor(gcn::Color(209, 52, 61)); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle(gcn::Rectangle( - being->x / 2 + getPadding() - 1, - being->y / 2 + getTitleBarHeight() - 1, 3, 3)); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle(gcn::Rectangle( + graphics->fillRectangle(gcn::Rectangle( being->x / 2 + getPadding() - 1, being->y / 2 + getTitleBarHeight() - 1, 3, 3)); - } } else { diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index fb03d90b..505262b6 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -104,16 +104,8 @@ void ProgressBar::draw(gcn::Graphics *graphics) if (progress > 0) { graphics->setColor(gcn::Color(red, green, blue, 200)); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle(gcn::Rectangle(4, 4, + graphics->fillRectangle(gcn::Rectangle(4, 4, (int)(progress * (getWidth() - 8)), getHeight() - 8)); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle(gcn::Rectangle(4, 4, - (int)(progress * (getWidth() - 8)), getHeight() - 8)); - } } } diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index 3350a252..05fb49ce 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -179,33 +179,16 @@ void ScrollArea::draw(gcn::Graphics *graphics) if (mHBarVisible && mVBarVisible) { graphics->setColor(getBaseColor()); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle(gcn::Rectangle(getWidth() - mScrollbarWidth, + graphics->fillRectangle(gcn::Rectangle(getWidth() - mScrollbarWidth, getHeight() - mScrollbarWidth, mScrollbarWidth, mScrollbarWidth)); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle(gcn::Rectangle(getWidth() - mScrollbarWidth, - getHeight() - mScrollbarWidth, - mScrollbarWidth, - mScrollbarWidth)); - } } if (mContent) { gcn::Rectangle contdim = mContent->getDimension(); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->pushClipArea(getContentDimension()); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->pushClipArea(getContentDimension()); - } + graphics->pushClipArea(getContentDimension()); if (mContent->getBorderSize() > 0) { @@ -214,44 +197,15 @@ void ScrollArea::draw(gcn::Graphics *graphics) rec.y -= mContent->getBorderSize(); rec.width += 2 * mContent->getBorderSize(); rec.height += 2 * mContent->getBorderSize(); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->pushClipArea(rec); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->pushClipArea(rec); - } + graphics->pushClipArea(rec); mContent->drawBorder(graphics); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->popClipArea(); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->popClipArea(); - } + graphics->popClipArea(); } - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->pushClipArea(contdim); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->pushClipArea(contdim); - } + graphics->pushClipArea(contdim); mContent->draw(graphics); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->popClipArea(); - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->popClipArea(); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->popClipArea(); - dynamic_cast<gcn::SDLGraphics*>(graphics)->popClipArea(); - } + graphics->popClipArea(); + graphics->popClipArea(); } } @@ -341,14 +295,7 @@ void ScrollArea::drawVBar(gcn::Graphics *graphics) { gcn::Rectangle dim = getVerticalBarDimension(); graphics->setColor(gcn::Color(0, 0, 0, 32)); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle(dim); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle(dim); - } + graphics->fillRectangle(dim); graphics->setColor(gcn::Color(255, 255, 255)); } @@ -356,14 +303,7 @@ void ScrollArea::drawHBar(gcn::Graphics *graphics) { gcn::Rectangle dim = getHorizontalBarDimension(); graphics->setColor(gcn::Color(0, 0, 0, 32)); - if (useOpenGL) { -#ifdef USE_OPENGL - dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle(dim); -#endif - } - else { - dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle(dim); - } + graphics->fillRectangle(dim); graphics->setColor(gcn::Color(255, 255, 255)); } |