This macro runs three "games" that each nicely illustrate 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
#ifndef __RUN_GAMES__
void games()
{
if (st1 == -1) {
printf("===>The macro games will try to build the Aclock library\n");
if (UNIX)
gSystem->Exec(
"(cd $ROOTSYS/test; make Aclock)");
else
gSystem->Exec(
"(cd %ROOTSYS%\\test && nmake -f Makefile.win32 Aclock.dll)");
st1 =
gSystem->Load(
"$(ROOTSYS)/test/Aclock");
}
if (st2 == -1) {
printf("===>The macro games will try to build the Hello library\n");
if (UNIX)
gSystem->Exec(
"(cd $ROOTSYS/test; make Hello)");
else
gSystem->Exec(
"(cd %ROOTSYS%\\test && nmake -f Makefile.win32 Hello.dll)");
st2 =
gSystem->Load(
"$(ROOTSYS)/test/Hello");
}
if (st3 == -1) {
if (UNIX) {
printf("===>The macro games will try to build the Tetris library\n");
gSystem->Exec(
"(cd $ROOTSYS/test; make Tetris)");
} else {
gSystem->Exec(
"(cd %ROOTSYS%\\test && nmake -f Makefile.win32 Tetris.dll)");
}
st3 =
gSystem->Load(
"$(ROOTSYS)/test/Tetris");
}
if (st1 || st2 || st3) {
printf("ERROR: one of the shared libs in $ROOTSYS/test didn't load properly\n");
return;
}
gROOT->ProcessLine(
"#define __RUN_GAMES__ 1");
gROOT->ProcessLine(
"#include \"Hello.h\"");
gROOT->ProcessLine(
"#include \"Aclock.h\"");
gROOT->ProcessLine(
"#include \"Tetris.h\"");
gROOT->ProcessLine(
"#include \"games.C\"");
gROOT->ProcessLine(
"rungames()");
gROOT->ProcessLine(
"#undef __RUN_GAMES__");
}
#else
class Hello;
class Aclock;
class Tetris;
void rungames()
{
Hello *
hello =
new Hello();
Aclock *clock = new Aclock();
Tetris *tetris = new Tetris();
}
#endif
std::string hello(std::string who, std::string msg)
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
- Author
- Valeriy Onuchin
Definition in file games.C.