/home/fwph/code/wurde/modules/eye/main.cpp

Go to the documentation of this file.
00001 #include "GUI.h"
00002 #include <stdlib.h>
00003 
00004 using namespace WURDE;
00005 
00006 static void Timer_CB(void *pUserData);
00007 
00008 GUI * gGui = NULL;
00009 
00010 WURDE::CommsManager* mCom;
00011 WURDE::ImageSource* m_source;
00012 static void KillGui() {
00013   if(gGui) {
00014     delete gGui;
00015   }
00016   gGui = NULL;
00017   mCom->cleanUp();
00018 }
00019 
00020 int main(int argc, char*argv[]) {
00021         CommsManager myManager("Eye");
00022         myManager.parseOptions(argc,argv);
00023         ImageSource myImageSource(STRAT_ASSIGNED, "EyeImageClient");
00024 
00025         mCom = &myManager;
00026         m_source = &myImageSource;
00027         printf("Registering modules...\n");
00028         myManager.setNoSleep();
00029         myManager.registerConsumer(&myImageSource);
00030         if(myManager.runUpdate()==STATE_RUN){
00031                 
00032                 atexit(KillGui);
00033                 gGui = new GUI();
00034                 printf("Here goes...\n");
00035         
00036                 Fl::repeat_timeout(1.0/20.0, Timer_CB, (void *)gGui);
00037                 return Fl::run();
00038         } else{
00039                 myManager.cleanUp();
00040         }
00041 
00042         return 0;
00043 }
00044 
00045 static void Timer_CB (void *pUserData) {
00046         GUI *gui = (GUI *)pUserData;
00047         gui->Tick();
00048         Fl::repeat_timeout(1.0/20.0, Timer_CB, (void *)pUserData);
00049 }

Generated on Thu Feb 1 15:31:52 2007 for WURDE by  doxygen 1.5.1