Updated examples to provide better style and use newer features.
This commit is contained in:
parent
206f74ec90
commit
3de4a7a26f
@ -1,11 +1,12 @@
|
||||
ZEngine Version Log for Version 0.8.1
|
||||
$Id: changelog.txt,v 1.22 2003/01/12 07:09:04 cozman Exp $
|
||||
$Id: changelog.txt,v 1.23 2003/01/12 19:01:17 cozman Exp $
|
||||
|
||||
0.8.2
|
||||
-Updated examples to use newer features and check for errors.
|
||||
-Changed ZEngine::CreateDisplay to return a bool.
|
||||
-Added \since option to documentation (Everything after 0.8.0 will be labeled with a version.)
|
||||
-Added "desired framerate" code to ZEngine.
|
||||
-Added "desired framerate" functionality into the test programs.
|
||||
-Added "desired framerate" code to ZEngine.
|
||||
-Fixed OpenGL color bleed in ZRect.
|
||||
|
||||
0.8.1
|
||||
|
@ -8,14 +8,14 @@
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZFontTest.cpp,v 1.10 2003/01/04 05:18:51 cozman Exp $*/
|
||||
/*$Id: ZFontTest.cpp,v 1.11 2003/01/12 19:00:14 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
using namespace ZE;
|
||||
|
||||
void Initialize()
|
||||
bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
@ -31,8 +31,8 @@ void Initialize()
|
||||
rate = cfg.GetInt("ZFontTest","framerate",60);
|
||||
|
||||
engine->SetupDisplay(w,h,bpp,fs);
|
||||
engine->CreateDisplay(title);
|
||||
engine->SetDesiredFramerate(rate);
|
||||
return engine->CreateDisplay(title);
|
||||
}
|
||||
|
||||
void Test()
|
||||
@ -60,6 +60,8 @@ void Test()
|
||||
{
|
||||
//In the active loop, check events first//
|
||||
engine->CheckEvents();
|
||||
if(engine->IsActive())
|
||||
{
|
||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||
engine->RequestQuit();
|
||||
betsy.DrawText(FormatStr("FPS: %.2f",engine->GetFramerate()),text[5]);
|
||||
@ -69,6 +71,7 @@ void Test()
|
||||
for(int i=0; i <= 5; i++)
|
||||
text[i].Draw(10.0f*i,50.0f*i);
|
||||
engine->Update(); //update the screen
|
||||
}
|
||||
|
||||
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
|
||||
}
|
||||
@ -77,9 +80,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
|
||||
Initialize();
|
||||
if(Initialize())
|
||||
{
|
||||
//engine->InitPhysFS(argv[0]); //remove this line if PhysFS is not available
|
||||
Test();
|
||||
}
|
||||
|
||||
ZEngine::ReleaseInstance(); //release engine instance
|
||||
return 0;
|
||||
|
@ -8,14 +8,14 @@
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZImageTest.cpp,v 1.13 2003/01/04 05:18:51 cozman Exp $*/
|
||||
/*$Id: ZImageTest.cpp,v 1.14 2003/01/12 19:00:15 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
using namespace ZE;
|
||||
|
||||
void Initialize()
|
||||
bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
@ -31,8 +31,8 @@ void Initialize()
|
||||
rate = cfg.GetInt("ZImageTest","framerate",60);
|
||||
|
||||
engine->SetupDisplay(w,h,bpp,fs);
|
||||
engine->CreateDisplay(title);
|
||||
engine->SetDesiredFramerate(rate);
|
||||
return engine->CreateDisplay(title);
|
||||
}
|
||||
|
||||
void Test()
|
||||
@ -62,6 +62,8 @@ void Test()
|
||||
//In the active loop, check events first//
|
||||
engine->CheckEvents();
|
||||
|
||||
if(engine->IsActive())
|
||||
{
|
||||
if(engine->ImagesNeedReload())
|
||||
{
|
||||
image1.Reload();
|
||||
@ -92,17 +94,20 @@ void Test()
|
||||
image3.Draw(200,0);
|
||||
textImage.Draw(0,100);
|
||||
engine->Update(); //update the screen
|
||||
}
|
||||
|
||||
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
|
||||
Initialize();
|
||||
if(Initialize())
|
||||
{
|
||||
//engine->InitPhysFS(argv[0]); //remove this line if PhysFS is not available
|
||||
Test();
|
||||
}
|
||||
|
||||
ZEngine::ReleaseInstance(); //release engine instance
|
||||
return 0;
|
||||
|
@ -8,14 +8,14 @@
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZMouseTest.cpp,v 1.11 2003/01/04 05:18:51 cozman Exp $*/
|
||||
/*$Id: ZMouseTest.cpp,v 1.12 2003/01/12 19:00:17 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
using namespace ZE;
|
||||
|
||||
void Initialize()
|
||||
bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
@ -31,8 +31,8 @@ void Initialize()
|
||||
rate = cfg.GetInt("ZMouseTest","framerate",60);
|
||||
|
||||
engine->SetupDisplay(w,h,bpp,fs);
|
||||
engine->CreateDisplay(title);
|
||||
engine->SetDesiredFramerate(rate);
|
||||
return engine->CreateDisplay(title);
|
||||
}
|
||||
|
||||
void Test()
|
||||
@ -59,6 +59,9 @@ void Test()
|
||||
{
|
||||
//In the active loop, check events first//
|
||||
engine->CheckEvents();
|
||||
|
||||
if(engine->IsActive())
|
||||
{
|
||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||
engine->RequestQuit();
|
||||
|
||||
@ -78,6 +81,7 @@ void Test()
|
||||
cursor.Draw(engine->MouseX()-8.0f,engine->MouseY()-8.0f);
|
||||
|
||||
engine->Update(); //update the screen
|
||||
}
|
||||
|
||||
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
|
||||
}
|
||||
@ -86,9 +90,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
|
||||
Initialize();
|
||||
if(Initialize())
|
||||
{
|
||||
//engine->InitPhysFS(argv[0]); //remove this line if PhysFS is not available
|
||||
Test();
|
||||
}
|
||||
|
||||
ZEngine::ReleaseInstance(); //release engine instance
|
||||
return 0;
|
||||
|
@ -8,14 +8,14 @@
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZMusicTest.cpp,v 1.12 2003/01/04 05:18:51 cozman Exp $*/
|
||||
/*$Id: ZMusicTest.cpp,v 1.13 2003/01/12 19:00:19 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
using namespace ZE;
|
||||
|
||||
void Initialize()
|
||||
bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
@ -31,8 +31,8 @@ void Initialize()
|
||||
rate = cfg.GetInt("ZMusicTest","framerate",60);
|
||||
|
||||
engine->SetupDisplay(w,h,bpp,fs);
|
||||
engine->CreateDisplay(title);
|
||||
engine->SetDesiredFramerate(rate);
|
||||
return engine->CreateDisplay(title);
|
||||
}
|
||||
|
||||
void Test()
|
||||
@ -53,7 +53,6 @@ void Test()
|
||||
engine->Update();
|
||||
do
|
||||
{
|
||||
|
||||
engine->CheckEvents();
|
||||
engine->Update();
|
||||
} while(!engine->QuitRequested());
|
||||
@ -69,6 +68,9 @@ void Test()
|
||||
{
|
||||
//In the active loop, check events first//
|
||||
engine->CheckEvents();
|
||||
|
||||
if(engine->IsActive())
|
||||
{
|
||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||
engine->RequestQuit();
|
||||
if(engine->KeyIsPressed(SDLK_r))
|
||||
@ -95,6 +97,7 @@ void Test()
|
||||
for(int i=0; i < 4; i++)
|
||||
text[i].Draw(0,i*50.0f);
|
||||
engine->Update(); //update the screen
|
||||
}
|
||||
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
|
||||
}
|
||||
}
|
||||
@ -103,9 +106,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
|
||||
Initialize();
|
||||
if(Initialize())
|
||||
{
|
||||
//engine->InitPhysFS(argv[0]); //remove this line if PhysFS is not available
|
||||
Test();
|
||||
}
|
||||
|
||||
ZEngine::ReleaseInstance(); //release engine instance
|
||||
return 0;
|
||||
|
@ -8,14 +8,14 @@
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZRectTest.cpp,v 1.14 2003/01/08 06:07:07 cozman Exp $*/
|
||||
/*$Id: ZRectTest.cpp,v 1.15 2003/01/12 19:00:21 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
using namespace ZE;
|
||||
|
||||
void Initialize()
|
||||
bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
@ -31,8 +31,8 @@ void Initialize()
|
||||
rate = cfg.GetInt("ZRectTest","framerate",60);
|
||||
|
||||
engine->SetupDisplay(w,h,bpp,fs);
|
||||
engine->CreateDisplay(title);
|
||||
engine->SetDesiredFramerate(rate);
|
||||
return engine->CreateDisplay(title);
|
||||
}
|
||||
|
||||
void Test()
|
||||
@ -45,6 +45,9 @@ void Test()
|
||||
{
|
||||
//In the active loop, check events first//
|
||||
engine->CheckEvents();
|
||||
|
||||
if(engine->IsActive())
|
||||
{
|
||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||
engine->RequestQuit();
|
||||
//movement//
|
||||
@ -73,6 +76,7 @@ void Test()
|
||||
stillRect.Draw(0,0,255,128);
|
||||
moveRect.Intersection(stillRect).Draw(0,255,0);
|
||||
engine->Update();
|
||||
}
|
||||
|
||||
} while(!engine->QuitRequested());
|
||||
}
|
||||
@ -81,9 +85,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
|
||||
Initialize();
|
||||
if(Initialize())
|
||||
{
|
||||
//engine->InitPhysFS(argv[0]); //remove this line if PhysFS is not available
|
||||
Test();
|
||||
}
|
||||
|
||||
ZEngine::ReleaseInstance(); //release engine instance
|
||||
return 0;
|
||||
|
@ -8,14 +8,14 @@
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZSoundTest.cpp,v 1.10 2003/01/04 05:18:51 cozman Exp $*/
|
||||
/*$Id: ZSoundTest.cpp,v 1.11 2003/01/12 19:00:22 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
using namespace ZE;
|
||||
|
||||
void Initialize()
|
||||
bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
@ -31,8 +31,8 @@ void Initialize()
|
||||
rate = cfg.GetInt("ZSoundTest","framerate",60);
|
||||
|
||||
engine->SetupDisplay(w,h,bpp,fs);
|
||||
engine->CreateDisplay(title);
|
||||
engine->SetDesiredFramerate(rate);
|
||||
return engine->CreateDisplay(title);
|
||||
}
|
||||
|
||||
void Test()
|
||||
@ -56,6 +56,9 @@ void Test()
|
||||
{
|
||||
//In the active loop, check events first//
|
||||
engine->CheckEvents();
|
||||
|
||||
if(engine->IsActive())
|
||||
{
|
||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||
engine->RequestQuit();
|
||||
if(engine->KeyIsPressed(SDLK_1))
|
||||
@ -90,6 +93,7 @@ void Test()
|
||||
for(int i=0; i < 6; i++)
|
||||
text[i].Draw(0,i*50.0f);
|
||||
engine->Update(); //update the screen
|
||||
}
|
||||
|
||||
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
|
||||
}
|
||||
@ -98,9 +102,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
|
||||
Initialize();
|
||||
if(Initialize())
|
||||
{
|
||||
//engine->InitPhysFS(argv[0]); //remove this line if PhysFS is not available
|
||||
Test();
|
||||
}
|
||||
|
||||
ZEngine::ReleaseInstance(); //release engine instance
|
||||
return 0;
|
||||
|
@ -8,14 +8,14 @@
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZTimerTest.cpp,v 1.10 2003/01/04 05:18:51 cozman Exp $*/
|
||||
/*$Id: ZTimerTest.cpp,v 1.11 2003/01/12 19:00:25 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
using namespace ZE;
|
||||
|
||||
void Initialize()
|
||||
bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
@ -31,8 +31,8 @@ void Initialize()
|
||||
rate = cfg.GetInt("ZTimerTest","framerate",60);
|
||||
|
||||
engine->SetupDisplay(w,h,bpp,fs);
|
||||
engine->CreateDisplay(title);
|
||||
engine->SetDesiredFramerate(rate);
|
||||
return engine->CreateDisplay(title);
|
||||
}
|
||||
|
||||
void Test()
|
||||
@ -54,6 +54,9 @@ void Test()
|
||||
{
|
||||
//In the active loop, check events first//
|
||||
engine->CheckEvents();
|
||||
|
||||
if(engine->IsActive())
|
||||
{
|
||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||
engine->RequestQuit();
|
||||
//pause current timer//
|
||||
@ -108,6 +111,7 @@ void Test()
|
||||
text[i].Draw(0,i*50.0f);
|
||||
|
||||
engine->Update(); //update the screen
|
||||
}
|
||||
|
||||
} while(!engine->QuitRequested()); //quit only when engine has encountered a quit request
|
||||
}
|
||||
@ -116,9 +120,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
|
||||
Initialize();
|
||||
if(Initialize())
|
||||
{
|
||||
//engine->InitPhysFS(argv[0]); //remove this line if PhysFS is not available
|
||||
Test();
|
||||
}
|
||||
|
||||
ZEngine::ReleaseInstance(); //release engine instance
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user