diff --git a/include/ZE_Defines.h b/include/ZE_Defines.h
index c795132..293f9a8 100644
--- a/include/ZE_Defines.h
+++ b/include/ZE_Defines.h
@@ -22,6 +22,20 @@
//Defines- undefine any of these if you dont have the indicated SDL extension//
+/*!
+ \brief Defines for graphics backend selection.
+
+ Various graphics backends, default is OpenGL, but to port to systems with SDL but no OpenGL
+ use of SDL is possible. .
+**/
+enum GFXBackend
+{
+ OGL, /*!< OpenGL 2D Rendering Target. */
+ SDL /*!< SDL Rendering Target. */
+};
+
+//! Define the graphics backend for ZEngine to use. (Options are OGL,SDL,DX)
+#define GFX_BACKEND OGL
//! Define to include font support.
#define USE_SDL_TTF
//! Define to include non-bmp image file support.
diff --git a/include/ZE_Includes.h b/include/ZE_Includes.h
index 34ee62b..542b1c0 100644
--- a/include/ZE_Includes.h
+++ b/include/ZE_Includes.h
@@ -24,8 +24,10 @@
#include "ZE_Defines.h"
#include "SDL.h"
+#if GFX_BACKEND == OGL
#include "SDL_opengl.h"
#include "external/SDLGL_Util.h"
+#endif
#ifdef USE_SDL_IMAGE
#include "SDL_image.h"
#endif
diff --git a/include/ZE_ZEngine.h b/include/ZE_ZEngine.h
index 2e1a3f4..5707684 100644
--- a/include/ZE_ZEngine.h
+++ b/include/ZE_ZEngine.h
@@ -13,7 +13,7 @@
\brief Definition file for core ZEngine class.
ZEngine Game Engine core Engine definition.
-
$Id: ZE_ZEngine.h,v 1.44 2003/07/12 01:25:42 cozman Exp $
+
$Id: ZE_ZEngine.h,v 1.45 2003/08/01 21:57:32 cozman Exp $
\author James Turk
**/
@@ -233,13 +233,14 @@ class ZEngine
\brief Clear screen to a certain color (Black by default).
Clears a rectangle on screen to a color, defaults to solid black.
- \param red Red component (0.0-1.0) of new color.
- \param green Green component (0.0-1.0) of new color.
- \param blue Blue component (0.0-1.0) of new color.
- \param alpha Alpha component (0.0-1.0) of new color.
+ \param red Red component (0-255) of new color.
+ \param green Green component (0-255) of new color.
+ \param blue Blue component (0-255) of new color.
+ \param alpha Alpha component (0-255) of new color.
**/
- void Clear(float red=0.0f, float green=0.0f, float blue=0.0f, float alpha=1.0f);
+ void Clear(Uint8 red=0, Uint8 green=0, Uint8 blue=0, Uint8 alpha=255);
+#if GFX_BACKEND == OGL
/////////////////////////////
//OpenGL Specific Functions//
/////////////////////////////
@@ -251,6 +252,7 @@ class ZEngine
unless you change the OpenGL mode manually.
**/
void SetGL2D();
+#endif //GFX_BACKEND
////////////////////////////////////////////
//Timer and Framerate Independent Movement//
diff --git a/include/ZE_ZImage.h b/include/ZE_ZImage.h
index 84b2f56..a6fb796 100644
--- a/include/ZE_ZImage.h
+++ b/include/ZE_ZImage.h
@@ -13,7 +13,7 @@
\brief Definition file for ZImage.
Definition file for ZImage, the OpenGL version of the ZImage class for ZEngine.
-
$Id: ZE_ZImage.h,v 1.19 2003/06/11 00:15:26 cozman Exp $
+
$Id: ZE_ZImage.h,v 1.20 2003/08/01 21:57:32 cozman Exp $
\author James Turk
**/
@@ -35,6 +35,11 @@ class ZImage
protected:
//! Pointer to ZEngine Object
ZEngine* rEngine;
+ //! Stored texture.
+ SDL_Surface *rImage;
+ //! Stored alpha value for drawing texture.
+ Uint8 rAlpha;
+#if GFX_BACKEND == OGL
//! Texture lower X, used internally for flip.
GLfloat rTexMinX;
//! Texture lower Y, used internally for flip
@@ -43,16 +48,13 @@ class ZImage
GLfloat rTexMaxX;
//! Texture Y width ratio, used internally by OpenGL.
GLfloat rTexMaxY;
- //! Stored texture for future use.
- SDL_Surface *rImage;
//! Texture ID for OpenGL.
unsigned int rTexID;
//! Current draw width of Texture.
unsigned int rWidth;
//! Current draw height of Texture.
unsigned int rHeight;
- //! Stored alpha value for drawing texture.
- Uint8 rAlpha;
+#endif //GFX_BACKEND == OGL
public:
@@ -203,6 +205,47 @@ class ZImage
**/
void SetColorKey(Uint8 red, Uint8 green, Uint8 blue);
+ /*!
+ \brief Draw Image to Screen.
+
+ Draw Image to screen at specified location.
+ \param x X coord to draw Image to.
+ \param y Y coord to draw Image to.
+ **/
+ void Draw(int x, int y) const;
+
+#if GFX_BACKEND == OGL
+ /*!
+ \brief Draw Image to Screen.
+
+ Draw Image to screen at specified location.
+ \since 0.8.3
+ \param x X coord to draw Image to.
+ \param y Y coord to draw Image to.
+ **/
+ void Draw(float x, float y) const;
+
+ /*!
+ \brief Draw Image rotated to screen.
+
+ Image is rotated about it's own center by specified angle, then drawn to screen.
+ \param x X coord to draw Image to.
+ \param y Y coord to draw Image to.
+ \param angle Angle in degrees to rotate image.
+ **/
+ void DrawRotated(int x, int y, float angle) const;
+
+ /*!
+ \brief Draw Image rotated to screen.
+
+ Image is rotated about it's own center by specified angle, then drawn to screen.
+ \since 0.8.3
+ \param x X coord to draw Image to.
+ \param y Y coord to draw Image to.
+ \param angle Angle in degrees to rotate image.
+ **/
+ void DrawRotated(float x, float y, float angle) const;
+
/*!
\brief Flip image over one or both axes.
@@ -237,46 +280,7 @@ class ZImage
Draw uses this but the average user should never need to call this.
**/
void Bind() const;
-
- /*!
- \brief Draw Image to Screen.
-
- Draw Image to screen at specified location.
- \param x X coord to draw Image to.
- \param y Y coord to draw Image to.
- **/
- void Draw(int x, int y) const;
-
- /*!
- \brief Draw Image to Screen.
-
- Draw Image to screen at specified location.
- \since 0.8.3
- \param x X coord to draw Image to.
- \param y Y coord to draw Image to.
- **/
- void Draw(float x, float y) const;
-
- /*!
- \brief Draw Image rotated to screen.
-
- Image is rotated about it's own center by specified angle, then drawn to screen.
- \param x X coord to draw Image to.
- \param y Y coord to draw Image to.
- \param angle Angle in degrees to rotate image.
- **/
- void DrawRotated(int x, int y, float angle) const;
-
- /*!
- \brief Draw Image rotated to screen.
-
- Image is rotated about it's own center by specified angle, then drawn to screen.
- \since 0.8.3
- \param x X coord to draw Image to.
- \param y Y coord to draw Image to.
- \param angle Angle in degrees to rotate image.
- **/
- void DrawRotated(float x, float y, float angle) const;
+#endif //GFX_BACKEND == OGL
/////////////
//Accessors//
diff --git a/include/ZE_ZRect.h b/include/ZE_ZRect.h
index 16c5208..2cff327 100644
--- a/include/ZE_ZRect.h
+++ b/include/ZE_ZRect.h
@@ -13,7 +13,7 @@
\brief Definition file for ZRect.
Definition file for ZRect, the Rectangle class for ZEngine.
-
$Id: ZE_ZRect.h,v 1.11 2003/05/13 01:30:51 cozman Exp $
+
$Id: ZE_ZRect.h,v 1.12 2003/08/01 21:57:32 cozman Exp $
\author James Turk
**/
@@ -32,7 +32,9 @@ namespace ZE
**/
class ZRect
{
- protected:
+ protected:
+ //! Pointer to ZEngine Object
+ ZEngine* rEngine;
//! X Position of top left corner of rectangle.
float rX;
//! Y Position of top left corner of rectangle.
diff --git a/include/external/SDLGL_Util.h b/include/external/SDLGL_Util.h
index 0921df8..36c896a 100755
--- a/include/external/SDLGL_Util.h
+++ b/include/external/SDLGL_Util.h
@@ -6,7 +6,9 @@
#include "ZE_Includes.h"
+#if GFX_BACKEND == OGL
int power_of_two(int input);
GLuint SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord);
+#endif
#endif //__sdlgl_h__