// callback function that tells OpenGL how to redraw window void display( void ) { glClear( GL_COLOR_BUFFER_BIT ); // clear the display switch(GAMESTATE) { //Game not yet started case 0: showStartScreen(); LEFT_SCORE = 0; RIGHT_SCORE = 0; BALL_WARP = 1; PADDLE_WARP = 1; //Display Name //Display Controls break; } if(PAUSED) { showPausedStr(); } draw_scores(); left_paddle.draw(); right_paddle.draw(); draw_outline(); ball.draw(); glFlush(); glutSwapBuffers(); }
int main(void) { int iChoice = 0; // size console window to 100x40 if(!initConsole()) { // show error box showError("Error", "Console Window could not be initialized.\nExiting program."); return EXIT_FAILURE; } // LogIn / Register Menu showStartScreen(); do { // choose between LogIn and Register getUserInput("%i", &iChoice, "\tChoose: ", "\n\tYour input is invalid. Please choose again.\n"); } while(iChoice != 1 && iChoice != 2); // LogIn / Register if(iChoice == 1) { // loop until valid login while(!showLogin()); } else { // loop until valid registration while(!showRegister()); } // loop until user quits manually while(startApplication()); return EXIT_SUCCESS; }