csharp_pain/Solar system/sss3d-source/Joystick.java

52 lines
1 KiB
Java
Raw Permalink Normal View History

2014-06-26 15:13:46 +00:00
/******************************************************************
*
* Copyright (C) Satoshi Konno 1999
*
* File : Joystick.java
*
******************************************************************/
public class Joystick {
public static final int BUTTON1 = 0x0001;
public static final int BUTTON2 = 0x0002;
public static final int BUTTON3 = 0x0004;
public static final int BUTTON4 = 0x0008;
static {
System.loadLibrary("joystick");
}
private int joyID = 0;
public Joystick(int id) {
joyID = id;
}
public native int getNumDevs();
public native float getXPos(int id);
public native float getYPos(int id);
public native float getZPos(int id);
public native int getButtons(int id);
public float getXPos() {
return getXPos(joyID);
}
public float getYPos() {
return getYPos(joyID);
}
public float getZPos() {
return getZPos(joyID);
}
public int getButtons() {
return getButtons(joyID);
}
public String toString() {
return "Joystick";
}
}