SDL_joystick.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef _SDL_joystick_h
  2. #define _SDL_joystick_h
  3. #include "SDL_stdinc.h"
  4. #include "SDL_error.h"
  5. #include "begin_code.h"
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. struct _SDL_Joystick;
  10. typedef struct _SDL_Joystick SDL_Joystick;
  11. typedef struct {
  12. Uint8 data[16];
  13. } SDL_JoystickGUID;
  14. typedef Sint32 SDL_JoystickID;
  15. typedef int SDLCALL tSDL_NumJoysticks(void);
  16. typedef const char * SDLCALL tSDL_JoystickNameForIndex(int device_index);
  17. typedef SDL_Joystick * SDLCALL tSDL_JoystickOpen(int device_index);
  18. typedef const char * SDLCALL tSDL_JoystickName(SDL_Joystick * joystick);
  19. typedef SDL_JoystickGUID SDLCALL tSDL_JoystickGetDeviceGUID(int device_index);
  20. typedef SDL_JoystickGUID SDLCALL tSDL_JoystickGetGUID(SDL_Joystick * joystick);
  21. extern DECLSPEC void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
  22. typedef SDL_JoystickGUID SDLCALL tSDL_JoystickGetGUIDFromString(const char *pchGUID);
  23. typedef SDL_bool SDLCALL tSDL_JoystickGetAttached(SDL_Joystick * joystick);
  24. typedef SDL_JoystickID SDLCALL tSDL_JoystickInstanceID(SDL_Joystick * joystick);
  25. typedef int SDLCALL tSDL_JoystickNumAxes(SDL_Joystick * joystick);
  26. typedef int SDLCALL tSDL_JoystickNumBalls(SDL_Joystick * joystick);
  27. typedef int SDLCALL tSDL_JoystickNumHats(SDL_Joystick * joystick);
  28. typedef int SDLCALL tSDL_JoystickNumButtons(SDL_Joystick * joystick);
  29. typedef void SDLCALL tSDL_JoystickUpdate(void);
  30. typedef int SDLCALL tSDL_JoystickEventState(int state);
  31. typedef Sint16 SDLCALL tSDL_JoystickGetAxis(SDL_Joystick * joystick,
  32. int axis);
  33. #define SDL_HAT_CENTERED 0x00
  34. #define SDL_HAT_UP 0x01
  35. #define SDL_HAT_RIGHT 0x02
  36. #define SDL_HAT_DOWN 0x04
  37. #define SDL_HAT_LEFT 0x08
  38. #define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
  39. #define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
  40. #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
  41. #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
  42. typedef Uint8 SDLCALL tSDL_JoystickGetHat(SDL_Joystick * joystick,
  43. int hat);
  44. typedef int SDLCALL tSDL_JoystickGetBall(SDL_Joystick * joystick,
  45. int ball, int *dx, int *dy);
  46. typedef Uint8 SDLCALL tSDL_JoystickGetButton(SDL_Joystick * joystick,
  47. int button);
  48. typedef void SDLCALL tSDL_JoystickClose(SDL_Joystick * joystick);
  49. extern tSDL_NumJoysticks *SDL_NumJoysticks;
  50. extern tSDL_JoystickNameForIndex *SDL_JoystickNameForIndex;
  51. extern tSDL_JoystickOpen *SDL_JoystickOpen;
  52. extern tSDL_JoystickName *SDL_JoystickName;
  53. extern tSDL_JoystickGetDeviceGUID *SDL_JoystickGetDeviceGUID;
  54. extern tSDL_JoystickGetGUID *SDL_JoystickGetGUID;
  55. extern tSDL_JoystickGetGUIDFromString *SDL_JoystickGetGUIDFromString;
  56. extern tSDL_JoystickGetAttached *SDL_JoystickGetAttached;
  57. extern tSDL_JoystickInstanceID *SDL_JoystickInstanceID;
  58. extern tSDL_JoystickNumAxes *SDL_JoystickNumAxes;
  59. extern tSDL_JoystickNumBalls *SDL_JoystickNumBalls;
  60. extern tSDL_JoystickNumHats *SDL_JoystickNumHats;
  61. extern tSDL_JoystickNumButtons *SDL_JoystickNumButtons;
  62. extern tSDL_JoystickUpdate *SDL_JoystickUpdate;
  63. extern tSDL_JoystickEventState *SDL_JoystickEventState;
  64. extern tSDL_JoystickGetAxis *SDL_JoystickGetAxis;
  65. extern tSDL_JoystickGetHat *SDL_JoystickGetHat;
  66. extern tSDL_JoystickGetBall *SDL_JoystickGetBall;
  67. extern tSDL_JoystickGetButton *SDL_JoystickGetButton;
  68. extern tSDL_JoystickClose *SDL_JoystickClose;
  69. #ifdef __cplusplus
  70. }
  71. #endif
  72. #include "close_code.h"
  73. #endif