Application::Application(HINSTANCE hInstance) { g_logger.Init(); m_pWindow = std::make_shared<Window>(hInstance, 800, 600, L"Kebab Engine", true); m_pRenderer = new Renderer(m_pWindow->GetHandle(), m_pWindow->GetWidth(), m_pWindow->GetHeight()); g_inputManager.Init(m_pWindow.get()); m_pPhysicsSystem = new PhysicsSystem(); m_scene.Init(m_pRenderer, m_pPhysicsSystem); }
int main(int argc, char**argv) { /* * this is the main loop of the controller. */ // define Handlers for sigint define_handlers(); int opt= 0; int verbose=1; string configFileName=""; string logFileName=""; static struct option long_options[] = { {"config", required_argument, 0, 'c' }, {"log", required_argument, 0, 'l' }, {"verbose", required_argument, 0, 'v' }, {0, 0, 0, 0 } }; int long_index =0; while ((opt = getopt_long(argc, argv,"c:l:v:", long_options, &long_index )) != -1) { switch (opt) { case 'c' : configFileName=string(optarg); break; case 'l' : logFileName=string(optarg); break; case 'v' : verbose=atoi(optarg); break; case '?': /* getopt_long already printed an error message. */ print_usage(); exit(EXIT_FAILURE); default: print_usage(); exit(EXIT_FAILURE); } } if ( configFileName == "" ) { print_usage(); exit(EXIT_FAILURE); } // ----------------- //string logFileName="/tmp/logRC.txt"; Logger l; try { printf("[RunControllerDaemon]::Init Logfile => %s\n",logFileName.c_str()); l.SetLogLevel(verbose); l.SetFileName(logFileName); l.Init(); } catch (logfile_open_exception &l) { printf("Cannot Open Log File: %s\n",logFileName.c_str()); exit(EXIT_FAILURE); } // //Daemon *d=new Daemon(); printf("RC\n"); DummyRunControlFSM *d=new DummyRunControlFSM(); printf("INIT\n"); //d->Init("data/configRC.xml"); printf("[RunControllerDaemon]::Init Configfile => %s\n",configFileName.c_str()); d->LogInit(&l); d->Init(configFileName); try{ printf("LOOP\n"); d->Loop(); } catch (sigint_exception &e) { printf("%s\n",e.what());} printf("CLEAR\n"); d->Clear(); return 0; }
int main(int argc,char**argv) { int port=5566; string address="127.0.0.1"; printf("This program is going to test:\n"); printf(" * the dataType consistency\n"); printf(" * Port used for the communication is %d.\n",port); printf(" * Addressed used for the communication is '%s'.\n",address.c_str()); printf(" * Logger.\n"); printf("\n"); Logger l; printf("-> Constructing Publisher\n"); Publisher pub; //printf("-> Constructing Context\n"); //zmq::context_t context(2); // ActivateLog printf("-> Config Log\n"); l.SetLogLevel(3); l.SetAsync(); l.SetFileName("/tmp/log.txt"); l.Init(); printf("-> Activate Logs\n"); pub.LogInit(&l); //Configure printf("-> Setting port\n"); pub.SetPort(port); //printf("-> Setting Context\n"); //pub.SetContext(&context); //pub.SetAsync(); //Init Sockets printf("-> Init Publisher\n"); pub.Init(); printf("-> Sleep\n"); sleep(10); //Init Mex printf("-> Init Mex\n"); dataType mexSend, mexRecv; char mex[]="Ciao\0da\0Andrea"; printf("-> Append to Send\n"); mexSend.append((void*)mex,14); printf("-> Send Dummy\n"); pub.SendMessage(mexSend); printf("-> Send\n"); pub.SendMessage(mexSend); printf("-> Sleep\n"); sleep(10); string toprint=Utility::AsciiData(mexSend.data(),mexSend.size() ); printf("%s",toprint.c_str()); sleep(1); printf("-> Calling Destructors and exit\n"); // printf("---> Pub\n"); // pub.~Publisher(); // printf("---> Log\n"); // l.~Logger(); // printf("---> Mex\n"); // mexSend.~dataType(); // mexRecv.~dataType(); // printf("---> Context\n"); // context.~context_t(); printf("---> Everything Else\n"); // printf("---> Log\n"); // l.~Logger(); return 0; }
int main(int argc,char**argv) { int port=5566; string address="127.0.0.1"; printf("This program is going to test:\n"); printf(" * the dataType consistency\n"); printf(" * the publisher and subscriber ability to handle it\n"); printf(" * Port used for the communication is %d.\n",port); printf(" * Addressed used for the communication is '%s'.\n",address.c_str()); printf(" * Logger.\n"); printf("\n"); Logger l; printf("-> Constructing Publisher\n"); Publisher pub; printf("-> Constructing Subscriber\n"); Subscriber sub; //printf("-> Constructing Context\n"); //zmq::context_t context(2); // ActivateLog printf("-> Config Log\n"); l.SetLogLevel(3); //l.SetAsync(); l.SetFileName("/tmp/log.txt"); l.Init(); printf("-> Activate Logs\n"); sub.LogInit(&l); pub.LogInit(&l); //Configure printf("-> Setting port\n"); pub.SetPort(port); printf("-> Setting port/address\n"); sub.SetAddress(address,port); //printf("-> Setting Context\n"); //pub.SetContext(&context); //sub.SetContext(&context); //pub.SetAsync(); //Init Sockets printf("-> Init Publisher\n"); pub.Init(); printf("-> Init subscriber\n"); sub.Init(); //Init Mex printf("-> Init Mex\n"); dataType mexSend, mexRecv; char mex[]="Ciao\0da\0Andrea"; printf("-> Append to Send\n"); mexSend.append((void*)mex,14); printf("-> Send Dummy\n"); int rc=1; rc=sub.RecvMessage(mexRecv); pub.SendMessage(mexSend); printf("-> Recv Dummy\n"); //while (rc) { rc=sub.RecvMessage(mexRecv); printf("Cycle\n"); sleep(1);} rc=sub.RecvMessage(mexRecv); printf("-> Send\n"); pub.SendMessage(mexSend); printf("-> Recv\n"); rc=1; while (rc) { rc=sub.RecvMessage(mexRecv); printf("Cycle\n"); sleep(2);} printf("-> Verify content of size %d == %d\n",mexSend.size(),mexRecv.size()); if (mexSend == mexRecv)printf(" ------ SUCCESS -------\n"); else printf(" ------ FAIL -------\n"); // for(int i=0;i<mexSend.size();i++) // { // char c1='\0'; // if(i<mexSend.size())c1=((char*)mexSend.data())[i]; // char c2='\0'; // if(i<mexRecv.size())c2=((char*)mexRecv.data())[i]; // printf(" %02X %02X\n",c1,c2); // } string toprint=Utility::AsciiData(mexSend.data(),mexRecv.data(),mexSend.size() ); printf("%s",toprint.c_str()); sleep(1); printf("-> Calling Destructors and exit\n"); }