Use SDL3-compatible SDL includes when SDL3 headers are available

This commit is contained in:
Sasha Szpakowski
2024-10-06 20:27:28 -03:00
parent 20b527f2ab
commit e986160431
27 changed files with 122 additions and 2 deletions
+5
View File
@@ -20,8 +20,13 @@
#include "delay.h"
#if __has_include(<SDL3/SDL_timer.h>)
#include <SDL3/SDL_timer.h>
#include <SDL3/SDL_version.h>
#else
#include <SDL_timer.h>
#include <SDL_version.h>
#endif
namespace love
{
+6 -1
View File
@@ -22,12 +22,17 @@
#include "common/runtime.h"
#include "common/Variant.h"
#include "modules/love/love.h"
#if __has_include(<SDL3/SDL.h>)
#include <SDL3/SDL.h>
#else
#include <SDL.h>
#endif
#ifdef LOVE_BUILD_EXE
#if SDL_VERSION_ATLEAST(3, 0, 0)
#include <SDL_main.h>
#include <SDL3/SDL_main.h>
#endif
// Lua
+4
View File
@@ -35,7 +35,11 @@
#include <cmath>
#if __has_include(<SDL3/SDL_version.h>)
#include <SDL3/SDL_version.h>
#else
#include <SDL_version.h>
#endif
#if SDL_VERSION_ATLEAST(3, 0, 0)
#include "joystick/sdl/JoystickSDL3.h"
+4
View File
@@ -26,7 +26,11 @@
#include "audio/Source.h"
// SDL
#if __has_include(<SDL3/SDL_events.h>)
#include <SDL3/SDL_events.h>
#else
#include <SDL_events.h>
#endif
namespace love
{
@@ -34,8 +34,13 @@
#endif
// SDL
#if __has_include(<SDL3/SDL_loadso.h>)
#include <SDL3/SDL_loadso.h>
#include <SDL3/SDL_version.h>
#else
#include <SDL_loadso.h>
#include <SDL_version.h>
#endif
// STL
#include <vector>
+4
View File
@@ -37,7 +37,11 @@
#include <cstdio>
// For SDL_GL_GetProcAddress.
#if __has_include(<SDL3/SDL_video.h>)
#include <SDL3/SDL_video.h>
#else
#include <SDL_video.h>
#endif
#ifdef LOVE_IOS
#include <SDL_syswm.h>
+5
View File
@@ -29,8 +29,13 @@
#include "Shader.h"
#include "Vulkan.h"
#if __has_include(<SDL3/SDL_version.h>)
#include <SDL3/SDL_version.h>
#include <SDL3/SDL_vulkan.h>
#else
#include <SDL_version.h>
#include <SDL_vulkan.h>
#endif
#include <algorithm>
#include <vector>
+4
View File
@@ -25,7 +25,11 @@
#include "sensor/sdl/Sensor.h"
// SDL
#if __has_include(<SDL3/SDL_version.h>)
#include <SDL3/SDL_version.h>
#else
#include <SDL_version.h>
#endif
// C++
#include <algorithm>
+4
View File
@@ -26,7 +26,11 @@
#include "common/EnumMap.h"
// SDL
#if __has_include(<SDL3/SDL.h>)
#include <SDL3/SDL.h>
#else
#include <SDL.h>
#endif
#if !SDL_VERSION_ATLEAST(3, 0, 0)
@@ -24,7 +24,11 @@
#include "JoystickSDL3.h"
// SDL
#if __has_include(<SDL3/SDL.h>)
#include <SDL3/SDL.h>
#else
#include <SDL.h>
#endif
// C++
#include <sstream>
+5 -1
View File
@@ -25,11 +25,15 @@
#include "sensor/sdl/Sensor.h"
// SDL
#if __has_include(<SDL3/SDL_version.h>)
#include <SDL3/SDL_version.h>
#else
#include <SDL_version.h>
#endif
#if SDL_VERSION_ATLEAST(3, 0, 0)
#include <SDL_guid.h>
#include <SDL3/SDL_guid.h>
// C++
#include <algorithm>
+4
View File
@@ -27,7 +27,11 @@
#include "common/int.h"
// SDL
#if __has_include(<SDL3/SDL.h>)
#include <SDL3/SDL.h>
#else
#include <SDL.h>
#endif
#if SDL_VERSION_ATLEAST(3, 0, 0)
+4
View File
@@ -18,7 +18,11 @@
* 3. This notice may not be removed or altered from any source distribution.
**/
#if __has_include(<SDL3/SDL_version.h>)
#include <SDL3/SDL_version.h>
#else
#include <SDL_version.h>
#endif
#include "Keyboard.h"
#include "window/Window.h"
+5
View File
@@ -26,8 +26,13 @@
#include "common/EnumMap.h"
// SDL
#if __has_include(<SDL3/SDL_keyboard.h>)
#include <SDL3/SDL_keyboard.h>
#include <SDL3/SDL_version.h>
#else
#include <SDL_keyboard.h>
#include <SDL_version.h>
#endif
#include <map>
+4
View File
@@ -22,7 +22,11 @@
#include "Cursor.h"
#include "common/config.h"
#if __has_include(<SDL3/SDL_version.h>)
#include <SDL3/SDL_version.h>
#else
#include <SDL_version.h>
#endif
namespace love
{
+4
View File
@@ -26,7 +26,11 @@
#include "common/EnumMap.h"
// SDL
#if __has_include(<SDL3/SDL_mouse.h>)
#include <SDL3/SDL_mouse.h>
#else
#include <SDL_mouse.h>
#endif
namespace love
{
+5
View File
@@ -23,8 +23,13 @@
#include "window/sdl/Window.h"
// SDL
#if __has_include(<SDL3/SDL_version.h>)
#include <SDL3/SDL_mouse.h>
#include <SDL3/SDL_version.h>
#else
#include <SDL_mouse.h>
#include <SDL_version.h>
#endif
namespace love
{
+5
View File
@@ -22,8 +22,13 @@
#include "Sensor.h"
// SDL
#if __has_include(<SDL3/SDL.h>)
#include <SDL3/SDL.h>
#include <SDL3/SDL_sensor.h>
#else
#include <SDL.h>
#include <SDL_sensor.h>
#endif
namespace love
{
+4
View File
@@ -25,7 +25,11 @@
#include "sensor/Sensor.h"
// SDL
#if __has_include(<SDL3/SDL_sensor.h>)
#include <SDL3/SDL_sensor.h>
#else
#include <SDL_sensor.h>
#endif
// std
#include <map>
+7
View File
@@ -23,6 +23,12 @@
#include "window/Window.h"
// SDL
#if __has_include(<SDL3/SDL_clipboard.h>)
#include <SDL3/SDL_clipboard.h>
#include <SDL3/SDL_cpuinfo.h>
#include <SDL3/SDL_version.h>
#include <SDL3/SDL_locale.h>
#else
#include <SDL_clipboard.h>
#include <SDL_cpuinfo.h>
#include <SDL_version.h>
@@ -30,6 +36,7 @@
#if SDL_VERSION_ATLEAST(2, 0, 14)
#include <SDL_locale.h>
#endif
#endif
namespace love
{
+4
View File
@@ -26,7 +26,11 @@
#include "common/EnumMap.h"
// SDL
#if __has_include(<SDL3/SDL_power.h>)
#include <SDL3/SDL_power.h>
#else
#include <SDL_power.h>
#endif
namespace love
{
+4
View File
@@ -26,7 +26,11 @@
#include "threads.h"
// SDL
#if __has_include(<SDL3/SDL_thread.h>)
#include <SDL3/SDL_thread.h>
#else
#include <SDL_thread.h>
#endif
namespace love
{
+6
View File
@@ -24,9 +24,15 @@
#include "common/config.h"
#include "thread/threads.h"
#if __has_include(<SDL3/SDL_version.h>)
#include <SDL3/SDL_version.h>
#include <SDL3/SDL_thread.h>
#include <SDL3/SDL_mutex.h>
#else
#include <SDL_version.h>
#include <SDL_thread.h>
#include <SDL_mutex.h>
#endif
namespace love
{
+4
View File
@@ -23,7 +23,11 @@
#include "common/Exception.h"
#include "Touch.h"
#if __has_include(<SDL3/SDL_version.h>)
#include <SDL3/SDL_version.h>
#else
#include <SDL_version.h>
#endif
// C++
#include <algorithm>
+4
View File
@@ -25,7 +25,11 @@
#include "touch/Touch.h"
// SDL
#if __has_include(<SDL3/SDL_events.h>)
#include <SDL3/SDL_events.h>
#else
#include <SDL_events.h>
#endif
namespace love
{
+4
View File
@@ -49,8 +49,12 @@
#endif
#ifdef LOVE_GRAPHICS_VULKAN
#if __has_include(<SDL3/SDL_vulkan.h>)
#include <SDL3/SDL_vulkan.h>
#else
#include <SDL_vulkan.h>
#endif
#endif
#if defined(LOVE_WINDOWS)
#define WIN32_LEAN_AND_MEAN
+4
View File
@@ -27,7 +27,11 @@
#include "graphics/Graphics.h"
// SDL
#if __has_include(<SDL3/SDL.h>)
#include <SDL3/SDL.h>
#else
#include <SDL.h>
#endif
namespace love
{