ofxGamepad: inverted button calls

Hi

I’m using ofxGamepad and I have come across some strange behavior. I follow the example code and use the listeners for “button pressed” and “button released”:

//in testApp::setup
if(ofxGamepadHandler::get()->getNumPads()>0)
{
ofxGamepad* pad = ofxGamepadHandler::get()->getGamepad(0);
ofAddListener(pad->onAxisChanged, this, &testApp::axisChanged);
ofAddListener(pad->onButtonPressed, this, &testApp::buttonPressed);
ofAddListener(pad->onButtonReleased, this, &testApp::buttonReleased);
}

//events
void testApp::buttonPressed(ofxGamepadButtonEvent& e)
{
cout << " PRESSED" << endl;
}

void testApp::buttonReleased(ofxGamepadButtonEvent& e)
{
cout << “RELEASED” << endl;
}

The thing is that these calls get inverted - when a gamepad button is released then buttonPressed() gets called and when a button is pressed buttonReleased() is called. The draw() functionality that comes with ofxGamepad also indicates this behavior.

  • I’ve tried two different gamepads
  • Tried another clean empty example, implemented ofxGamepad and got the same strange behavior
  • Using xcode 4.5
  • OF 0.72
  • Played super meat boy with no inverted button behavior on the same gamepad
  • Axis calls work as expected

I’m aware this problem is easy to get around just by using buttonReleased as a call to buttonPressed(). But I’m concerned that this condition will be opposite on some machines, and that would be troublesome…
I haven’t had the chance to try this on any other system yet, not because I’m lazy, just because of some linker issues when not running through Xcode (but that’s another story, not ofxGamepad related).

Would be great if someone had any ideas on what may be the cause of this :slight_smile: