SDL_oldnames.h 3.8 KB

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