diff --git a/examples/android/SDL_RENDERER/app/jni/src/example.cpp b/examples/android/SDL_RENDERER/app/jni/src/example.cpp index 79c8bc123..68470d1f2 100644 --- a/examples/android/SDL_RENDERER/app/jni/src/example.cpp +++ b/examples/android/SDL_RENDERER/app/jni/src/example.cpp @@ -25,15 +25,8 @@ #include #include -// Make some defines to keep the code below compatible with both SDL2 and SDL3 #if SDL_MAJOR_VERSION >= 3 #include - #define DEFAULT_RENDERING_DRIVER nullptr - #define SDL_WINDOW_SHOWN 0 - #define SDL_RENDERER_ACCELERATED 0 - #define SDL_CreateWindow SDL_CreateWindowWithPosition -#else - #define DEFAULT_RENDERING_DRIVER -1 #endif // The background image will rotate with the screen @@ -105,11 +98,18 @@ int main(int, char**) // TGUI requires a window created with the SDL_WINDOW_OPENGL flag and an OpenGL context. // SDL_WINDOW_RESIZABLE is needed to support screen rotations. +#if SDL_MAJOR_VERSION >= 3 + SDL_Window* window = SDL_CreateWindow("TGUI window with SDL", + 800, 600, // ignored because of SDL_WINDOW_FULLSCREEN_DESKTOP flag + SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_RESIZABLE); + SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr); +#else SDL_Window* window = SDL_CreateWindow("TGUI window with SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, // ignored because of SDL_WINDOW_FULLSCREEN_DESKTOP flag SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_RESIZABLE); - SDL_Renderer* renderer = SDL_CreateRenderer(window, DEFAULT_RENDERING_DRIVER, SDL_RENDERER_ACCELERATED); + SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); +#endif SDL_SetRenderDrawColor(renderer, 240, 240, 240, 255); diff --git a/examples/main-SDL_RENDERER.cpp b/examples/main-SDL_RENDERER.cpp index 34a493587..5b3761252 100644 --- a/examples/main-SDL_RENDERER.cpp +++ b/examples/main-SDL_RENDERER.cpp @@ -48,7 +48,7 @@ int main(int, char **) #if SDL_MAJOR_VERSION >= 3 SDL_Window* window = SDL_CreateWindow("TGUI example (SDL-Renderer)", 800, 600, 0); - SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr, 0); + SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr); #else SDL_Window* window = SDL_CreateWindow("TGUI example (SDL-Renderer)", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, diff --git a/src/DefaultBackendWindow.cpp b/src/DefaultBackendWindow.cpp index 7417d0ddc..963b4a015 100644 --- a/src/DefaultBackendWindow.cpp +++ b/src/DefaultBackendWindow.cpp @@ -233,7 +233,7 @@ namespace tgui #if TGUI_HAS_BACKEND_SDL_RENDERER #if SDL_MAJOR_VERSION >= 3 - m_renderer = SDL_CreateRenderer(m_window, nullptr, 0); + m_renderer = SDL_CreateRenderer(m_window, nullptr); #else m_renderer = SDL_CreateRenderer(m_window, -1, SDL_RENDERER_ACCELERATED); #endif diff --git a/tests/main.cpp b/tests/main.cpp index 8dca42a94..ad73702e6 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -157,7 +157,7 @@ struct TestsWindowDefault : public TestsWindowBase window = SDL_CreateWindow(windowTitle, windowWidth, windowHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); - renderer = SDL_CreateRenderer(window, nullptr, 0); + renderer = SDL_CreateRenderer(window, nullptr); #else window = SDL_CreateWindow(windowTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,