SDL_main.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2024 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. * # CategoryMain
  20. *
  21. * Redefine main() if necessary so that it is called by SDL.
  22. *
  23. * In order to make this consistent on all platforms, the application's main()
  24. * should look like this:
  25. *
  26. * ```c
  27. * int main(int argc, char *argv[])
  28. * {
  29. * }
  30. * ```
  31. *
  32. * SDL will take care of platform specific details on how it gets called.
  33. *
  34. * For more information, see:
  35. *
  36. * https://wiki.libsdl.org/SDL3/README/main-functions
  37. */
  38. #ifndef SDL_main_h_
  39. #define SDL_main_h_
  40. #include <SDL3/SDL_platform_defines.h>
  41. #include <SDL3/SDL_stdinc.h>
  42. #include <SDL3/SDL_error.h>
  43. #include <SDL3/SDL_events.h>
  44. #ifndef SDL_MAIN_HANDLED
  45. #ifdef SDL_PLATFORM_WIN32
  46. /* On Windows SDL provides WinMain(), which parses the command line and passes
  47. the arguments to your main function.
  48. If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
  49. */
  50. #define SDL_MAIN_AVAILABLE
  51. #elif defined(SDL_PLATFORM_GDK)
  52. /* On GDK, SDL provides a main function that initializes the game runtime.
  53. If you prefer to write your own WinMain-function instead of having SDL
  54. provide one that calls your main() function,
  55. #define SDL_MAIN_HANDLED before #include'ing SDL_main.h
  56. and call the SDL_RunApp function from your entry point.
  57. */
  58. #define SDL_MAIN_NEEDED
  59. #elif defined(SDL_PLATFORM_IOS)
  60. /* On iOS SDL provides a main function that creates an application delegate
  61. and starts the iOS application run loop.
  62. To use it, just #include SDL_main.h in the source file that contains your
  63. main() function.
  64. See src/video/uikit/SDL_uikitappdelegate.m for more details.
  65. */
  66. #define SDL_MAIN_NEEDED
  67. #elif defined(SDL_PLATFORM_ANDROID)
  68. /* On Android SDL provides a Java class in SDLActivity.java that is the
  69. main activity entry point.
  70. See docs/README-android.md for more details on extending that class.
  71. */
  72. #define SDL_MAIN_NEEDED
  73. /* As this is launched from Java, the real entry point (main() function)
  74. is outside of the the binary built from this code.
  75. This define makes sure that, unlike on other platforms, SDL_main.h
  76. and SDL_main_impl.h export an `SDL_main()` function (to be called
  77. from Java), but don't implement a native `int main(int argc, char* argv[])`
  78. or similar.
  79. */
  80. #define SDL_MAIN_EXPORTED
  81. #elif defined(SDL_PLATFORM_EMSCRIPTEN)
  82. /* On Emscripten, SDL provides a main function that converts URL
  83. parameters that start with "SDL_" to environment variables, so
  84. they can be used as SDL hints, etc.
  85. This is 100% optional, so if you don't want this to happen, you may
  86. define SDL_MAIN_HANDLED
  87. */
  88. #define SDL_MAIN_AVAILABLE
  89. #elif defined(SDL_PLATFORM_PSP)
  90. /* On PSP SDL provides a main function that sets the module info,
  91. activates the GPU and starts the thread required to be able to exit
  92. the software.
  93. If you provide this yourself, you may define SDL_MAIN_HANDLED
  94. */
  95. #define SDL_MAIN_AVAILABLE
  96. #elif defined(SDL_PLATFORM_PS2)
  97. #define SDL_MAIN_AVAILABLE
  98. #define SDL_PS2_SKIP_IOP_RESET() \
  99. void reset_IOP(); \
  100. void reset_IOP() {}
  101. #elif defined(SDL_PLATFORM_3DS)
  102. /*
  103. On N3DS, SDL provides a main function that sets up the screens
  104. and storage.
  105. If you provide this yourself, you may define SDL_MAIN_HANDLED
  106. */
  107. #define SDL_MAIN_AVAILABLE
  108. #elif defined(SDL_PLATFORM_NGAGE)
  109. /*
  110. TODO: not sure if it should be SDL_MAIN_NEEDED, in SDL2 ngage had a
  111. main implementation, but wasn't mentioned in SDL_main.h
  112. */
  113. #define SDL_MAIN_AVAILABLE
  114. #endif
  115. #endif /* SDL_MAIN_HANDLED */
  116. #ifdef SDL_MAIN_EXPORTED
  117. /* We need to export SDL_main so it can be launched from external code,
  118. like SDLActivity.java on Android */
  119. #define SDLMAIN_DECLSPEC SDL_DECLSPEC
  120. #else
  121. /* usually this is empty */
  122. #define SDLMAIN_DECLSPEC
  123. #endif /* SDL_MAIN_EXPORTED */
  124. #ifdef SDL_WIKI_DOCUMENTATION_SECTION
  125. /**
  126. * Inform SDL to use the main callbacks instead of main.
  127. *
  128. * SDL does not define this macro, but will check if it is defined when
  129. * including `SDL_main.h`. If defined, SDL will expect the app to provide
  130. * several functions: SDL_AppInit, SDL_AppEvent, SDL_AppIterate, and
  131. * SDL_AppQuit. The app should not provide a `main` function in this case, and
  132. * doing so will likely cause the build to fail.
  133. *
  134. * Please see [README/main-functions](README/main-functions), (or
  135. * docs/README-main-functions.md in the source tree) for a more detailed
  136. * explanation.
  137. *
  138. * \since This macro is used by the headers since SDL 3.0.0.
  139. *
  140. * \sa SDL_AppInit
  141. * \sa SDL_AppEvent
  142. * \sa SDL_AppIterate
  143. * \sa SDL_AppQuit
  144. */
  145. #define SDL_MAIN_USE_CALLBACKS 1
  146. #endif
  147. #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) || defined(SDL_MAIN_USE_CALLBACKS)
  148. #define main SDL_main
  149. #endif
  150. #include <SDL3/SDL_init.h>
  151. #include <SDL3/SDL_begin_code.h>
  152. #ifdef __cplusplus
  153. extern "C" {
  154. #endif
  155. /*
  156. * You can (optionally!) define SDL_MAIN_USE_CALLBACKS before including
  157. * SDL_main.h, and then your application will _not_ have a standard
  158. * "main" entry point. Instead, it will operate as a collection of
  159. * functions that are called as necessary by the system. On some
  160. * platforms, this is just a layer where SDL drives your program
  161. * instead of your program driving SDL, on other platforms this might
  162. * hook into the OS to manage the lifecycle. Programs on most platforms
  163. * can use whichever approach they prefer, but the decision boils down
  164. * to:
  165. *
  166. * - Using a standard "main" function: this works like it always has for
  167. * the past 50+ years in C programming, and your app is in control.
  168. * - Using the callback functions: this might clean up some code,
  169. * avoid some #ifdef blocks in your program for some platforms, be more
  170. * resource-friendly to the system, and possibly be the primary way to
  171. * access some future platforms (but none require this at the moment).
  172. *
  173. * This is up to the app; both approaches are considered valid and supported
  174. * ways to write SDL apps.
  175. *
  176. * If using the callbacks, don't define a "main" function. Instead, implement
  177. * the functions listed below in your program.
  178. */
  179. #ifdef SDL_MAIN_USE_CALLBACKS
  180. /**
  181. * App-implemented initial entry point for SDL_MAIN_USE_CALLBACKS apps.
  182. *
  183. * Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a
  184. * standard "main" function, you should not supply this.
  185. *
  186. * This function is called by SDL once, at startup. The function should
  187. * initialize whatever is necessary, possibly create windows and open audio
  188. * devices, etc. The `argc` and `argv` parameters work like they would with a
  189. * standard "main" function.
  190. *
  191. * This function should not go into an infinite mainloop; it should do any
  192. * one-time setup it requires and then return.
  193. *
  194. * The app may optionally assign a pointer to `*appstate`. This pointer will
  195. * be provided on every future call to the other entry points, to allow
  196. * application state to be preserved between functions without the app needing
  197. * to use a global variable. If this isn't set, the pointer will be NULL in
  198. * future entry points.
  199. *
  200. * If this function returns SDL_APP_CONTINUE, the app will proceed to normal
  201. * operation, and will begin receiving repeated calls to SDL_AppIterate and
  202. * SDL_AppEvent for the life of the program. If this function returns
  203. * SDL_APP_FAILURE, SDL will call SDL_AppQuit and terminate the process with
  204. * an exit code that reports an error to the platform. If it returns
  205. * SDL_APP_SUCCESS, SDL calls SDL_AppQuit and terminates with an exit code
  206. * that reports success to the platform.
  207. *
  208. * \param appstate a place where the app can optionally store a pointer for
  209. * future use.
  210. * \param argc the standard ANSI C main's argc; number of elements in `argv`.
  211. * \param argv the standard ANSI C main's argv; array of command line
  212. * arguments.
  213. * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
  214. * terminate with success, SDL_APP_CONTINUE to continue.
  215. *
  216. * \threadsafety This function is not thread safe.
  217. *
  218. * \since This function is available since SDL 3.0.0.
  219. *
  220. * \sa SDL_AppIterate
  221. * \sa SDL_AppEvent
  222. * \sa SDL_AppQuit
  223. */
  224. extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppInit(void **appstate, int argc, char *argv[]);
  225. /**
  226. * App-implemented iteration entry point for SDL_MAIN_USE_CALLBACKS apps.
  227. *
  228. * Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a
  229. * standard "main" function, you should not supply this.
  230. *
  231. * This function is called repeatedly by SDL after SDL_AppInit returns 0. The
  232. * function should operate as a single iteration the program's primary loop;
  233. * it should update whatever state it needs and draw a new frame of video,
  234. * usually.
  235. *
  236. * On some platforms, this function will be called at the refresh rate of the
  237. * display (which might change during the life of your app!). There are no
  238. * promises made about what frequency this function might run at. You should
  239. * use SDL's timer functions if you need to see how much time has passed since
  240. * the last iteration.
  241. *
  242. * There is no need to process the SDL event queue during this function; SDL
  243. * will send events as they arrive in SDL_AppEvent, and in most cases the
  244. * event queue will be empty when this function runs anyhow.
  245. *
  246. * This function should not go into an infinite mainloop; it should do one
  247. * iteration of whatever the program does and return.
  248. *
  249. * The `appstate` parameter is an optional pointer provided by the app during
  250. * SDL_AppInit(). If the app never provided a pointer, this will be NULL.
  251. *
  252. * If this function returns SDL_APP_CONTINUE, the app will continue normal
  253. * operation, receiving repeated calls to SDL_AppIterate and SDL_AppEvent for
  254. * the life of the program. If this function returns SDL_APP_FAILURE, SDL will
  255. * call SDL_AppQuit and terminate the process with an exit code that reports
  256. * an error to the platform. If it returns SDL_APP_SUCCESS, SDL calls
  257. * SDL_AppQuit and terminates with an exit code that reports success to the
  258. * platform.
  259. *
  260. * \param appstate an optional pointer, provided by the app in SDL_AppInit.
  261. * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
  262. * terminate with success, SDL_APP_CONTINUE to continue.
  263. *
  264. * \threadsafety This function is not thread safe.
  265. *
  266. * \since This function is available since SDL 3.0.0.
  267. *
  268. * \sa SDL_AppInit
  269. * \sa SDL_AppEvent
  270. */
  271. extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppIterate(void *appstate);
  272. /**
  273. * App-implemented event entry point for SDL_MAIN_USE_CALLBACKS apps.
  274. *
  275. * Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a
  276. * standard "main" function, you should not supply this.
  277. *
  278. * This function is called as needed by SDL after SDL_AppInit returns
  279. * SDL_APP_CONTINUE. It is called once for each new event.
  280. *
  281. * There is (currently) no guarantee about what thread this will be called
  282. * from; whatever thread pushes an event onto SDL's queue will trigger this
  283. * function. SDL is responsible for pumping the event queue between each call
  284. * to SDL_AppIterate, so in normal operation one should only get events in a
  285. * serial fashion, but be careful if you have a thread that explicitly calls
  286. * SDL_PushEvent.
  287. *
  288. * Events sent to this function are not owned by the app; if you need to save
  289. * the data, you should copy it.
  290. *
  291. * This function should not go into an infinite mainloop; it should handle the
  292. * provided event appropriately and return.
  293. *
  294. * The `appstate` parameter is an optional pointer provided by the app during
  295. * SDL_AppInit(). If the app never provided a pointer, this will be NULL.
  296. *
  297. * If this function returns SDL_APP_CONTINUE, the app will continue normal
  298. * operation, receiving repeated calls to SDL_AppIterate and SDL_AppEvent for
  299. * the life of the program. If this function returns SDL_APP_FAILURE, SDL will
  300. * call SDL_AppQuit and terminate the process with an exit code that reports
  301. * an error to the platform. If it returns SDL_APP_SUCCESS, SDL calls
  302. * SDL_AppQuit and terminates with an exit code that reports success to the
  303. * platform.
  304. *
  305. * \param appstate an optional pointer, provided by the app in SDL_AppInit.
  306. * \param event the new event for the app to examine.
  307. * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
  308. * terminate with success, SDL_APP_CONTINUE to continue.
  309. *
  310. * \threadsafety This function is not thread safe.
  311. *
  312. * \since This function is available since SDL 3.0.0.
  313. *
  314. * \sa SDL_AppInit
  315. * \sa SDL_AppIterate
  316. */
  317. extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event);
  318. /**
  319. * App-implemented deinit entry point for SDL_MAIN_USE_CALLBACKS apps.
  320. *
  321. * Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a
  322. * standard "main" function, you should not supply this.
  323. *
  324. * This function is called once by SDL before terminating the program.
  325. *
  326. * This function will be called no matter what, even if SDL_AppInit requests
  327. * termination.
  328. *
  329. * This function should not go into an infinite mainloop; it should
  330. * deinitialize any resources necessary, perform whatever shutdown activities,
  331. * and return.
  332. *
  333. * You do not need to call SDL_Quit() in this function, as SDL will call it
  334. * after this function returns and before the process terminates, but it is
  335. * safe to do so.
  336. *
  337. * The `appstate` parameter is an optional pointer provided by the app during
  338. * SDL_AppInit(). If the app never provided a pointer, this will be NULL. This
  339. * function call is the last time this pointer will be provided, so any
  340. * resources to it should be cleaned up here.
  341. *
  342. * \param appstate an optional pointer, provided by the app in SDL_AppInit.
  343. * \param result the result code that terminated the app (success or failure).
  344. *
  345. * \threadsafety This function is not thread safe.
  346. *
  347. * \since This function is available since SDL 3.0.0.
  348. *
  349. * \sa SDL_AppInit
  350. */
  351. extern SDLMAIN_DECLSPEC void SDLCALL SDL_AppQuit(void *appstate, SDL_AppResult result);
  352. #endif /* SDL_MAIN_USE_CALLBACKS */
  353. /**
  354. * The prototype for the application's main() function
  355. *
  356. * \param argc an ANSI-C style main function's argc.
  357. * \param argv an ANSI-C style main function's argv.
  358. * \returns an ANSI-C main return code; generally 0 is considered successful
  359. * program completion, and small non-zero values are considered
  360. * errors.
  361. *
  362. * \since This datatype is available since SDL 3.0.0.
  363. */
  364. typedef int (SDLCALL *SDL_main_func)(int argc, char *argv[]);
  365. /**
  366. * An app-supplied function for program entry.
  367. *
  368. * Apps do not directly create this function; they should create a standard
  369. * ANSI-C `main` function instead. If SDL needs to insert some startup code
  370. * before `main` runs, or the platform doesn't actually _use_ a function
  371. * called "main", SDL will do some macro magic to redefine `main` to
  372. * `SDL_main` and provide its own `main`.
  373. *
  374. * Apps should include `SDL_main.h` in the same file as their `main` function,
  375. * and they should not use that symbol for anything else in that file, as it
  376. * might get redefined.
  377. *
  378. * This function is only provided by the app if it isn't using
  379. * SDL_MAIN_USE_CALLBACKS.
  380. *
  381. * Program startup is a surprisingly complex topic. Please see
  382. * [README/main-functions](README/main-functions), (or
  383. * docs/README-main-functions.md in the source tree) for a more detailed
  384. * explanation.
  385. *
  386. * \param argc an ANSI-C style main function's argc.
  387. * \param argv an ANSI-C style main function's argv.
  388. * \returns an ANSI-C main return code; generally 0 is considered successful
  389. * program completion, and small non-zero values are considered
  390. * errors.
  391. *
  392. * \threadsafety This is the program entry point.
  393. *
  394. * \since This function is available since SDL 3.0.0.
  395. */
  396. extern SDLMAIN_DECLSPEC int SDLCALL SDL_main(int argc, char *argv[]);
  397. /**
  398. * Circumvent failure of SDL_Init() when not using SDL_main() as an entry
  399. * point.
  400. *
  401. * This function is defined in SDL_main.h, along with the preprocessor rule to
  402. * redefine main() as SDL_main(). Thus to ensure that your main() function
  403. * will not be changed it is necessary to define SDL_MAIN_HANDLED before
  404. * including SDL.h.
  405. *
  406. * \since This function is available since SDL 3.0.0.
  407. *
  408. * \sa SDL_Init
  409. */
  410. extern SDL_DECLSPEC void SDLCALL SDL_SetMainReady(void);
  411. /**
  412. * Initializes and launches an SDL application, by doing platform-specific
  413. * initialization before calling your mainFunction and cleanups after it
  414. * returns, if that is needed for a specific platform, otherwise it just calls
  415. * mainFunction.
  416. *
  417. * You can use this if you want to use your own main() implementation without
  418. * using SDL_main (like when using SDL_MAIN_HANDLED). When using this, you do
  419. * *not* need SDL_SetMainReady().
  420. *
  421. * \param argc the argc parameter from the application's main() function, or 0
  422. * if the platform's main-equivalent has no argc.
  423. * \param argv the argv parameter from the application's main() function, or
  424. * NULL if the platform's main-equivalent has no argv.
  425. * \param mainFunction your SDL app's C-style main(). NOT the function you're
  426. * calling this from! Its name doesn't matter; it doesn't
  427. * literally have to be `main`.
  428. * \param reserved should be NULL (reserved for future use, will probably be
  429. * platform-specific then).
  430. * \returns the return value from mainFunction: 0 on success, otherwise
  431. * failure; SDL_GetError() might have more information on the
  432. * failure.
  433. *
  434. * \threadsafety Generally this is called once, near startup, from the
  435. * process's initial thread.
  436. *
  437. * \since This function is available since SDL 3.0.0.
  438. */
  439. extern SDL_DECLSPEC int SDLCALL SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void *reserved);
  440. /**
  441. * An entry point for SDL's use in SDL_MAIN_USE_CALLBACKS.
  442. *
  443. * Generally, you should not call this function directly. This only exists to
  444. * hand off work into SDL as soon as possible, where it has a lot more control
  445. * and functionality available, and make the inline code in SDL_main.h as
  446. * small as possible.
  447. *
  448. * Not all platforms use this, it's actual use is hidden in a magic
  449. * header-only library, and you should not call this directly unless you
  450. * _really_ know what you're doing.
  451. *
  452. * \param argc standard Unix main argc.
  453. * \param argv standard Unix main argv.
  454. * \param appinit the application's SDL_AppInit function.
  455. * \param appiter the application's SDL_AppIterate function.
  456. * \param appevent the application's SDL_AppEvent function.
  457. * \param appquit the application's SDL_AppQuit function.
  458. * \returns standard Unix main return value.
  459. *
  460. * \threadsafety It is not safe to call this anywhere except as the only
  461. * function call in SDL_main.
  462. *
  463. * \since This function is available since SDL 3.0.0.
  464. */
  465. extern SDL_DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit);
  466. #if defined(SDL_PLATFORM_WINDOWS)
  467. /**
  468. * Register a win32 window class for SDL's use.
  469. *
  470. * This can be called to set the application window class at startup. It is
  471. * safe to call this multiple times, as long as every call is eventually
  472. * paired with a call to SDL_UnregisterApp, but a second registration attempt
  473. * while a previous registration is still active will be ignored, other than
  474. * to increment a counter.
  475. *
  476. * Most applications do not need to, and should not, call this directly; SDL
  477. * will call it when initializing the video subsystem.
  478. *
  479. * \param name the window class name, in UTF-8 encoding. If NULL, SDL
  480. * currently uses "SDL_app" but this isn't guaranteed.
  481. * \param style the value to use in WNDCLASSEX::style. If `name` is NULL, SDL
  482. * currently uses `(CS_BYTEALIGNCLIENT | CS_OWNDC)` regardless of
  483. * what is specified here.
  484. * \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL
  485. * will use `GetModuleHandle(NULL)` instead.
  486. * \returns true on success or false on failure; call SDL_GetError() for more
  487. * information.
  488. *
  489. * \since This function is available since SDL 3.0.0.
  490. */
  491. extern SDL_DECLSPEC bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst);
  492. /**
  493. * Deregister the win32 window class from an SDL_RegisterApp call.
  494. *
  495. * This can be called to undo the effects of SDL_RegisterApp.
  496. *
  497. * Most applications do not need to, and should not, call this directly; SDL
  498. * will call it when deinitializing the video subsystem.
  499. *
  500. * It is safe to call this multiple times, as long as every call is eventually
  501. * paired with a prior call to SDL_RegisterApp. The window class will only be
  502. * deregistered when the registration counter in SDL_RegisterApp decrements to
  503. * zero through calls to this function.
  504. *
  505. * \since This function is available since SDL 3.0.0.
  506. */
  507. extern SDL_DECLSPEC void SDLCALL SDL_UnregisterApp(void);
  508. #endif /* defined(SDL_PLATFORM_WINDOWS) */
  509. #ifdef SDL_PLATFORM_GDK
  510. /**
  511. * Callback from the application to let the suspend continue.
  512. *
  513. * \since This function is available since SDL 3.0.0.
  514. */
  515. extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
  516. #endif /* SDL_PLATFORM_GDK */
  517. #ifdef __cplusplus
  518. }
  519. #endif
  520. #include <SDL3/SDL_close_code.h>
  521. #if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL)
  522. /* include header-only SDL_main implementations */
  523. #if defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
  524. /* platforms which main (-equivalent) can be implemented in plain C */
  525. #include <SDL3/SDL_main_impl.h>
  526. #endif
  527. #endif
  528. #endif /* SDL_main_h_ */