hey,
I have a class where I pass some variables (string, int, float, bool) as reference:
ofApp.h
#include "ofxPrintMyVars.h"
string s;
float f;
int i;
bool b;
ofApp.cpp
setup()
ofxPrintMyVars::addString("myString", &s);
ofxPrintMyVars::addFloat("myFloat", &f);
ofxPrintMyVars::addInt("myInt ", &i);
ofxPrintMyVars::addBool("myBool ", &b);
ofxPrintMyVars.h
void addFloat(string name, float *var);
vector<float> floats;
ofxPrintMyVars.cpp
void ofxPrintMyVars::addFloat(string name, float *var, bool _newLine)
{
floats.push_back(var);
}
The class just draws the values of these variables and runs very well.
But I want to add ofParameters types too.
Has the ofParameter type (or others) âa simple C float type variableâ somewhere accesible?
If it has, then I can pass directly this &var with the methods I have already implemented.
Something like:
ofApp
ofParameter<float> fParam;
ofxPrintMyVars::addFloat("myFloat", & (> fParam <) );
The point is that here I donât need the ofParameter more stuff like min, max, name, listener âŚetc
If this is not possible, my approach would be to make âadder methodsâ to any ofParameter types or ofAbstractParameter, and then to cast them to identify typesâŚetc.
I want to know if there is an easier wayâŚ