Created
December 9, 2013 17:01
-
-
Save darrenmothersele/7875888 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "ofMain.h" | |
class testApp : public ofBaseApp{ | |
public: | |
int randomCounts[20]; | |
void setup(); | |
void update(); | |
void draw(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "testApp.h" | |
#include <ofGraphics.h> | |
void testApp::setup(){ | |
ofBackground(255); | |
ofSetColor(0); | |
} | |
void testApp::update(){ | |
int index = ofRandom(20); | |
randomCounts[index]++; | |
} | |
void testApp::draw(){ | |
int w = ofGetWidth() / 20; | |
for (int x = 0; x < 20; ++x) { | |
ofRect(x * w, ofGetHeight() - randomCounts[x], w - 1, randomCounts[x]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ofMain.h" | |
#include "testApp.h" | |
int main( ){ | |
ofSetupOpenGL(1024,768,OF_WINDOW); | |
ofRunApp(new testApp()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment