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

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

public abstract class KeyEvent extends Event {
	final long window;
	
	public KeyEvent(long window) {
		this.window = window;
	}
	
	@Override
	public boolean isCancelable() { return true; }
	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; }
	}
}
