Last active
December 30, 2018 15:32
-
-
Save hiroMTB/6306b682d36281523dc0c8e5bf8cdb35 to your computer and use it in GitHub Desktop.
ofxGui, NOT working example
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 "ofMain.h" | |
#include "ofApp.h" | |
//======================================================================== | |
int main( ){ | |
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context | |
// this kicks off the running of my app | |
// can be OF_WINDOW or OF_FULLSCREEN | |
// pass in width and height too: | |
ofRunApp( new ofApp()); | |
} |
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
// | |
// MyClass.h | |
// | |
#pragma once | |
#include "ofxGui.h" | |
class MyClass{ | |
public: | |
MyClass(int i){ | |
string name = "settings" + ofToString(i); | |
gui.setup(name, name+".xml", i*220, 0); | |
gui.add(grp); | |
gui.loadFromFile(name+".xml"); | |
} | |
void draw(){ | |
gui.draw(); | |
} | |
ofParameter<int> myInt{"MyInt", 0, 0, 100}; | |
ofParameterGroup grp{"My Class", myInt}; | |
ofxPanel gui; | |
}; | |
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(){ | |
for(int i=0; i<3; i++){ | |
myClasses.push_back(i); | |
} | |
} | |
//-------------------------------------------------------------- | |
void ofApp::update(){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::draw(){ | |
for(auto & c : myClasses){ | |
c.draw(); | |
} | |
} | |
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 "MyClass.h" | |
class ofApp : public ofBaseApp{ | |
public: | |
void setup(); | |
void update(); | |
void draw(); | |
vector<MyClass> myClasses; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment