SDL: Simplified SDL_main.h migration notes

From e0ab597549fda1e6244c05fbc94044c6280a614c Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 31 Aug 2023 09:29:59 -0700
Subject: [PATCH] Simplified SDL_main.h migration notes

Thanks for the feedback!
 docs/ | 31 +++----------------------------
 1 file changed, 3 insertions(+), 28 deletions(-)

diff --git a/docs/ b/docs/
index 26bf2178417f..2f00a5d704a0 100644
--- a/docs/
+++ b/docs/
@@ -4,6 +4,8 @@ This guide provides useful information for migrating applications from SDL 2.0 t
 Details on API changes are organized by SDL 2.0 header below.
+The file with your main() function should include <SDL3/SDL_main.h>, as that is no longer included in SDL.h.
 Many functions and symbols have been renamed. We have provided a handy Python script []( to rename SDL2 functions to their SDL3 counterparts:
 ```sh --all-symbols source_code_path
@@ -11,14 +13,11 @@ --all-symbols source_code_path
 It's also possible to apply a semantic patch to migrate more easily to SDL3: [SDL_migration.cocci](
 SDL headers should now be included as `#include <SDL3/SDL.h>`. Typically that's the only header you'll need in your application unless you are using OpenGL or Vulkan functionality. We have provided a handy Python script []( to rename SDL2 headers to their SDL3 counterparts:
 ```sh source_code_path

-The file with your main() function should also include <SDL3/SDL_main.h>, see below in the SDL_main.h section.

CMake users should use this snippet to include SDL support in their project:

@@ -39,10 +38,7 @@ LDFLAGS += $(shell pkg-config sdl3 --libs)

The SDL3test library has been renamed SDL3_test.

-There is no SDLmain library anymore, it's now header-only, see below in the SDL_main.h section.
-begin_code.h and close_code.h in the public headers have been renamed to SDL_begin_code.h and SDL_close_code.h. These aren't meant to be included directly by applications, but if your application did, please update your `#include` lines.
+The SDLmain library has been removed, it's been entirely replaced by SDL_main.h.

The vi format comments have been removed from source code. Vim users can use the [editorconfig plugin]( to automatically set tab spacing for the SDL coding style.

@@ -699,27 +695,6 @@ Instead SDL_main.h is now a header-only library **and not included by SDL.h anym
Using it is really simple: Just `#include <SDL3/SDL_main.h>` in the source file with your standard
`int main(int argc, char* argv[])` function.

-The rest happens automatically: If your target platform needs the SDL_main functionality,
-your main function will be renamed to SDL_main (with a macro, just like in SDL2),
-and the real main-function will be implemented by inline code from SDL_main.h - and if your target
-platform doesn't need it, nothing happens.
-Like in SDL2, if you want to handle the platform-specific main yourself instead of using the SDL_main magic,
-you can `#define SDL_MAIN_HANDLED` before `#include <SDL3/SDL_main.h>` - don't forget to call SDL_SetMainReady()
-If you need SDL_main.h in another source file (that doesn't implement main()), you also need to
-`#define SDL_MAIN_HANDLED` there, to avoid that multiple main functions are generated by SDL_main.h
-There is currently one platform where this approach doesn't always work: WinRT.
-It requires WinMain to be implemented in a C++ source file that's compiled with `/ZW`. If your main
-is implemented in plain C, or you can't use `/ZW` on that file, you can add another .cpp
-source file that just contains `#include <SDL3/SDL_main.h>` and compile that with `/ZW` - but keep
-in mind that the source file with your standard main also needs that include!
-See [](./ for more details.
-Furthermore, the different SDL_*RunApp() functions (SDL_WinRtRunApp, SDL_GDKRunApp, SDL_UIKitRunApp)
-have been unified into just `int SDL_RunApp(int argc, char* argv[], void * reserved)` (which is also
-used by additional platforms that didn't have a SDL_RunApp-like function before).
## SDL_metal.h

SDL_Metal_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place.