SDL_sysjoystick_c.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #include "SDL_internal.h"
  19. #ifdef SDL_JOYSTICK_ANDROID
  20. #ifndef SDL_sysjoystick_c_h_
  21. #define SDL_sysjoystick_c_h_
  22. #include "../SDL_sysjoystick.h"
  23. extern bool Android_OnPadDown(int device_id, int keycode, int scancode);
  24. extern bool Android_OnPadUp(int device_id, int keycode, int scancode);
  25. extern bool Android_OnJoy(int device_id, int axisnum, float value);
  26. extern bool Android_OnHat(int device_id, int hat_id, int x, int y);
  27. extern void Android_OnJoySensor(int device_id, int sensor_type, Uint64 sensor_timestamp, float x, float y, float z);
  28. extern void Android_AddJoystick(int device_id, const char *name, const char *desc, int vendor_id, int product_id, int button_mask, int naxes, int axis_mask, int nhats,
  29. bool can_rumble, bool has_rgb_led, bool has_accelerometer, bool has_gyroscope);
  30. extern void Android_RemoveJoystick(int device_id);
  31. // A linked list of available joysticks
  32. typedef struct SDL_joylist_item
  33. {
  34. int device_instance;
  35. int device_id; // Android's device id
  36. Uint16 vendor_id;
  37. Uint16 product_id;
  38. char *name; // "SideWinder 3D Pro" or whatever
  39. SDL_GUID guid;
  40. SDL_Joystick *joystick;
  41. int nbuttons, naxes, nhats;
  42. int dpad_state;
  43. bool can_rumble;
  44. bool has_rgb_led;
  45. bool has_accelerometer;
  46. bool has_gyroscope;
  47. struct SDL_joylist_item *next;
  48. } SDL_joylist_item;
  49. typedef SDL_joylist_item joystick_hwdata;
  50. #endif // SDL_sysjoystick_c_h_
  51. #endif // SDL_JOYSTICK_ANDROID