Пример #1
0
bool VistaDirectXGamepad::InitInput()
{
	switch(m_eDriver)
	{
	case TP_DIRECTX:
		{
			return InitDirectXInput();
		}
	case TP_UNKNOWN:
		{
			if(InitDirectXInput())
				return true;
			else
			{
				// try to init xinput
				if(InitXInput())
					return true;
			}
		}
	case TP_XINPUT:
		{
			return InitXInput();
		}
	default:
		break;
	}

	return false;
}
Пример #2
0
int main(int argc, char** argv)
{
	int nRtn;
	int bList = 0;
	UI* pUI=NULL, **ppUI;
	FORMAT* pFmt;
	FORMATTYPE fmt=FORMATTYPE_DEFAULT;
	const char* pa;
	Display* pDisp = NULL;
	const char* pszDeviceName = NULL;

	++argv;
	pa = *(argv++); 
	pszDeviceName = pa;

	/* device must be specified */
	if (!pszDeviceName && !bList)
	{
		fprintf(stderr,"input_device not specified\n");
	}


	/* default to first valid UI, if not specified */
	if (pUI == NULL)
		pUI = gpUIs[0];
	
	/* open connection to XServer with XInput */
	pDisp = InitXInput();
	if (!pDisp) exit(1);

	nRtn = Run(pDisp,pUI,fmt,pszDeviceName);

	/* release device list */
	if (gpDevList)
		XFreeDeviceList(gpDevList);

	XCloseDisplay(pDisp);

	return nRtn;
}