summaryrefslogtreecommitdiff
path: root/src/graphics.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-14 19:02:46 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-14 19:02:46 +0000
commit89dd5a7e669012bdb838cbf41418b2d779df300b (patch)
tree44285d37f23f8d3e3c5dad438b125244d9f325e1 /src/graphics.cpp
parent48bd665f9048cd99cc70f324ae04e20ad64d5c70 (diff)
downloadmana-89dd5a7e669012bdb838cbf41418b2d779df300b.tar.gz
mana-89dd5a7e669012bdb838cbf41418b2d779df300b.tar.bz2
mana-89dd5a7e669012bdb838cbf41418b2d779df300b.tar.xz
mana-89dd5a7e669012bdb838cbf41418b2d779df300b.zip
Make the wrapper functions in the Graphics class conditional on OpenGL support.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r--src/graphics.cpp174
1 files changed, 77 insertions, 97 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 5c7e01b3..cd80fd3e 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -23,7 +23,9 @@
#include "graphics.h"
+#ifdef USE_OPENGL
#include <guichan/imagefont.hpp>
+#endif
#include "log.h"
#include "main.h"
@@ -137,103 +139,6 @@ bool Graphics::setFullscreen(bool fs)
mScreen->format->BitsPerPixel, fs, mHWAccel);
}
-void Graphics::_beginDraw()
-{
-#ifdef USE_OPENGL
- if (useOpenGL) {
- gcn::OpenGLGraphics::_beginDraw();
- } else
-#endif
- {
- gcn::SDLGraphics::_beginDraw();
- }
-}
-
-void Graphics::_endDraw()
-{
-#ifdef USE_OPENGL
- if (useOpenGL) {
- gcn::OpenGLGraphics::_endDraw();
- } else
-#endif
- {
- gcn::SDLGraphics::_endDraw();
- }
-}
-
-void Graphics::setFont(gcn::ImageFont *font)
-{
- if (!useOpenGL) {
- gcn::SDLGraphics::setFont(font);
- }
-#ifdef USE_OPENGL
- else {
- gcn::OpenGLGraphics::setFont(font);
- }
-#endif
-}
-
-void Graphics::drawText(const std::string &text,
- int x, int y, unsigned int alignment)
-{
- if (!useOpenGL) {
- gcn::SDLGraphics::drawText(text, x, y, alignment);
- }
-#ifdef USE_OPENGL
- else {
- gcn::OpenGLGraphics::drawText(text, x, y, alignment);
- }
-#endif
-}
-
-void Graphics::setColor(gcn::Color color)
-{
- if (!useOpenGL) {
- gcn::SDLGraphics::setColor(color);
- }
-#ifdef USE_OPENGL
- else {
- gcn::OpenGLGraphics::setColor(color);
- }
-#endif
-}
-
-void Graphics::popClipArea()
-{
- if (!useOpenGL) {
- gcn::SDLGraphics::popClipArea();
- }
-#ifdef USE_OPENGL
- else {
- gcn::OpenGLGraphics::popClipArea();
- }
-#endif
-}
-
-bool Graphics::pushClipArea(gcn::Rectangle area)
-{
- if (!useOpenGL) {
- return gcn::SDLGraphics::pushClipArea(area);
- }
-#ifdef USE_OPENGL
- else {
- return gcn::OpenGLGraphics::pushClipArea(area);
- }
-#endif
-}
-
-void Graphics::fillRectangle(const gcn::Rectangle &rectangle)
-{
- if (!useOpenGL) {
- gcn::SDLGraphics::fillRectangle(rectangle);
- }
-#ifdef USE_OPENGL
- else {
- gcn::OpenGLGraphics::fillRectangle(rectangle);
- }
-#endif
-}
-
int Graphics::getWidth()
{
return mScreen->w;
@@ -343,3 +248,78 @@ void Graphics::updateScreen()
SDL_Delay(10);
}
}
+
+#ifdef USE_OPENGL
+void Graphics::_beginDraw()
+{
+ if (useOpenGL) {
+ gcn::OpenGLGraphics::_beginDraw();
+ } else {
+ gcn::SDLGraphics::_beginDraw();
+ }
+}
+
+void Graphics::_endDraw()
+{
+ if (useOpenGL) {
+ gcn::OpenGLGraphics::_endDraw();
+ } else {
+ gcn::SDLGraphics::_endDraw();
+ }
+}
+
+void Graphics::setFont(gcn::ImageFont *font)
+{
+ if (!useOpenGL) {
+ gcn::SDLGraphics::setFont(font);
+ } else {
+ gcn::OpenGLGraphics::setFont(font);
+ }
+}
+
+void Graphics::drawText(const std::string &text,
+ int x, int y, unsigned int alignment)
+{
+ if (!useOpenGL) {
+ gcn::SDLGraphics::drawText(text, x, y, alignment);
+ } else {
+ gcn::OpenGLGraphics::drawText(text, x, y, alignment);
+ }
+}
+
+void Graphics::setColor(gcn::Color color)
+{
+ if (!useOpenGL) {
+ gcn::SDLGraphics::setColor(color);
+ } else {
+ gcn::OpenGLGraphics::setColor(color);
+ }
+}
+
+void Graphics::popClipArea()
+{
+ if (!useOpenGL) {
+ gcn::SDLGraphics::popClipArea();
+ } else {
+ gcn::OpenGLGraphics::popClipArea();
+ }
+}
+
+bool Graphics::pushClipArea(gcn::Rectangle area)
+{
+ if (!useOpenGL) {
+ return gcn::SDLGraphics::pushClipArea(area);
+ } else {
+ return gcn::OpenGLGraphics::pushClipArea(area);
+ }
+}
+
+void Graphics::fillRectangle(const gcn::Rectangle &rectangle)
+{
+ if (!useOpenGL) {
+ gcn::SDLGraphics::fillRectangle(rectangle);
+ } else {
+ gcn::OpenGLGraphics::fillRectangle(rectangle);
+ }
+}
+#endif