void FrkKeyboard::Init(){ ZeroMemory(&m_hBuffer, sizeof(m_hBuffer)); InitDirectInput(); CreateDevice(); SetCooperativeLevel(); SetDataFormat(); Acquire(); }
DInputDevice::DInputDevice(DInput *dinput, LPDIRECTINPUT8 di, DIDEVICEINSTANCE &device, HWND hwnd) : _did(nullptr), _instanceGuid(device.guidInstance), _productGuid(device.guidProduct), _name(device.tszProductName), _instanceName(device.tszInstanceName), _dataPacket(nullptr), _dataPacketSize(0), _acquired(false), _hwnd(hwnd), _numAxes(0), _numButtons(0), _numPOVs(0), _dinput(dinput), _deviceId(dinput->GetGUIDId(device.guidInstance)) { HRESULT result; result = di->CreateDevice(device.guidInstance, &_did, nullptr); if (result != DI_OK) { Log(Error, "Could not create direct input 8 device interface: 0x%08x", result); return; } SetCooperativeLevel(false, true); GetCapabilities(); EnumObjects(); SetDataFormat(); SetBufferSize(sizeof(DIJOYSTATE)); Acquire(); GetState(_lastState); }