当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECTINPUT8::EnumDevicesBySemantics方法代码示例

本文整理汇总了C++中LPDIRECTINPUT8::EnumDevicesBySemantics方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTINPUT8::EnumDevicesBySemantics方法的具体用法?C++ LPDIRECTINPUT8::EnumDevicesBySemantics怎么用?C++ LPDIRECTINPUT8::EnumDevicesBySemantics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECTINPUT8的用法示例。


在下文中一共展示了LPDIRECTINPUT8::EnumDevicesBySemantics方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InitDirectInput

BOOL InitDirectInput(HINSTANCE hInstApp)
{
	int		i;
	HRESULT	hr;
	hr = DirectInput8Create(hInstApp,DIRECTINPUT_VERSION,IID_IDirectInput8A,(void **)&lpDInput,NULL);
	if(hr != DI_OK){
		return FALSE;
	}
	int numder_of_actions = sizeof(g_GameAction) / sizeof(g_GameAction[0]);
	ZeroMemory(&g_DIActionFormat,sizeof(DIACTIONFORMAT));
	g_DIActionFormat.dwSize        = sizeof(DIACTIONFORMAT);
	g_DIActionFormat.dwActionSize  = sizeof(DIACTION);
	g_DIActionFormat.dwDataSize    = numder_of_actions * sizeof(DWORD);
	g_DIActionFormat.dwNumActions  = numder_of_actions;
	g_DIActionFormat.guidActionMap = g_AppGuid;
	g_DIActionFormat.dwGenre       = DIVIRTUAL_STRATEGY_ROLEPLAYING;
	g_DIActionFormat.rgoAction     = g_GameAction;
	g_DIActionFormat.dwBufferSize  = 100;
	g_DIActionFormat.lAxisMin      = -32768;
	g_DIActionFormat.lAxisMax      = 32767;
	lstrcpy(g_DIActionFormat.tszActionMap, className);

	g_iDIDeviceNum = 0;
	hr = lpDInput->EnumDevicesBySemantics(NULL, &g_DIActionFormat,
				EnumDevicesBySemanticsCallback, NULL, DIEDBSFL_ATTACHEDONLY);
	if (FAILED(hr)){
		return FALSE;
	}
	for(i=0;i<g_iDIDeviceNum;i++){
		g_pDIDevice[i]->Acquire();
		g_pDIDevice[i]->Poll();
	}
	return TRUE;
} // InitDirectInput
开发者ID:0xrofi,项目名称:Aquaplus,代码行数:34,代码来源:keyInput.cpp

示例2: main

int main()
{
    HRESULT hr;

    hr=DirectInput8Create
       (GetModuleHandle (NULL), DIRECTINPUT_VERSION, IID_IDirectInput8A,
       (VOID**)&gp_DI, NULL);

    printf("Devices\n-----------------\n");
    hr = gp_DI->EnumDevices(DI8DEVCLASS_ALL,EnumDevicesCallback, NULL, DIEDFL_ALLDEVICES);


    memset(&g_ActionFormat, 0, sizeof(g_ActionFormat));
    g_ActionFormat.dwSize = sizeof(g_ActionFormat);
    g_ActionFormat.dwActionSize = sizeof(DIACTION);
    g_ActionFormat.dwNumActions = ARRAYSIZE(g_commands_space);
    g_ActionFormat.dwDataSize = 4 * g_ActionFormat.dwNumActions;
    g_ActionFormat.rgoAction = g_commands_space;
    g_ActionFormat.guidActionMap = ACTIONMAP_GUID;
    g_ActionFormat.dwBufferSize = 32;
    g_ActionFormat.dwGenre = DIVIRTUAL_SPACESIM;

    printf("Space combat enumeration\n------------\n");
    hr=gp_DI->EnumDevicesBySemantics
       (NULL, &g_ActionFormat, EnumSemanticsCallback, NULL, DIEDBSFL_AVAILABLEDEVICES );

//    if(FAILED(hr)) printf("Failed?\n");

//    g_ActionFormat.dwNumActions = ARRAYSIZE(g_commands_driving);
//    g_ActionFormat.dwDataSize = 4 * g_ActionFormat.dwNumActions;
//    g_ActionFormat.rgoAction = g_commands_driving;
//    g_ActionFormat.dwGenre = DIVIRTUAL_DRIVING_RACE;

//    printf("Driving race enumeration\n------------\n");
//    hr=gp_DI->EnumDevicesBySemantics
//       (NULL, &g_ActionFormat, EnumSemanticsCallback, NULL, DIEDBSFL_AVAILABLEDEVICES);

//    if(FAILED(hr)) printf("Failed?\n");

//    g_ActionFormat.dwNumActions = ARRAYSIZE(g_commands_fps);
//    g_ActionFormat.dwDataSize = 4 * g_ActionFormat.dwNumActions;
//    g_ActionFormat.rgoAction = g_commands_fps;
//    g_ActionFormat.dwGenre = DIVIRTUAL_FIGHTING_FPS;

//    printf("First person shooter enumeration\n------------\n");
//    hr=gp_DI->EnumDevicesBySemantics
//       (NULL, &g_ActionFormat, EnumSemanticsCallback, NULL, DIEDBSFL_AVAILABLEDEVICES);

//    if(FAILED(hr)) printf("Failed?\n");

    return 0;
}
开发者ID:lfzawacki,项目名称:dinput-samples,代码行数:52,代码来源:devices_test.cpp

示例3: EnumDevicesBySemantics

 HRESULT _stdcall EnumDevicesBySemantics(LPCWSTR a,LPDIACTIONFORMATW b,LPDIENUMDEVICESBYSEMANTICSCBW c,LPVOID d,DWORD e)
 {
     return RealInput->EnumDevicesBySemantics(a,b,c,d,e);
 }
开发者ID:europop,项目名称:morrgraphext,代码行数:4,代码来源:DInput+(mouse+combat).cpp


注:本文中的LPDIRECTINPUT8::EnumDevicesBySemantics方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。