Suby

main

May 25th, 2012
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 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 <ctime>
  10.  
  11. //if anyone wants to try to compile this to test it out, you need to press spacebar to unpause it
  12.  
  13. int main( int argc, char* args[] )
  14. {
  15. //srand((long)time(0));
  16.  
  17. //Quit flag
  18. bool quit = false;
  19.  
  20. Timer SimulationTime;
  21. SimulationTime.start();
  22. SimulationTime.pause();
  23.  
  24. SDL_Graphics GraphicsObject(SCREEN_WIDTH, SCREEN_HEIGHT, BACKGROUND_RED, BACKGROUND_GREEN, BACKGROUND_BLUE);
  25. Input InputObject;
  26. Board BoardObject;
  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);
  36.  
  37. //clear the screen
  38. GraphicsObject.clearScreen();
  39.  
  40. Simulator.SimulateTurn(BoardObject, SimulationTime);
  41.  
  42. //draw the board
  43. BoardObject.DrawBoard(&GraphicsObject);
  44.  
  45. //update the screen
  46. GraphicsObject.updateScreen();
  47.  
  48. SDL_Delay(1);
  49. //Cap the frame rate
  50.  
  51. }
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment