swh:1:snp:af87cd67498ef4fe47c76ed3e7caffe5b61facaf
Tip revision: 136229b0e9b3d0574472ff512b8c24929d3a6a5a authored by Unknown Author on 31 October 2002, 07:27:38 UTC
This commit was manufactured by cvs2svn to create tag 'v3-03-09a'.
This commit was manufactured by cvs2svn to create tag 'v3-03-09a'.
Tip revision: 136229b
games.C
void games()
{
// This macro runs three "games" that each nicely illustrate
// some of the graphics capabilities of ROOT. Thanks to the
// clever usage of TTimer objects it looks like they are all
// executing in parallel (emulation of multi-threading).
// It uses the small classes generated in $ROOTSYS/test/Hello,
// Aclock, Tetris
Bool_t UNIX = strcmp(gSystem->GetName(), "Unix") == 0;
Int_t st1 = gSystem->Load("$(ROOTSYS)/test/Aclock");
if (st1 == -1) {
printf("===>The macro games will try to build the Aclock library\n");
if (UNIX)
gSystem->Exec("(cd $ROOTSYS/test; make Aclock.so)");
else
gSystem->Exec("(cd %ROOTSYS%\\test && nmake Aclock.dll)");
st1 = gSystem->Load("$(ROOTSYS)/test/Aclock");
}
Int_t st2 = gSystem->Load("$(ROOTSYS)/test/Hello");
if (st2 == -1) {
printf("===>The macro games will try to build the Hello library\n");
if (UNIX)
gSystem->Exec("(cd $ROOTSYS/test; make Hello.so)");
else
gSystem->Exec("(cd %ROOTSYS%\\test && nmake Hello.dll)");
st2 = gSystem->Load("$(ROOTSYS)/test/Hello");
}
Int_t st3 = gSystem->Load("$(ROOTSYS)/test/Tetris");
if (st3 == -1) {
if (UNIX) {
printf("===>The macro games will try to build the Tetris library\n");
gSystem->Exec("(cd $ROOTSYS/test; make Tetris.so)");
st3 = gSystem->Load("$(ROOTSYS)/test/Tetris");
} else {
printf(" Sorry! No tetris for Windows yet.");
st3 = 0;
}
}
if (st1 || st2 || st3) {
printf("ERROR: one of the shared libs in $ROOTSYS/test didn't load properly\n");
return;
}
// run the dancing Hello World
Hello *hello = new Hello();
// run the analog clock
Aclock *clock = new Aclock();
// run the Tetris game
if (UNIX) Tetris *tetris = new Tetris();
}