StrikerX3/JXInput

Emulate controller?

TheQuietCroc opened this issue · 1 comments

Is it possible to use this to emulate pressing an XInput button and such instead of reacting to it?

Do you mean to generate button presses so that other applications could capture them (similar to java.awt.Robot)? That is not the goal of JXInput; it's meant to be an XInput wrapper, so it can only do whatever XInput allows. It's not a controller emulator, and will never be.

If you are trying to emulate button presses within your application with the purposes of testing, you could simply override the values of the desired public fields from XInputButtons or XInputAxes right after polling, like this:

XInputDevice device = ...;
device.poll();
// override values for testing purposes
XInputButtons buttons = device.getComponents().getButtons();
buttons.a = true;
buttons.x = true;