diff --git a/README.md b/README.md index dd72d59..38e0d37 100644 --- a/README.md +++ b/README.md @@ -51,5 +51,8 @@ See the specific examples directories for a full description on each example. [Matrix Plot Example](example_matrix_plot) ![alt text](example_matrix_plot/images/matrix_plot.png "Matrix Plot Example") +[Bar Plot Example](example_bar_plot) +![alt text](example_bar_plot/images/bar_plot.png "Bar Plot Example") + ##License The ofxGRT is available under a MIT license. diff --git a/example_bar_plot/README.md b/example_bar_plot/README.md new file mode 100644 index 0000000..c80adaa --- /dev/null +++ b/example_bar_plot/README.md @@ -0,0 +1,24 @@ +##Bar Plot Example + +This example demonstrates the how to use ofxGrt Bar Plot class. + +The example will generate a basic sine wave signal and plot this using the bar plot class. + +![alt text](images/bar_plot.png "Bar Plot Example") + +##Building and running the example +On OS X and Linux, you can build this example by running the following command in terminal: + +```` +cd THIS_DIRECTORY +make -j4 +```` + +To run the example, run the following in terminal: + +```` +make run +```` + +##Using the example +To use this example, simply build and run it. \ No newline at end of file diff --git a/example_bar_plot/images/bar_plot.png b/example_bar_plot/images/bar_plot.png new file mode 100644 index 0000000..c3965ae Binary files /dev/null and b/example_bar_plot/images/bar_plot.png differ diff --git a/example_bar_plot/src/ofApp.cpp b/example_bar_plot/src/ofApp.cpp index ac0283c..51edfec 100644 --- a/example_bar_plot/src/ofApp.cpp +++ b/example_bar_plot/src/ofApp.cpp @@ -14,7 +14,6 @@ void ofApp::setup(){ //Setup the plot plot1.setup( NUM_DIMENSIONS, "sine data"); plot1.setRanges( -1.0, 1.0, true ); - } @@ -33,11 +32,10 @@ void ofApp::update(){ //-------------------------------------------------------------- void ofApp::draw(){ - int zoom = 5; int plotX = 10; int plotY = 10; int plotW = ofGetWidth() - plotX*2; - int plotH = 100; + int plotH = ofGetHeight() - 20; ofSetColor(255,255,255); ofFill(); @@ -52,6 +50,16 @@ void ofApp::draw(){ //-------------------------------------------------------------- void ofApp::keyPressed(int key){ + switch(key){ + case 'q': + { + ofImage img; + img.grabScreen(0, 0 , ofGetWidth(), ofGetHeight()); + img.save( ofToDataPath( "screenshot_" + Util::timeAsString() + ".png") ); + } + break; + } + } //-------------------------------------------------------------- diff --git a/example_matrix_plot/README.md b/example_matrix_plot/README.md index bfda11c..e7583ee 100644 --- a/example_matrix_plot/README.md +++ b/example_matrix_plot/README.md @@ -1,6 +1,6 @@ ##Matrix Plot Example -This example demonstrates the how to use GRT Matrix Plot class. +This example demonstrates the how to use ofxGrt Matrix Plot class. The example will generate three matrices, and plot them with the default grayscale plot and using a heatmap texture.