diff --git a/include/ZE_Defines.h b/include/ZE_Defines.h
index 293f9a8..1cff3e4 100644
--- a/include/ZE_Defines.h
+++ b/include/ZE_Defines.h
@@ -22,20 +22,14 @@
//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. */
-};
+//! OpenGL 2D Rendering Target.
+#define ZE_OGL (1)
+//! SDL Rendering Target.
+#define ZE_SDL (2)
+//! Define the graphics backend for ZEngine to use. (Options are ZE_OGL,ZE_SDL,ZE_D3D)
+#define GFX_BACKEND (ZE_SDL)
-//! 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 542b1c0..5844df9 100644
--- a/include/ZE_Includes.h
+++ b/include/ZE_Includes.h
@@ -24,7 +24,7 @@
#include "ZE_Defines.h"
#include "SDL.h"
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
#include "SDL_opengl.h"
#include "external/SDLGL_Util.h"
#endif
diff --git a/include/ZE_ZEngine.h b/include/ZE_ZEngine.h
index 5707684..0012f21 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.45 2003/08/01 21:57:32 cozman Exp $
+
$Id: ZE_ZEngine.h,v 1.46 2003/08/02 01:18:45 cozman Exp $
\author James Turk
**/
@@ -240,7 +240,7 @@ class ZEngine
**/
void Clear(Uint8 red=0, Uint8 green=0, Uint8 blue=0, Uint8 alpha=255);
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
/////////////////////////////
//OpenGL Specific Functions//
/////////////////////////////
diff --git a/include/ZE_ZImage.h b/include/ZE_ZImage.h
index a6fb796..9e7fbee 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.20 2003/08/01 21:57:32 cozman Exp $
+
$Id: ZE_ZImage.h,v 1.21 2003/08/02 01:18:45 cozman Exp $
\author James Turk
**/
@@ -39,7 +39,7 @@ class ZImage
SDL_Surface *rImage;
//! Stored alpha value for drawing texture.
Uint8 rAlpha;
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
//! Texture lower X, used internally for flip.
GLfloat rTexMinX;
//! Texture lower Y, used internally for flip
@@ -214,7 +214,7 @@ class ZImage
**/
void Draw(int x, int y) const;
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
/*!
\brief Draw Image to Screen.
diff --git a/include/ZE_ZSimpleParticleSystem.h b/include/ZE_ZSimpleParticleSystem.h
index 52f2a8d..3656e9a 100755
--- a/include/ZE_ZSimpleParticleSystem.h
+++ b/include/ZE_ZSimpleParticleSystem.h
@@ -14,7 +14,7 @@
Definition and implementation file for ZEngine simple particle system, ZSimpleParticleSystem based on ZBaseParticleSystem.
Due to problems with template classes the template implementation needs to be in the same file as the declaration.
-
$Id: ZE_ZSimpleParticleSystem.h,v 1.3 2003/07/10 23:45:09 cozman Exp $
+
$Id: ZE_ZSimpleParticleSystem.h,v 1.4 2003/08/02 01:18:45 cozman Exp $
\author James Turk
**/
@@ -283,6 +283,8 @@ void ZSimpleParticleSystem::UpdateParticle(int index, float elapse
rParticles[index].energy = 0;
}
+#if (GFX_BACKEND == ZE_OGL)
+
template
void ZSimpleParticleSystem::Render()
{
@@ -332,6 +334,36 @@ void ZSimpleParticleSystem::Render()
}
}
+#elif (GFX_BACKEND == ZE_SDL)
+
+template
+void ZSimpleParticleSystem::Render()
+{
+ switch(rStyle)
+ {
+ case DS_POINT:
+ for(unsigned int i=0; i < rCurParticles; i++)
+ {
+ //draw point
+ }
+ break;
+ case DS_LINE:
+ for(unsigned int i=0; i < rCurParticles; i++)
+ {
+ //draw line
+ }
+ break;
+ case DS_IMAGE:
+ for(unsigned int i=0; i < rCurParticles; i++)
+ {
+ //draw image
+ }
+ break;
+ }
+}
+
+#endif //GFX_BACKEND
+
template
void ZSimpleParticleSystem::ReloadImage()
{
diff --git a/include/external/SDLGL_Util.h b/include/external/SDLGL_Util.h
index 36c896a..dafa571 100755
--- a/include/external/SDLGL_Util.h
+++ b/include/external/SDLGL_Util.h
@@ -6,7 +6,7 @@
#include "ZE_Includes.h"
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
int power_of_two(int input);
GLuint SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord);
#endif
diff --git a/src/ZE_ZEngine.cpp b/src/ZE_ZEngine.cpp
index 00c7a34..6377371 100644
--- a/src/ZE_ZEngine.cpp
+++ b/src/ZE_ZEngine.cpp
@@ -13,7 +13,7 @@
\brief Central source file for ZEngine.
Actual implementation of ZEngine singleton class, the core of ZEngine.
-
$Id: ZE_ZEngine.cpp,v 1.54 2003/08/01 21:56:58 cozman Exp $
+
$Id: ZE_ZEngine.cpp,v 1.55 2003/08/02 01:18:45 cozman Exp $
\author James Turk
**/
@@ -84,7 +84,7 @@ bool ZEngine::CreateDisplay(std::string title, std::string icon)
SDL_Surface *iconImg;
bool status=true; //status of setup, only true if everything went flawless
int bpp;
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
int rgb_size[3];
#endif
@@ -136,7 +136,7 @@ bool ZEngine::CreateDisplay(std::string title, std::string icon)
}
}
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
//buffer sizes
switch (mBPP)
{
@@ -171,7 +171,7 @@ bool ZEngine::CreateDisplay(std::string title, std::string icon)
SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, 0);
flags |= SDL_OPENGL;
-#elif GFX_BACKEND == SDL
+#elif (GFX_BACKEND == ZE_SDL)
flags |= SDL_DOUBLEBUF;
#endif //GFX_BACKEND
@@ -208,7 +208,7 @@ bool ZEngine::CreateDisplay(std::string title, std::string icon)
mHeight = mScreen->h;
mBPP = mScreen->format->BitsPerPixel;
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
SetGL2D();
#endif
@@ -304,9 +304,9 @@ SDL_Surface *ZEngine::Display()
void ZEngine::Update()
{
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
SDL_GL_SwapBuffers();
-#elif GFX_BACKEND == SDL
+#elif (GFX_BACKEND == ZE_SDL)
SDL_Flip(mScreen);
#endif
@@ -323,7 +323,7 @@ void ZEngine::Update()
}
}
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
void ZEngine::Clear(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha)
{
@@ -359,7 +359,7 @@ void ZEngine::SetGL2D()
glLoadIdentity();
}
-#elif GFX_BACKEND == SDL
+#elif (GFX_BACKEND == ZE_SDL)
void ZEngine::Clear(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha)
{
diff --git a/src/ZE_ZImage.cpp b/src/ZE_ZImage.cpp
index 012a3ed..d28a342 100644
--- a/src/ZE_ZImage.cpp
+++ b/src/ZE_ZImage.cpp
@@ -13,7 +13,7 @@
\brief Source file for ZImage.
Implementation of ZImage, the Image class for ZEngine.
-
$Id: ZE_ZImage.cpp,v 1.38 2003/08/01 21:56:58 cozman Exp $
+
$Id: ZE_ZImage.cpp,v 1.39 2003/08/02 01:18:45 cozman Exp $
\author James Turk
**/
@@ -116,7 +116,7 @@ void ZImage::OpenFromImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint
OpenFromImage(img.Surface(),x,y,w,h);
}
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
//attach is really the core of ZImage, everything calls it, it converts SDL_Surface->OpenGL Texture->ZImage
void ZImage::Attach(SDL_Surface *surface)
@@ -292,7 +292,7 @@ bool ZImage::IsLoaded() const
return glIsTexture(rTexID) == GL_TRUE;
}
-#elif GFX_BACKEND == SDL
+#elif (GFX_BACKEND == ZE_SDL)
void ZImage::Attach(SDL_Surface *surface)
{
diff --git a/src/ZE_ZRect.cpp b/src/ZE_ZRect.cpp
index a347fa1..f23e6d5 100644
--- a/src/ZE_ZRect.cpp
+++ b/src/ZE_ZRect.cpp
@@ -13,7 +13,7 @@
\brief Source file for ZRect.
Implementation of ZRect, the Rectangle class for ZEngine.
-
$Id: ZE_ZRect.cpp,v 1.13 2003/08/01 21:56:58 cozman Exp $
+
$Id: ZE_ZRect.cpp,v 1.14 2003/08/02 01:18:45 cozman Exp $
\author James Turk
**/
@@ -100,7 +100,7 @@ bool ZRect::operator<(const ZRect &rhs) const
void ZRect::Draw(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha) const
{
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
glBindTexture(GL_TEXTURE_2D,0); //reset to blank texture
glColor4ub(red,green,blue,alpha);
glBegin(GL_QUADS);
@@ -110,7 +110,7 @@ void ZRect::Draw(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha) const
glVertex2f(rX, rY+rHeight);
glEnd();
glColor4ub(255,255,255,255); //restore color setting
-#elif GFX_BACKEND == SDL
+#elif (GFX_BACKEND == ZE_SDL)
SDL_Rect rect = SDLrect();
SDL_FillRect(rEngine->Display(), &rect, SDL_MapRGBA(rEngine->Display()->format,red,green,blue,alpha));
#endif //GFX_BACKEND
diff --git a/src/external/SDLGL_Util.cpp b/src/external/SDLGL_Util.cpp
index 4550eb0..f794dc0 100755
--- a/src/external/SDLGL_Util.cpp
+++ b/src/external/SDLGL_Util.cpp
@@ -4,7 +4,7 @@
#include "external/SDLGL_Util.h"
-#if GFX_BACKEND == OGL
+#if (GFX_BACKEND == ZE_OGL)
//finds nearest power of two (going up), needed for surfaces
int power_of_two(int input)
diff --git a/test/ZFontTest.cpp b/test/ZFontTest.cpp
index e954c2b..52ae25e 100644
--- a/test/ZFontTest.cpp
+++ b/test/ZFontTest.cpp
@@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
and the home of this Library is http://www.zengine.sourceforge.net
*******************************************************************************/
-/*$Id: ZFontTest.cpp,v 1.13 2003/07/10 20:45:39 cozman Exp $*/
+/*$Id: ZFontTest.cpp,v 1.14 2003/08/02 01:18:45 cozman Exp $*/
#include
#include
@@ -70,7 +70,7 @@ void Test()
engine->Clear(); //clear screen
//draw the images//
for(int i=0; i <= 5; i++)
- text[i].Draw(10.0f*i,50.0f*i);
+ text[i].Draw(10*i,50*i);
engine->Update(); //update the screen
}
diff --git a/test/ZImageTest.cpp b/test/ZImageTest.cpp
index ec7cfc6..d848657 100644
--- a/test/ZImageTest.cpp
+++ b/test/ZImageTest.cpp
@@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
and the home of this Library is http://www.zengine.sourceforge.net
*******************************************************************************/
-/*$Id: ZImageTest.cpp,v 1.19 2003/07/10 20:45:39 cozman Exp $*/
+/*$Id: ZImageTest.cpp,v 1.20 2003/08/02 01:18:45 cozman Exp $*/
#include
#include
@@ -91,9 +91,13 @@ void Test()
image1.SetAlpha(alpha);
image1.Draw(0,0);
+#if (GFX_BACKEND == ZE_OGL)
image2.DrawRotated(100,0,angle);
if(++angle > 360)
angle = 0.0f;
+#elif (GFX_BACKEND == ZE_SDL)
+ image2.Draw(100,0);
+#endif
image3.Draw(200,0);
textImage.Draw(0,100);
diff --git a/test/ZParticleTest.cpp b/test/ZParticleTest.cpp
index 8d973bc..11013f5 100755
--- a/test/ZParticleTest.cpp
+++ b/test/ZParticleTest.cpp
@@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
and the home of this Library is http://www.zengine.sourceforge.net
*******************************************************************************/
-/*$Id: ZParticleTest.cpp,v 1.2 2003/07/11 20:51:45 cozman Exp $*/
+/*$Id: ZParticleTest.cpp,v 1.3 2003/08/02 01:18:45 cozman Exp $*/
#include
#include
@@ -76,7 +76,7 @@ void Test()
effect[2].SetImage("data/particle2.tga");
bg.Open("data/rainbow.bmp");
- bg.Resize(engine->DisplayWidth()/2,engine->DisplayHeight()); //gives perspective on alpha on half of screen
+ //bg.Resize(engine->DisplayWidth()/2,engine->DisplayHeight()); //gives perspective on alpha on half of screen
font.DrawText("(P)ause (U)npause (C)lear",text[0]);
font.DrawText("1-3 : Change System Being Controlled",text[1]);