package  
{
	import flash.events.KeyboardEvent;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	/**
	 * ...
	 * @author beisik
	 */
	public class Keys 
	{
		public static const KEY_W: uint = 87;
		public static const KEY_A: uint = 65;
		public static const KEY_S: uint = 83;
		public static const KEY_D: uint = 68;
		
		public static const KEY_LEFT: uint = 37;
		public static const KEYS_UP: uint = 38;
		public static const KEY_RIGHT: uint = 39;
		public static const KEY_DOWN: uint = 40;
		
		public static var keys: Vector.<Boolean> = new Vector.<Boolean>(256, true);
		
		public static var mouseDown: Boolean;
		
		public static var cursor: Point = new Point();
		
		public static function onKeyDown(e: KeyboardEvent): void
		{
			keys[e.keyCode] = true;
		}
		
		public static function onKeyUp(e: KeyboardEvent): void
		{
			keys[e.keyCode] = false;
		}
		
		public static function Down(key: uint): Boolean
		{
			return keys[key];
		}
		
		public static function onMouseDown(e: MouseEvent): void
		{
			mouseDown = true;
		}
		
		public static function onMouseUp(e: MouseEvent): void
		{
			mouseDown = false;
		}
		
		public static function onMouseMove(e: MouseEvent): void
		{
			cursor.x = e.stageX;
			cursor.y = e.stageY;
		}
		
	}

}