From 69629356120042776041e01490b70cddd2a17927 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sat, 26 Dec 2015 18:21:17 +0000 Subject: [PATCH] Change example code style using ofStyler --- example/src/CrossSource.cpp | 42 +++++++++++------------ example/src/CrossSource.h | 6 ++-- example/src/CustomSource.cpp | 64 ++++++++++++++++++------------------ example/src/CustomSource.h | 18 +++++----- example/src/main.cpp | 52 ++++++++++++++--------------- example/src/ofApp.cpp | 42 +++++++++++------------ example/src/ofApp.h | 18 +++++----- 7 files changed, 121 insertions(+), 121 deletions(-) mode change 100755 => 100644 example/src/ofApp.cpp mode change 100755 => 100644 example/src/ofApp.h diff --git a/example/src/CrossSource.cpp b/example/src/CrossSource.cpp index 6516c79..7b216c5 100644 --- a/example/src/CrossSource.cpp +++ b/example/src/CrossSource.cpp @@ -1,26 +1,26 @@ #include "CrossSource.h" -CrossSource::CrossSource() { - name = "Cross FBO Source"; - allocate(500, 500); +CrossSource::CrossSource(){ + name = "Cross FBO Source"; + allocate(500, 500); } -void CrossSource::draw() { - ofClear(0); - ofSetColor(255, 255, 0, 255); - ofRect(0, 0, getWidth(), getHeight()); - - ofSetColor(0, 0, 0, 255); - ofSetLineWidth(5); - - float y = sin( float(ofGetFrameNum()) / 10.0f ) * 100.0f; - - ofPoint startPoint = ofPoint(10, y); - ofPoint endPoint = ofPoint(getWidth() - 10, getHeight() - y); - ofLine(startPoint, endPoint); - - float tempY = startPoint.y; - startPoint.y = endPoint.y; - endPoint.y = tempY; - ofLine(startPoint, endPoint); +void CrossSource::draw(){ + ofClear(0); + ofSetColor(255, 255, 0, 255); + ofRect(0, 0, getWidth(), getHeight()); + + ofSetColor(0, 0, 0, 255); + ofSetLineWidth(5); + + float y = sin(float(ofGetFrameNum()) / 10.0f) * 100.0f; + + ofPoint startPoint = ofPoint(10, y); + ofPoint endPoint = ofPoint(getWidth() - 10, getHeight() - y); + ofLine(startPoint, endPoint); + + float tempY = startPoint.y; + startPoint.y = endPoint.y; + endPoint.y = tempY; + ofLine(startPoint, endPoint); } \ No newline at end of file diff --git a/example/src/CrossSource.h b/example/src/CrossSource.h index 985aa9b..bc0d2b2 100644 --- a/example/src/CrossSource.h +++ b/example/src/CrossSource.h @@ -4,8 +4,8 @@ #include "FboSource.h" class CrossSource : public ofx::piMapper::FboSource { - public: - CrossSource(); + public: + CrossSource(); - void draw(); + void draw(); }; \ No newline at end of file diff --git a/example/src/CustomSource.cpp b/example/src/CustomSource.cpp index dd9c260..7418240 100644 --- a/example/src/CustomSource.cpp +++ b/example/src/CustomSource.cpp @@ -1,42 +1,42 @@ #include "CustomSource.h" -CustomSource::CustomSource() { - // Give our source a decent name - name = "Custom FBO Source"; - - // Allocate our FBO source, decide how big it should be - allocate(500, 500); - - // Genereate rects to be rendered into the FBO - int numRects = 20; // change this to add more or less rects - for (int i = 0; i < numRects; i++) { - rects.push_back(ofRectangle(0, - ofRandom(fbo->getHeight()), - fbo->getWidth(), - ofRandom(20))); - rectSpeeds.push_back((1.0f + ofRandom(5))); - } +CustomSource::CustomSource(){ + // Give our source a decent name + name = "Custom FBO Source"; + + // Allocate our FBO source, decide how big it should be + allocate(500, 500); + + // Genereate rects to be rendered into the FBO + int numRects = 20; // change this to add more or less rects + for(int i = 0; i < numRects; i++){ + rects.push_back(ofRectangle(0, + ofRandom(fbo->getHeight()), + fbo->getWidth(), + ofRandom(20))); + rectSpeeds.push_back((1.0f + ofRandom(5))); + } } // Don't do any drawing here -void CustomSource::update() { - // Move rects - for (int i = 0; i < rects.size(); i++) { - rects[i].y += rectSpeeds[i]; - if (rects[i].y > fbo->getHeight()) { - rects[i].y = -rects[i].getHeight(); - } - } +void CustomSource::update(){ + // Move rects + for(int i = 0; i < rects.size(); i++){ + rects[i].y += rectSpeeds[i]; + if(rects[i].y > fbo->getHeight()){ + rects[i].y = -rects[i].getHeight(); + } + } } // No need to take care of fbo.begin() and fbo.end() here. // All within draw() is being rendered into fbo; -void CustomSource::draw() { - // Fill FBO with our rects - ofClear(0); - //ofBackground(0); - ofSetColor(255); - for (int i = 0; i < rects.size(); i++) { - ofRect(rects[i]); - } +void CustomSource::draw(){ + // Fill FBO with our rects + ofClear(0); + //ofBackground(0); + ofSetColor(255); + for(int i = 0; i < rects.size(); i++){ + ofRect(rects[i]); + } } \ No newline at end of file diff --git a/example/src/CustomSource.h b/example/src/CustomSource.h index bddb984..cb23a3e 100644 --- a/example/src/CustomSource.h +++ b/example/src/CustomSource.h @@ -4,15 +4,15 @@ #include "FboSource.h" class CustomSource : public ofx::piMapper::FboSource { - public: - CustomSource(); + public: + CustomSource(); - // These are overrides of FboSource virtual functions. - // FBO sources are not executing before they have been assigned to a surface. - void update(); - void draw(); // You don't have to care about fbo.begin() or fbo.end() here + // These are overrides of FboSource virtual functions. + // FBO sources are not executing before they have been assigned to a surface. + void update(); + void draw(); // You don't have to care about fbo.begin() or fbo.end() here - private: - vector rects; - vector rectSpeeds; + private: + vector rects; + vector rectSpeeds; }; \ No newline at end of file diff --git a/example/src/main.cpp b/example/src/main.cpp index 4c419e8..95c3000 100644 --- a/example/src/main.cpp +++ b/example/src/main.cpp @@ -4,34 +4,34 @@ #ifdef TARGET_RASPBERRY_PI -int main(int argc, char* argv[]) { - - bool fullscreen = false; - - if (argc > 0) { - std::string fullscreenFlag = "-f"; - for (int i = 0; i < argc; i++) { - if (strcmp(argv[i], fullscreenFlag.c_str()) == 0) { - fullscreen = true; - break; - } - } - } - - if (fullscreen) { - ofSetupOpenGL(600, 500, OF_FULLSCREEN); - } else { - ofSetupOpenGL(800, 450, OF_WINDOW); - } - - ofRunApp(new ofApp()); -} + int main(int argc, char * argv[]){ + + bool fullscreen = false; + + if(argc > 0){ + std::string fullscreenFlag = "-f"; + for(int i = 0; i < argc; i++){ + if(strcmp(argv[i], fullscreenFlag.c_str()) == 0){ + fullscreen = true; + break; + } + } + } + + if(fullscreen){ + ofSetupOpenGL(600, 500, OF_FULLSCREEN); + }else{ + ofSetupOpenGL(800, 450, OF_WINDOW); + } + + ofRunApp(new ofApp()); + } #else -int main() { - ofSetupOpenGL(800, 600, OF_WINDOW); - ofRunApp(new ofApp()); -} + int main(){ + ofSetupOpenGL(800, 600, OF_WINDOW); + ofRunApp(new ofApp()); + } #endif diff --git a/example/src/ofApp.cpp b/example/src/ofApp.cpp old mode 100755 new mode 100644 index f616d4f..8e1bdc5 --- a/example/src/ofApp.cpp +++ b/example/src/ofApp.cpp @@ -1,26 +1,26 @@ #include "ofApp.h" -void ofApp::setup() { - ofBackground(0); - - // Enable or disable audio for video sources globally - // Set this to false to save resources on the Raspberry Pi - ofx::piMapper::VideoSource::enableAudio = false; - - // Add our CustomSource to list of fbo sources of the piMapper - // FBO sources should be added before piMapper.setup() so the - // piMapper is able to load the source if it is assigned to - // a surface in XML settings. - crossSource = new CrossSource(); - customSource = new CustomSource(); - piMapper.registerFboSource(*crossSource); - piMapper.registerFboSource(*customSource); - piMapper.setup(); - - // The info layer is hidden by default, press to toggle - // piMapper.showInfo(); +void ofApp::setup(){ + ofBackground(0); + + // Enable or disable audio for video sources globally + // Set this to false to save resources on the Raspberry Pi + ofx::piMapper::VideoSource::enableAudio = false; + + // Add our CustomSource to list of fbo sources of the piMapper + // FBO sources should be added before piMapper.setup() so the + // piMapper is able to load the source if it is assigned to + // a surface in XML settings. + crossSource = new CrossSource(); + customSource = new CustomSource(); + piMapper.registerFboSource(*crossSource); + piMapper.registerFboSource(*customSource); + piMapper.setup(); + + // The info layer is hidden by default, press to toggle + // piMapper.showInfo(); } -void ofApp::draw() { - piMapper.draw(); +void ofApp::draw(){ + piMapper.draw(); } \ No newline at end of file diff --git a/example/src/ofApp.h b/example/src/ofApp.h old mode 100755 new mode 100644 index 88f13c7..54aabf8 --- a/example/src/ofApp.h +++ b/example/src/ofApp.h @@ -7,14 +7,14 @@ #include "VideoSource.h" class ofApp : public ofBaseApp { - public: - void setup(); - void draw(); + public: + void setup(); + void draw(); - ofxPiMapper piMapper; - - // By using a custom source that is derived from FboSource - // you will be able to see the source listed in sources editor - CustomSource * customSource; - CrossSource * crossSource; + ofxPiMapper piMapper; + + // By using a custom source that is derived from FboSource + // you will be able to see the source listed in sources editor + CustomSource * customSource; + CrossSource * crossSource; }; \ No newline at end of file