I'm trying to write a program in which a knob drawn in an OpenGL window functions as a GUI widget. Here's the class for the knob:
Code:
class gluisKnob
{
public:
double value, max, min, default, step, scrollStep;
void setTarget (void*);
};
// Function to set the target
void gluisKnob::setTarget (void * TARGET)
{
target = TARGET;
}
There are more functions and members, but this is the important bit.
The knob is to turn when clicked and dragged, or when scrolled on, and changes the value of a variable that target points to.
I have no trouble assigning the address of some other variable (int, float, whatever) to target but how do I use that to assign a value to the variable it points to?
example:
Code:
gluisKnob knob;
double pitch;
knob.setTarget (&pitch);
...
// This part is during the program's main loop
if (user_clicks_and_drags_the_knob() )
{
knob.target = knob's_new_value; // This doesn't work
*knob.target = knob's_new_value; // This gives the error message in the thread title
knob.*target = knob's_new_value // This doesn't work either.
}
Thanks,
Chris