Search code examples
keyboardmouse

Can you program buttons on a gamepad to bind with mouse/keyboard input?


I was wondering if there was a way to write a program that could bind buttons on a gamepad to certain mouse/keyboard inputs. For example moving an analog stick on the gamepad to move the mouse, and clicking certain buttons on the gamepad == pressing keyboard keys or mouse clicks. Which language would be able to do this?


Solution

  • Sure, its possible. You just need some sort of Joystick interface that allows you to read its actions and then your program can translate it into other actions sent to the system.

    For example, in Java, you can use Jinput to read the joystick and then use jawa.awt.Robot to move the mouse. You may want to use some movement controls, such as a quadratic gradient to speedup/slowdown the mouse movements the longer the joystick is pushed in one direction, for instance.