7 #define CALCPOS(pos, min, max) (((((float)(pos) - (float)(min)) * 2.0) / ((float)(max) - (float)(min) + 1.0)) - 1.0)
19 FBCALL int fb_GfxGetJoystick(
int id, ssize_t *buttons,
float *a1,
float *a2,
float *a3,
float *a4,
float *a5,
float *a6,
float *a7,
float *a8)
25 *a1 = *a2 = *a3 = *a4 = *a5 = *a6 = *a7 = *a8 = -1000.0;
32 if ((
id < 0) || (
id > 15))
38 if (joyGetDevCaps(
id + JOYSTICKID1, &j->
caps,
sizeof(j->
caps)) != JOYERR_NOERROR)
45 info.dwSize =
sizeof(info);
46 info.dwFlags = JOY_RETURNALL;
47 if (joyGetPosEx(
id + JOYSTICKID1, &info) != JOYERR_NOERROR)
51 if (j->
caps.wCaps & JOYCAPS_HASZ)
53 if (j->
caps.wCaps & JOYCAPS_HASR)
55 if (j->
caps.wCaps & JOYCAPS_HASU)
57 if (j->
caps.wCaps & JOYCAPS_HASV)
59 if (j->
caps.wCaps & JOYCAPS_HASPOV)
63 if(( info.dwPOV > 4500 -
POV_LAP ) && ( info.dwPOV < 13500 +
POV_LAP ))
65 else if(( info.dwPOV > 22500 -
POV_LAP ) && ( info.dwPOV < 31500 +
POV_LAP ))
68 if(( info.dwPOV > 13500 -
POV_LAP ) && ( info.dwPOV < 22500 +
POV_LAP ))
70 else if(( info.dwPOV >= 0 ) && ( info.dwPOV < 4500 +
POV_LAP ))
72 else if(( info.dwPOV > 31500 -
POV_LAP ) && ( info.dwPOV < 36000 ))
76 *buttons = info.dwButtons;