Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include "Ball.h"
  2.  
  3. int numBalls; // The total number of balls we'll use.
  4.  
  5. vector<Ball> balls; // A collection of all balls.
  6.  
  7. void setup() {
  8. ofSetFrameRate(60);
  9.  
  10. numBalls = 75; // The total number of balls we'll use.
  11.  
  12. // Enable vertical sync.
  13. ofSetVerticalSync(true);
  14.  
  15. // Set the window size.
  16. ofSetWindowShape(500, 500);
  17.  
  18. // Set the background color.
  19. ofBackground(255);
  20.  
  21. // Create the balls
  22. for (int i = 0; i < numBalls; i++) {
  23. balls.push_back(Ball());
  24. }
  25. }
  26.  
  27. void update() {
  28. // Update all balls.
  29. for (int i = 0; i < balls.size(); i++) {
  30. balls[i].update();
  31. }
  32. }
  33.  
  34. void draw() {
  35. // Draw all balls.
  36. for (int i = 0; i < balls.size(); i++) {
  37. balls[i].draw();
  38. }
  39.  
  40. // Log a message.
  41. ofLogNotice("draw()") << ofGetTimestampString();
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement