@niels wrote:
Hey people,
I am looking for a way, to return the last changed parameter inside ofxGui. I couldn´t find something like this in the given functions. Is there a workaround for this?
What I want to do, is modifying individual parameters within another gui on a timeloop-base. But I don’t want to have all these guis in one interface because that would overload my window.In the moment, I just can change the position value in the timeLoop, of course I could make another parameter for size. But in advance thats not a solution. I thought about having generated one gui-panel from a gui-class for every parameter in setup, and than only draw the gui panel for the activated parameter which I don´t know how to get. I hope this is understandable.
I thank you ahead!Here is my code:
ofApp.h:
#pragma once #include "ofMain.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); ofxPanel guiGlobal; ofxPanel guiLoop; ofParameter<float> size; ofParameter<float> position; ofParameter<float> timeLoop; ofParameter<float> change; ofParameter<bool> record; vector<float> changes; };
ofApp.cpp:
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup(){ guiGlobal.setup("values"); guiGlobal.add(size.set("size",5,0,100)); guiGlobal.add(position.set("position",100,0,500)); guiGlobal.setPosition(10,10); guiLoop.setup("loop"); guiLoop.add(record.set("record",false)); guiLoop.add(timeLoop.set("timeLoop",0,0,100)); guiLoop.add(change.set("change",0,-200,200)); guiLoop.setPosition(300,10); changes.resize(100); } //-------------------------------------------------------------- void ofApp::update(){ timeLoop += 0.05; timeLoop = fmod(timeLoop,100); if (record){ changes[(int)timeLoop] = change; } } //-------------------------------------------------------------- void ofApp::draw(){ guiGlobal.draw(); guiLoop.draw(); ofDrawRectangle(position + changes[(int)timeLoop], 100, size, 100); } //-------------------------------------------------------------- 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){ } }
Posts: 1
Participants: 1