1
0

SDL_sysjoystick_c.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2025 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);
  24. extern bool Android_OnPadUp(int device_id, int keycode);
  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_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, bool can_rumble);
  28. extern void Android_RemoveJoystick(int device_id);
  29. // A linked list of available joysticks
  30. typedef struct SDL_joylist_item
  31. {
  32. int device_instance;
  33. int device_id; // Android's device id
  34. char *name; // "SideWinder 3D Pro" or whatever
  35. SDL_GUID guid;
  36. SDL_Joystick *joystick;
  37. int nbuttons, naxes, nhats;
  38. int dpad_state;
  39. bool can_rumble;
  40. struct SDL_joylist_item *next;
  41. } SDL_joylist_item;
  42. typedef SDL_joylist_item joystick_hwdata;
  43. #endif // SDL_sysjoystick_c_h_
  44. #endif // SDL_JOYSTICK_ANDROID