int main(){ int ch='X'; //Creates the 3 stacks; initially empty (head points to tail) headA=initLLNode(100); tailA=initLLNode(100); headA->next=tailA; headB=initLLNode(101); tailB=initLLNode(101); headB->next=tailB; headC=initLLNode(102); tailC=initLLNode(102); headC->next=tailC; //repeat the prompt until the user enters the ESC key. //(esc corresponds to ASCII value 27, so we repeat while ch is not equal to 27) while(ch!=27){ if(ch==49)play(); //if 1 entered, start play mode if(ch==50)Demo(); //if 2 entered, demo mode if(ch==51)hof(); //if 3 entered, go to hall of face system("cls"); //this clears the screen printf("Tower of Hanoi\n" "==============================\n" "Press 1 to go to Game Mode.\n" "Press 2 to go to Demo Mode.\n" "Press 3 to go to Hall of Fame.\n" "Press ESC to Exit.\n"); emptyStacks(); //initalizes the stacks (explained at function definition) ch = getch(); //gets user input } return 0; }
int main (void) { // unsigned int i,data[2]; // unsigned char count = 0,flag = FALSE; Init(); /* for (i = 0; i < 0x1FFF; i++) { OdometrieData(data); if ((data[0] < 200) && (flag == TRUE)) { count ++; flag = FALSE; } if (data[0] >= 600) flag = TRUE; } if (count > 10) Demo(); */ while (1) { if (PollSwitch()) { while (PollSwitch()); Demo(); } SelfTest(); } return 0; }
int main() { auto logger = std::make_shared<gst::StdoutLogger>(); auto window = std::make_shared<gst::WindowImpl>( logger, // exit on close true, // exit on esc true, // fullscreen false, // resize false, // size gst::Resolution(800, 600), // title "Rim Lighting" ); if (window->open()) { auto runner = gst::WorldRunner(); auto clock = gst::HighResolutionClock(); auto demo = Demo(logger, window); return runner.control(demo, clock, *window); } else { return 1; } }
int main ( int argc, char** argv ) { Demo D = Demo(640,480); D.Execute(); return 0; }
void App::main() { setDebugMode(true); debugController->setActive(false); // Load objects here sky = Sky::fromFile(dataDir + "sky/"); debugShowRenderingStats = false; Demo(this).run(); }
void App::main() { setDebugMode(true); debugController.setActive(true); camera.init(VideoCapture::enumerateDeviceNames()[0], 128, 96); // Load objects here sky = Sky::create(renderDevice, dataDir + "sky/"); Demo(this).run(); }
int main() { std::vector<Demo> trial ; trial.push_back(Demo(2)); std::cout << trial[0].getMember(); // Try this : //Demo ob(3); //trial.push_back(ob); // will throw error return 0; }
void Keyboard(unsigned char key, int x, int y) { const float increment = 0.2f; switch(key) { case ESC_KEY: exit( 0 ); break; case 'f': frameStepping = frameStepping ? false : true; break; case ' ': frameStepping = true; canStep = true; break; case 'w': Camera::position[ 2 ] -= increment; Camera::target[ 2 ] -= increment; break; case 's': Camera::position[ 2 ] += increment; Camera::target[ 2 ] += increment; break; case 'a': Camera::position[ 0 ] -= increment; Camera::target[ 0 ] -= increment; break; case 'd': Camera::position[ 0 ] += increment; Camera::target[ 0 ] += increment; break; case 'q': Camera::position[ 1 ] -= increment; Camera::target[ 1 ] -= increment; break; case 'e': Camera::position[ 1 ] += increment; Camera::target[ 1 ] += increment; break; case 'r': Demo( ); break; } }
void ProcesaRGB() { int8 i=0; int1 CambiandoRojo, CambiandoVerde, CambiandoAzul; CambiandoRojo=false; CambiandoVerde=false; CambiandoAzul=false; while (i<CaracteresRecibidos) { if ((Buffer[i]=='r') || (Buffer[i]=='R')) { CambiandoRojo=true; CambiandoVerde=false; CambiandoAzul=false; Rojo=0; } if ((Buffer[i]=='g') || (Buffer[i]=='G')) { CambiandoVerde=true; CambiandoRojo=false; CambiandoAzul=false; Verde=0; } if ((Buffer[i]=='b') || (Buffer[i]=='B')) { CambiandoAzul=true; CambiandoRojo=false; CambiandoVerde=false; Azul=0; } if ((Buffer[i]>='0') && (Buffer[i]<='9')) { if (CambiandoRojo) Rojo=Rojo*10+Buffer[i]-48; if (CambiandoVerde) Verde=Verde*10+Buffer[i]-48; if (CambiandoAzul) Azul=Azul*10+Buffer[i]-48; } if ((Buffer[i]=='d') || (Buffer[i]=='D')) Demo(); i++; } printf ("Color establecido: Rojo = %u, Verde = %u, Azul = %u \n\r\n\r",Rojo,Verde,Azul); CaracteresRecibidos=0; ComandoRecibido=false; }
int main( int argc, char *argv[]) { if(argc != 3 && argc != 2) { printf("Wrong command. Use **./app -h** for help.\n"); return 0; } void *lib_handle; PCIE_HANDLE hPCIe; lib_handle = PCIE_Load(); if (!lib_handle) { printf("PCIE_Load failed\n"); return 0; } hPCIe = PCIE_Open(0,0,0); if (!hPCIe) { printf("PCIE_Open failed\n"); return 0; } char* input = argv[1]; if (strcmp("-d",input)==0) { Demo(hPCIe, argv[2]); } else if(strcmp("-h",input)==0) { printf("Use **./app -d <imagefilename>** to start demo.\n"); } else { printf("Wrong command. Use **./app -h** for help.\n"); } return 0; }
int main( int argc, char** argv ) { // Starting width / height of the window const u32 kWindowWidth = 1000; const u32 kWindowHeight = 600; // Initialize GLUT glutInit( &argc, argv ); // Get how big our screen is that we're displaying the window on int screenWidth = glutGet( GLUT_SCREEN_WIDTH ); int screenHeight = glutGet( GLUT_SCREEN_HEIGHT ); // Initialize the display mode to utilize double buffering, 4-channel framebuffer and depth buffer glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL ); // Setup the window glutInitWindowSize( kWindowWidth, kWindowHeight ); glutInitWindowPosition( (screenWidth - kWindowWidth) / 2, (screenHeight - kWindowHeight) / 2 ); glutCreateWindow( "qu3e Physics by Randy Gaul" ); glutDisplayFunc( PhysicsLoop ); glutReshapeFunc( Reshape ); glutKeyboardFunc( Keyboard ); glutMouseFunc( Mouse ); glutIdleFunc( PhysicsLoop ); // Setup all the open-gl states we want to use (ones that don't change in the lifetime of the application) // Note: These can be changed anywhere, but generally we don't change the back buffer color glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); glEnable( GL_CULL_FACE ); glEnable( GL_DEPTH_TEST ); glCullFace( GL_BACK ); glFrontFace( GL_CCW ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glEnable( GL_BLEND ); // Show the window that we just initailized glutShowWindow( ); // Used FFP to setup lights float floats[ 4 ]; for ( i32 i = 0; i < 4; ++i ) floats[ i ] = (float)Light::ambient[ i ]; glLightfv( GL_LIGHT0, GL_AMBIENT, floats ); for ( i32 i = 0; i < 4; ++i ) floats[ i ] = (float)Light::diffuse[ i ]; glLightfv( GL_LIGHT0, GL_DIFFUSE, floats ); for ( i32 i = 0; i < 4; ++i ) floats[ i ] = (float)Light::specular[ i ]; glLightfv( GL_LIGHT0, GL_SPECULAR, floats ); for ( i32 i = 0; i < 4; ++i ) floats[ i ] = (float)Camera::position[ i ]; glLightfv( GL_LIGHT0, GL_POSITION, floats ); glEnable( GL_LIGHT0 ); glColorMaterial( GL_FRONT, GL_AMBIENT_AND_DIFFUSE ); Demo( ); glutMainLoop( ); return 0; }
/** * @brief Main program. * @param None * @retval None */ int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f0xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f0xx.c file*/ /* Setup SysTick Timer for 1 msec interrupts.*/ if (SysTick_Config(SystemCoreClock / 1000)) { /* Capture error */ while (1); } /* Initialize LEDs, User Button on STM32F072B-DISCO board ***********/ STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_EXTI); STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); STM_EVAL_LEDInit(LED5); STM_EVAL_LEDInit(LED6); /* Initialize Mems Gyroscope */ Demo_GyroConfig(); /* Initialize USB Device */ USBD_Init(&USB_Device_dev, &USR_desc, &USBD_HID_cb, &USR_cb); /* Init STMTouch driver */ TSL_user_Init(); /* End of Initialisation */ /* Delay 1s to select Test Program or to go directly through the demo*/ Delay (1000); if (STM_EVAL_PBGetState(BUTTON_USER) == Bit_SET ) { /* Wait for User button is released */ while (STM_EVAL_PBGetState(BUTTON_USER) != Bit_RESET) {} /* Set ButtonPressed at 0 value */ ButtonPressed = 0; /* LED test : Blinking LEDs */ LED_Test(); /* Wait for User button to be pressed to switch to USB Test the cursor move in square path and led On corresponding to such direction */ USB_Test(); /* Move Discovery board to execute MEMS Test, Mems detect the angular rate and led On corresponding to such direction*/ MEMS_Test(); /* Wait for User button to be pressed to switch to Touch Sensor Test each TouchKey pointed correspond to specific Leds On, test can performed in both direction */ LTS_Test(); } /* Infinite loop */ while (1) { Demo(); } }