diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-08-18 13:11:12 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-08-18 13:11:12 +0000 |
commit | 141975cfd22b21403383ea5213cb85ef5427fc9e (patch) | |
tree | 6a9acf54dc1b3b95d873b48d5d292f72e6cdcf07 /src/graphics.h | |
parent | b0867dde000892f1aab803bf7d06a51d799baf43 (diff) | |
download | mana-141975cfd22b21403383ea5213cb85ef5427fc9e.tar.gz mana-141975cfd22b21403383ea5213cb85ef5427fc9e.tar.bz2 mana-141975cfd22b21403383ea5213cb85ef5427fc9e.tar.xz mana-141975cfd22b21403383ea5213cb85ef5427fc9e.zip |
Semi-separated OpenGL and SDL graphics classes, improving OpenGL performance.
Diffstat (limited to 'src/graphics.h')
-rw-r--r-- | src/graphics.h | 52 |
1 files changed, 7 insertions, 45 deletions
diff --git a/src/graphics.h b/src/graphics.h index a3b4aab3..f62662f7 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -25,9 +25,6 @@ #define _GRAPHICS_H #include <guichan/sdl/sdlgraphics.hpp> -#ifdef USE_OPENGL -#include <guichan/opengl/openglgraphics.hpp> -#endif #include "guichanfwd.h" @@ -39,30 +36,22 @@ class SDL_Surface; /** * A central point of control for graphics. */ -class Graphics : -#ifdef USE_OPENGL -public gcn::OpenGLGraphics, -#endif -public gcn::SDLGraphics { +class Graphics : public gcn::SDLGraphics { public: /** * Constructor. */ -#ifdef USE_OPENGL - Graphics(bool useOpenGL); -#else Graphics(); -#endif /** * Destructor. */ - ~Graphics(); + virtual ~Graphics(); /** * Try to create a window with the given settings. */ - bool setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel); + virtual bool setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel); /** * Set fullscreen mode. @@ -83,9 +72,9 @@ public gcn::SDLGraphics { * @return <code>true</code> if the image was blitted properly * <code>false</code> otherwise. */ - bool drawImage(Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height); + virtual bool drawImage(Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height); - void drawImagePattern(Image *image, int x, int y, int w, int h); + virtual void drawImagePattern(Image *image, int x, int y, int w, int h); /** * Draws a rectangle using images. 4 corner images, 4 side images and 1 @@ -111,7 +100,7 @@ public gcn::SDLGraphics { * Updates the screen. This is done by either copying the buffer to the * screen or swapping pages. */ - void updateScreen(); + virtual void updateScreen(); /** * Returns the width of the screen. @@ -123,36 +112,9 @@ public gcn::SDLGraphics { */ int getHeight(); - /* - * Wrapper functions to delegate calls to the right base-class when we - * compile with OpenGL support and thus have two gcn::Graphics - * base-classes. - */ -#ifdef USE_OPENGL - void _beginDraw(); - void _endDraw(); - - void setFont(gcn::ImageFont *font); - - void drawText(const std::string &text, - int x, - int y, - unsigned int alignment); - - void setColor(gcn::Color color); - - void popClipArea(); - bool pushClipArea(gcn::Rectangle area); - - void fillRectangle(const gcn::Rectangle &rectangle); -#endif - - private: + protected: SDL_Surface *mScreen; bool mFullscreen, mHWAccel; -#ifdef USE_OPENGL - bool useOpenGL; -#endif }; #endif |