
unit ControlPad
{
	link memory linka {} = #.linker.linka;
	
	//[i] linksysconst_uint8 ID;
	public const uint8 ID = 0;
	
	//[i] var_int32 Width;
	public linka int32 Width = #addr ID * 0x0100 + 0x03;
	//[i] var_int32 Height;
	public linka int32 Height = #addr ID * 0x0100 + 0x04;
	//[i] var_int32 BackColor;
	public linka int32 BackColor = #addr ID * 0x0100 + 0x05;
	
	///[i] var_int32 ButtonIndex;
	public linka int32 ButtonIndex = #addr ID * 0x0100 + 0x20;
	//[i] var_int32 MouseX;
	public linka int32 MouseX = #addr ID * 0x0100 + 0x21;
	//[i] var_int32 MouseY;
	public linka int32 MouseY = #addr ID * 0x0100 + 0x22;

	//[i] var_uint8 OS_EventFlag;
	public uint8 OS_EventFlag;
	
	//[i] event press_event;
	//[i] event up_event;
	//[i] event move_event;
	
	//---------------------------------------------------
	//[i] function_void OS_init;
	public void OS_init()
	{
		OS_EventFlag = 0;
	}
	//---------------------------------------------------
	//[i] function_bool MousePress;
	public bool MousePress()
	{
		if( ButtonIndex == 0 ) {
			return false;
		}
		else if( ButtonIndex == 1 ) {
			return true;
		}
		else {
			return true;
		}


//		ACI_SetInterrupt( 1, true );
//		int32 dd = ButtonIndex;
//		ACI_SetInterrupt( 1, false );
		
		
//		bool r;
//		if( dd == 0 ) {
//			r = false;
//		}
//		else if( ButtonIndex == 1 ) {
//			r = true;
//		}
//		else {
//			r = true;
//		}
		
//		return r;
	}
	
	//---------------------------------------------------
	//[i] function_void SetImage Cstring;
	public void SetImage( [#.code uint16*?] string )
	{
		#.linker.SetString( ID, 0x30, string );
	}
	
	dll void ACI_SetInterrupt( int32 index, bool open ){}
}











