I need to write an easy function that only return bool answer.
if there is joystick plugged in the computer - true,else - false. how can i do this?
I have tried to write this code, but i only get the num of deviced that plug by usb to my computer, i need to know that this usb is joystick.
UINT pNum = 0;
RAWINPUTDEVICELIST* arr = new RAWINPUTDEVICELIST;
PRAWINPUTDEVICELIST pRawInputDeviceList = arr;
GetRawInputDeviceList(pRawInputDeviceList, &pNum, sizeof(RAWINPUTDEVICELIST));
std::cout << "Num entered: " << pNum << std::endl;
Use the
joyGetPosfunction to determine whether a given joystick is physically attached to the system. If the specified joystick is not connected, joyGetPos returns a JOYERR_UNPLUGGED error value.The
joyGetNumDevsfunction returns the number of joysticks supported by the current driver or zero if no driver is installed.