SDL_oldnames.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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_FreeWAV SDL_free
  36. /* ##SDL_keycode.h */
  37. #define KMOD_ALT SDL_KMOD_ALT
  38. #define KMOD_CAPS SDL_KMOD_CAPS
  39. #define KMOD_CTRL SDL_KMOD_CTRL
  40. #define KMOD_GUI SDL_KMOD_GUI
  41. #define KMOD_LALT SDL_KMOD_LALT
  42. #define KMOD_LCTRL SDL_KMOD_LCTRL
  43. #define KMOD_LGUI SDL_KMOD_LGUI
  44. #define KMOD_LSHIFT SDL_KMOD_LSHIFT
  45. #define KMOD_MODE SDL_KMOD_MODE
  46. #define KMOD_NONE SDL_KMOD_NONE
  47. #define KMOD_NUM SDL_KMOD_NUM
  48. #define KMOD_RALT SDL_KMOD_RALT
  49. #define KMOD_RCTRL SDL_KMOD_RCTRL
  50. #define KMOD_RESERVED SDL_KMOD_RESERVED
  51. #define KMOD_RGUI SDL_KMOD_RGUI
  52. #define KMOD_RSHIFT SDL_KMOD_RSHIFT
  53. #define KMOD_SCROLL SDL_KMOD_SCROLL
  54. #define KMOD_SHIFT SDL_KMOD_SHIFT
  55. /* ##SDL_platform.h */
  56. #ifdef __IOS__
  57. #define __IPHONEOS__ __IOS__
  58. #endif
  59. #ifdef __MACOS__
  60. #define __MACOSX__ __MACOS__
  61. #endif
  62. /* ##SDL_rwops.h */
  63. #define RW_SEEK_CUR SDL_RW_SEEK_CUR
  64. #define RW_SEEK_END SDL_RW_SEEK_END
  65. #define RW_SEEK_SET SDL_RW_SEEK_SET
  66. #else /* !SDL_ENABLE_OLD_NAMES */
  67. /* ##SDL_audio.h */
  68. #define SDL_FreeWAV SDL_FreeWAV_renamed_SDL_free
  69. /* ##SDL_keycode.h */
  70. #define KMOD_ALT KMOD_ALT_renamed_SDL_KMOD_ALT
  71. #define KMOD_CAPS KMOD_CAPS_renamed_SDL_KMOD_CAPS
  72. #define KMOD_CTRL KMOD_CTRL_renamed_SDL_KMOD_CTRL
  73. #define KMOD_GUI KMOD_GUI_renamed_SDL_KMOD_GUI
  74. #define KMOD_LALT KMOD_LALT_renamed_SDL_KMOD_LALT
  75. #define KMOD_LCTRL KMOD_LCTRL_renamed_SDL_KMOD_LCTRL
  76. #define KMOD_LGUI KMOD_LGUI_renamed_SDL_KMOD_LGUI
  77. #define KMOD_LSHIFT KMOD_LSHIFT_renamed_SDL_KMOD_LSHIFT
  78. #define KMOD_MODE KMOD_MODE_renamed_SDL_KMOD_MODE
  79. #define KMOD_NONE KMOD_NONE_renamed_SDL_KMOD_NONE
  80. #define KMOD_NUM KMOD_NUM_renamed_SDL_KMOD_NUM
  81. #define KMOD_RALT KMOD_RALT_renamed_SDL_KMOD_RALT
  82. #define KMOD_RCTRL KMOD_RCTRL_renamed_SDL_KMOD_RCTRL
  83. #define KMOD_RESERVED KMOD_RESERVED_renamed_SDL_KMOD_RESERVED
  84. #define KMOD_RGUI KMOD_RGUI_renamed_SDL_KMOD_RGUI
  85. #define KMOD_RSHIFT KMOD_RSHIFT_renamed_SDL_KMOD_RSHIFT
  86. #define KMOD_SCROLL KMOD_SCROLL_renamed_SDL_KMOD_SCROLL
  87. #define KMOD_SHIFT KMOD_SHIFT_renamed_SDL_KMOD_SHIFT
  88. /* ##SDL_platform.h */
  89. #ifdef __IOS__
  90. #define __IPHONEOS__ __IPHONEOS___renamed___IOS__
  91. #endif
  92. #ifdef __MACOS__
  93. #define __MACOSX__ __MACOSX___renamed___MACOS__
  94. #endif
  95. /* ##SDL_rwops.h */
  96. #define RW_SEEK_CUR RW_SEEK_CUR_renamed_SDL_RW_SEEK_CUR
  97. #define RW_SEEK_END RW_SEEK_END_renamed_SDL_RW_SEEK_END
  98. #define RW_SEEK_SET RW_SEEK_SET_renamed_SDL_RW_SEEK_SET
  99. #endif /* SDL_ENABLE_OLD_NAMES */
  100. #endif /* SDL_oldnames_h_ */