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

import speiger.src.coreengine.core.events.api.Event;
import speiger.src.coreengine.core.events.api.ICancelableEvent;

public abstract class KeyEvent extends Event implements ICancelableEvent {
	final long window;
	
	public KeyEvent(long window) {
		this.window = window;
	}
	
	public long window() { return window; }
	
	public static class Key extends KeyEvent {
		final int key;
		final int scancode;
		final boolean press;
		
		public Key(long window, int key, int scancode, boolean press) {
			super(window);
			this.key = key;
			this.scancode = scancode;
			this.press = press;
		}
		
		public int key() { return key; }
		public int scancode() { return scancode; }
		public boolean press() { return press; }
	}
	
	public static class Char extends KeyEvent {
		final int codepoint;

		public Char(long window, int codepoint) {
			super(window);
			this.codepoint = codepoint;
		}
		
		public int codepoint() { return codepoint; }
	}
}
