Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Ball.h"
- int numBalls; // The total number of balls we'll use.
- vector<Ball> balls; // A collection of all balls.
- void setup() {
- ofSetFrameRate(60);
- numBalls = 75; // The total number of balls we'll use.
- // Enable vertical sync.
- ofSetVerticalSync(true);
- // Set the window size.
- ofSetWindowShape(500, 500);
- // Set the background color.
- ofBackground(255);
- // Create the balls
- for (int i = 0; i < numBalls; i++) {
- balls.push_back(Ball());
- }
- }
- void update() {
- // Update all balls.
- for (int i = 0; i < balls.size(); i++) {
- balls[i].update();
- }
- }
- void draw() {
- // Draw all balls.
- for (int i = 0; i < balls.size(); i++) {
- balls[i].draw();
- }
- // Log a message.
- ofLogNotice("draw()") << ofGetTimestampString();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement