← Back

ofxGLFWJoystick

github.com/armadillu/ofxGLFWJoystick · @armadillu
OF 0.12 Hardware Interface

Use Joysticks in OpenFrameworks (GLFW window only)

13 9 Last commit 1y ago Created 11y ago

Forks

Forks pushed to more recently than armadillu/ofxGLFWJoystick itself, plus any admin-confirmed fork with commits of its own — worth checking if you're hitting issues with the original.

Scylardor/ofxGLFWJoystick by @Scylardor · ★ 1 · pushed 1y ago

README

ofxGLFWJoystick



Use any number of joysticks with OpenFrameworks. This add-on wraps the GLFW functionality, so it will most likely only work if your project uses a ofAppGLFWWindow.

3 joysticks

How to Use



Just update the singleton object every frame:

	void ofApp::update(){
		ofxGLFWJoystick::one().update();
	}


And then access any values from any class:

	int joystickID = 0;
	int axisID = 0;
	float joyX = ofxGLFWJoystick::one().getAxisValue(axisID, joystickID);


That's all! To know what features are supported on your joystick, or if it's supported at all, you might want to drawDebug() the joysticks:

	ofxGLFWJoystick::one().drawDebug(100,100);


Notes

Only tested on OSX.

It seems that joysticks need to be plugged in before you launch the app for them to be detected.

I got an USB Xbox 360 controller to work on OSX using this.

Access from the main thread only.

License

MIT

Get this addon

HTTPS
SSH