games.C

Go to the documentation of this file.
00001 void games()
00002 {
00003    // This macro runs three "games" that each nicely illustrate the graphics capabilities of ROOT. 
00004    // Thanks to the clever usage of TTimer objects it looks like they are all
00005    // executing in parallel (emulation of multi-threading).
00006    // It uses the small classes generated in $ROOTSYS/test/Hello,
00007    // Aclock, Tetris
00008    //Author: Valeriy Onuchin
00009    
00010    Bool_t UNIX = strcmp(gSystem->GetName(), "Unix") == 0;
00011    Int_t st1 = gSystem->Load("$(ROOTSYS)/test/Aclock");
00012    if (st1 == -1) {
00013       printf("===>The macro games will try to build the Aclock library\n");
00014       if (UNIX)
00015          gSystem->Exec("(cd $ROOTSYS/test; make Aclock)");
00016       else
00017          gSystem->Exec("(cd %ROOTSYS%\\test && nmake -f Makefile.win32 Aclock.dll)");
00018 
00019       st1 = gSystem->Load("$(ROOTSYS)/test/Aclock");
00020    }
00021    Int_t st2 = gSystem->Load("$(ROOTSYS)/test/Hello");
00022    if (st2 == -1) {
00023       printf("===>The macro games will try to build the Hello library\n");
00024       if (UNIX)
00025          gSystem->Exec("(cd $ROOTSYS/test; make Hello)");
00026       else
00027          gSystem->Exec("(cd %ROOTSYS%\\test && nmake -f Makefile.win32 Hello.dll)");
00028 
00029       st2 = gSystem->Load("$(ROOTSYS)/test/Hello");
00030    }
00031    Int_t st3 = gSystem->Load("$(ROOTSYS)/test/Tetris");
00032    if (st3 == -1) {
00033       if (UNIX) {
00034          printf("===>The macro games will try to build the Tetris library\n");
00035          gSystem->Exec("(cd $ROOTSYS/test; make Tetris)");
00036       } else {
00037          gSystem->Exec("(cd %ROOTSYS%\\test && nmake -f Makefile.win32 Tetris.dll)");
00038       }
00039       st3 = gSystem->Load("$(ROOTSYS)/test/Tetris");
00040    }
00041 
00042    if (st1 || st2 || st3) {
00043       printf("ERROR: one of the shared libs in $ROOTSYS/test didn't load properly\n");
00044       return;
00045    }
00046 
00047    // run the dancing Hello World
00048    Hello *hello = new Hello();
00049 
00050    // run the analog clock
00051    Aclock *clock = new Aclock();
00052 
00053    // run the Tetris game
00054    Tetris *tetris = new Tetris();
00055 }

Generated on Tue Jul 5 15:44:23 2011 for ROOT_528-00b_version by  doxygen 1.5.1