minor updates, removal of ReleaseInstance, updated license for 2004

This commit is contained in:
James Turk 2003-12-31 12:27:58 +00:00
parent aeb7e39cf2
commit c80671bc1e
9 changed files with 60 additions and 45 deletions

View File

@ -1,6 +1,6 @@
/*******************************************************************************
This file is Part of the ZEngine Library for 2D game development.
Copyright (C) 2002, 2003 James Turk
Copyright (C) 2002-2004 James Turk
ZEngine is Licensed under a BSD-style license.
This example file is in the public domain, it may be used with no restrictions.
@ -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: ZAnimTest.cpp,v 1.1 2003/12/16 00:30:36 cozman Exp $*/
// $Id: ZAnimTest.cpp,v 1.2 2003/12/31 12:27:58 cozman Exp $
#include <ZEngine.h>
#include <string>
@ -36,11 +36,13 @@ bool Initialize()
void Test()
{
ZEngine *engine = ZEngine::GetInstance();
ZFont font("data/axaxax.ttf",20);
ZFont font;
ZImage srcImg,tankImg[8],text[2];
ZAnimation tank[8];
int i;
font.OpenFromZRF("default");
srcImg.OpenFromZip("data/data.zip","tank.bmp");
for(i=0; i < 8; ++i)
tankImg[i].OpenFromImage(srcImg,0,140*i,200,140);
@ -87,6 +89,5 @@ int main(int argc, char *argv[])
{
if(Initialize())
Test();
ZEngine::ReleaseInstance();
return 0;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
This file is Part of the ZEngine Library for 2D game development.
Copyright (C) 2002, 2003 James Turk
Copyright (C) 2002-2004 James Turk
ZEngine is Licensed under a BSD-style license.
This example file is in the public domain, it may be used with no restrictions.
@ -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.19 2003/12/14 22:35:35 cozman Exp $*/
// $Id: ZFontTest.cpp,v 1.20 2003/12/31 12:27:58 cozman Exp $
#include <ZEngine.h>
#include <string>
@ -30,6 +30,8 @@ bool Initialize()
fs = cfg.GetBool("ZFontTest","fullscreen",false);
title = cfg.GetString("ZFontTest","title","ZFont Test");
engine->SetResourceFile("resources.zrf");
return engine->CreateDisplay(w,h,bpp,fs,title);
}
@ -39,9 +41,10 @@ void Test()
//Open and Setup all the Fonts and Create Images//
ZImage text[6];
ZFont almonte("data/almontew.ttf",48), axaxax("data/axaxax.ttf",32), betsy;//("data/betsy.ttf",64);
ZFont almonte, axaxax("data/axaxax.ttf",32), betsy;
almonte.OpenFromZRF("default");
almonte.Resize(48);
betsy.OpenFromZip("data/data.zip","betsy.ttf",20);
betsy.Resize(64);
almonte.SetColor(255,0,0,128);
almonte.DrawText("This is the font test.",text[0]);
axaxax.SetColor(0,255,255);
@ -80,6 +83,5 @@ int main(int argc, char *argv[])
{
if(Initialize())
Test();
ZEngine::ReleaseInstance();
return 0;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
This file is Part of the ZEngine Library for 2D game development.
Copyright (C) 2002, 2003 James Turk
Copyright (C) 2002-2004 James Turk
ZEngine is Licensed under a BSD-style license.
This example file is in the public domain, it may be used with no restrictions.
@ -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.29 2003/12/14 22:35:35 cozman Exp $*/
// $Id: ZImageTest.cpp,v 1.30 2003/12/31 12:27:58 cozman Exp $
#include <ZEngine.h>
#include <string>
@ -30,6 +30,8 @@ bool Initialize()
fs = cfg.GetBool("ZImageTest","fullscreen",true);
title = cfg.GetString("ZImageTest","title","ZImage Test");
engine->SetResourceFile("resources.zrf");
return engine->CreateDisplay(w,h,bpp,fs,title);
}
@ -38,7 +40,6 @@ void Test()
ZEngine *engine = ZEngine::GetInstance();
float angle=0.0f,movDelta;
float alpha=128.0f,alphaDelta=15.0f;
SDL_Surface *temp;
//Open and Setup all the Images//
ZImage image1,image2,image3,image4,textImage;
@ -48,13 +49,20 @@ void Test()
font.SetColor(0,255,0);
font.SetBGColor(0,0,255);
temp = SDL_LoadBMP("data/rainbow.bmp"); //this is a separate surface
engine->SetErrorLog(ZLOG_HTML,"err.html");
engine->ReportError(ZERR_CRITICAL,"This is a critical test error!!! Something has gone seriously wrong!");
engine->ReportError(ZERR_DEPRECIATED,"This is a test of a depreciated feature.");
engine->ReportError(ZERR_ERROR,"This is a normal error, but only a test.");
engine->ReportError(ZERR_NOTE,"Relax, this is just a test note.");
engine->ReportError(ZERR_VERBOSE,"This test wouldn't show up if verbose was off.");
engine->ReportError(ZERR_WARNING,"This is a test warning, not critical but not verbose either.");
image1.OpenFromZip("data/data.zip","test02.bmp");
image1.SetColorKey(255,0,255);
image2.Open("data/test01.bmp");
image2.SetColorKey(255,0,255);
image3.OpenFromImage(image2.Surface(),5,5,20,20);
image4.Attach(temp); //this attaches the surface into itself
image4.OpenFromZRF("rainbow");
#if (GFX_BACKEND == ZE_OGL)
image4.Resize(400,300);

View File

@ -1,6 +1,6 @@
/*******************************************************************************
This file is Part of the ZEngine Library for 2D game development.
Copyright (C) 2002, 2003 James Turk
Copyright (C) 2002-2004 James Turk
ZEngine is Licensed under a BSD-style license.
This example file is in the public domain, it may be used with no restrictions.
@ -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.21 2003/12/14 22:35:35 cozman Exp $*/
// $Id: ZMouseTest.cpp,v 1.22 2003/12/31 12:27:58 cozman Exp $
#include <ZEngine.h>
#include <string>
@ -30,6 +30,8 @@ bool Initialize()
fs = cfg.GetBool("ZMouseTest","fullscreen",false);
title = cfg.GetString("ZMouseTest","title","ZMouse Test");
engine->SetResourceFile("resources.zrf");
return engine->CreateDisplay(w,h,bpp,fs,title);
}
@ -39,9 +41,11 @@ void Test()
//Open and Setup all the Images//
ZImage text[3], cursor("data/cursor.bmp");
ZFont font("data/almontew.ttf",30);
ZFont font;
SDL_Rect textRect;
font.OpenFromZRF("default");
engine->HideCursor();
cursor.SetColorKey(255,0,255);
@ -50,8 +54,8 @@ void Test()
font.DrawText("Mouse Test",text[0]);
font.DrawShadedText("Mouse Test",text[1]);
textRect.x = textRect.y = 100;
textRect.w = font.StringWidth("Mouse Test");
textRect.h = font.StringHeight("Mouse Test");
textRect.w = font.CalcStringWidth("Mouse Test");
textRect.h = font.CalcStringHeight("Mouse Test");
do
{
@ -76,7 +80,7 @@ void Test()
engine->Clear(); //clear screen
//draw the images//
text[engine->MouseInRect(&textRect)].Draw(100,100);
text[engine->MouseInRect(textRect)].Draw(100,100);
text[2].Draw(0,0);
cursor.Draw(engine->MouseX()-8,engine->MouseY()-8);
@ -90,6 +94,5 @@ int main(int argc, char *argv[])
{
if(Initialize())
Test();
ZEngine::ReleaseInstance();
return 0;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
This file is Part of the ZEngine Library for 2D game development.
Copyright (C) 2002, 2003 James Turk
Copyright (C) 2002-2004 James Turk
ZEngine is Licensed under a BSD-style license.
This example file is in the public domain, it may be used with no restrictions.
@ -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.21 2003/12/14 22:35:35 cozman Exp $*/
// $Id: ZMusicTest.cpp,v 1.22 2003/12/31 12:27:58 cozman Exp $
#include <ZEngine.h>
#include <string>
@ -43,8 +43,8 @@ void Test()
if(!song.IsLoaded()) //this executes if there is no music.ogg file
{
engine->Clear();
engine->CreateDisplay(800,70,32,false,"ZMusic Test");
engine->Clear();
font.DrawText("Music.ogg does not exist, please read music.txt.",text[0]);
text[0].Draw(0,0);
engine->Update();
@ -83,12 +83,12 @@ void Test()
if(engine->KeyIsPressed(SDLK_SPACE))
song.Play();
if(engine->KeyIsPressed(SDLK_UP))
song.SetVolume(song.Volume()+1);
song.SetVolume(song.GetVolume()+1);
if(engine->KeyIsPressed(SDLK_DOWN))
song.SetVolume(song.Volume()-1);
song.SetVolume(song.GetVolume()-1);
font.DrawText(FormatStr("Volume: %d",song.Volume()),text[3]);
font.DrawText(FormatStr("Volume: %d",song.GetVolume()),text[3]);
engine->Clear(); //clear screen
for(int i=0; i < 4; i++)
@ -103,6 +103,5 @@ int main(int argc, char *argv[])
{
if(Initialize())
Test();
ZEngine::ReleaseInstance();
return 0;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
This file is Part of the ZEngine Library for 2D game development.
Copyright (C) 2002, 2003 James Turk
Copyright (C) 2002-2004 James Turk
ZEngine is Licensed under a BSD-style license.
This example file is in the public domain, it may be used with no restrictions.
@ -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.9 2003/12/14 22:35:35 cozman Exp $*/
// $Id: ZParticleTest.cpp,v 1.10 2003/12/31 12:27:58 cozman Exp $
#include <ZEngine.h>
#include <string>
@ -30,6 +30,8 @@ bool Initialize()
fs = cfg.GetBool("ZParticleTest","fullscreen",false);
title = cfg.GetString("ZParticleTest","title","ZParticle Test");
engine->SetResourceFile("resources.zrf");
return engine->CreateDisplay(w,h,bpp,fs,title);
}
@ -72,7 +74,7 @@ void Test()
effect[2].SetRate(30);
effect[2].SetImage("data/particle2.tga");
bg.Open("data/rainbow.bmp");
bg.OpenFromZRF("rainbow");
#if (GFX_BACKEND == ZE_OGL)
bg.Resize(engine->DisplayWidth()/2.0f,static_cast<float>(engine->DisplayHeight())); //gives perspective on alpha on half of screen
#endif
@ -148,6 +150,5 @@ int main(int argc, char *argv[])
{
if(Initialize())
Test();
ZEngine::ReleaseInstance();
return 0;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
This file is Part of the ZEngine Library for 2D game development.
Copyright (C) 2002, 2003 James Turk
Copyright (C) 2002-2004 James Turk
ZEngine is Licensed under a BSD-style license.
This example file is in the public domain, it may be used with no restrictions.
@ -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.22 2003/12/14 22:35:35 cozman Exp $*/
// $Id: ZRectTest.cpp,v 1.23 2003/12/31 12:27:58 cozman Exp $
#include <ZEngine.h>
#include <string>
@ -83,6 +83,5 @@ int main(int argc, char *argv[])
{
if(Initialize())
Test();
ZEngine::ReleaseInstance();
return 0;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
This file is Part of the ZEngine Library for 2D game development.
Copyright (C) 2002, 2003 James Turk
Copyright (C) 2002-2004 James Turk
ZEngine is Licensed under a BSD-style license.
This example file is in the public domain, it may be used with no restrictions.
@ -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.21 2003/12/14 22:35:35 cozman Exp $*/
// $Id: ZSoundTest.cpp,v 1.22 2003/12/31 12:27:58 cozman Exp $
#include <ZEngine.h>
#include <string>
@ -30,6 +30,8 @@ bool Initialize()
fs = cfg.GetBool("ZSoundTest","fullscreen",false);
title = cfg.GetString("ZSoundTest","title","ZSound Test");
engine->SetResourceFile("resources.zrf");
return engine->CreateDisplay(w,h,bpp,fs,title);
}
@ -45,7 +47,7 @@ void Test()
for(int i=0; i < 4; i++)
sample[i].OpenFromZip("data/data.zip",FormatStr("%s.wav",name[i].c_str()));
sample[4].Open("data/whip.wav");
sample[4].OpenFromZRF("whip");
font.DrawText("(P)ause\t(U)npause",text[0]);
@ -82,11 +84,11 @@ void Test()
if(engine->KeyIsPressed(SDLK_SPACE))
sample[sampleNum].Play();
if(engine->KeyIsPressed(SDLK_UP))
sample[sampleNum].SetVolume(sample[sampleNum].Volume()+1);
sample[sampleNum].SetVolume(sample[sampleNum].GetVolume()+1);
if(engine->KeyIsPressed(SDLK_DOWN))
sample[sampleNum].SetVolume(sample[sampleNum].Volume()-1);
sample[sampleNum].SetVolume(sample[sampleNum].GetVolume()-1);
font.DrawText(FormatStr("Volume: %d",sample[sampleNum].Volume()),text[4]);
font.DrawText(FormatStr("Volume: %d",sample[sampleNum].GetVolume()),text[4]);
font.DrawText(FormatStr("Sample: %s",name[sampleNum].c_str()),text[5]);
engine->Clear(); //clear screen
@ -102,6 +104,5 @@ int main(int argc, char *argv[])
{
if(Initialize())
Test();
ZEngine::ReleaseInstance();
return 0;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
This file is Part of the ZEngine Library for 2D game development.
Copyright (C) 2002, 2003 James Turk
Copyright (C) 2002-2004 James Turk
ZEngine is Licensed under a BSD-style license.
This example file is in the public domain, it may be used with no restrictions.
@ -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.20 2003/12/14 22:35:35 cozman Exp $*/
// $Id: ZTimerTest.cpp,v 1.21 2003/12/31 12:27:58 cozman Exp $
#include <ZEngine.h>
#include <string>
@ -30,6 +30,8 @@ bool Initialize()
fs = cfg.GetBool("ZTimerTest","fullscreen",false);
title = cfg.GetString("ZTimerTest","title","ZTimer Test");
engine->SetResourceFile("resources.zrf");
return engine->CreateDisplay(w,h,bpp,fs,title);
}
@ -118,6 +120,5 @@ int main(int argc, char *argv[])
{
if(Initialize())
Test();
ZEngine::ReleaseInstance();
return 0;
}