/**
 * abstraction class for the OswaldInterface.
 * runs on top of the Joystick class, will work
 * with any joystick on a linux 2.6 kernel
 * @author goskab
 */
public class OswaldInterface {
	Joystick js;
	
	/**
	 * Make a new oswald interface object, this
	 * will open the joystick and watch the values
	 * that come from it, ask the object for values
	 * to check the input from the user.
	 */
	public OswaldInterface() {
		js = new Joystick("/dev/input/js0");
	}
	
	/**
	 * get the X axis on the touchpad
	 * (not touchscreen)
	 * @return integer (+/- ~32000 max)
	 */
	public int getTouchX() {
		return js.getAxis(0);
	}
	
	/**
	 * get the Y axis on the touchpad
	 * (not touchscreen)
	 * @return integer (+/- ~32000 max)
	 */
	public int getTouchY() {
		return js.getAxis(1);
	}
	
	/**
	 * get the X axis on the accelerometer
	 * @return integer (+/- ~32000 max)
	 */
	public int getAccelX() {
		return js.getAxis(2);
	}

	/**
	 * get the Y axis on the accelerometer
	 * @return integer (+/- ~32000 max)
	 */
	public int getAccelY() {
		return js.getAxis(3);
	}
	
	/**
	 * get the Z axis on the accelerometer
	 * @return integer (+/- ~32000 max)
	 */
	public int getAccelZ() {
		return js.getAxis(4);
	}
	
	/**
	 * get the value of a button (includes up,
	 * down, left, right).
	 * @param num button number
	 * @return true if pressed, false if not
	 */
	public boolean getButton(int num) {
		return js.getButton(num);
	}
}
