package speiger.src.coreengine.rendering.input.events;

import speiger.src.coreengine.utils.eventbus.Event;

public class JoystickEvent extends Event {
	final long window;
	final int jid;
	
	public JoystickEvent(long window, int jid) {
		this.window = window;
		this.jid = jid;
	}
	
	public long window() { return window; }
	public int jid() { return jid; }
	
	public static class Connected extends JoystickEvent {
		boolean connected;

		public Connected(long window, int jid, boolean connected) {
			super(window, jid);
			this.connected = connected;
		}
		
		public boolean connected() { return connected; }
	}
	
	public static class Button extends JoystickEvent {
		final int button;
		final boolean press;
		
		public Button(long window, int jid, int button, boolean press) {
			super(window, jid);
			this.button = button;
			this.press = press;
		}
		
		public int button() { return button; }
		public boolean press() { return press; }
	}
	
	public static class Axis extends JoystickEvent {
		int axis;
		float value;
		boolean negative;
		boolean halfPress;
		boolean fullPress;
		
		public Axis(long window, int jid, int axis, float value, boolean negative, boolean halfPress, boolean fullPress) {
			super(window, jid);
			this.axis = axis;
			this.value = value;
			this.negative = negative;
			this.halfPress = halfPress;
			this.fullPress = fullPress;
		}
		
		public int axis() { return axis; }
		public float value() { return value; }
		public float absoluteValue() { return Math.abs(value); }
		public boolean negative() { return negative; }
		public boolean halfPress() { return halfPress; }
		public boolean fullPress() { return fullPress; }
	}
}
