From 50c360746b46a76d881c5ae076223c6a6d10f54d Mon Sep 17 00:00:00 2001
From: James Turk <james.p.turk@gmail.com>
Date: Tue, 21 Oct 2003 01:17:35 +0000
Subject: [PATCH] changed tests to use new CreateDisplay

---
 test/ZFontTest.cpp     |  6 ++----
 test/ZImageTest.cpp    | 19 ++++++++++---------
 test/ZMouseTest.cpp    |  6 ++----
 test/ZMusicTest.cpp    |  9 +++------
 test/ZParticleTest.cpp |  6 ++----
 test/ZRectTest.cpp     |  6 ++----
 test/ZSoundTest.cpp    |  6 ++----
 test/ZTimerTest.cpp    |  6 ++----
 8 files changed, 25 insertions(+), 39 deletions(-)

diff --git a/test/ZFontTest.cpp b/test/ZFontTest.cpp
index 6f0e98a..21747d6 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.16 2003/09/24 02:05:56 cozman Exp $*/
+/*$Id: ZFontTest.cpp,v 1.17 2003/10/21 01:17:35 cozman Exp $*/
 
 #include <ZEngine.h>
 #include <string> 
@@ -31,9 +31,7 @@ bool Initialize()
     title = cfg.GetString("ZFontTest","title","ZFont Test");
     rate = cfg.GetInt("ZFontTest","framerate",60);
 
-    engine->SetupDisplay(w,h,bpp,fs);
-    engine->SetDesiredFramerate(rate);
-    return engine->CreateDisplay(title);
+    return engine->CreateDisplay(w,h,bpp,fs,title);
 }
 
 void Test()
diff --git a/test/ZImageTest.cpp b/test/ZImageTest.cpp
index 80bfdd4..157141a 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.25 2003/09/24 02:05:56 cozman Exp $*/
+/*$Id: ZImageTest.cpp,v 1.26 2003/10/21 01:17:35 cozman Exp $*/
 
 #include <ZEngine.h>
 #include <string> 
@@ -31,16 +31,15 @@ bool Initialize()
     title = cfg.GetString("ZImageTest","title","ZImage Test");
     rate = cfg.GetInt("ZImageTest","framerate",60);
 
-    engine->SetupDisplay(w,h,bpp,fs);
     engine->SetDesiredFramerate(rate);
-    return engine->CreateDisplay(title);
+    return engine->CreateDisplay(w,h,bpp,fs,title);
 }
 
 void Test()
 {
     ZEngine *engine = ZEngine::GetInstance();
     float angle=0.0f,movDelta;
-    Uint8 alpha=128,alphaDelta=1;
+    float alpha=128.0f,alphaDelta=15.0f;
     SDL_Surface *temp;
 
     //Open and Setup all the Images//
@@ -77,6 +76,7 @@ void Test()
                 image1.Reload();
                 image2.Reload();
                 image3.Reload();
+                image4.Reload();
                 textImage.Reload();
                 engine->SetReloadNeed(false);   //very important for speed, without this you'd be reloading every frame
             }
@@ -109,15 +109,16 @@ void Test()
 
             engine->Clear();    //clear screen
             //draw the images//
-            alpha += alphaDelta;
-            if(alpha == 255 || alpha == 0)
-                alphaDelta *= -1;
-            image1.SetAlpha(alpha);
+            alpha += alphaDelta*engine->GetFrameTime();
+            if(alpha >= 255 || alpha <= 0)
+                alphaDelta *= -1.0f;
+            image1.SetAlpha(static_cast<Uint8>(alpha));
             image1.Draw(0,0);
 
 #if (GFX_BACKEND == ZE_OGL)
             image2.DrawRotated(100,0,angle);
-            if(++angle > 360)
+            angle+=(150*engine->GetFrameTime());
+            if(angle > 360)
                 angle = 0.0f;
 #elif (GFX_BACKEND == ZE_SDL)
             image2.Draw(100,0);
diff --git a/test/ZMouseTest.cpp b/test/ZMouseTest.cpp
index dbf6385..6f4d5f8 100644
--- a/test/ZMouseTest.cpp
+++ b/test/ZMouseTest.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: ZMouseTest.cpp,v 1.18 2003/10/05 19:46:04 cozman Exp $*/
+/*$Id: ZMouseTest.cpp,v 1.19 2003/10/21 01:17:35 cozman Exp $*/
 
 #include <ZEngine.h>
 #include <string> 
@@ -31,9 +31,7 @@ bool Initialize()
     title = cfg.GetString("ZMouseTest","title","ZMouse Test");
     rate = cfg.GetInt("ZMouseTest","framerate",60);
 
-    engine->SetupDisplay(w,h,bpp,fs);
-    engine->SetDesiredFramerate(rate);
-    return engine->CreateDisplay(title);
+    return engine->CreateDisplay(w,h,bpp,fs,title);
 }
 
 void Test()
diff --git a/test/ZMusicTest.cpp b/test/ZMusicTest.cpp
index 7fb5552..3e19b29 100644
--- a/test/ZMusicTest.cpp
+++ b/test/ZMusicTest.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: ZMusicTest.cpp,v 1.18 2003/09/24 02:05:56 cozman Exp $*/
+/*$Id: ZMusicTest.cpp,v 1.19 2003/10/21 01:17:35 cozman Exp $*/
 
 #include <ZEngine.h>
 #include <string> 
@@ -31,9 +31,7 @@ bool Initialize()
     title = cfg.GetString("ZMusicTest","title","ZMusic Test");
     rate = cfg.GetInt("ZMusicTest","framerate",60);
 
-    engine->SetupDisplay(w,h,bpp,fs);
-    engine->SetDesiredFramerate(rate);
-    return engine->CreateDisplay(title);
+    return engine->CreateDisplay(w,h,bpp,fs,title);
 }
 
 void Test()
@@ -47,8 +45,7 @@ void Test()
     if(!song.IsLoaded())    //this executes if there is no music.ogg file
     {
         engine->Clear();
-        engine->SetupDisplay(800,70,32,false);
-        engine->CreateDisplay("ZMusic Test");
+        engine->CreateDisplay(800,70,32,false,"ZMusic Test");
         font.DrawText("Music.ogg does not exist, please read music.txt.",text[0]);
         text[0].Draw(0,0);
         engine->Update();
diff --git a/test/ZParticleTest.cpp b/test/ZParticleTest.cpp
index 09a5b8b..51b5669 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.6 2003/09/24 02:05:56 cozman Exp $*/
+/*$Id: ZParticleTest.cpp,v 1.7 2003/10/21 01:17:35 cozman Exp $*/
 
 #include <ZEngine.h>
 #include <string> 
@@ -31,9 +31,7 @@ bool Initialize()
     title = cfg.GetString("ZParticleTest","title","ZParticle Test");
     rate = cfg.GetInt("ZParticleTest","framerate",60);
 
-    engine->SetupDisplay(w,h,bpp,fs);
-    engine->SetDesiredFramerate(rate);
-    return engine->CreateDisplay(title);
+    return engine->CreateDisplay(w,h,bpp,fs,title);
 }
 
 
diff --git a/test/ZRectTest.cpp b/test/ZRectTest.cpp
index f181835..1f014d4 100644
--- a/test/ZRectTest.cpp
+++ b/test/ZRectTest.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: ZRectTest.cpp,v 1.19 2003/09/24 02:05:56 cozman Exp $*/
+/*$Id: ZRectTest.cpp,v 1.20 2003/10/21 01:17:35 cozman Exp $*/
 
 #include <ZEngine.h>
 #include <string> 
@@ -31,9 +31,7 @@ bool Initialize()
     title = cfg.GetString("ZRectTest","title","ZRect Test");
     rate = cfg.GetInt("ZRectTest","framerate",60);
 
-    engine->SetupDisplay(w,h,bpp,fs);
-    engine->SetDesiredFramerate(rate);
-    return engine->CreateDisplay(title);
+    return engine->CreateDisplay(w,h,bpp,fs,title);
 }
 
 void Test()
diff --git a/test/ZSoundTest.cpp b/test/ZSoundTest.cpp
index 660a943..8bd11c5 100644
--- a/test/ZSoundTest.cpp
+++ b/test/ZSoundTest.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: ZSoundTest.cpp,v 1.18 2003/10/05 19:20:52 cozman Exp $*/
+/*$Id: ZSoundTest.cpp,v 1.19 2003/10/21 01:17:35 cozman Exp $*/
 
 #include <ZEngine.h>
 #include <string> 
@@ -31,9 +31,7 @@ bool Initialize()
     title = cfg.GetString("ZSoundTest","title","ZSound Test");
     rate = cfg.GetInt("ZSoundTest","framerate",60);
 
-    engine->SetupDisplay(w,h,bpp,fs);
-    engine->SetDesiredFramerate(rate);
-    return engine->CreateDisplay(title);
+    return engine->CreateDisplay(w,h,bpp,fs,title);
 }
 
 void Test()
diff --git a/test/ZTimerTest.cpp b/test/ZTimerTest.cpp
index 69f232c..abf5279 100644
--- a/test/ZTimerTest.cpp
+++ b/test/ZTimerTest.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: ZTimerTest.cpp,v 1.17 2003/09/24 02:05:56 cozman Exp $*/
+/*$Id: ZTimerTest.cpp,v 1.18 2003/10/21 01:17:35 cozman Exp $*/
 
 #include <ZEngine.h>
 #include <string> 
@@ -31,9 +31,7 @@ bool Initialize()
     title = cfg.GetString("ZTimerTest","title","ZTimer Test");
     rate = cfg.GetInt("ZTimerTest","framerate",60);
 
-    engine->SetupDisplay(w,h,bpp,fs);
-    engine->SetDesiredFramerate(rate);
-    return engine->CreateDisplay(title);
+    return engine->CreateDisplay(w,h,bpp,fs,title);
 }
 
 void Test()