changed tests to use new CreateDisplay

This commit is contained in:
James Turk 2003-10-21 01:17:35 +00:00
parent 59bc6aa966
commit 50c360746b
8 changed files with 25 additions and 39 deletions

View File

@ -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 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 <ZEngine.h>
#include <string> #include <string>
@ -31,9 +31,7 @@ bool Initialize()
title = cfg.GetString("ZFontTest","title","ZFont Test"); title = cfg.GetString("ZFontTest","title","ZFont Test");
rate = cfg.GetInt("ZFontTest","framerate",60); rate = cfg.GetInt("ZFontTest","framerate",60);
engine->SetupDisplay(w,h,bpp,fs); return engine->CreateDisplay(w,h,bpp,fs,title);
engine->SetDesiredFramerate(rate);
return engine->CreateDisplay(title);
} }
void Test() void Test()

View File

@ -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 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 <ZEngine.h>
#include <string> #include <string>
@ -31,16 +31,15 @@ bool Initialize()
title = cfg.GetString("ZImageTest","title","ZImage Test"); title = cfg.GetString("ZImageTest","title","ZImage Test");
rate = cfg.GetInt("ZImageTest","framerate",60); rate = cfg.GetInt("ZImageTest","framerate",60);
engine->SetupDisplay(w,h,bpp,fs);
engine->SetDesiredFramerate(rate); engine->SetDesiredFramerate(rate);
return engine->CreateDisplay(title); return engine->CreateDisplay(w,h,bpp,fs,title);
} }
void Test() void Test()
{ {
ZEngine *engine = ZEngine::GetInstance(); ZEngine *engine = ZEngine::GetInstance();
float angle=0.0f,movDelta; float angle=0.0f,movDelta;
Uint8 alpha=128,alphaDelta=1; float alpha=128.0f,alphaDelta=15.0f;
SDL_Surface *temp; SDL_Surface *temp;
//Open and Setup all the Images// //Open and Setup all the Images//
@ -77,6 +76,7 @@ void Test()
image1.Reload(); image1.Reload();
image2.Reload(); image2.Reload();
image3.Reload(); image3.Reload();
image4.Reload();
textImage.Reload(); textImage.Reload();
engine->SetReloadNeed(false); //very important for speed, without this you'd be reloading every frame 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 engine->Clear(); //clear screen
//draw the images// //draw the images//
alpha += alphaDelta; alpha += alphaDelta*engine->GetFrameTime();
if(alpha == 255 || alpha == 0) if(alpha >= 255 || alpha <= 0)
alphaDelta *= -1; alphaDelta *= -1.0f;
image1.SetAlpha(alpha); image1.SetAlpha(static_cast<Uint8>(alpha));
image1.Draw(0,0); image1.Draw(0,0);
#if (GFX_BACKEND == ZE_OGL) #if (GFX_BACKEND == ZE_OGL)
image2.DrawRotated(100,0,angle); image2.DrawRotated(100,0,angle);
if(++angle > 360) angle+=(150*engine->GetFrameTime());
if(angle > 360)
angle = 0.0f; angle = 0.0f;
#elif (GFX_BACKEND == ZE_SDL) #elif (GFX_BACKEND == ZE_SDL)
image2.Draw(100,0); image2.Draw(100,0);

View File

@ -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 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 <ZEngine.h>
#include <string> #include <string>
@ -31,9 +31,7 @@ bool Initialize()
title = cfg.GetString("ZMouseTest","title","ZMouse Test"); title = cfg.GetString("ZMouseTest","title","ZMouse Test");
rate = cfg.GetInt("ZMouseTest","framerate",60); rate = cfg.GetInt("ZMouseTest","framerate",60);
engine->SetupDisplay(w,h,bpp,fs); return engine->CreateDisplay(w,h,bpp,fs,title);
engine->SetDesiredFramerate(rate);
return engine->CreateDisplay(title);
} }
void Test() void Test()

View File

@ -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 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 <ZEngine.h>
#include <string> #include <string>
@ -31,9 +31,7 @@ bool Initialize()
title = cfg.GetString("ZMusicTest","title","ZMusic Test"); title = cfg.GetString("ZMusicTest","title","ZMusic Test");
rate = cfg.GetInt("ZMusicTest","framerate",60); rate = cfg.GetInt("ZMusicTest","framerate",60);
engine->SetupDisplay(w,h,bpp,fs); return engine->CreateDisplay(w,h,bpp,fs,title);
engine->SetDesiredFramerate(rate);
return engine->CreateDisplay(title);
} }
void Test() void Test()
@ -47,8 +45,7 @@ void Test()
if(!song.IsLoaded()) //this executes if there is no music.ogg file if(!song.IsLoaded()) //this executes if there is no music.ogg file
{ {
engine->Clear(); engine->Clear();
engine->SetupDisplay(800,70,32,false); engine->CreateDisplay(800,70,32,false,"ZMusic Test");
engine->CreateDisplay("ZMusic Test");
font.DrawText("Music.ogg does not exist, please read music.txt.",text[0]); font.DrawText("Music.ogg does not exist, please read music.txt.",text[0]);
text[0].Draw(0,0); text[0].Draw(0,0);
engine->Update(); engine->Update();

View File

@ -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 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 <ZEngine.h>
#include <string> #include <string>
@ -31,9 +31,7 @@ bool Initialize()
title = cfg.GetString("ZParticleTest","title","ZParticle Test"); title = cfg.GetString("ZParticleTest","title","ZParticle Test");
rate = cfg.GetInt("ZParticleTest","framerate",60); rate = cfg.GetInt("ZParticleTest","framerate",60);
engine->SetupDisplay(w,h,bpp,fs); return engine->CreateDisplay(w,h,bpp,fs,title);
engine->SetDesiredFramerate(rate);
return engine->CreateDisplay(title);
} }

View File

@ -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 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 <ZEngine.h>
#include <string> #include <string>
@ -31,9 +31,7 @@ bool Initialize()
title = cfg.GetString("ZRectTest","title","ZRect Test"); title = cfg.GetString("ZRectTest","title","ZRect Test");
rate = cfg.GetInt("ZRectTest","framerate",60); rate = cfg.GetInt("ZRectTest","framerate",60);
engine->SetupDisplay(w,h,bpp,fs); return engine->CreateDisplay(w,h,bpp,fs,title);
engine->SetDesiredFramerate(rate);
return engine->CreateDisplay(title);
} }
void Test() void Test()

View File

@ -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 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 <ZEngine.h>
#include <string> #include <string>
@ -31,9 +31,7 @@ bool Initialize()
title = cfg.GetString("ZSoundTest","title","ZSound Test"); title = cfg.GetString("ZSoundTest","title","ZSound Test");
rate = cfg.GetInt("ZSoundTest","framerate",60); rate = cfg.GetInt("ZSoundTest","framerate",60);
engine->SetupDisplay(w,h,bpp,fs); return engine->CreateDisplay(w,h,bpp,fs,title);
engine->SetDesiredFramerate(rate);
return engine->CreateDisplay(title);
} }
void Test() void Test()

View File

@ -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 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 <ZEngine.h>
#include <string> #include <string>
@ -31,9 +31,7 @@ bool Initialize()
title = cfg.GetString("ZTimerTest","title","ZTimer Test"); title = cfg.GetString("ZTimerTest","title","ZTimer Test");
rate = cfg.GetInt("ZTimerTest","framerate",60); rate = cfg.GetInt("ZTimerTest","framerate",60);
engine->SetupDisplay(w,h,bpp,fs); return engine->CreateDisplay(w,h,bpp,fs,title);
engine->SetDesiredFramerate(rate);
return engine->CreateDisplay(title);
} }
void Test() void Test()