SDL_oldnames.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2022 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. /**
  19. * \file SDL_oldnames.h
  20. *
  21. * Definitions to ease transition from SDL2 code
  22. */
  23. #ifndef SDL_oldnames_h_
  24. #define SDL_oldnames_h_
  25. #include <SDL3/SDL_platform.h>
  26. /* The new function names are recommended, but if you want to have the
  27. * old names available while you are in the process of migrating code
  28. * to SDL3, you can define `SDL_ENABLE_OLD_NAMES` in your project.
  29. *
  30. * You can use https://github.com/libsdl-org/SDL/blob/main/build-scripts/rename_symbols.py to mass rename the symbols defined here in your codebase:
  31. * rename_symbols.py --all-symbols source_code_path
  32. */
  33. #ifdef SDL_ENABLE_OLD_NAMES
  34. /* ##SDL_audio.h */
  35. #define SDL_AudioStreamAvailable SDL_GetAudioStreamAvailable
  36. #define SDL_AudioStreamClear SDL_ClearAudioStream
  37. #define SDL_AudioStreamFlush SDL_FlushAudioStream
  38. #define SDL_AudioStreamGet SDL_GetAudioStreamData
  39. #define SDL_AudioStreamPut SDL_PutAudioStreamData
  40. #define SDL_FreeAudioStream SDL_DestroyAudioStream
  41. #define SDL_FreeWAV SDL_free
  42. #define SDL_NewAudioStream SDL_CreateAudioStream
  43. /* ##SDL_keycode.h */
  44. #define KMOD_ALT SDL_KMOD_ALT
  45. #define KMOD_CAPS SDL_KMOD_CAPS
  46. #define KMOD_CTRL SDL_KMOD_CTRL
  47. #define KMOD_GUI SDL_KMOD_GUI
  48. #define KMOD_LALT SDL_KMOD_LALT
  49. #define KMOD_LCTRL SDL_KMOD_LCTRL
  50. #define KMOD_LGUI SDL_KMOD_LGUI
  51. #define KMOD_LSHIFT SDL_KMOD_LSHIFT
  52. #define KMOD_MODE SDL_KMOD_MODE
  53. #define KMOD_NONE SDL_KMOD_NONE
  54. #define KMOD_NUM SDL_KMOD_NUM
  55. #define KMOD_RALT SDL_KMOD_RALT
  56. #define KMOD_RCTRL SDL_KMOD_RCTRL
  57. #define KMOD_RESERVED SDL_KMOD_RESERVED
  58. #define KMOD_RGUI SDL_KMOD_RGUI
  59. #define KMOD_RSHIFT SDL_KMOD_RSHIFT
  60. #define KMOD_SCROLL SDL_KMOD_SCROLL
  61. #define KMOD_SHIFT SDL_KMOD_SHIFT
  62. /* ##SDL_platform.h */
  63. #ifdef __IOS__
  64. #define __IPHONEOS__ __IOS__
  65. #endif
  66. #ifdef __MACOS__
  67. #define __MACOSX__ __MACOS__
  68. #endif
  69. /* ##SDL_rwops.h */
  70. #define RW_SEEK_CUR SDL_RW_SEEK_CUR
  71. #define RW_SEEK_END SDL_RW_SEEK_END
  72. #define RW_SEEK_SET SDL_RW_SEEK_SET
  73. #else /* !SDL_ENABLE_OLD_NAMES */
  74. /* ##SDL_audio.h */
  75. #define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_renamed_SDL_GetAudioStreamAvailable
  76. #define SDL_AudioStreamClear SDL_AudioStreamClear_renamed_SDL_ClearAudioStream
  77. #define SDL_AudioStreamFlush SDL_AudioStreamFlush_renamed_SDL_FlushAudioStream
  78. #define SDL_AudioStreamGet SDL_AudioStreamGet_renamed_SDL_GetAudioStreamData
  79. #define SDL_AudioStreamPut SDL_AudioStreamPut_renamed_SDL_PutAudioStreamData
  80. #define SDL_FreeAudioStream SDL_FreeAudioStream_renamed_SDL_DestroyAudioStream
  81. #define SDL_FreeWAV SDL_FreeWAV_renamed_SDL_free
  82. #define SDL_NewAudioStream SDL_NewAudioStream_renamed_SDL_CreateAudioStream
  83. /* ##SDL_keycode.h */
  84. #define KMOD_ALT KMOD_ALT_renamed_SDL_KMOD_ALT
  85. #define KMOD_CAPS KMOD_CAPS_renamed_SDL_KMOD_CAPS
  86. #define KMOD_CTRL KMOD_CTRL_renamed_SDL_KMOD_CTRL
  87. #define KMOD_GUI KMOD_GUI_renamed_SDL_KMOD_GUI
  88. #define KMOD_LALT KMOD_LALT_renamed_SDL_KMOD_LALT
  89. #define KMOD_LCTRL KMOD_LCTRL_renamed_SDL_KMOD_LCTRL
  90. #define KMOD_LGUI KMOD_LGUI_renamed_SDL_KMOD_LGUI
  91. #define KMOD_LSHIFT KMOD_LSHIFT_renamed_SDL_KMOD_LSHIFT
  92. #define KMOD_MODE KMOD_MODE_renamed_SDL_KMOD_MODE
  93. #define KMOD_NONE KMOD_NONE_renamed_SDL_KMOD_NONE
  94. #define KMOD_NUM KMOD_NUM_renamed_SDL_KMOD_NUM
  95. #define KMOD_RALT KMOD_RALT_renamed_SDL_KMOD_RALT
  96. #define KMOD_RCTRL KMOD_RCTRL_renamed_SDL_KMOD_RCTRL
  97. #define KMOD_RESERVED KMOD_RESERVED_renamed_SDL_KMOD_RESERVED
  98. #define KMOD_RGUI KMOD_RGUI_renamed_SDL_KMOD_RGUI
  99. #define KMOD_RSHIFT KMOD_RSHIFT_renamed_SDL_KMOD_RSHIFT
  100. #define KMOD_SCROLL KMOD_SCROLL_renamed_SDL_KMOD_SCROLL
  101. #define KMOD_SHIFT KMOD_SHIFT_renamed_SDL_KMOD_SHIFT
  102. /* ##SDL_platform.h */
  103. #ifdef __IOS__
  104. #define __IPHONEOS__ __IPHONEOS___renamed___IOS__
  105. #endif
  106. #ifdef __MACOS__
  107. #define __MACOSX__ __MACOSX___renamed___MACOS__
  108. #endif
  109. /* ##SDL_rwops.h */
  110. #define RW_SEEK_CUR RW_SEEK_CUR_renamed_SDL_RW_SEEK_CUR
  111. #define RW_SEEK_END RW_SEEK_END_renamed_SDL_RW_SEEK_END
  112. #define RW_SEEK_SET RW_SEEK_SET_renamed_SDL_RW_SEEK_SET
  113. #endif /* SDL_ENABLE_OLD_NAMES */
  114. #endif /* SDL_oldnames_h_ */