
unit KeyBoard
{
	link memory linka {} = #.linker.linka;
	
	//[i] linksysconst_uint8 ID;
	public const uint8 ID = 0;
	
	const uint8 CMD_KeyPress = 0x01;
	const uint8 CMD_KeyDown = 0x02;
	const uint8 CMD_KeyUp = 0x03;
	
	//---------------------------------------------------
	//[i] function_void OS_init;
	public void OS_init()
	{
		
	}
	
	//---------------------------------------------------
	//按键事件
	//[i] function_void KeyPress int32;
	public void KeyPress( int32 k )
	{
		#.linker.SetValue( ID, CMD_KeyPress, (uint)k );
	}
	//---------------------------------------------------
	//按键按下事件
	//[i] function_void KeyDown int32;
	public void KeyDown( int32 k )
	{
		#.linker.SetValue( ID, CMD_KeyDown, (uint)k );
	}
	//---------------------------------------------------
	//按键松开事件
	//[i] function_void KeyUp int32;
	public void KeyUp( int32 k )
	{
		#.linker.SetValue( ID, CMD_KeyUp, (uint)k );
	}
	
	//---------------------------------------------------
	//按键值常量
	
	///[i] var_uint8 VK_APPS; //鼠标右键
	///uint8 VK_APPS = #const 0x5D;
	//大小写转换键
	//[i] const_int32 VK_CAPITAL;
	const int32 VK_CAPITAL = 0x14;
	//左SHIFT键
	//[i] const_int32 VK_LSHIFT;
	const int32 VK_LSHIFT = 0xA0;
	//回车键
	//[i] const_int32 VK_RETURN;
	const int32 VK_RETURN = 0x0D;
	//退格键
	//[i] const_int32 VK_BACK;
	const int32 VK_BACK = 0x08;
	//左窗口键
	//[i] const_int32 VK_LWIN;
	const int32 VK_LWIN = 0x5B;
	//退出键
	//[i] const_int32 VK_ESCAPE;
	const int32 VK_ESCAPE = 0x1B;

	//控制键
	//[i] const_int32 VK_CONTROL;
	const int32 VK_CONTROL = 0x11;
	//左控制键
	///[i] var VK_LCONTROL;
	///uint8 VK_LCONTROL = 0xA2;
	//右控制键
	///[i] var VK_RCONTROL;
	///uint8 VK_RCONTROL = 0xA3;
	
	//ALT键
	//[i] const_int32 VK_MENU;
	const int32 VK_MENU = 0x12;
	//右ALT键
	///[i] var VK_RMENU;
	///uint8 VK_RMENU = 0xA5;
	//左ALT键
	///[i] var VK_LMENU;
	///uint8 VK_LMENU = 0xA4;
	
	//起点键
	//[i] const_int32 VK_HOME;
	const int32 VK_HOME = 0x24;
	//终点键
	//[i] const_int32 VK_END;
	const int32 VK_END = 0x23;
	//插入键
	//[i] const_int32 VK_INSERT;
	const int32 VK_INSERT = 0x2D;
	//删除键
	//[i] const_int32 VK_DELETE;
	const int32 VK_DELETE = 0x2E;
	//上翻页键
	//[i] const_int32 VK_PRIOR;
	const int32 VK_PRIOR = 0x21;
	//下翻页键
	//[i] const_int32 VK_NEXT;
	const int32 VK_NEXT = 0x22;
	
	//上方向键
	//[i] const_int32 VK_UP;
	const int32 VK_UP = 0x26;
	//下方向键
	//[i] const_int32 VK_DOWN;
	const int32 VK_DOWN = 0x28;
	//左方向键
	//[i] const_int32 VK_LEFT;
	const int32 VK_LEFT = 0x25;
	//右方向键
	//[i] const_int32 VK_RIGHT;
	const int32 VK_RIGHT = 0x27;
}








