Skip to content

Instantly share code, notes, and snippets.

@stephanschulz
Created January 29, 2023 20:00
Show Gist options
  • Save stephanschulz/1594b4c92847804589b8a174ec185388 to your computer and use it in GitHub Desktop.
Save stephanschulz/1594b4c92847804589b8a174ec185388 to your computer and use it in GitHub Desktop.
oscParametersSenderExample + ofParameter<void>
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
parameters.setName("parameters");
parameters.add(size.set("size",10,1,100));
parameters.add(number.set("number",10,1,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(),6667,"localhost",6666);
ofSetVerticalSync(true);
}
//--------------------------------------------------------------
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){
}
#pragma once
#include "ofMain.h"
#include "ofxOscParameterSync.h"
#include "ofxGui.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;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment