本文整理汇总了C++中IDirectInputDevice8::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectInputDevice8::Release方法的具体用法?C++ IDirectInputDevice8::Release怎么用?C++ IDirectInputDevice8::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectInputDevice8
的用法示例。
在下文中一共展示了IDirectInputDevice8::Release方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Release
ULONG _stdcall Release(void) {
if(--Refs==0) {
RealDevice->Release();
delete this;
return 0;
} else { return Refs; }
}
示例2: gamepadCallback
// Callback that lists all gamepads.
static BOOL CALLBACK gamepadCallback(LPCDIDEVICEINSTANCE device,
LPVOID userData)
{
Impl* pimpl = static_cast<Impl*>(userData);
IDirectInputDevice8* gamepad;
if (FAILED(pimpl->input->CreateDevice(device->guidInstance,
&gamepad, 0)))
{
return DIENUM_CONTINUE;
}
if (FAILED(gamepad->SetDataFormat(&c_dfDIJoystick)) ||
FAILED(gamepad->SetCooperativeLevel(pimpl->window,
DISCL_EXCLUSIVE | DISCL_FOREGROUND)) ||
FAILED(gamepad->EnumObjects(axisCallback, gamepad, DIDFT_AXIS)))
{
gamepad->Release();
return DIENUM_CONTINUE;
}
pimpl->gamepads.push_back(Win::shareComPtr(gamepad));
return DIENUM_CONTINUE;
}
示例3:
IDirectInputDevice8 *BaseInputDevice::create_device(IDirectInput8 *pDI, GUID guid)
{
IDirectInputDevice8 *device;
HRESULT hr;
hr = pDI->CreateDevice(guid, &device, NULL);
if(FAILED(hr)) return NULL;
hr = device->SetCooperativeLevel(Render::hWnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
if(FAILED(hr))
{
device->Release(); return NULL;
}
device->Acquire();
return device;
}