Java中的虚拟操纵杆

Java中的虚拟操纵杆,java,java-native-interface,wrapper,jna,joystick,Java,Java Native Interface,Wrapper,Jna,Joystick,你听说过有Java包装的Windows虚拟操纵杆吗 我尝试了PPJOY,它工作得很好,但是我需要使用JNI从Java来让它工作,这在目前看来并不容易 谢谢 你来了。我为PPJoy制作了一个Java包装器。而且它真的很容易使用。见: try { /* * Try to create a new joystick. */ Joystick joystick = new Joystick(); try { /* * Set

你听说过有Java包装的Windows虚拟操纵杆吗

我尝试了PPJOY,它工作得很好,但是我需要使用JNI从Java来让它工作,这在目前看来并不容易


谢谢

你来了。我为PPJoy制作了一个Java包装器。而且它真的很容易使用。见:

try {
    /*
     * Try to create a new joystick.
     */
    Joystick joystick = new Joystick();

    try {
        /*
         * Set joystick values
         */

        /*
         * Set analog values for Axis X/Y/Z,
         * Rotation X/Y/Z, Slider, Dial. Overall 8 axes.
         * 
         * Here we set the Z Axis to maximum.
         */
        joystick.analog[Joystick.ANALOG_AXIS_Z] = Joystick.ANALOG_MAX;

        /*
         * Set digital values for the buttons. Overall 16 buttons.
         *
         * Here we turn on the 13-th button
         */
        joystick.digital[12] = Joystick.DIGITAL_ON;

        /*
         * Send the data to the joystick. Keep in mind,
         * that the send method may throw a JoystickException
         */
        joystick.send();
    } finally {
        joystick.close();
    }
} catch (JoystickException e) {
    e.printStackTrace();
}
可以找到源代码和二进制文件。

我发现:


不过还没试过。希望有帮助

PPJoy可能是您最好的选择,但我真的希望有人能为您提供更好的解决方案!谢谢,我知道效果很好。而且在C代码中实现起来也相对简单。但是,我在Java中需要它:-/也许,它可以使用JNA或NativeCall而不是JNI工作。六羟甲基三聚氰胺六甲醚。