1 | if(XInputGetState(ControllerIndex, &ControllerState) == ERROR_SUCCESS) |
In the watch window, I tried to see the value of XInputGetState but it says
1 | identifier "XInputGetState" is undefined" |
It turns out, after the following code, XInputGetState is still undefined:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #define X_INPUT_GET_STATE(name) DWORD WINAPI name(DWORD dwUserIndex, XINPUT_STATE *pState) typedef X_INPUT_GET_STATE(x_input_get_state); X_INPUT_GET_STATE(XInputGetStateStub) { return(ERROR_DEVICE_NOT_CONNECTED); } global_variable x_input_get_state *XInputGetState_ = XInputGetStateStub; #define XInputGetState XInputGetState_ internal void Win32LoadXInput(void) { HMODULE XInputLibrary = LoadLibraryA("xinput1_4.dll"); if(!XInputLibrary) { XInputLibrary = LoadLibraryA("xinput1_3.ll"); } if(XInputLibrary) { XInputGetState = (x_input_get_state *)GetProcAddress(XInputLibrary, "XInputGetState"); XInputSetState = (x_input_set_state *)GetProcAddress(XInputLibrary, "XInputSetState"); } } |
What am I doing wrong?