summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-16 17:33:52 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-16 17:33:52 +0000
commite4e314d67ac1327aecad7bc2934921eec62050c8 (patch)
treea2b9b222d72dff45da774fce6d8911ab49b57571 /src
parent18ce80c0ab33d39975ed996653942bd2a7614dc9 (diff)
downloadmana-e4e314d67ac1327aecad7bc2934921eec62050c8.tar.gz
mana-e4e314d67ac1327aecad7bc2934921eec62050c8.tar.bz2
mana-e4e314d67ac1327aecad7bc2934921eec62050c8.tar.xz
mana-e4e314d67ac1327aecad7bc2934921eec62050c8.zip
Leave out OpenGL completely when not enabled.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/graphics.cpp6
-rw-r--r--src/graphics.h4
-rw-r--r--src/gui/gui.cpp11
-rw-r--r--src/gui/gui.h2
-rw-r--r--src/main.cpp2
-rw-r--r--src/resources/image.h2
7 files changed, 25 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b0323c5f..75519286 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -138,5 +138,5 @@ INCLUDES = \
# the library search path.
tmw_LDFLAGS = $(all_libraries) $(LIBSDL_RPATH) -lguichan_sdl -lguichan `pkg-config --libs libxml-2.0`
tmw_CXXFLAGS = -Wall $(OPENGL_CFLAGS) $(LIBSDL_CFLAGS) `pkg-config --cflags libxml-2.0` -fno-inline
-tmw_LDADD = $(OPENGL_LIBS) $(LIBSDL_LIBS) -lguichan -lphysfs
+tmw_LDADD = $(LIBSDL_LIBS) -lguichan $(OPENGL_LIBS) -lphysfs
tmw_TARGET = tmw
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 94c23704..4e43b4b5 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -32,6 +32,7 @@ SDL_Surface *screen;
Graphics::Graphics():
mouseCursor(NULL)
{
+#ifdef USE_OPENGL
if (useOpenGL) {
// Setup OpenGL
glViewport(0, 0, 800, 600);
@@ -41,6 +42,7 @@ Graphics::Graphics():
logger->log("Using OpenGL %s double buffering.",
(gotDoubleBuffer ? "with" : "without"));
}
+#endif
#ifdef USE_OPENGL
setTargetPlane(800, 600);
@@ -139,6 +141,7 @@ void Graphics::updateScreen()
mouseCursor->draw(screen, mouseX - 5, mouseY - 2);
}
+#ifdef USE_OPENGL
if (useOpenGL) {
glFlush();
glFinish();
@@ -148,6 +151,9 @@ void Graphics::updateScreen()
else {
SDL_Flip(screen);
}
+#else
+ SDL_Flip(screen);
+#endif
// Decrement frame counter when using framerate limiting
if (framesToDraw > 1) framesToDraw--;
diff --git a/src/graphics.h b/src/graphics.h
index e6dd6b02..78d4a3e6 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -25,9 +25,11 @@
#define _GRAPHICS_H
#include <guichan/sdl.hpp>
-#include <guichan/opengl.hpp>
#include <SDL.h>
+#ifdef USE_OPENGL
+#include <guichan/opengl.hpp>
#include <SDL_opengl.h>
+#endif
#include "resources/image.h"
extern SDL_Surface *screen;
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 5b527904..ab818555 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -34,8 +34,7 @@ Graphics *guiGraphics; // Graphics driver
gcn::SDLInput *guiInput; // GUI input
WindowContainer *guiTop; // The top container
-Gui::Gui(Graphics *graphics):
- hostImageLoader(NULL)
+Gui::Gui(Graphics *graphics)
{
// Set graphics
guiGraphics = graphics;
@@ -46,13 +45,19 @@ Gui::Gui(Graphics *graphics):
setInput(guiInput);
// Set image loader
+#ifdef USE_OPENGL
if (useOpenGL) {
hostImageLoader = new gcn::SDLImageLoader();
imageLoader = new gcn::OpenGLImageLoader(hostImageLoader);
}
else {
+ hostImageLoader = NULL;
imageLoader = new gcn::SDLImageLoader();
}
+#else
+ imageLoader = new gcn::SDLImageLoader();
+#endif
+
gcn::Image::setImageLoader(imageLoader);
// Initialize top GUI widget
@@ -84,9 +89,11 @@ Gui::~Gui()
delete guiFont;
delete guiTop;
delete imageLoader;
+#ifdef USE_OPENGL
if (hostImageLoader) {
delete hostImageLoader;
}
+#endif
delete guiInput;
}
diff --git a/src/gui/gui.h b/src/gui/gui.h
index ff1f4889..35b7e21f 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -73,7 +73,9 @@ class Gui : public gcn::Gui, public gcn::MouseListener
private:
gcn::Gui *gui; /**< The GUI system */
+#ifdef USE_OPENGL
gcn::ImageLoader *hostImageLoader; /**< For loading images in GL */
+#endif
gcn::ImageLoader *imageLoader; /**< For loading images */
gcn::ImageFont *guiFont; /**< The global GUI font */
diff --git a/src/main.cpp b/src/main.cpp
index 505cc647..923ceb9c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -37,7 +37,9 @@
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <SDL.h>
+#ifdef USE_OPENGL
#include <SDL_opengl.h>
+#endif
#include <SDL_image.h>
#ifdef __USE_UNIX98
diff --git a/src/resources/image.h b/src/resources/image.h
index c38677d8..807f0fb0 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -26,7 +26,9 @@
#include "resource.h"
#include <SDL.h>
+#ifdef USE_OPENGL
#include <SDL_opengl.h>
+#endif
#include <string>
// This flag causes image alpha channel to be preserved, otherwise masking is