removal of ZE_main, and addition of some new features to Image,Font and Sound tests

This commit is contained in:
James Turk 2003-09-24 02:05:56 +00:00
parent 1000addea2
commit ad4cfb7c7f
8 changed files with 41 additions and 27 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.15 2003/09/09 02:45:58 cozman Exp $*/ /*$Id: ZFontTest.cpp,v 1.16 2003/09/24 02:05:56 cozman Exp $*/
#include <ZEngine.h> #include <ZEngine.h>
#include <string> #include <string>
@ -42,7 +42,9 @@ void Test()
//Open and Setup all the Fonts and Create Images// //Open and Setup all the Fonts and Create Images//
ZImage text[6]; ZImage text[6];
ZFont almonte("data/almontew.ttf",48), axaxax("data/axaxax.ttf",32), betsy("data/betsy.ttf",64); ZFont almonte("data/almontew.ttf",48), axaxax("data/axaxax.ttf",32), betsy;//("data/betsy.ttf",64);
betsy.OpenFromZip("data/data.zip","betsy.ttf",20);
betsy.Resize(64);
almonte.SetColor(255,0,0,128); almonte.SetColor(255,0,0,128);
almonte.DrawText("This is the font test.",text[0]); almonte.DrawText("This is the font test.",text[0]);
axaxax.SetColor(0,255,255); axaxax.SetColor(0,255,255);
@ -77,9 +79,10 @@ void Test()
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request } while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
} }
int ZE_main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if(Initialize()) if(Initialize())
Test(); Test();
ZEngine::ReleaseInstance();
return 0; return 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: ZImageTest.cpp,v 1.24 2003/09/09 02:45:58 cozman Exp $*/ /*$Id: ZImageTest.cpp,v 1.25 2003/09/24 02:05:56 cozman Exp $*/
#include <ZEngine.h> #include <ZEngine.h>
#include <string> #include <string>
@ -41,9 +41,9 @@ 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; Uint8 alpha=128,alphaDelta=1;
SDL_Surface *temp;
//Open and Setup all the Images// //Open and Setup all the Images//
SDL_Surface *temp;
ZImage image1,image2,image3,image4,textImage; ZImage image1,image2,image3,image4,textImage;
ZFont font("data/almontew.ttf",30); ZFont font("data/almontew.ttf",30);
ZRect clipRect(400,300,30,30); ZRect clipRect(400,300,30,30);
@ -51,14 +51,14 @@ void Test()
font.SetColor(0,255,0); font.SetColor(0,255,0);
font.SetBGColor(0,0,255); font.SetBGColor(0,0,255);
temp = SDL_LoadBMP("data/test02.bmp"); //this is a separate surface temp = SDL_LoadBMP("data/rainbow.bmp"); //this is a separate surface
image1.Attach(temp); //this attaches the surface into itself image1.OpenFromZip("data/data.zip","test02.bmp");
image2.Open("data/test01.bmp");
image3.OpenFromImage(image2.Surface(),5,5,20,20);
image4.Open("data/test02.bmp");
temp = NULL; //and temp will now be controlled and freed by image1
image1.SetColorKey(255,0,255); image1.SetColorKey(255,0,255);
image2.Open("data/test01.bmp");
image2.SetColorKey(255,0,255); image2.SetColorKey(255,0,255);
image3.OpenFromImage(image2.Surface(),5,5,20,20);
image4.Attach(temp); //this attaches the surface into itself
#if (GFX_BACKEND == ZE_OGL) #if (GFX_BACKEND == ZE_OGL)
image4.Resize(400,300); image4.Resize(400,300);
image4.Flip(true,false); image4.Flip(true,false);
@ -134,9 +134,12 @@ void Test()
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request } while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
} }
int ZE_main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
//atexit(ZEngine::ReleaseInstance);
if(Initialize()) if(Initialize())
Test(); Test();
ZImage img("data/test01.bmp");
ZEngine::ReleaseInstance();
return 0; return 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.16 2003/09/09 02:45:58 cozman Exp $*/ /*$Id: ZMouseTest.cpp,v 1.17 2003/09/24 02:05:56 cozman Exp $*/
#include <ZEngine.h> #include <ZEngine.h>
#include <string> #include <string>
@ -87,9 +87,10 @@ void Test()
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request } while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
} }
int ZE_main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if(Initialize()) if(Initialize())
Test(); Test();
ZEngine::ReleaseInstance();
return 0; return 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: ZMusicTest.cpp,v 1.17 2003/09/09 02:45:58 cozman Exp $*/ /*$Id: ZMusicTest.cpp,v 1.18 2003/09/24 02:05:56 cozman Exp $*/
#include <ZEngine.h> #include <ZEngine.h>
#include <string> #include <string>
@ -103,9 +103,10 @@ void Test()
} }
} }
int ZE_main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if(Initialize()) if(Initialize())
Test(); Test();
ZEngine::ReleaseInstance();
return 0; return 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: ZParticleTest.cpp,v 1.5 2003/09/09 02:45:58 cozman Exp $*/ /*$Id: ZParticleTest.cpp,v 1.6 2003/09/24 02:05:56 cozman Exp $*/
#include <ZEngine.h> #include <ZEngine.h>
#include <string> #include <string>
@ -147,9 +147,10 @@ void Test()
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request } while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
} }
int ZE_main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if(Initialize()) if(Initialize())
Test(); Test();
ZEngine::ReleaseInstance();
return 0; return 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: ZRectTest.cpp,v 1.18 2003/09/09 02:45:58 cozman Exp $*/ /*$Id: ZRectTest.cpp,v 1.19 2003/09/24 02:05:56 cozman Exp $*/
#include <ZEngine.h> #include <ZEngine.h>
#include <string> #include <string>
@ -82,9 +82,10 @@ void Test()
} while(!engine->QuitRequested()); } while(!engine->QuitRequested());
} }
int ZE_main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if(Initialize()) if(Initialize())
Test(); Test();
ZEngine::ReleaseInstance();
return 0; return 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: ZSoundTest.cpp,v 1.16 2003/09/09 02:45:58 cozman Exp $*/ /*$Id: ZSoundTest.cpp,v 1.17 2003/09/24 02:05:56 cozman Exp $*/
#include <ZEngine.h> #include <ZEngine.h>
#include <string> #include <string>
@ -46,8 +46,10 @@ void Test()
ZImage text[6]; ZImage text[6];
int sampleNum = 0; int sampleNum = 0;
for(int i=0; i < 5; i++) for(int i=0; i < 4; i++)
sample[i].Open(FormatStr("data/%s.wav",name[i].c_str())); sample[i].OpenFromZip("data/data.zip",FormatStr("%s.wav",name[i].c_str()));
sample[i].Open("data/whip.wav");
font.DrawText("(P)ause\t(U)npause",text[0]); font.DrawText("(P)ause\t(U)npause",text[0]);
font.DrawText("(F)ade Out\t(H)alt\t",text[1]); font.DrawText("(F)ade Out\t(H)alt\t",text[1]);
@ -99,9 +101,10 @@ void Test()
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request } while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
} }
int ZE_main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if(Initialize()) if(Initialize())
Test(); Test();
ZEngine::ReleaseInstance();
return 0; return 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: ZTimerTest.cpp,v 1.16 2003/09/09 02:45:58 cozman Exp $*/ /*$Id: ZTimerTest.cpp,v 1.17 2003/09/24 02:05:56 cozman Exp $*/
#include <ZEngine.h> #include <ZEngine.h>
#include <string> #include <string>
@ -117,9 +117,10 @@ void Test()
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request } while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
} }
int ZE_main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if(Initialize()) if(Initialize())
Test(); Test();
ZEngine::ReleaseInstance();
return 0; return 0;
} }