Esempio n. 1
0
// program code aways begins at the top of main()
int main(){
  //The next line is a function drom core.cpp
  // it sets up Allegro for graphics and keyboard
  techInit();
    
  gameSetup();  
    
  // this next while loop
  while(key[KEY_ESC] == false){
    updatePaddlePosition();
    
    moveBall();
    
    if(numberOfBricksRemaining() == 0) {
      resetBricks();
    }
    
    drawingThings();
    
    // this line draws the screenBuffer to the screen
    // by drawing to off-screen memory first, then
    // copying the new total image to screen all at once,
    // we can avoid any flickering/flashing from the player
    // seeing characters drawn sequentially.
    // The technique us called double buffering.
    updateScreen();
    
    // is the game going too fast on your awesome modern hardware?
    // Experiment with numbers 0-15 here to slow down the application:
    rest(1);
    }
  return 0;
  } END_OF_MAIN()// putting this line after the main() function
Esempio n. 2
0
// program code aways begins at the top of main()
int main(){
  //The next line is a function drom core.cpp
  // it sets up Allegro for graphics and keyboard
  techInit();
    
  gameSetup();
    
  while(key[KEY_ESC] == false){
    movePlayer();
    
    moveShot();
    
    drawThings();
    
    updateScreen();

    // is the game going too fast on your awesome modern hardware?
    // Experiment with numbers 0-15 here to slow down the application:
    rest(1);
    }
  return 0;
} END_OF_MAIN()// putting this line after the main() function