CodePudding user response:
JoyStickSDL - mirror/SDL
Tasssadar/libenjoy
Directlnput or XInput technology
API
//read the handle information
UINT joyNums;
JoyNums=joyGetNumDevs ();
//printf (" the number of the current handle: % d \ n ", joyNums);
If (joyNums>
=1){
MMRESULT joyreturn=joyGetPosEx (JOYSTICKID1, & amp; Joyinfoex);
If (joyreturn==JOYERR_NOERROR)
{
Printf (" 09 0 x % d ", joyinfoex dwXpos);
Printf (" 09 0 x % d ", joyinfoex dwYpos);
//printf (" 0 x % 9 x ", joyinfoex dwZpos);
//printf (" 0 x % 9 x ", joyinfoex dwPOV);
//printf (" 0 x % 9 x ", joyinfoex dwButtons);
printf("\n");
} the else
{
The switch (joyreturn)
{
Case JOYERR_PARMS:
Printf (" bad parameters \ n ");
break;
Case JOYERR_NOCANDO:
Printf (" request not completed \ n ");
break;
Case JOYERR_UNPLUGGED:
Printf (" joystick is unplugged \ n ");
break;
Default:
An unknown error printf (" \ n ");
break;
}
}
}