Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#pragma once
#include "ofMain.h"
class testApp : public ofBaseApp{
public:
int randomCounts[20];
void setup();
void update();
void draw();
};
#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]);
}
}
#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