summaryrefslogtreecommitdiff
path: root/src/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r--src/graphics.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 8fc60abb..93448c7c 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -50,35 +50,41 @@ Graphics::Graphics(SDL_Surface *screen):
}
// Initialize for drawing
- if (useOpenGL) {
- gcn::OpenGLGraphics::_beginDraw() ;
+ if (!useOpenGL) {
+ gcn::SDLGraphics::_beginDraw();
}
+#ifdef USE_OPENGL
else {
- gcn::SDLGraphics::_beginDraw();
+ gcn::OpenGLGraphics::_beginDraw();
}
+#endif
//_beginDraw();
}
Graphics::~Graphics()
{
// Deinitialize for drawing
- if (useOpenGL) {
- gcn::OpenGLGraphics::_endDraw() ;
+ if (!useOpenGL) {
+ gcn::SDLGraphics::_endDraw();
}
+#ifdef USE_OPENGL
else {
- gcn::SDLGraphics::_endDraw();
+ gcn::OpenGLGraphics::_endDraw();
}
+#endif
//_endDraw();
}
void Graphics::setFont(gcn::ImageFont *font)
{
- if (useOpenGL) {
- gcn::OpenGLGraphics::setFont(font);
+ if (!useOpenGL) {
+ gcn::SDLGraphics::setFont(font);
}
+#ifdef USE_OPENGL
else {
- gcn::SDLGraphics::setFont(font);
+ gcn::OpenGLGraphics::setFont(font);
}
+#endif
}
void Graphics::drawText(const std::string &text,
@@ -86,22 +92,26 @@ void Graphics::drawText(const std::string &text,
int y,
unsigned int alignment)
{
- if (useOpenGL) {
- gcn::OpenGLGraphics::drawText(text, x, y, alignment);
+ if (!useOpenGL) {
+ gcn::SDLGraphics::drawText(text, x, y, alignment);
}
+#ifdef USE_OPENGL
else {
- gcn::SDLGraphics::drawText(text, x, y, alignment);
+ gcn::OpenGLGraphics::drawText(text, x, y, alignment);
}
+#endif
}
void Graphics::setColor(gcn::Color color)
{
- if (useOpenGL) {
- gcn::OpenGLGraphics::setColor(color);
+ if (!useOpenGL) {
+ gcn::SDLGraphics::setColor(color);
}
+#ifdef USE_OPENGL
else {
- gcn::SDLGraphics::setColor(color);
+ gcn::OpenGLGraphics::setColor(color);
}
+#endif
}
int Graphics::getWidth()