本文整理汇总了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
示例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;
}
示例3: EnumDevicesBySemantics
HRESULT _stdcall EnumDevicesBySemantics(LPCWSTR a,LPDIACTIONFORMATW b,LPDIENUMDEVICESBYSEMANTICSCBW c,LPVOID d,DWORD e)
{
return RealInput->EnumDevicesBySemantics(a,b,c,d,e);
}