SDL_gameinput.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #ifndef SDL_gameinput_h_
  20. #define SDL_gameinput_h_
  21. #if defined(HAVE_GAMEINPUT_H) && defined(__cplusplus)
  22. #ifdef HAVE_GCC_DIAGNOSTIC_PRAGMA
  23. #pragma GCC diagnostic push
  24. #pragma GCC diagnostic ignored "-Wundef"
  25. #endif
  26. #include "gameinput.h"
  27. #ifdef HAVE_GCC_DIAGNOSTIC_PRAGMA
  28. #pragma GCC diagnostic pop
  29. #endif
  30. #ifndef GAMEINPUT_API_VERSION
  31. #define GAMEINPUT_API_VERSION 0
  32. #endif
  33. #if GAMEINPUT_API_VERSION > 0
  34. // Use the namespace of the current GameInput version
  35. #define STR_JOIN2(A, B) A##B
  36. #define STR_JOIN(A, B) STR_JOIN2(A, B)
  37. using namespace GameInput::STR_JOIN(v, GAMEINPUT_API_VERSION);
  38. #endif
  39. // Default value for SDL_HINT_JOYSTICK_GAMEINPUT
  40. #if defined(SDL_PLATFORM_GDK) || (GAMEINPUT_API_VERSION >= 3)
  41. #define SDL_GAMEINPUT_DEFAULT true
  42. #else
  43. #define SDL_GAMEINPUT_DEFAULT false
  44. #endif
  45. extern bool SDL_InitGameInput(IGameInput **ppGameInput);
  46. extern bool SDL_GameInputReady(void);
  47. extern void SDL_QuitGameInput(void);
  48. #endif // HAVE_GAMEINPUT_H && __cplusplus
  49. /* Set up for C function definitions, even when using C++ */
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53. extern bool SDL_UsingGameInputForXInputControllers(void);
  54. /* Ends C function definitions when using C++ */
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #endif // SDL_gameinput_h_