I'm confused about how I can set an outside variable from within an event handler.
I have an interface kit class setup like this:
Code: Select all
class ofxPhidgetsIfkit : public ofxPhidgets {
public:
void init();
void digiOut(int index, int state);
void exit();
~ofxPhidgetsIfkit() { exit(); };
bool pushed;
private:
static int CCONV InputChangeHandler(CPhidgetInterfaceKitHandle phid, void *usrptr, int index, int state);
int display_properties(CPhidgetInterfaceKitHandle phid);
int result, numSensors, i;
const char *err;
//Declare an InterfaceKit handle
CPhidgetInterfaceKitHandle ifKit = 0;
};
And in the implementation of this method like so:
Code: Select all
int CCONV ofxPhidgetsIfkit::InputChangeHandler(CPhidgetInterfaceKitHandle phid, void *usrptr, int index, int state)
{
printf("Digital Input: %d > State: %d\n", index, state);
if (index && state) {
//how do I set the pushed boolean to true?//
}
return 0;
}
Now the question, like it says in the code, How do I set the 'pushed' boolean to true from within that handler so I can use it in my main app e.g.: if (myInterfacekit.pushed){ //do stuff//}
Any help much appreciated!!