int main(int argc, char const** argv) { assert(argc==3); std::cout << "*** Welcome ***" << std::endl; { Demo demo; demo.on_connect(argv[1], argv[2]); int max = 10; for (int i = 1; i<=max; ++i) { //std::cout << "round " << i << " of " << max << std::endl; //boost::this_thread::sleep_for(boost::chrono::milliseconds(1000)); demo.on_async_testrun(); //if ( i < max ) //std::cin.get(); } } // Demo destructor joins IO thread, making sure all stats are final using namespace boost::accumulators; std::cout << "avg. Buffer size: " << mean(demo_results::bufsize) << ", std.dev. " << sqrt(variance(demo_results::bufsize)) << "\n"; std::cout << "avg. b/w: " << mean(demo_results::mbps) << " mbps, std.dev. " << sqrt(variance(demo_results::mbps)) << "\n"; std::cout << "avg. time: " << mean(demo_results::micros) << " micro_sec, std.dev. " << sqrt(variance(demo_results::micros)) << "\n"; //std::cin.get(); return 0; }
int main(int argc, void ** argv) { Demo app; app.Initialize(&argc, argv); app.Execute(); return 0; }
void Lesson8() { Demo t; Demo t1("Demo Parameter"); cout << t.GetDesc() << endl; cout << t1.GetDesc() << endl; }
int main() { initWindow(1024, 768, &Demo::resizeWindow); Demo app; app.run(); }
extern "C" void WinMainCRTStartup() { //Sleep(15000); HDC hDC; HGLRC context; CreateGLWindow(&hDC, &context); Demo demo; demo.Init(); MusicInit(music); sndPlaySoundA((const char*)&music, SND_ASYNC|SND_MEMORY|SND_LOOP); do { demo.Step(); demo.RenderFrame(); SwapBuffers(hDC); AppProcessMessages(); } while(!GetAsyncKeyState(VK_ESCAPE)); ExitProcess(0); }
void Lesson6() { Demo t; t.a = 11; t.b = 22; cout << t.do_something() << endl; }
int main() { Demo <int><string> d; d.set1( 100 ); d.dump(); d.set2( "string" ); d.dump(); }
bool add_one() { printf("\n*** add_one()\n"); ClientPeek client_peek; Demo client; client.yarp().attachAsClient(client_peek); client.add_one(14); Server server; Bottle bot("[add] [one] 14"); DummyConnector con; bot.write(con.getWriter()); server.read(con.getReader()); bot.read(con.getReader()); printf("Result is %s\n", bot.toString().c_str()); if (bot.get(0).asInt() != 15) return false; bot.fromString("[add] [one] 15"); DummyConnector con2; bot.write(con2.getWriter()); server.read(con2.getReader()); bot.read(con2.getReader()); printf("Result is %s\n", bot.toString().c_str()); if (bot.get(0).asInt() != 16) return false; return true; }
// Initialize the engine void Demo::Initialize(HINSTANCE hInstance, int nCmdShow) { // Grab instance Demo* pDemo = Demo::privGetInstance(); // Create window pDemo->window = pDemo->privCreateGraphicsWindow(hInstance, nCmdShow, "Bricks Demo", GAME_WIDTH, GAME_HEIGHT); // Initialize Direct3D pDemo->privInitDevice(); pDemo->privCreateShader(); pDemo->privCreateBuffers(); // initialize motion blur pDemo->motionBlur.initialize(200); pDemo->motionBlur.setBlurTime(0.5f); // Set up camera pDemo->cam.setViewport(0, 0, GAME_WIDTH, GAME_HEIGHT); pDemo->cam.setPerspective(35.0f, float(GAME_WIDTH) / float(GAME_HEIGHT), 1.0f, 4500.0f); pDemo->cam.setOrientAndPosition(Vect(0.0f, 1.0f, 0.0f), Vect(0.0f, 50.0f, -10.0f), Vect(0.0f, 50.0f, 0.0f)); pDemo->cam.updateCamera(); pDemo->projection = pDemo->cam.getProjMatrix(); pDemo->projection.T(); pDemo->deviceCon->UpdateSubresource(pDemo->projectionBuffer, 0, nullptr, &pDemo->projection, 0, 0); // Set up Lighting Vect lightDir(20.0f, 100.0f, 100.0f); lightDir.norm(); Vect lightColor(1.0f, 1.0f, 1.0f, 1.0f); pDemo->lightInfo.color = lightColor; pDemo->lightInfo.direction = lightDir; pDemo->globalLightDir = lightDir; pDemo->deviceCon->UpdateSubresource(pDemo->lightBuffer, 0, nullptr, &pDemo->lightInfo, 0, 0); };
int main ( int argc, char** argv ) { Demo D = Demo(640,480); D.Execute(); return 0; }
void Demo::Shutdown() { Demo* p = Demo::privGetInstance(); // Destroy everything p->motionBlur.destroy(); p->privDestroyBuffers(); p->privDestroyShader(); p->privShutDownDevice(); }
int main(int argc, char** argv) { QApplication a(argc, argv); a.setStyle(new NyanProxyStyle); Demo demo; demo.show(); return a.exec(); }
Demo* Demo::create(PhysicsWorld* world) { Demo* pRet = new Demo(); if (pRet && pRet->init(world)) { return pRet; } pRet = NULL; return NULL; }
int main() { Demo a; MyCar car; a.setName("masuchen"); cout << a.getName() << endl; car.setPrice(100); cout <<car.getPrice() << endl; while (1); // return 0; }
int main() { Demo* currentDemo = 0; bool isRunning = true; char choice; do { cout << "** Procedural Content Generation using Generative Grammars **\n\n"; cout << "Select demo:\n"; cout << " Demo 1: Quest Generation (Description)\n"; cout << " Demo 2: Weapon Generation\n"; cout << " 'q' to quit\n\n"; cout << "(Number)> "; choice = cin.get(); if( currentDemo != 0 ) { delete currentDemo; currentDemo = 0; } switch (choice) { case '1': currentDemo = new DemoQuests(); break; case '2': currentDemo = new DemoWeapons(); break; case 'q': isRunning = false; break; } if( currentDemo!= 0 ) { currentDemo->Initialize(); currentDemo->Run(); cin.get(); // registers 2 enters for some reason :/ #ifdef WINDOWS_PLATFORM system("cls"); #else system("clear"); #endif } } while ( isRunning ); delete currentDemo; return 0; }
int main() { auto pd = std::make_unique<Demo>(); Demo d; std::cout << pd->get() << std::endl; // prints 5 std::cout << d.get() << std::endl; // prints 5 std::cout << NS::get() << std::endl; // prints 20 std::cout << Demo::get() << std::endl; // prints 5 std::cout << ::get() << std::endl; // prints 10 std::cout << get() << std::endl; // prints 10 return 0; }
int TLOC_MAIN(int , char *[]) { Demo demo; demo.Initialize(core_ds::MakeTuple(800, 600)); demo.Run(); //------------------------------------------------------------------------ // Exiting TLOC_LOG_CORE_INFO() << "Exiting normally"; return 0; }
std::string CommandLineParser::parse(int argc, char** argv) { // Parse command line. static struct option longopts[] = { { "help", no_argument, NULL, 'h' }, { "demo", optional_argument, NULL, 'd' }, { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } }; char ch; while ((ch = getopt_long(argc, argv, "hdV", longopts, NULL)) != -1) { std::string demoName; switch (ch) { case 'd': { if (optarg != NULL) { demoName = std::string(optarg); std::cout << "Requested demo: " << demoName << "\n" << std::endl; Demo *demo = Demo::getDemo(demoName); if (demo) { demo->generate(); exit(0); } else { Demo::listDemos(std::cout); exit(-1); } } else { Demo::listDemos(std::cout); exit(0); } } break; case 'V': #ifdef CONFIG_FLAGS std::cout<<"Compiled with options: "<<std::endl<<CONFIG_FLAGS<<std::endl<<std::endl; #endif exit(-1); break; case 'h': Help::printHelp(); break; default: UsageMessage::print(); exit(0); break; } } argc -= optind; argv += optind; std::string xmlFileName = "pimc.xml"; if (argc == 1) xmlFileName = argv[0]; return xmlFileName; }
// here is were everything begins int main(int argc, char* argv[]) { Demo demo; // process command line options demo.parseOptions(argc, argv); // setup image source, window for drawing, serial port... demo.setup(); // the actual processing loop where tags are detected and visualized demo.loop(); return 0; }
int _tmain(int argc, _TCHAR* argv[]) { cout << endl; Demo t; t.setA(11); t.setB(22); t.setB(22); cout << endl; cout << t.do_something() << endl; return 0; }
//Call Back function for camera subsciber void imageCallback(const sensor_msgs::ImageConstPtr& msg){ cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8); //cv::imshow("view", cv_ptr->image); //cv::waitKey(1); cv::cvtColor(cv_ptr->image, image_gray, CV_BGR2GRAY); demo.processImage(cv_ptr->image, image_gray); }
void App::main() { window()->setCaption("Q3 Renderer"); setDebugMode(true); debugController.setActive(true); dumpPolygons = false; clipMovement = true; sky = Sky::create(renderDevice, dataDir + "sky/"); debugCamera.setNearPlaneZ(-0.5f); debugCamera.setFarPlaneZ(-100);//(float)-inf()); debugController.init(renderDevice, userInput); debugController.setMoveRate(500 * BSPMAP::LOAD_SCALE); debugController.setActive(true); renderDevice->setColorClearValue(Color3(0.1f, 0.5f, 1.0f)); // Load the map map = new BSPMAP::Map(); bool ret = map->load("D:/games/dojo/scratch/data-files/q3/", "ut_ricochet.bsp"); // bool ret = map->load("D:/media/models/q3/maps/urbanterror/", "ut_ricochet.bsp"); debugAssert(ret); (void)ret; debugController.setPosition(map->getStartingPosition()); debugController.lookAt(map->getStartingPosition() - Vector3::unitZ()); debugCamera.setCoordinateFrame(debugController.getCoordinateFrame()); applet->run(); }
void Init(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glewInit(); glutInitContextVersion (3, 2); #ifdef _DEBUG glutInitContextFlags (GLUT_DEBUG); #endif glutInitWindowSize (WindowWidth, WindowHeight); glutInitWindowPosition(50, 50); glutCreateWindow (argv[0]); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc (keyboard); glutIdleFunc(display); glewInit(); #ifdef _DEBUG SetupOpenGLDebugCallback(); #endif gDemo.Init(); }
void PreconditionAssertDemo() { // define a variable, but we don't know it's value yet Demo::MyEnum my_enum = Demo::MyEnum::kUndefined; // oops, forgot to set a valid value to the variable demo_->PreconditionAssert(my_enum); }
bool test_live_rpc() { printf("\n*** test_live_rpc()\n"); Network yarp; yarp.setLocalMode(true); Demo client; Server server; Port client_port,server_port; client_port.open("/client"); server_port.open("/server"); yarp.connect(client_port.getName(),server_port.getName()); int x = 0; client.yarp().attachAsClient(client_port); server.yarp().attachAsServer(server_port); // Check regular RPC works, even with oneways Bottle cmd, reply; cmd.fromString("[add] [one] 5"); client_port.write(cmd,reply); printf("Cmd %s reply %s\n", cmd.toString().c_str(), reply.toString().c_str()); if (reply.get(0).asInt()!=6) return false; cmd.fromString("[test] [void] 5"); client_port.write(cmd,reply); printf("Cmd %s reply %s\n", cmd.toString().c_str(), reply.toString().c_str()); cmd.fromString("[add] [one] 6"); client_port.write(cmd,reply); printf("Cmd %s reply %s\n", cmd.toString().c_str(), reply.toString().c_str()); if (reply.get(0).asInt()!=7) return false; cmd.fromString("[test] [1way] 5"); client_port.write(cmd,reply); printf("Cmd %s reply %s\n", cmd.toString().c_str(), reply.toString().c_str()); cmd.fromString("[add] [one] 7"); client_port.write(cmd,reply); printf("Cmd %s reply %s\n", cmd.toString().c_str(), reply.toString().c_str()); if (reply.get(0).asInt()!=8) return false; return true; }
// here is were everything begins int main(int argc, char* argv[]) { Demo demo; // process command line options demo.parseOptions(argc, argv); demo.setup(); if (demo.isVideo()) { cout << "Processing video" << endl; // setup image source, window for drawing, serial port... demo.setupVideo(); // the actual processing loop where tags are detected and visualized demo.loop(); } else { cout << "Processing image" << endl; // process single image demo.loadImages(); } return 0; }
bool test_live() { printf("\n*** test_live()\n"); Network yarp; yarp.setLocalMode(true); Demo client; Server server; Port client_port,server_port; client_port.open("/client"); server_port.open("/server"); yarp.connect(client_port.getName(),server_port.getName()); int x = 0; client.yarp().attachAsClient(client_port); server.yarp().attachAsServer(server_port); x = client.add_one(99); printf("Result %d\n", x); client.test_void(200); client.test_void(201); x = client.add_one(100); printf("Result %d\n", x); client.test_1way(200); client.test_1way(201); x = client.add_one(101); printf("Result %d\n", x); return (x==102); }
void App::main() { setDebugMode(true); debugController->setActive(true); // Load objects here sky = Sky::fromFile(dataDir + "sky/"); applet->run(); }
bool test_void() { printf("\n*** test_void()\n"); ClientPeek client_peek; Demo client; client.yarp().attachAsClient(client_peek); client.test_void(14); client.test_1way(14); Server server; Bottle bot("[test] [void] 14"); DummyConnector con; bot.write(con.getWriter()); server.read(con.getReader()); bot.read(con.getReader()); printf("Result is %s (should be blank)\n", bot.toString().c_str()); return bot.size()==0 && !bot.isNull(); }
int main(int argc, char* argv[]) { ros::init(argc, argv, "ros_apriltags_node"); Demo demo; process_flag = false; // process command line options demo.parseOptions(argc, argv); demo.setup(); if (demo.isVideo()) { cout << "Processing video" << endl; // setup image source, window for drawing, serial port... //demo.setupVideo(); //ros::spinOnce(); // the actual processing loop where tags are detected and visualized demo.loop(); } else { cout << "Processing image" << endl; // process single image demo.loadImages(); } return 0; }