Advertisement
Suby

main

Jun 1st, 2012
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. #include "SDL.h"
  2. #include "SDL_image.h"
  3. #include "sdl_graphics.h"
  4. #include "constants.h"
  5. #include "input.h"
  6. #include "board.h"
  7. #include "timer.h"
  8. #include "simulation_rules.h"
  9. #include "menu.h"
  10.  
  11.  
  12. int main( int argc, char* args[] )
  13. {
  14. //    srand((long)time(0));
  15.    
  16.     //Quit flag
  17.     bool quit = false;
  18.  
  19.     Timer SimulationTime;
  20.     SimulationTime.start();
  21.     SimulationTime.pause();
  22.  
  23.     SDL_Graphics GraphicsObject(SCREEN_WIDTH, SCREEN_HEIGHT, BACKGROUND_RED, BACKGROUND_GREEN, BACKGROUND_BLUE);
  24.     Input InputObject;
  25.     Board BoardObject;
  26.     Menu MenuObject;
  27.     Simulation_Rules Simulator;
  28.  
  29.     //While the user hasn't quit
  30.     while(quit == false)
  31.     {      
  32.         //get input
  33.         InputObject.readInput(quit, SimulationTime);
  34.  
  35.         InputObject.handleMouseInput(BoardObject, SimulationTime, MenuObject);
  36.  
  37.         //clear the screen
  38.         GraphicsObject.clearScreen();
  39.  
  40.         Simulator.SimulateTurn(BoardObject, SimulationTime, MenuObject);
  41.  
  42.         //draw the board
  43.         BoardObject.DrawBoard(&GraphicsObject);
  44.        
  45.         MenuObject.drawMenu(&GraphicsObject, SimulationTime);
  46.  
  47.         //update the screen
  48.         GraphicsObject.updateScreen();
  49.    
  50.         SDL_Delay(1);
  51.         //Cap the frame rate
  52.        
  53.     }    
  54.     return 0;    
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement