/ofxGamepad

gamepad support for openframeworks 007

Primary LanguageC++

Gamepad support for OpenFrameworks

On linux it's stable and fully functional, using the native <linux/joystick.h>.
Window and Mac Versions use OIS, which is also available on linux as well. To switch you simply have to #define USE_OIS. Mac and Windows should define USE_OIS automatically.

Additional notes for Windows:
For Windows a handle to the window needs to be passed to the input manager/OIS. Since openFrameworks handles the creation of the window, we need a different method to get this handle.

To make this work we do the following:

(1) In our app we define a name for the window:

void gamepadExampleApp::setup(){  
    ofSetWindowTitle("gamepadExampleApp");  

(2) In the add-on we use the same name to find the window and obtain the handle:	

On line 77 of ofxGamepadHandler.cpp , you will find something like this:
HWND windowHandle = FindWindow(NULL, L"gamepadExampleApp");  

You can use any name as a title, just make sure you use the same name in both files.