Created
January 29, 2023 20:01
-
-
Save stephanschulz/58b82dc7e102fb65d11b43e26e239d41 to your computer and use it in GitHub Desktop.
oscParametersReceiverExample + ofParameter<void>
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 "ofApp.h" | |
//-------------------------------------------------------------- | |
void ofApp::setup(){ | |
parameters.setName("parameters"); | |
parameters.add(size.set("size",10,0,100)); | |
parameters.add(number.set("number",10,0,100)); | |
parameters.add(check.set("check",false)); | |
parameters.add(voidTest.set("voidTest")); | |
parameters.add(color.set("color",ofColor(127),ofColor(0,0),ofColor(255))); | |
gui.setup(parameters); | |
// by now needs to pass the gui parameter groups since the panel internally creates it's own group | |
sync.setup((ofParameterGroup&)gui.getParameter(),6666,"localhost",6667); | |
ofSetVerticalSync(true); | |
listeners.push(voidTest.newListener( [&]() { | |
color.set(ofColor(ofRandom(255),ofRandom(255),ofRandom(255))); | |
})); | |
} | |
//-------------------------------------------------------------- | |
void ofApp::update(){ | |
sync.update(); | |
} | |
//-------------------------------------------------------------- | |
void ofApp::draw(){ | |
gui.draw(); | |
ofSetColor(color); | |
for(int i=0;i<number;i++){ | |
ofDrawCircle(ofGetWidth()*.5-size*((number-1)*0.5-i), ofGetHeight()*.5, size); | |
} | |
} | |
//-------------------------------------------------------------- | |
void ofApp::keyPressed(int key){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::keyReleased(int key){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseMoved(int x, int y ){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseDragged(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mousePressed(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseReleased(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseEntered(int x, int y){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseExited(int x, int y){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::windowResized(int w, int h){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::gotMessage(ofMessage msg){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::dragEvent(ofDragInfo dragInfo){ | |
} |
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" | |
#include "ofxGui.h" | |
#include "ofxOscParameterSync.h" | |
class ofApp : public ofBaseApp{ | |
public: | |
void setup(); | |
void update(); | |
void draw(); | |
void keyPressed (int key); | |
void keyReleased(int key); | |
void mouseMoved(int x, int y ); | |
void mouseDragged(int x, int y, int button); | |
void mousePressed(int x, int y, int button); | |
void mouseReleased(int x, int y, int button); | |
void mouseEntered(int x, int y); | |
void mouseExited(int x, int y); | |
void windowResized(int w, int h); | |
void dragEvent(ofDragInfo dragInfo); | |
void gotMessage(ofMessage msg); | |
ofxOscParameterSync sync; | |
ofParameter<float> size; | |
ofParameter<int> number; | |
ofParameter<bool> check; | |
ofParameter<void> voidTest; | |
ofParameterGroup parameters; | |
ofParameter<ofColor> color; | |
ofxPanel gui; | |
ofEventListeners listeners; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment