I'm sorry for like 2-3 threads but I need this badly(sort of). Ok here's the code:
#include "dxinput.h"
#define BUTTON_DOWN(obj, button) (obj.rgbButtons[button] & 0x80)
LPDIRECTINPUT8 dinput;
LPDIRECTINPUTDEVICE8 dimouse;
LPDIRECTINPUTDEVICE8 dikeyboard;
LPDIRECTINPUTDEVICE8 dijoystick;
DIMOUSESTATE mouse_state;
char keys[256];
int Init_DirectInput(HWND hWnd)
{
HRESULT result = DirectInput8Create(
GetModuleHandle(NULL),
DIRECTINPUT_VERSION,
IID_IDirectInput8,
(void**)&dinput,
NULL);
if(result != DI_OK)
return 0;
result = dinput->CreateDevice(GUID_SysMouse, &dimouse, NULL);
if(result != DI_OK)
return 0;
result = dinput->CreateDevice(GUID_SysKeyboard, &dikeyboard, NULL);
if(result != DI_OK)
return 0;
return 1;
}
int Init_Mouse(HWND hWnd)
{
HRESULT result = dimouse->SetDataFormat(&c_dfDIMouse);
if(result != DI_OK)
return 0;
result = dimouse->SetCooperativeLevel(hWnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND);
if(result != DI_OK)
return 0;
result = dimouse->Acquire();
if (result != DI_OK)
return 0;
return 1;
}
This part is where the debug says its wrong:
HRESULT result = dimouse->SetDataFormat(&c_dfDIMouse);
Someone please help me
Thanks,
Brandon