2
0
Эх сурвалжийг харах

docs: heavy editing to make this happy with latest wikibridge.

The public headers saw lots of cleanups, backporting from SDL3 docs, and
merging with the wiki.

The markdown files in docs/README-*.md were converted to Unix endlines.
Ryan C. Gordon 1 жил өмнө
parent
commit
e03ad30a57
80 өөрчлөгдсөн 6362 нэмэгдсэн , 5635 устгасан
  1. 469 155
      build-scripts/wikiheaders.pl
  2. 483 483
      docs/README-android.md
  3. 163 163
      docs/README-cmake.md
  4. 123 123
      docs/README-directfb.md
  5. 138 138
      docs/README-dynapi.md
  6. 374 374
      docs/README-emscripten.md
  7. 176 176
      docs/README-gdk.md
  8. 71 71
      docs/README-gesture.md
  9. 19 19
      docs/README-git.md
  10. 4 4
      docs/README-hg.md
  11. 307 307
      docs/README-ios.md
  12. 27 27
      docs/README-kmsbsd.md
  13. 96 96
      docs/README-linux.md
  14. 285 285
      docs/README-macos.md
  15. 28 28
      docs/README-n3ds.md
  16. 103 103
      docs/README-nacl.md
  17. 44 44
      docs/README-ngage.md
  18. 92 92
      docs/README-os2.md
  19. 17 17
      docs/README-pandora.md
  20. 8 8
      docs/README-platforms.md
  21. 68 68
      docs/README-porting.md
  22. 51 51
      docs/README-ps2.md
  23. 36 36
      docs/README-psp.md
  24. 180 180
      docs/README-raspberrypi.md
  25. 41 41
      docs/README-riscos.md
  26. 86 86
      docs/README-touch.md
  27. 60 60
      docs/README-versions.md
  28. 114 114
      docs/README-visualc.md
  29. 33 33
      docs/README-vita.md
  30. 10 10
      docs/README-wince.md
  31. 58 58
      docs/README-windows.md
  32. 519 519
      docs/README-winrt.md
  33. 3 2
      include/SDL_atomic.h
  34. 26 22
      include/SDL_audio.h
  35. 6 0
      include/SDL_bits.h
  36. 4 3
      include/SDL_blendmode.h
  37. 39 0
      include/SDL_endian.h
  38. 86 81
      include/SDL_events.h
  39. 15 12
      include/SDL_gamecontroller.h
  40. 16 16
      include/SDL_guid.h
  41. 318 306
      include/SDL_haptic.h
  42. 3 2
      include/SDL_hidapi.h
  43. 1119 835
      include/SDL_hints.h
  44. 12 8
      include/SDL_joystick.h
  45. 5 4
      include/SDL_keyboard.h
  46. 8 8
      include/SDL_keycode.h
  47. 7 8
      include/SDL_log.h
  48. 3 3
      include/SDL_main.h
  49. 6 4
      include/SDL_messagebox.h
  50. 2 2
      include/SDL_metal.h
  51. 5 5
      include/SDL_mouse.h
  52. 3 3
      include/SDL_mutex.h
  53. 28 4
      include/SDL_pixels.h
  54. 1 1
      include/SDL_power.h
  55. 3 3
      include/SDL_quit.h
  56. 2 2
      include/SDL_render.h
  57. 5 5
      include/SDL_rwops.h
  58. 6 6
      include/SDL_scancode.h
  59. 59 51
      include/SDL_sensor.h
  60. 9 9
      include/SDL_shape.h
  61. 27 15
      include/SDL_stdinc.h
  62. 66 64
      include/SDL_surface.h
  63. 5 5
      include/SDL_system.h
  64. 7 6
      include/SDL_syswm.h
  65. 1 1
      include/SDL_test.h
  66. 9 9
      include/SDL_test_assert.h
  67. 10 10
      include/SDL_test_common.h
  68. 2 2
      include/SDL_test_compare.h
  69. 11 11
      include/SDL_test_font.h
  70. 29 28
      include/SDL_test_fuzzer.h
  71. 5 5
      include/SDL_test_harness.h
  72. 2 2
      include/SDL_test_images.h
  73. 3 3
      include/SDL_test_log.h
  74. 4 4
      include/SDL_test_md5.h
  75. 3 3
      include/SDL_test_memory.h
  76. 4 4
      include/SDL_test_random.h
  77. 8 6
      include/SDL_thread.h
  78. 9 9
      include/SDL_timer.h
  79. 26 25
      include/SDL_version.h
  80. 49 49
      include/SDL_video.h

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 469 - 155
build-scripts/wikiheaders.pl


+ 483 - 483
docs/README-android.md

@@ -1,483 +1,483 @@
-Android
-================================================================================
-
-Matt Styles wrote a tutorial on building SDL for Android with Visual Studio:
-http://trederia.blogspot.de/2017/03/building-sdl2-for-android-with-visual.html
-
-The rest of this README covers the Android gradle style build process.
-
-If you are using the older ant build process, it is no longer officially
-supported, but you can use the "android-project-ant" directory as a template.
-
-
-Requirements
-================================================================================
-
-Android SDK (version 34 or later)
-https://developer.android.com/sdk/index.html
-
-Android NDK r15c or later
-https://developer.android.com/tools/sdk/ndk/index.html
-
-Minimum API level supported by SDL: 19 (Android 4.4)
-
-
-How the port works
-================================================================================
-
-- Android applications are Java-based, optionally with parts written in C
-- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
-  the SDL library
-- This means that your application C code must be placed inside an Android
-  Java project, along with some C support code that communicates with Java
-- This eventually produces a standard Android .apk package
-
-The Android Java code implements an "Activity" and can be found in:
-android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
-
-The Java code loads your game code, the SDL shared library, and
-dispatches to native functions implemented in the SDL library:
-src/core/android/SDL_android.c
-
-
-Building an app
-================================================================================
-
-For simple projects you can use the script located at build-scripts/androidbuild.sh
-
-There's two ways of using it:
-
-    androidbuild.sh com.yourcompany.yourapp < sources.list
-    androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c
-
-sources.list should be a text file with a source file name in each line
-Filenames should be specified relative to the current directory, for example if
-you are in the build-scripts directory and want to create the testgles.c test, you'll
-run:
-
-    ./androidbuild.sh org.libsdl.testgles ../test/testgles.c
-
-One limitation of this script is that all sources provided will be aggregated into
-a single directory, thus all your source files should have a unique name.
-
-Once the project is complete the script will tell you where the debug APK is located.
-If you want to create a signed release APK, you can use the project created by this
-utility to generate it.
-
-Finally, a word of caution: re running androidbuild.sh wipes any changes you may have
-done in the build directory for the app!
-
-
-
-For more complex projects, follow these instructions:
-
-1. Get the source code for SDL and copy the 'android-project' directory located at SDL/android-project to a suitable location. Also make sure to rename it to your project name (In these examples: YOURPROJECT).
-
-   (The 'android-project' directory can basically be seen as a sort of starting point for the android-port of your project. It contains the glue code between the Android Java 'frontend' and the SDL code 'backend'. It also contains some standard behaviour, like how events should be handled, which you will be able to change.)
-
-2. Move or [symlink](https://en.wikipedia.org/wiki/Symbolic_link) the SDL directory into the "YOURPROJECT/app/jni" directory
-
-(This is needed as the source of SDL has to be compiled by the Android compiler)
-
-3. Edit "YOURPROJECT/app/jni/src/Android.mk" to include your source files.
-
-(They should be separated by spaces after the "LOCAL_SRC_FILES := " declaration)
-
-4a. If you want to use Android Studio, simply open your 'YOURPROJECT' directory and start building.
-
-4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
-
-
-If you already have a project that uses CMake, the instructions change somewhat:
-
-1. Do points 1 and 2 from the instruction above.
-2. Edit "YOURPROJECT/app/build.gradle" to comment out or remove sections containing ndk-build
-   and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
-3. Edit "YOURPROJECT/app/jni/CMakeLists.txt" to include your project (it defaults to
-   adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
-   as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
-   in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
-   add_executable() for the target containing your "main" function.
-
-If you wish to use Android Studio, you can skip the last step.
-
-4. Run './gradlew installDebug' or './gradlew installRelease' in the project directory. It will build and install your .apk on any
-   connected Android device
-
-Here's an explanation of the files in the Android project, so you can customize them:
-
-    android-project/app
-        build.gradle            - build info including the application version and SDK
-        src/main/AndroidManifest.xml	- package manifest. Among others, it contains the class name of the main Activity and the package name of the application.
-        jni/			- directory holding native code
-        jni/Application.mk	- Application JNI settings, including target platform and STL library
-        jni/Android.mk		- Android makefile that can call recursively the Android.mk files in all subdirectories
-        jni/CMakeLists.txt	- Top-level CMake project that adds SDL as a subproject
-        jni/SDL/		- (symlink to) directory holding the SDL library files
-        jni/SDL/Android.mk	- Android makefile for creating the SDL shared library
-        jni/src/		- directory holding your C/C++ source
-        jni/src/Android.mk	- Android makefile that you should customize to include your source code and any library references
-        jni/src/CMakeLists.txt	- CMake file that you may customize to include your source code and any library references
-        src/main/assets/	- directory holding asset files for your application
-        src/main/res/		- directory holding resources for your application
-        src/main/res/mipmap-*	- directories holding icons for different phone hardware
-        src/main/res/values/strings.xml	- strings used in your application, including the application name
-        src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application.
-
-
-Customizing your application name
-================================================================================
-
-To customize your application name, edit AndroidManifest.xml and replace
-"org.libsdl.app" with an identifier for your product package.
-
-Then create a Java class extending SDLActivity and place it in a directory
-under src matching your package, e.g.
-
-    src/com/gamemaker/game/MyGame.java
-
-Here's an example of a minimal class file:
-
-    --- MyGame.java --------------------------
-    package com.gamemaker.game;
-
-    import org.libsdl.app.SDLActivity;
-
-    /**
-     * A sample wrapper class that just calls SDLActivity
-     */
-
-    public class MyGame extends SDLActivity { }
-
-    ------------------------------------------
-
-Then replace "SDLActivity" in AndroidManifest.xml with the name of your
-class, .e.g. "MyGame"
-
-
-Customizing your application icon
-================================================================================
-
-Conceptually changing your icon is just replacing the "ic_launcher.png" files in
-the drawable directories under the res directory. There are several directories
-for different screen sizes.
-
-
-Loading assets
-================================================================================
-
-Any files you put in the "app/src/main/assets" directory of your project
-directory will get bundled into the application package and you can load
-them using the standard functions in SDL_rwops.h.
-
-There are also a few Android specific functions that allow you to get other
-useful paths for saving and loading data:
-* SDL_AndroidGetInternalStoragePath()
-* SDL_AndroidGetExternalStorageState()
-* SDL_AndroidGetExternalStoragePath()
-
-See SDL_system.h for more details on these functions.
-
-The asset packaging system will, by default, compress certain file extensions.
-SDL includes two asset file access mechanisms, the preferred one is the so
-called "File Descriptor" method, which is faster and doesn't involve the Dalvik
-GC, but given this method does not work on compressed assets, there is also the
-"Input Stream" method, which is automatically used as a fall back by SDL. You
-may want to keep this fact in mind when building your APK, specially when large
-files are involved.
-For more information on which extensions get compressed by default and how to
-disable this behaviour, see for example:
-
-http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
-
-
-Pause / Resume behaviour
-================================================================================
-
-If SDL_HINT_ANDROID_BLOCK_ON_PAUSE hint is set (the default),
-the event loop will block itself when the app is paused (ie, when the user
-returns to the main Android dashboard). Blocking is better in terms of battery
-use, and it allows your app to spring back to life instantaneously after resume
-(versus polling for a resume message).
-
-Upon resume, SDL will attempt to restore the GL context automatically.
-In modern devices (Android 3.0 and up) this will most likely succeed and your
-app can continue to operate as it was.
-
-However, there's a chance (on older hardware, or on systems under heavy load),
-where the GL context can not be restored. In that case you have to listen for
-a specific message (SDL_RENDER_DEVICE_RESET) and restore your textures
-manually or quit the app.
-
-You should not use the SDL renderer API while the app going in background:
-- SDL_APP_WILLENTERBACKGROUND:
-    after you read this message, GL context gets backed-up and you should not
-    use the SDL renderer API.
-
-    When this event is received, you have to set the render target to NULL, if you're using it.
-    (eg call SDL_SetRenderTarget(renderer, NULL))
-
-- SDL_APP_DIDENTERFOREGROUND:
-   GL context is restored, and the SDL renderer API is available (unless you
-   receive SDL_RENDER_DEVICE_RESET).
-
-Mouse / Touch events
-================================================================================
-
-In some case, SDL generates synthetic mouse (resp. touch) events for touch
-(resp. mouse) devices.
-To enable/disable this behavior, see SDL_hints.h:
-- SDL_HINT_TOUCH_MOUSE_EVENTS
-- SDL_HINT_MOUSE_TOUCH_EVENTS
-
-Misc
-================================================================================
-
-For some device, it appears to works better setting explicitly GL attributes
-before creating a window:
-  SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
-  SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
-  SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
-
-Threads and the Java VM
-================================================================================
-
-For a quick tour on how Linux native threads interoperate with the Java VM, take
-a look here: https://developer.android.com/guide/practices/jni.html
-
-If you want to use threads in your SDL app, it's strongly recommended that you
-do so by creating them using SDL functions. This way, the required attach/detach
-handling is managed by SDL automagically. If you have threads created by other
-means and they make calls to SDL functions, make sure that you call
-Android_JNI_SetupThread() before doing anything else otherwise SDL will attach
-your thread automatically anyway (when you make an SDL call), but it'll never
-detach it.
-
-
-If you ever want to use JNI in a native thread (created by "SDL_CreateThread()"),
-it won't be able to find your java class and method because of the java class loader
-which is different for native threads, than for java threads (eg your "main()").
-
-the work-around is to find class/method, in you "main()" thread, and to use them
-in your native thread.
-
-see:
-https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class
-
-Using STL
-================================================================================
-
-You can use STL in your project by creating an Application.mk file in the jni
-folder and adding the following line:
-
-    APP_STL := c++_shared
-
-For more information go here:
-	https://developer.android.com/ndk/guides/cpp-support
-
-
-Using the emulator
-================================================================================
-
-There are some good tips and tricks for getting the most out of the
-emulator here: https://developer.android.com/tools/devices/emulator.html
-
-Especially useful is the info on setting up OpenGL ES 2.0 emulation.
-
-Notice that this software emulator is incredibly slow and needs a lot of disk space.
-Using a real device works better.
-
-
-Troubleshooting
-================================================================================
-
-You can see if adb can see any devices with the following command:
-
-    adb devices
-
-You can see the output of log messages on the default device with:
-
-    adb logcat
-
-You can push files to the device with:
-
-    adb push local_file remote_path_and_file
-
-You can push files to the SD Card at /sdcard, for example:
-
-    adb push moose.dat /sdcard/moose.dat
-
-You can see the files on the SD card with a shell command:
-
-    adb shell ls /sdcard/
-
-You can start a command shell on the default device with:
-
-    adb shell
-
-You can remove the library files of your project (and not the SDL lib files) with:
-
-    ndk-build clean
-
-You can do a build with the following command:
-
-    ndk-build
-
-You can see the complete command line that ndk-build is using by passing V=1 on the command line:
-
-    ndk-build V=1
-
-If your application crashes in native code, you can use ndk-stack to get a symbolic stack trace:
-	https://developer.android.com/ndk/guides/ndk-stack
-
-If you want to go through the process manually, you can use addr2line to convert the
-addresses in the stack trace to lines in your code.
-
-For example, if your crash looks like this:
-
-    I/DEBUG   (   31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
-    I/DEBUG   (   31):  r0 00000000  r1 00001000  r2 00000003  r3 400085d4
-    I/DEBUG   (   31):  r4 400085d0  r5 40008000  r6 afd41504  r7 436c6a7c
-    I/DEBUG   (   31):  r8 436c6b30  r9 435c6fb0  10 435c6f9c  fp 4168d82c
-    I/DEBUG   (   31):  ip 8346aff0  sp 436c6a60  lr afd1c8ff  pc afd1c902  cpsr 60000030
-    I/DEBUG   (   31):          #00  pc 0001c902  /system/lib/libc.so
-    I/DEBUG   (   31):          #01  pc 0001ccf6  /system/lib/libc.so
-    I/DEBUG   (   31):          #02  pc 000014bc  /data/data/org.libsdl.app/lib/libmain.so
-    I/DEBUG   (   31):          #03  pc 00001506  /data/data/org.libsdl.app/lib/libmain.so
-
-You can see that there's a crash in the C library being called from the main code.
-I run addr2line with the debug version of my code:
-
-    arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
-
-and then paste in the number after "pc" in the call stack, from the line that I care about:
-000014bc
-
-I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23.
-
-You can add logging to your code to help show what's happening:
-
-    #include <android/log.h>
-
-    __android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
-
-If you need to build without optimization turned on, you can create a file called
-"Application.mk" in the jni directory, with the following line in it:
-
-    APP_OPTIM := debug
-
-
-Memory debugging
-================================================================================
-
-The best (and slowest) way to debug memory issues on Android is valgrind.
-Valgrind has support for Android out of the box, just grab code using:
-
-    svn co svn://svn.valgrind.org/valgrind/trunk valgrind
-
-... and follow the instructions in the file README.android to build it.
-
-One thing I needed to do on Mac OS X was change the path to the toolchain,
-and add ranlib to the environment variables:
-export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib
-
-Once valgrind is built, you can create a wrapper script to launch your
-application with it, changing org.libsdl.app to your package identifier:
-
-    --- start_valgrind_app -------------------
-    #!/system/bin/sh
-    export TMPDIR=/data/data/org.libsdl.app
-    exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
-    ------------------------------------------
-
-Then push it to the device:
-
-    adb push start_valgrind_app /data/local
-
-and make it executable:
-
-    adb shell chmod 755 /data/local/start_valgrind_app
-
-and tell Android to use the script to launch your application:
-
-    adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
-
-If the setprop command says "could not set property", it's likely that
-your package name is too long and you should make it shorter by changing
-AndroidManifest.xml and the path to your class file in android-project/src
-
-You can then launch your application normally and waaaaaaaiiittt for it.
-You can monitor the startup process with the logcat command above, and
-when it's done (or even while it's running) you can grab the valgrind
-output file:
-
-    adb pull /sdcard/valgrind.log
-
-When you're done instrumenting with valgrind, you can disable the wrapper:
-
-    adb shell setprop wrap.org.libsdl.app ""
-
-
-Graphics debugging
-================================================================================
-
-If you are developing on a compatible Tegra-based tablet, NVidia provides
-Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL
-and GLES libraries, you must follow their instructions for installing the
-interposer library on a rooted device. The non-rooted instructions are not
-compatible with applications that use SDL2 for video.
-
-The Tegra Graphics Debugger is available from NVidia here:
-https://developer.nvidia.com/tegra-graphics-debugger
-
-
-Why is API level 19 the minimum required?
-================================================================================
-
-The latest NDK toolchain doesn't support targeting earlier than API level 19.
-As of this writing, according to https://www.composables.com/tools/distribution-chart
-about 99.7% of the Android devices accessing Google Play support API level 19 or
-higher (August 2023).
-
-
-A note regarding the use of the "dirty rectangles" rendering technique
-================================================================================
-
-If your app uses a variation of the "dirty rectangles" rendering technique,
-where you only update a portion of the screen on each frame, you may notice a
-variety of visual glitches on Android, that are not present on other platforms.
-This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
-contexts, in particular the use of the eglSwapBuffers function. As stated in the
-documentation for the function "The contents of ancillary buffers are always
-undefined after calling eglSwapBuffers".
-Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
-is not possible for SDL as it requires EGL 1.4, available only on the API level
-17+, so the only workaround available on this platform is to redraw the entire
-screen each frame.
-
-Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
-
-
-Ending your application
-================================================================================
-
-Two legitimate ways:
-
-- return from your main() function. Java side will automatically terminate the
-Activity by calling Activity.finish().
-
-- Android OS can decide to terminate your application by calling onDestroy()
-(see Activity life cycle). Your application will receive a SDL_QUIT event you
-can handle to save things and quit.
-
-Don't call exit() as it stops the activity badly.
-
-NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode
-SDLK_AC_BACK, for any purpose.
-
-Known issues
-================================================================================
-
-- The number of buttons reported for each joystick is hardcoded to be 36, which
-is the current maximum number of buttons Android can report.
-
+Android
+================================================================================
+
+Matt Styles wrote a tutorial on building SDL for Android with Visual Studio:
+http://trederia.blogspot.de/2017/03/building-sdl2-for-android-with-visual.html
+
+The rest of this README covers the Android gradle style build process.
+
+If you are using the older ant build process, it is no longer officially
+supported, but you can use the "android-project-ant" directory as a template.
+
+
+Requirements
+================================================================================
+
+Android SDK (version 34 or later)
+https://developer.android.com/sdk/index.html
+
+Android NDK r15c or later
+https://developer.android.com/tools/sdk/ndk/index.html
+
+Minimum API level supported by SDL: 19 (Android 4.4)
+
+
+How the port works
+================================================================================
+
+- Android applications are Java-based, optionally with parts written in C
+- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
+  the SDL library
+- This means that your application C code must be placed inside an Android
+  Java project, along with some C support code that communicates with Java
+- This eventually produces a standard Android .apk package
+
+The Android Java code implements an "Activity" and can be found in:
+android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
+
+The Java code loads your game code, the SDL shared library, and
+dispatches to native functions implemented in the SDL library:
+src/core/android/SDL_android.c
+
+
+Building an app
+================================================================================
+
+For simple projects you can use the script located at build-scripts/androidbuild.sh
+
+There's two ways of using it:
+
+    androidbuild.sh com.yourcompany.yourapp < sources.list
+    androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c
+
+sources.list should be a text file with a source file name in each line
+Filenames should be specified relative to the current directory, for example if
+you are in the build-scripts directory and want to create the testgles.c test, you'll
+run:
+
+    ./androidbuild.sh org.libsdl.testgles ../test/testgles.c
+
+One limitation of this script is that all sources provided will be aggregated into
+a single directory, thus all your source files should have a unique name.
+
+Once the project is complete the script will tell you where the debug APK is located.
+If you want to create a signed release APK, you can use the project created by this
+utility to generate it.
+
+Finally, a word of caution: re running androidbuild.sh wipes any changes you may have
+done in the build directory for the app!
+
+
+
+For more complex projects, follow these instructions:
+
+1. Get the source code for SDL and copy the 'android-project' directory located at SDL/android-project to a suitable location. Also make sure to rename it to your project name (In these examples: YOURPROJECT).
+
+   (The 'android-project' directory can basically be seen as a sort of starting point for the android-port of your project. It contains the glue code between the Android Java 'frontend' and the SDL code 'backend'. It also contains some standard behaviour, like how events should be handled, which you will be able to change.)
+
+2. Move or [symlink](https://en.wikipedia.org/wiki/Symbolic_link) the SDL directory into the "YOURPROJECT/app/jni" directory
+
+(This is needed as the source of SDL has to be compiled by the Android compiler)
+
+3. Edit "YOURPROJECT/app/jni/src/Android.mk" to include your source files.
+
+(They should be separated by spaces after the "LOCAL_SRC_FILES := " declaration)
+
+4a. If you want to use Android Studio, simply open your 'YOURPROJECT' directory and start building.
+
+4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
+
+
+If you already have a project that uses CMake, the instructions change somewhat:
+
+1. Do points 1 and 2 from the instruction above.
+2. Edit "YOURPROJECT/app/build.gradle" to comment out or remove sections containing ndk-build
+   and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
+3. Edit "YOURPROJECT/app/jni/CMakeLists.txt" to include your project (it defaults to
+   adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
+   as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
+   in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
+   add_executable() for the target containing your "main" function.
+
+If you wish to use Android Studio, you can skip the last step.
+
+4. Run './gradlew installDebug' or './gradlew installRelease' in the project directory. It will build and install your .apk on any
+   connected Android device
+
+Here's an explanation of the files in the Android project, so you can customize them:
+
+    android-project/app
+        build.gradle            - build info including the application version and SDK
+        src/main/AndroidManifest.xml	- package manifest. Among others, it contains the class name of the main Activity and the package name of the application.
+        jni/			- directory holding native code
+        jni/Application.mk	- Application JNI settings, including target platform and STL library
+        jni/Android.mk		- Android makefile that can call recursively the Android.mk files in all subdirectories
+        jni/CMakeLists.txt	- Top-level CMake project that adds SDL as a subproject
+        jni/SDL/		- (symlink to) directory holding the SDL library files
+        jni/SDL/Android.mk	- Android makefile for creating the SDL shared library
+        jni/src/		- directory holding your C/C++ source
+        jni/src/Android.mk	- Android makefile that you should customize to include your source code and any library references
+        jni/src/CMakeLists.txt	- CMake file that you may customize to include your source code and any library references
+        src/main/assets/	- directory holding asset files for your application
+        src/main/res/		- directory holding resources for your application
+        src/main/res/mipmap-*	- directories holding icons for different phone hardware
+        src/main/res/values/strings.xml	- strings used in your application, including the application name
+        src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application.
+
+
+Customizing your application name
+================================================================================
+
+To customize your application name, edit AndroidManifest.xml and replace
+"org.libsdl.app" with an identifier for your product package.
+
+Then create a Java class extending SDLActivity and place it in a directory
+under src matching your package, e.g.
+
+    src/com/gamemaker/game/MyGame.java
+
+Here's an example of a minimal class file:
+
+    --- MyGame.java --------------------------
+    package com.gamemaker.game;
+
+    import org.libsdl.app.SDLActivity;
+
+    /**
+     * A sample wrapper class that just calls SDLActivity
+     */
+
+    public class MyGame extends SDLActivity { }
+
+    ------------------------------------------
+
+Then replace "SDLActivity" in AndroidManifest.xml with the name of your
+class, .e.g. "MyGame"
+
+
+Customizing your application icon
+================================================================================
+
+Conceptually changing your icon is just replacing the "ic_launcher.png" files in
+the drawable directories under the res directory. There are several directories
+for different screen sizes.
+
+
+Loading assets
+================================================================================
+
+Any files you put in the "app/src/main/assets" directory of your project
+directory will get bundled into the application package and you can load
+them using the standard functions in SDL_rwops.h.
+
+There are also a few Android specific functions that allow you to get other
+useful paths for saving and loading data:
+* SDL_AndroidGetInternalStoragePath()
+* SDL_AndroidGetExternalStorageState()
+* SDL_AndroidGetExternalStoragePath()
+
+See SDL_system.h for more details on these functions.
+
+The asset packaging system will, by default, compress certain file extensions.
+SDL includes two asset file access mechanisms, the preferred one is the so
+called "File Descriptor" method, which is faster and doesn't involve the Dalvik
+GC, but given this method does not work on compressed assets, there is also the
+"Input Stream" method, which is automatically used as a fall back by SDL. You
+may want to keep this fact in mind when building your APK, specially when large
+files are involved.
+For more information on which extensions get compressed by default and how to
+disable this behaviour, see for example:
+
+http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
+
+
+Pause / Resume behaviour
+================================================================================
+
+If SDL_HINT_ANDROID_BLOCK_ON_PAUSE hint is set (the default),
+the event loop will block itself when the app is paused (ie, when the user
+returns to the main Android dashboard). Blocking is better in terms of battery
+use, and it allows your app to spring back to life instantaneously after resume
+(versus polling for a resume message).
+
+Upon resume, SDL will attempt to restore the GL context automatically.
+In modern devices (Android 3.0 and up) this will most likely succeed and your
+app can continue to operate as it was.
+
+However, there's a chance (on older hardware, or on systems under heavy load),
+where the GL context can not be restored. In that case you have to listen for
+a specific message (SDL_RENDER_DEVICE_RESET) and restore your textures
+manually or quit the app.
+
+You should not use the SDL renderer API while the app going in background:
+- SDL_APP_WILLENTERBACKGROUND:
+    after you read this message, GL context gets backed-up and you should not
+    use the SDL renderer API.
+
+    When this event is received, you have to set the render target to NULL, if you're using it.
+    (eg call SDL_SetRenderTarget(renderer, NULL))
+
+- SDL_APP_DIDENTERFOREGROUND:
+   GL context is restored, and the SDL renderer API is available (unless you
+   receive SDL_RENDER_DEVICE_RESET).
+
+Mouse / Touch events
+================================================================================
+
+In some case, SDL generates synthetic mouse (resp. touch) events for touch
+(resp. mouse) devices.
+To enable/disable this behavior, see SDL_hints.h:
+- SDL_HINT_TOUCH_MOUSE_EVENTS
+- SDL_HINT_MOUSE_TOUCH_EVENTS
+
+Misc
+================================================================================
+
+For some device, it appears to works better setting explicitly GL attributes
+before creating a window:
+  SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
+  SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
+  SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
+
+Threads and the Java VM
+================================================================================
+
+For a quick tour on how Linux native threads interoperate with the Java VM, take
+a look here: https://developer.android.com/guide/practices/jni.html
+
+If you want to use threads in your SDL app, it's strongly recommended that you
+do so by creating them using SDL functions. This way, the required attach/detach
+handling is managed by SDL automagically. If you have threads created by other
+means and they make calls to SDL functions, make sure that you call
+Android_JNI_SetupThread() before doing anything else otherwise SDL will attach
+your thread automatically anyway (when you make an SDL call), but it'll never
+detach it.
+
+
+If you ever want to use JNI in a native thread (created by "SDL_CreateThread()"),
+it won't be able to find your java class and method because of the java class loader
+which is different for native threads, than for java threads (eg your "main()").
+
+the work-around is to find class/method, in you "main()" thread, and to use them
+in your native thread.
+
+see:
+https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class
+
+Using STL
+================================================================================
+
+You can use STL in your project by creating an Application.mk file in the jni
+folder and adding the following line:
+
+    APP_STL := c++_shared
+
+For more information go here:
+	https://developer.android.com/ndk/guides/cpp-support
+
+
+Using the emulator
+================================================================================
+
+There are some good tips and tricks for getting the most out of the
+emulator here: https://developer.android.com/tools/devices/emulator.html
+
+Especially useful is the info on setting up OpenGL ES 2.0 emulation.
+
+Notice that this software emulator is incredibly slow and needs a lot of disk space.
+Using a real device works better.
+
+
+Troubleshooting
+================================================================================
+
+You can see if adb can see any devices with the following command:
+
+    adb devices
+
+You can see the output of log messages on the default device with:
+
+    adb logcat
+
+You can push files to the device with:
+
+    adb push local_file remote_path_and_file
+
+You can push files to the SD Card at /sdcard, for example:
+
+    adb push moose.dat /sdcard/moose.dat
+
+You can see the files on the SD card with a shell command:
+
+    adb shell ls /sdcard/
+
+You can start a command shell on the default device with:
+
+    adb shell
+
+You can remove the library files of your project (and not the SDL lib files) with:
+
+    ndk-build clean
+
+You can do a build with the following command:
+
+    ndk-build
+
+You can see the complete command line that ndk-build is using by passing V=1 on the command line:
+
+    ndk-build V=1
+
+If your application crashes in native code, you can use ndk-stack to get a symbolic stack trace:
+	https://developer.android.com/ndk/guides/ndk-stack
+
+If you want to go through the process manually, you can use addr2line to convert the
+addresses in the stack trace to lines in your code.
+
+For example, if your crash looks like this:
+
+    I/DEBUG   (   31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
+    I/DEBUG   (   31):  r0 00000000  r1 00001000  r2 00000003  r3 400085d4
+    I/DEBUG   (   31):  r4 400085d0  r5 40008000  r6 afd41504  r7 436c6a7c
+    I/DEBUG   (   31):  r8 436c6b30  r9 435c6fb0  10 435c6f9c  fp 4168d82c
+    I/DEBUG   (   31):  ip 8346aff0  sp 436c6a60  lr afd1c8ff  pc afd1c902  cpsr 60000030
+    I/DEBUG   (   31):          #00  pc 0001c902  /system/lib/libc.so
+    I/DEBUG   (   31):          #01  pc 0001ccf6  /system/lib/libc.so
+    I/DEBUG   (   31):          #02  pc 000014bc  /data/data/org.libsdl.app/lib/libmain.so
+    I/DEBUG   (   31):          #03  pc 00001506  /data/data/org.libsdl.app/lib/libmain.so
+
+You can see that there's a crash in the C library being called from the main code.
+I run addr2line with the debug version of my code:
+
+    arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
+
+and then paste in the number after "pc" in the call stack, from the line that I care about:
+000014bc
+
+I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23.
+
+You can add logging to your code to help show what's happening:
+
+    #include <android/log.h>
+
+    __android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
+
+If you need to build without optimization turned on, you can create a file called
+"Application.mk" in the jni directory, with the following line in it:
+
+    APP_OPTIM := debug
+
+
+Memory debugging
+================================================================================
+
+The best (and slowest) way to debug memory issues on Android is valgrind.
+Valgrind has support for Android out of the box, just grab code using:
+
+    svn co svn://svn.valgrind.org/valgrind/trunk valgrind
+
+... and follow the instructions in the file README.android to build it.
+
+One thing I needed to do on Mac OS X was change the path to the toolchain,
+and add ranlib to the environment variables:
+export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib
+
+Once valgrind is built, you can create a wrapper script to launch your
+application with it, changing org.libsdl.app to your package identifier:
+
+    --- start_valgrind_app -------------------
+    #!/system/bin/sh
+    export TMPDIR=/data/data/org.libsdl.app
+    exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
+    ------------------------------------------
+
+Then push it to the device:
+
+    adb push start_valgrind_app /data/local
+
+and make it executable:
+
+    adb shell chmod 755 /data/local/start_valgrind_app
+
+and tell Android to use the script to launch your application:
+
+    adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
+
+If the setprop command says "could not set property", it's likely that
+your package name is too long and you should make it shorter by changing
+AndroidManifest.xml and the path to your class file in android-project/src
+
+You can then launch your application normally and waaaaaaaiiittt for it.
+You can monitor the startup process with the logcat command above, and
+when it's done (or even while it's running) you can grab the valgrind
+output file:
+
+    adb pull /sdcard/valgrind.log
+
+When you're done instrumenting with valgrind, you can disable the wrapper:
+
+    adb shell setprop wrap.org.libsdl.app ""
+
+
+Graphics debugging
+================================================================================
+
+If you are developing on a compatible Tegra-based tablet, NVidia provides
+Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL
+and GLES libraries, you must follow their instructions for installing the
+interposer library on a rooted device. The non-rooted instructions are not
+compatible with applications that use SDL2 for video.
+
+The Tegra Graphics Debugger is available from NVidia here:
+https://developer.nvidia.com/tegra-graphics-debugger
+
+
+Why is API level 19 the minimum required?
+================================================================================
+
+The latest NDK toolchain doesn't support targeting earlier than API level 19.
+As of this writing, according to https://www.composables.com/tools/distribution-chart
+about 99.7% of the Android devices accessing Google Play support API level 19 or
+higher (August 2023).
+
+
+A note regarding the use of the "dirty rectangles" rendering technique
+================================================================================
+
+If your app uses a variation of the "dirty rectangles" rendering technique,
+where you only update a portion of the screen on each frame, you may notice a
+variety of visual glitches on Android, that are not present on other platforms.
+This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
+contexts, in particular the use of the eglSwapBuffers function. As stated in the
+documentation for the function "The contents of ancillary buffers are always
+undefined after calling eglSwapBuffers".
+Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
+is not possible for SDL as it requires EGL 1.4, available only on the API level
+17+, so the only workaround available on this platform is to redraw the entire
+screen each frame.
+
+Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
+
+
+Ending your application
+================================================================================
+
+Two legitimate ways:
+
+- return from your main() function. Java side will automatically terminate the
+Activity by calling Activity.finish().
+
+- Android OS can decide to terminate your application by calling onDestroy()
+(see Activity life cycle). Your application will receive a SDL_QUIT event you
+can handle to save things and quit.
+
+Don't call exit() as it stops the activity badly.
+
+NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode
+SDLK_AC_BACK, for any purpose.
+
+Known issues
+================================================================================
+
+- The number of buttons reported for each joystick is hardcoded to be 36, which
+is the current maximum number of buttons Android can report.
+

+ 163 - 163
docs/README-cmake.md

@@ -1,163 +1,163 @@
-# CMake
-
-(www.cmake.org)
-
-SDL's build system was traditionally based on autotools. Over time, this
-approach has suffered from several issues across the different supported
-platforms.
-To solve these problems, a new build system based on CMake was introduced.
-It is developed in parallel to the legacy autotools build system, so users
-can experiment with it without complication.
-
-The CMake build system is supported on the following platforms:
-
-* FreeBSD
-* Linux
-* Microsoft Visual C
-* MinGW and Msys
-* macOS, iOS, and tvOS, with support for XCode
-* Android
-* Emscripten
-* RiscOS
-* Playstation Vita
-
-## Building SDL
-
-Assuming the source for SDL is located at `~/sdl`
-```sh
-cd ~
-mkdir build
-cd build
-cmake ~/sdl
-cmake --build .
-```
-
-This will build the static and dynamic versions of SDL in the `~/build` directory.
-Installation can be done using:
-
-```sh
-cmake --install .        # '--install' requires CMake 3.15, or newer
-```
-
-## Including SDL in your project
-
-SDL can be included in your project in 2 major ways:
-- using a system SDL library, provided by your (*nix) distribution or a package manager
-- using a vendored SDL library: this is SDL copied or symlinked in a subfolder.
-
-The following CMake script supports both, depending on the value of `MYGAME_VENDORED`.
-
-```cmake
-cmake_minimum_required(VERSION 3.5)
-project(mygame)
-
-# Create an option to switch between a system sdl library and a vendored sdl library
-option(MYGAME_VENDORED "Use vendored libraries" OFF)
-
-if(MYGAME_VENDORED)
-    add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL)
-else()
-    # 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found
-    find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2)
-
-    # 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available
-    find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main)
-endif()
-
-# Create your game executable target as usual
-add_executable(mygame WIN32 mygame.c)
-
-# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications
-if(TARGET SDL2::SDL2main)
-    # It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static)
-    target_link_libraries(mygame PRIVATE SDL2::SDL2main)
-endif()
-
-# Link to the actual SDL2 library. SDL2::SDL2 is the shared SDL library, SDL2::SDL2-static is the static SDL libarary.
-target_link_libraries(mygame PRIVATE SDL2::SDL2)
-```
-
-### A system SDL library
-
-For CMake to find SDL, it must be installed in [a default location CMake is looking for](https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure).
-
-The following components are available, to be used as an argument of `find_package`.
-
-| Component name | Description                                                                                |
-|----------------|--------------------------------------------------------------------------------------------|
-| SDL2           | The SDL2 shared library, available through the `SDL2::SDL2` target [^SDL_TARGET_EXCEPTION] |
-| SDL2-static    | The SDL2 static library, available through the `SDL2::SDL2-static` target                  |
-| SDL2main       | The SDL2main static library, available through the `SDL2::SDL2main` target                 |
-| SDL2test       | The SDL2test static library, available through the `SDL2::SDL2test` target                 |
-
-### Using a vendored SDL
-
-This only requires a copy of SDL in a subdirectory.
-
-## CMake configuration options for platforms
-
-### iOS/tvOS
-
-CMake 3.14+ natively includes support for iOS and tvOS.  SDL binaries may be built
-using Xcode or Make, possibly among other build-systems.
-
-When using a recent version of CMake (3.14+), it should be possible to:
-
-- build SDL for iOS, both static and dynamic
-- build SDL test apps (as iOS/tvOS .app bundles)
-- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
-
-To use, set the following CMake variables when running CMake's configuration stage:
-
-- `CMAKE_SYSTEM_NAME=<OS>`   (either `iOS` or `tvOS`)
-- `CMAKE_OSX_SYSROOT=<SDK>`  (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
-                              `appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
-- `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
-
-
-#### Examples
-
-- for iOS-Simulator, using the latest, installed SDK:
-
-    ```bash
-    cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
-    ```
-
-- for iOS-Device, using the latest, installed SDK, 64-bit only
-
-    ```bash
-    cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64
-    ```
-
-- for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
-
-    ```cmake
-    cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"
-    ```
-
-- for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
-
-    ```cmake
-    cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64
-    ```
-
-- for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
-
-    ```cmake
-    cmake ~/sdl -DSDL_TESTS=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
-    ```
-
-- for tvOS-Simulator, using the latest, installed SDK:
-
-    ```cmake
-    cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
-    ```
-
-- for tvOS-Device, using the latest, installed SDK:
-
-    ```cmake
-    cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`
-    ```
-
-
-[^SDL_TARGET_EXCEPTION]: `SDL2::SDL2` can be an ALIAS to a static `SDL2::SDL2-static` target for multiple reasons.
+# CMake
+
+(www.cmake.org)
+
+SDL's build system was traditionally based on autotools. Over time, this
+approach has suffered from several issues across the different supported
+platforms.
+To solve these problems, a new build system based on CMake was introduced.
+It is developed in parallel to the legacy autotools build system, so users
+can experiment with it without complication.
+
+The CMake build system is supported on the following platforms:
+
+* FreeBSD
+* Linux
+* Microsoft Visual C
+* MinGW and Msys
+* macOS, iOS, and tvOS, with support for XCode
+* Android
+* Emscripten
+* RiscOS
+* Playstation Vita
+
+## Building SDL
+
+Assuming the source for SDL is located at `~/sdl`
+```sh
+cd ~
+mkdir build
+cd build
+cmake ~/sdl
+cmake --build .
+```
+
+This will build the static and dynamic versions of SDL in the `~/build` directory.
+Installation can be done using:
+
+```sh
+cmake --install .        # '--install' requires CMake 3.15, or newer
+```
+
+## Including SDL in your project
+
+SDL can be included in your project in 2 major ways:
+- using a system SDL library, provided by your (*nix) distribution or a package manager
+- using a vendored SDL library: this is SDL copied or symlinked in a subfolder.
+
+The following CMake script supports both, depending on the value of `MYGAME_VENDORED`.
+
+```cmake
+cmake_minimum_required(VERSION 3.5)
+project(mygame)
+
+# Create an option to switch between a system sdl library and a vendored sdl library
+option(MYGAME_VENDORED "Use vendored libraries" OFF)
+
+if(MYGAME_VENDORED)
+    add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL)
+else()
+    # 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found
+    find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2)
+
+    # 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available
+    find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main)
+endif()
+
+# Create your game executable target as usual
+add_executable(mygame WIN32 mygame.c)
+
+# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications
+if(TARGET SDL2::SDL2main)
+    # It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static)
+    target_link_libraries(mygame PRIVATE SDL2::SDL2main)
+endif()
+
+# Link to the actual SDL2 library. SDL2::SDL2 is the shared SDL library, SDL2::SDL2-static is the static SDL libarary.
+target_link_libraries(mygame PRIVATE SDL2::SDL2)
+```
+
+### A system SDL library
+
+For CMake to find SDL, it must be installed in [a default location CMake is looking for](https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure).
+
+The following components are available, to be used as an argument of `find_package`.
+
+| Component name | Description                                                                                |
+|----------------|--------------------------------------------------------------------------------------------|
+| SDL2           | The SDL2 shared library, available through the `SDL2::SDL2` target [^SDL_TARGET_EXCEPTION] |
+| SDL2-static    | The SDL2 static library, available through the `SDL2::SDL2-static` target                  |
+| SDL2main       | The SDL2main static library, available through the `SDL2::SDL2main` target                 |
+| SDL2test       | The SDL2test static library, available through the `SDL2::SDL2test` target                 |
+
+### Using a vendored SDL
+
+This only requires a copy of SDL in a subdirectory.
+
+## CMake configuration options for platforms
+
+### iOS/tvOS
+
+CMake 3.14+ natively includes support for iOS and tvOS.  SDL binaries may be built
+using Xcode or Make, possibly among other build-systems.
+
+When using a recent version of CMake (3.14+), it should be possible to:
+
+- build SDL for iOS, both static and dynamic
+- build SDL test apps (as iOS/tvOS .app bundles)
+- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
+
+To use, set the following CMake variables when running CMake's configuration stage:
+
+- `CMAKE_SYSTEM_NAME=<OS>`   (either `iOS` or `tvOS`)
+- `CMAKE_OSX_SYSROOT=<SDK>`  (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
+                              `appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
+- `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
+
+
+#### Examples
+
+- for iOS-Simulator, using the latest, installed SDK:
+
+    ```bash
+    cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
+    ```
+
+- for iOS-Device, using the latest, installed SDK, 64-bit only
+
+    ```bash
+    cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64
+    ```
+
+- for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
+
+    ```cmake
+    cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"
+    ```
+
+- for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
+
+    ```cmake
+    cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64
+    ```
+
+- for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
+
+    ```cmake
+    cmake ~/sdl -DSDL_TESTS=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
+    ```
+
+- for tvOS-Simulator, using the latest, installed SDK:
+
+    ```cmake
+    cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
+    ```
+
+- for tvOS-Device, using the latest, installed SDK:
+
+    ```cmake
+    cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`
+    ```
+
+
+[^SDL_TARGET_EXCEPTION]: `SDL2::SDL2` can be an ALIAS to a static `SDL2::SDL2-static` target for multiple reasons.

+ 123 - 123
docs/README-directfb.md

@@ -1,123 +1,123 @@
-DirectFB
-========
-
-Supports:
-
-- Hardware YUV overlays
-- OpenGL - software only
-- 2D/3D accelerations (depends on directfb driver)
-- multiple displays
-- windows
-
-What you need:
-
-* DirectFB 1.0.1, 1.2.x, 1.3.0
-* Kernel-Framebuffer support: required: vesafb, radeonfb ....
-* Mesa 7.0.x	   - optional for OpenGL
-
-The `/etc/directfbrc` file should contain the following lines to make
-your joystick work and avoid crashes:
-
-```
-disable-module=joystick
-disable-module=cle266
-disable-module=cyber5k
-no-linux-input-grab
-```
-
-To disable to use x11 backend when DISPLAY variable is found use
-
-```
-export SDL_DIRECTFB_X11_CHECK=0
-```
-
-To disable the use of linux input devices, i.e. multimice/multikeyboard support,
-use
-
-```
-export SDL_DIRECTFB_LINUX_INPUT=0
-```
-
-To use hardware accelerated YUV-overlays for YUV-textures, use:
-
-```
-export SDL_DIRECTFB_YUV_DIRECT=1
-```
-
-This is disabled by default. It will only support one
-YUV texture, namely the first. Every other YUV texture will be
-rendered in software.
-
-In addition, you may use (directfb-1.2.x)
-
-```
-export SDL_DIRECTFB_YUV_UNDERLAY=1
-```
-
-to make the YUV texture an underlay. This will make the cursor to
-be shown.
-
-Simple Window Manager
-=====================
-
-The driver has support for a very, very basic window manager you may
-want to use when running with `wm=default`. Use
-
-```
-export SDL_DIRECTFB_WM=1
-```
-
-to enable basic window borders. In order to have the window title rendered,
-you need to have the following font installed:
-
-```
-/usr/share/fonts/truetype/freefont/FreeSans.ttf
-```
-
-OpenGL Support
-==============
-
-The following instructions will give you *software* OpenGL. However this
-works at least on all directfb supported platforms.
-
-As of this writing 20100802 you need to pull Mesa from git and do the following:
-
-```
-git clone git://anongit.freedesktop.org/git/mesa/mesa
-cd mesa
-git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
-```
-
-Edit `configs/linux-directfb` so that the Directories-section looks like this:
-
-```
-# Directories
-SRC_DIRS     = mesa glu
-GLU_DIRS     = sgi
-DRIVER_DIRS  = directfb
-PROGRAM_DIRS =
-```
-
-Then do the following:
-
-```
-make linux-directfb
-make
-
-echo Installing - please enter sudo pw.
-
-sudo make install INSTALL_DIR=/usr/local/dfb_GL
-cd src/mesa/drivers/directfb
-make
-sudo make install INSTALL_DIR=/usr/local/dfb_GL
-```
-
-To run the SDL - testprograms:
-
-```
-export SDL_VIDEODRIVER=directfb
-export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
-export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
-
-./testgl
-```
+DirectFB
+========
+
+Supports:
+
+- Hardware YUV overlays
+- OpenGL - software only
+- 2D/3D accelerations (depends on directfb driver)
+- multiple displays
+- windows
+
+What you need:
+
+* DirectFB 1.0.1, 1.2.x, 1.3.0
+* Kernel-Framebuffer support: required: vesafb, radeonfb ....
+* Mesa 7.0.x	   - optional for OpenGL
+
+The `/etc/directfbrc` file should contain the following lines to make
+your joystick work and avoid crashes:
+
+```
+disable-module=joystick
+disable-module=cle266
+disable-module=cyber5k
+no-linux-input-grab
+```
+
+To disable to use x11 backend when DISPLAY variable is found use
+
+```
+export SDL_DIRECTFB_X11_CHECK=0
+```
+
+To disable the use of linux input devices, i.e. multimice/multikeyboard support,
+use
+
+```
+export SDL_DIRECTFB_LINUX_INPUT=0
+```
+
+To use hardware accelerated YUV-overlays for YUV-textures, use:
+
+```
+export SDL_DIRECTFB_YUV_DIRECT=1
+```
+
+This is disabled by default. It will only support one
+YUV texture, namely the first. Every other YUV texture will be
+rendered in software.
+
+In addition, you may use (directfb-1.2.x)
+
+```
+export SDL_DIRECTFB_YUV_UNDERLAY=1
+```
+
+to make the YUV texture an underlay. This will make the cursor to
+be shown.
+
+Simple Window Manager
+=====================
+
+The driver has support for a very, very basic window manager you may
+want to use when running with `wm=default`. Use
+
+```
+export SDL_DIRECTFB_WM=1
+```
+
+to enable basic window borders. In order to have the window title rendered,
+you need to have the following font installed:
+
+```
+/usr/share/fonts/truetype/freefont/FreeSans.ttf
+```
+
+OpenGL Support
+==============
+
+The following instructions will give you *software* OpenGL. However this
+works at least on all directfb supported platforms.
+
+As of this writing 20100802 you need to pull Mesa from git and do the following:
+
+```
+git clone git://anongit.freedesktop.org/git/mesa/mesa
+cd mesa
+git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
+```
+
+Edit `configs/linux-directfb` so that the Directories-section looks like this:
+
+```
+# Directories
+SRC_DIRS     = mesa glu
+GLU_DIRS     = sgi
+DRIVER_DIRS  = directfb
+PROGRAM_DIRS =
+```
+
+Then do the following:
+
+```
+make linux-directfb
+make
+
+echo Installing - please enter sudo pw.
+
+sudo make install INSTALL_DIR=/usr/local/dfb_GL
+cd src/mesa/drivers/directfb
+make
+sudo make install INSTALL_DIR=/usr/local/dfb_GL
+```
+
+To run the SDL - testprograms:
+
+```
+export SDL_VIDEODRIVER=directfb
+export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
+export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
+
+./testgl
+```

+ 138 - 138
docs/README-dynapi.md

@@ -1,138 +1,138 @@
-# Dynamic API
-
-Originally posted on Ryan's Google+ account.
-
-Background:
-
-- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2,
-  but developers are shipping their own SDL2 with individual Steam games.
-  These games might stop getting updates, but a newer SDL2 might be needed later.
-  Certainly we'll always be fixing bugs in SDL, even if a new video target isn't
-  ever needed, and these fixes won't make it to a game shipping its own SDL.
-- Even if we replace the SDL2 in those games with a compatible one, that is to
-  say, edit a developer's Steam depot (yuck!), there are developers that are
-  statically linking SDL2 that we can't do this for. We can't even force the
-  dynamic loader to ignore their SDL2 in this case, of course.
-- If you don't ship an SDL2 with the game in some form, people that disabled the
-  Steam Runtime, or just tried to run the game from the command line instead of
-  Steam might find themselves unable to run the game, due to a missing dependency.
-- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
-  generic Linux boxes that may or may not have SDL2 installed, you have to ship
-  the library or risk a total failure to launch. So now, you might have to have
-  a non-Steam build plus a Steam build (that is, one with and one without SDL2
-  included), which is inconvenient if you could have had one universal build
-  that works everywhere.
-- We like the zlib license, but the biggest complaint from the open source
-  community about the license change is the static linking. The LGPL forced this
-  as a legal, not technical issue, but zlib doesn't care. Even those that aren't
-  concerned about the GNU freedoms found themselves solving the same problems:
-  swapping in a newer SDL to an older game often times can save the day.
-  Static linking stops this dead.
-
-So here's what we did:
-
-SDL now has, internally, a table of function pointers. So, this is what SDL_Init
-now looks like:
-
-```c
-Uint32 SDL_Init(Uint32 flags)
-{
-    return jump_table.SDL_Init(flags);
-}
-```
-
-Except that is all done with a bunch of macro magic so we don't have to maintain
-every one of these.
-
-What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
-SDL_Init() that you've been calling all this time. But at startup, it looks more
-like this:
-
-```c
-Uint32 SDL_Init_DEFAULT(Uint32 flags)
-{
-    SDL_InitDynamicAPI();
-    return jump_table.SDL_Init(flags);
-}
-```
-
-SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function
-pointers, which means that this `_DEFAULT` function never gets called again.
-First call to any SDL function sets the whole thing up.
-
-So you might be asking, what was the value in that? Isn't this what the operating
-system's dynamic loader was supposed to do for us? Yes, but now we've got this
-level of indirection, we can do things like this:
-
-```bash
-export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
-./MyGameThatIsStaticallyLinkedToSDL2
-```
-
-And now, this game that is statically linked to SDL, can still be overridden
-with a newer, or better, SDL. The statically linked one will only be used as
-far as calling into the jump table in this case. But in cases where no override
-is desired, the statically linked version will provide its own jump table,
-and everyone is happy.
-
-So now:
-- Developers can statically link SDL, and users can still replace it.
-  (We'd still rather you ship a shared library, though!)
-- Developers can ship an SDL with their game, Valve can override it for, say,
-  new features on SteamOS, or distros can override it for their own needs,
-  but it'll also just work in the default case.
-- Developers can ship the same package to everyone (Humble Bundle, GOG, etc),
-  and it'll do the right thing.
-- End users (and Valve) can update a game's SDL in almost any case,
-  to keep abandoned games running on newer platforms.
-- Everyone develops with SDL exactly as they have been doing all along.
-  Same headers, same ABI. Just get the latest version to enable this magic.
-
-
-A little more about SDL_InitDynamicAPI():
-
-Internally, InitAPI does some locking to make sure everything waits until a
-single thread initializes everything (although even SDL_CreateThread() goes
-through here before spinning a thread, too), and then decides if it should use
-an external SDL library. If not, it sets up the jump table using the current
-SDL's function pointers (which might be statically linked into a program, or in
-a shared library of its own). If so, it loads that library and looks for and
-calls a single function:
-
-```c
-Sint32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
-```
-
-That function takes a version number (more on that in a moment), the address of
-the jump table, and the size, in bytes, of the table.
-Now, we've got policy here: this table's layout never changes; new stuff gets
-added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all
-the needed functions if tablesize <= sizeof its own jump table. If tablesize is
-bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
-if it's smaller, we know we can provide the entire API that the caller needs.
-
-The version variable is a failsafe switch.
-Right now it's always 1. This number changes when there are major API changes
-(so we know if the tablesize might be smaller, or entries in it have changed).
-Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not
-inconceivable to have a small dispatch library that only supplies this one
-function and loads different, otherwise-incompatible SDL libraries and has the
-right one initialize the jump table based on the version. For something that
-must generically catch lots of different versions of SDL over time, like the
-Steam Client, this isn't a bad option.
-
-Finally, I'm sure some people are reading this and thinking,
-"I don't want that overhead in my project!"
-
-To which I would point out that the extra function call through the jump table
-probably wouldn't even show up in a profile, but lucky you: this can all be
-disabled. You can build SDL without this if you absolutely must, but we would
-encourage you not to do that. However, on heavily locked down platforms like
-iOS, or maybe when debugging, it makes sense to disable it. The way this is
-designed in SDL, you just have to change one #define, and the entire system
-vaporizes out, and SDL functions exactly like it always did. Most of it is
-macro magic, so the system is contained to one C file and a few headers.
-However, this is on by default and you have to edit a header file to turn it
-off. Our hopes is that if we make it easy to disable, but not too easy,
-everyone will ultimately be able to get what they want, but we've gently
-nudged everyone towards what we think is the best solution.
+# Dynamic API
+
+Originally posted on Ryan's Google+ account.
+
+Background:
+
+- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2,
+  but developers are shipping their own SDL2 with individual Steam games.
+  These games might stop getting updates, but a newer SDL2 might be needed later.
+  Certainly we'll always be fixing bugs in SDL, even if a new video target isn't
+  ever needed, and these fixes won't make it to a game shipping its own SDL.
+- Even if we replace the SDL2 in those games with a compatible one, that is to
+  say, edit a developer's Steam depot (yuck!), there are developers that are
+  statically linking SDL2 that we can't do this for. We can't even force the
+  dynamic loader to ignore their SDL2 in this case, of course.
+- If you don't ship an SDL2 with the game in some form, people that disabled the
+  Steam Runtime, or just tried to run the game from the command line instead of
+  Steam might find themselves unable to run the game, due to a missing dependency.
+- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
+  generic Linux boxes that may or may not have SDL2 installed, you have to ship
+  the library or risk a total failure to launch. So now, you might have to have
+  a non-Steam build plus a Steam build (that is, one with and one without SDL2
+  included), which is inconvenient if you could have had one universal build
+  that works everywhere.
+- We like the zlib license, but the biggest complaint from the open source
+  community about the license change is the static linking. The LGPL forced this
+  as a legal, not technical issue, but zlib doesn't care. Even those that aren't
+  concerned about the GNU freedoms found themselves solving the same problems:
+  swapping in a newer SDL to an older game often times can save the day.
+  Static linking stops this dead.
+
+So here's what we did:
+
+SDL now has, internally, a table of function pointers. So, this is what SDL_Init
+now looks like:
+
+```c
+Uint32 SDL_Init(Uint32 flags)
+{
+    return jump_table.SDL_Init(flags);
+}
+```
+
+Except that is all done with a bunch of macro magic so we don't have to maintain
+every one of these.
+
+What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
+SDL_Init() that you've been calling all this time. But at startup, it looks more
+like this:
+
+```c
+Uint32 SDL_Init_DEFAULT(Uint32 flags)
+{
+    SDL_InitDynamicAPI();
+    return jump_table.SDL_Init(flags);
+}
+```
+
+SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function
+pointers, which means that this `_DEFAULT` function never gets called again.
+First call to any SDL function sets the whole thing up.
+
+So you might be asking, what was the value in that? Isn't this what the operating
+system's dynamic loader was supposed to do for us? Yes, but now we've got this
+level of indirection, we can do things like this:
+
+```bash
+export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
+./MyGameThatIsStaticallyLinkedToSDL2
+```
+
+And now, this game that is statically linked to SDL, can still be overridden
+with a newer, or better, SDL. The statically linked one will only be used as
+far as calling into the jump table in this case. But in cases where no override
+is desired, the statically linked version will provide its own jump table,
+and everyone is happy.
+
+So now:
+- Developers can statically link SDL, and users can still replace it.
+  (We'd still rather you ship a shared library, though!)
+- Developers can ship an SDL with their game, Valve can override it for, say,
+  new features on SteamOS, or distros can override it for their own needs,
+  but it'll also just work in the default case.
+- Developers can ship the same package to everyone (Humble Bundle, GOG, etc),
+  and it'll do the right thing.
+- End users (and Valve) can update a game's SDL in almost any case,
+  to keep abandoned games running on newer platforms.
+- Everyone develops with SDL exactly as they have been doing all along.
+  Same headers, same ABI. Just get the latest version to enable this magic.
+
+
+A little more about SDL_InitDynamicAPI():
+
+Internally, InitAPI does some locking to make sure everything waits until a
+single thread initializes everything (although even SDL_CreateThread() goes
+through here before spinning a thread, too), and then decides if it should use
+an external SDL library. If not, it sets up the jump table using the current
+SDL's function pointers (which might be statically linked into a program, or in
+a shared library of its own). If so, it loads that library and looks for and
+calls a single function:
+
+```c
+Sint32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
+```
+
+That function takes a version number (more on that in a moment), the address of
+the jump table, and the size, in bytes, of the table.
+Now, we've got policy here: this table's layout never changes; new stuff gets
+added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all
+the needed functions if tablesize <= sizeof its own jump table. If tablesize is
+bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
+if it's smaller, we know we can provide the entire API that the caller needs.
+
+The version variable is a failsafe switch.
+Right now it's always 1. This number changes when there are major API changes
+(so we know if the tablesize might be smaller, or entries in it have changed).
+Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not
+inconceivable to have a small dispatch library that only supplies this one
+function and loads different, otherwise-incompatible SDL libraries and has the
+right one initialize the jump table based on the version. For something that
+must generically catch lots of different versions of SDL over time, like the
+Steam Client, this isn't a bad option.
+
+Finally, I'm sure some people are reading this and thinking,
+"I don't want that overhead in my project!"
+
+To which I would point out that the extra function call through the jump table
+probably wouldn't even show up in a profile, but lucky you: this can all be
+disabled. You can build SDL without this if you absolutely must, but we would
+encourage you not to do that. However, on heavily locked down platforms like
+iOS, or maybe when debugging, it makes sense to disable it. The way this is
+designed in SDL, you just have to change one #define, and the entire system
+vaporizes out, and SDL functions exactly like it always did. Most of it is
+macro magic, so the system is contained to one C file and a few headers.
+However, this is on by default and you have to edit a header file to turn it
+off. Our hopes is that if we make it easy to disable, but not too easy,
+everyone will ultimately be able to get what they want, but we've gently
+nudged everyone towards what we think is the best solution.

+ 374 - 374
docs/README-emscripten.md

@@ -1,374 +1,374 @@
-# Emscripten
-
-## The state of things
-
-(As of September 2023, but things move quickly and we don't update this
-document often.)
-
-In modern times, all the browsers you probably care about (Chrome, Firefox,
-Edge, and Safari, on Windows, macOS, Linux, iOS and Android), support some
-reasonable base configurations:
-
-- WebAssembly (don't bother with asm.js any more)
-- WebGL (which will look like OpenGL ES 2 or 3 to your app).
-- Threads (see caveats, though!)
-- Game controllers
-- Autoupdating (so you can assume they have a recent version of the browser)
-
-All this to say we're at the point where you don't have to make a lot of
-concessions to get even a fairly complex SDL-based game up and running.
-
-
-## RTFM
-
-This document is a quick rundown of some high-level details. The
-documentation at [emscripten.org](https://emscripten.org/) is vast
-and extremely detailed for a wide variety of topics, and you should at
-least skim through it at some point.
-
-
-## Porting your app to Emscripten
-
-Many many things just need some simple adjustments and they'll compile
-like any other C/C++ code, as long as SDL was handling the platform-specific
-work for your program.
-
-First, you probably need this in at least one of your source files:
-
-```c
-#ifdef __EMSCRIPTEN__
-#include <emscripten.h>
-#endif
-```
-
-Second: assembly language code has to go. Replace it with C. You can even use
-[x86 SIMD intrinsic functions in Emscripten](https://emscripten.org/docs/porting/simd.html)!
-
-Third: Middleware has to go. If you have a third-party library you link
-against, you either need an Emscripten port of it, or the source code to it
-to compile yourself, or you need to remove it.
-
-Fourth: You still start in a function called main(), but you need to get out of
-it and into a function that gets called repeatedly, and returns quickly,
-called a mainloop.
-
-Somewhere in your program, you probably have something that looks like a more
-complicated version of this:
-
-```c
-void main(void)
-{
-    initialize_the_game();
-    while (game_is_still_running) {
-        check_for_new_input();
-        think_about_stuff();
-        draw_the_next_frame();
-    }
-    deinitialize_the_game();
-}
-```
-
-This will not work on Emscripten, because the main thread needs to be free
-to do stuff and can't sit in this loop forever. So Emscripten lets you set up
-a [mainloop](https://emscripten.org/docs/porting/emscripten-runtime-environment.html#browser-main-loop).
-
-```c
-static void mainloop(void)   /* this will run often, possibly at the monitor's refresh rate */
-{
-    if (!game_is_still_running) {
-        deinitialize_the_game();
-        #ifdef __EMSCRIPTEN__
-        emscripten_cancel_main_loop();  /* this should "kill" the app. */
-        #else
-        exit(0);
-        #endif
-    }
-
-    check_for_new_input();
-    think_about_stuff();
-    draw_the_next_frame();
-}
-
-void main(void)
-{
-    initialize_the_game();
-    #ifdef __EMSCRIPTEN__
-    emscripten_set_main_loop(mainloop, 0, 1);
-    #else
-    while (1) { mainloop(); }
-    #endif
-}
-```
-
-Basically, `emscripten_set_main_loop(mainloop, 0, 1);` says "run
-`mainloop` over and over until I end the program." The function will
-run, and return, freeing the main thread for other tasks, and then
-run again when it's time. The `1` parameter does some magic to make
-your main() function end immediately; this is useful because you
-don't want any shutdown code that might be sitting below this code
-to actually run if main() were to continue on, since we're just
-getting started.
-
-There's a lot of little details that are beyond the scope of this
-document, but that's the biggest intial set of hurdles to porting
-your app to the web.
-
-
-## Do you need threads?
-
-If you plan to use threads, they work on all major browsers now. HOWEVER,
-they bring with them a lot of careful considerations. Rendering _must_
-be done on the main thread. This is a general guideline for many
-platforms, but a hard requirement on the web.
-
-Many other things also must happen on the main thread; often times SDL
-and Emscripten make efforts to "proxy" work to the main thread that
-must be there, but you have to be careful (and read more detailed
-documentation than this for the finer points).
-
-Even when using threads, your main thread needs to set an Emscripten
-mainloop that runs quickly and returns, or things will fail to work
-correctly.
-
-You should definitely read [Emscripten's pthreads docs](https://emscripten.org/docs/porting/pthreads.html)
-for all the finer points. Mostly SDL's thread API will work as expected,
-but is built on pthreads, so it shares the same little incompatibilities
-that are documented there, such as where you can use a mutex, and when
-a thread will start running, etc.
-
-
-IMPORTANT: You have to decide to either build something that uses
-threads or something that doesn't; you can't have one build
-that works everywhere. This is an Emscripten (or maybe WebAssembly?
-Or just web browsers in general?) limitation. If you aren't using
-threads, it's easier to not enable them at all, at build time.
-
-If you use threads, you _have to_ run from a web server that has
-[COOP/COEP headers set correctly](https://web.dev/why-coop-coep/)
-or your program will fail to start at all.
-
-If building with threads, `__EMSCRIPTEN_PTHREADS__` will be defined
-for checking with the C preprocessor, so you can build something
-different depending on what sort of build you're compiling.
-
-
-## Audio
-
-Audio works as expected at the API level, but not exactly like other
-platforms.
-
-You'll only see a single default audio device. Audio capture also works;
-if the browser pops up a prompt to ask for permission to access the
-microphone, the SDL_OpenAudioDevice call will succeed and start producing
-silence at a regular interval. Once the user approves the request, real
-audio data will flow. If the user denies it, the app is not informed and
-will just continue to receive silence.
-
-Modern web browsers will not permit web pages to produce sound before the
-user has interacted with them (clicked or tapped on them, usually); this is
-for several reasons, not the least of which being that no one likes when a
-random browser tab suddenly starts making noise and the user has to scramble
-to figure out which and silence it.
-
-SDL will allow you to open the audio device for playback in this
-circumstance, and your audio callback will fire, but SDL will throw the audio
-data away until the user interacts with the page. This helps apps that depend
-on the audio callback to make progress, and also keeps audio playback in sync
-once the app is finally allowed to make noise.
-
-There are two reasonable ways to deal with the silence at the app level:
-if you are writing some sort of media player thing, where the user expects
-there to be a volume control when you mouseover the canvas, just default
-that control to a muted state; if the user clicks on the control to unmute
-it, on this first click, open the audio device. This allows the media to
-play at start, and the user can reasonably opt-in to listening.
-
-Many games do not have this sort of UI, and are more rigid about starting
-audio along with everything else at the start of the process. For these, your
-best bet is to write a little Javascript that puts up a "Click here to play!"
-UI, and upon the user clicking, remove that UI and then call the Emscripten
-app's main() function. As far as the application knows, the audio device was
-available to be opened as soon as the program started, and since this magic
-happens in a little Javascript, you don't have to change your C/C++ code at
-all to make it happen.
-
-Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385
-for some Javascript code to steal for this approach.
-
-
-## Rendering
-
-If you use SDL's 2D render API, it will use GLES2 internally, which
-Emscripten will turn into WebGL calls. You can also use OpenGL ES 2
-directly by creating a GL context and drawing into it.
-
-Calling SDL_RenderPresent (or SDL_GL_SwapWindow) will not actually
-present anything on the screen until your return from your mainloop
-function.
-
-
-## Building SDL/emscripten
-
-First: do you _really_ need to build SDL from source?
-
-If you aren't developing SDL itself, have a desire to mess with its source
-code, or need something on the bleeding edge, don't build SDL. Just use
-Emscripten's packaged version!
-
-Compile and link your app with `-sUSE_SDL=2` and it'll use a build of
-SDL packaged with Emscripten. This comes from the same source code and
-fixes the Emscripten project makes to SDL are generally merged into SDL's
-revision control, so often this is much easier for app developers.
-
-`-sUSE_SDL=1` will select Emscripten's JavaScript reimplementation of SDL
-1.2 instead; if you need SDL 1.2, this might be fine, but we generally
-recommend you don't use SDL 1.2 in modern times.
-
-
-If you want to build SDL, though...
-
-SDL currently requires at least Emscripten 3.1.35 to build. Newer versions
-are likely to work, as well.
-
-
-Build:
-
-This works on Linux/Unix and macOS. Please send comments about Windows.
-
-Make sure you've [installed emsdk](https://emscripten.org/docs/getting_started/downloads.html)
-first, and run `source emsdk_env.sh` at the command line so it finds the
-tools.
-
-(These configure options might be overkill, but this has worked for me.)
-
-```bash
-cd SDL
-mkdir build
-cd build
-emconfigure ../configure --host=wasm32-unknown-emscripten --disable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3"
-emmake make -j4
-```
-
-If you want to build with thread support, something like this works:
-
-```bash
-emconfigure ../configure --host=wasm32-unknown-emscripten --enable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3 -pthread" LDFLAGS="-pthread"
-```
-
-Or with cmake:
-
-```bash
-mkdir build
-cd build
-emcmake cmake ..
-emmake make -j4
-```
-
-To build one of the tests:
-
-```bash
-cd test/
-emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
-```
-
-## Building your app
-
-You need to compile with `emcc` instead of `gcc` or `clang` or whatever, but
-mostly it uses the same command line arguments as Clang.
-
-Link against the SDL/build/.libs/libSDL2.a file you generated by building SDL,
-link with `-sUSE_SDL=2` to use Emscripten's prepackaged SDL2 build.
-
-Usually you would produce a binary like this:
-
-```bash
-gcc -o mygame mygame.c  # or whatever
-```
-
-But for Emscripten, you want to output something else:
-
-```bash
-emcc -o index.html mygame.c
-```
-
-This will produce several files...support Javascript and WebAssembly (.wasm)
-files. The `-o index.html` will produce a simple HTML page that loads and
-runs your app. You will (probably) eventually want to replace or customize
-that file and do `-o index.js` instead to just build the code pieces.
-
-If you're working on a program of any serious size, you'll likely need to
-link with `-sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=1gb` to get access
-to more memory. If using pthreads, you'll need the `-sMAXIMUM_MEMORY=1gb`
-or the app will fail to start on iOS browsers, but this might be a bug that
-goes away in the future.
-
-
-## Data files
-
-Your game probably has data files. Here's how to access them.
-
-Filesystem access works like a Unix filesystem; you have a single directory
-tree, possibly interpolated from several mounted locations, no drive letters,
-'/' for a path separator. You can access them with standard file APIs like
-open() or fopen() or SDL_RWops. You can read or write from the filesystem.
-
-By default, you probably have a "MEMFS" filesystem (all files are stored in
-memory, but access to them is immediate and doesn't need to block). There are
-other options, like "IDBFS" (files are stored in a local database, so they
-don't need to be in RAM all the time and they can persist between runs of the
-program, but access is not synchronous). You can mix and match these file
-systems, mounting a MEMFS filesystem at one place and idbfs elsewhere, etc,
-but that's beyond the scope of this document. Please refer to Emscripten's
-[page on the topic](https://emscripten.org/docs/porting/files/file_systems_overview.html)
-for more info.
-
-The _easiest_ (but not the best) way to get at your data files is to embed
-them in the app itself. Emscripten's linker has support for automating this.
-
-```bash
-emcc -o index.html loopwave.c --embed-file=../test/sample.wav@/sounds/sample.wav
-```
-
-This will pack ../test/sample.wav in your app, and make it available at
-"/sounds/sample.wav" at runtime. Emscripten makes sure this data is available
-before your main() function runs, and since it's in MEMFS, you can just
-read it like you do on other platforms. `--embed-file` can also accept a
-directory to pack an entire tree, and you can specify the argument multiple
-times to pack unrelated things into the final installation.
-
-Note that this is absolutely the best approach if you have a few small
-files to include and shouldn't worry about the issue further. However, if you
-have hundreds of megabytes and/or thousands of files, this is not so great,
-since the user will download it all every time they load your page, and it
-all has to live in memory at runtime.
-
-[Emscripten's documentation on the matter](https://emscripten.org/docs/porting/files/packaging_files.html)
-gives other options and details, and is worth a read.
-
-
-## Debugging
-
-Debugging web apps is a mixed bag. You should compile and link with
-`-gsource-map`, which embeds a ton of source-level debugging information into
-the build, and make sure _the app source code is available on the web server_,
-which is often a scary proposition for various reasons.
-
-When you debug from the browser's tools and hit a breakpoint, you can step
-through the actual C/C++ source code, though, which can be nice.
-
-If you try debugging in Firefox and it doesn't work well for no apparent
-reason, try Chrome, and vice-versa. These tools are still relatively new,
-and improving all the time.
-
-SDL_Log() (or even plain old printf) will write to the Javascript console,
-and honestly I find printf-style debugging to be easier than setting up a build
-for proper debugging, so use whatever tools work best for you.
-
-
-## Questions?
-
-Please give us feedback on this document at [the SDL bug tracker](https://github.com/libsdl-org/SDL/issues).
-If something is wrong or unclear, we want to know!
-
-
-
+# Emscripten
+
+## The state of things
+
+(As of September 2023, but things move quickly and we don't update this
+document often.)
+
+In modern times, all the browsers you probably care about (Chrome, Firefox,
+Edge, and Safari, on Windows, macOS, Linux, iOS and Android), support some
+reasonable base configurations:
+
+- WebAssembly (don't bother with asm.js any more)
+- WebGL (which will look like OpenGL ES 2 or 3 to your app).
+- Threads (see caveats, though!)
+- Game controllers
+- Autoupdating (so you can assume they have a recent version of the browser)
+
+All this to say we're at the point where you don't have to make a lot of
+concessions to get even a fairly complex SDL-based game up and running.
+
+
+## RTFM
+
+This document is a quick rundown of some high-level details. The
+documentation at [emscripten.org](https://emscripten.org/) is vast
+and extremely detailed for a wide variety of topics, and you should at
+least skim through it at some point.
+
+
+## Porting your app to Emscripten
+
+Many many things just need some simple adjustments and they'll compile
+like any other C/C++ code, as long as SDL was handling the platform-specific
+work for your program.
+
+First, you probably need this in at least one of your source files:
+
+```c
+#ifdef __EMSCRIPTEN__
+#include <emscripten.h>
+#endif
+```
+
+Second: assembly language code has to go. Replace it with C. You can even use
+[x86 SIMD intrinsic functions in Emscripten](https://emscripten.org/docs/porting/simd.html)!
+
+Third: Middleware has to go. If you have a third-party library you link
+against, you either need an Emscripten port of it, or the source code to it
+to compile yourself, or you need to remove it.
+
+Fourth: You still start in a function called main(), but you need to get out of
+it and into a function that gets called repeatedly, and returns quickly,
+called a mainloop.
+
+Somewhere in your program, you probably have something that looks like a more
+complicated version of this:
+
+```c
+void main(void)
+{
+    initialize_the_game();
+    while (game_is_still_running) {
+        check_for_new_input();
+        think_about_stuff();
+        draw_the_next_frame();
+    }
+    deinitialize_the_game();
+}
+```
+
+This will not work on Emscripten, because the main thread needs to be free
+to do stuff and can't sit in this loop forever. So Emscripten lets you set up
+a [mainloop](https://emscripten.org/docs/porting/emscripten-runtime-environment.html#browser-main-loop).
+
+```c
+static void mainloop(void)   /* this will run often, possibly at the monitor's refresh rate */
+{
+    if (!game_is_still_running) {
+        deinitialize_the_game();
+        #ifdef __EMSCRIPTEN__
+        emscripten_cancel_main_loop();  /* this should "kill" the app. */
+        #else
+        exit(0);
+        #endif
+    }
+
+    check_for_new_input();
+    think_about_stuff();
+    draw_the_next_frame();
+}
+
+void main(void)
+{
+    initialize_the_game();
+    #ifdef __EMSCRIPTEN__
+    emscripten_set_main_loop(mainloop, 0, 1);
+    #else
+    while (1) { mainloop(); }
+    #endif
+}
+```
+
+Basically, `emscripten_set_main_loop(mainloop, 0, 1);` says "run
+`mainloop` over and over until I end the program." The function will
+run, and return, freeing the main thread for other tasks, and then
+run again when it's time. The `1` parameter does some magic to make
+your main() function end immediately; this is useful because you
+don't want any shutdown code that might be sitting below this code
+to actually run if main() were to continue on, since we're just
+getting started.
+
+There's a lot of little details that are beyond the scope of this
+document, but that's the biggest intial set of hurdles to porting
+your app to the web.
+
+
+## Do you need threads?
+
+If you plan to use threads, they work on all major browsers now. HOWEVER,
+they bring with them a lot of careful considerations. Rendering _must_
+be done on the main thread. This is a general guideline for many
+platforms, but a hard requirement on the web.
+
+Many other things also must happen on the main thread; often times SDL
+and Emscripten make efforts to "proxy" work to the main thread that
+must be there, but you have to be careful (and read more detailed
+documentation than this for the finer points).
+
+Even when using threads, your main thread needs to set an Emscripten
+mainloop that runs quickly and returns, or things will fail to work
+correctly.
+
+You should definitely read [Emscripten's pthreads docs](https://emscripten.org/docs/porting/pthreads.html)
+for all the finer points. Mostly SDL's thread API will work as expected,
+but is built on pthreads, so it shares the same little incompatibilities
+that are documented there, such as where you can use a mutex, and when
+a thread will start running, etc.
+
+
+IMPORTANT: You have to decide to either build something that uses
+threads or something that doesn't; you can't have one build
+that works everywhere. This is an Emscripten (or maybe WebAssembly?
+Or just web browsers in general?) limitation. If you aren't using
+threads, it's easier to not enable them at all, at build time.
+
+If you use threads, you _have to_ run from a web server that has
+[COOP/COEP headers set correctly](https://web.dev/why-coop-coep/)
+or your program will fail to start at all.
+
+If building with threads, `__EMSCRIPTEN_PTHREADS__` will be defined
+for checking with the C preprocessor, so you can build something
+different depending on what sort of build you're compiling.
+
+
+## Audio
+
+Audio works as expected at the API level, but not exactly like other
+platforms.
+
+You'll only see a single default audio device. Audio capture also works;
+if the browser pops up a prompt to ask for permission to access the
+microphone, the SDL_OpenAudioDevice call will succeed and start producing
+silence at a regular interval. Once the user approves the request, real
+audio data will flow. If the user denies it, the app is not informed and
+will just continue to receive silence.
+
+Modern web browsers will not permit web pages to produce sound before the
+user has interacted with them (clicked or tapped on them, usually); this is
+for several reasons, not the least of which being that no one likes when a
+random browser tab suddenly starts making noise and the user has to scramble
+to figure out which and silence it.
+
+SDL will allow you to open the audio device for playback in this
+circumstance, and your audio callback will fire, but SDL will throw the audio
+data away until the user interacts with the page. This helps apps that depend
+on the audio callback to make progress, and also keeps audio playback in sync
+once the app is finally allowed to make noise.
+
+There are two reasonable ways to deal with the silence at the app level:
+if you are writing some sort of media player thing, where the user expects
+there to be a volume control when you mouseover the canvas, just default
+that control to a muted state; if the user clicks on the control to unmute
+it, on this first click, open the audio device. This allows the media to
+play at start, and the user can reasonably opt-in to listening.
+
+Many games do not have this sort of UI, and are more rigid about starting
+audio along with everything else at the start of the process. For these, your
+best bet is to write a little Javascript that puts up a "Click here to play!"
+UI, and upon the user clicking, remove that UI and then call the Emscripten
+app's main() function. As far as the application knows, the audio device was
+available to be opened as soon as the program started, and since this magic
+happens in a little Javascript, you don't have to change your C/C++ code at
+all to make it happen.
+
+Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385
+for some Javascript code to steal for this approach.
+
+
+## Rendering
+
+If you use SDL's 2D render API, it will use GLES2 internally, which
+Emscripten will turn into WebGL calls. You can also use OpenGL ES 2
+directly by creating a GL context and drawing into it.
+
+Calling SDL_RenderPresent (or SDL_GL_SwapWindow) will not actually
+present anything on the screen until your return from your mainloop
+function.
+
+
+## Building SDL/emscripten
+
+First: do you _really_ need to build SDL from source?
+
+If you aren't developing SDL itself, have a desire to mess with its source
+code, or need something on the bleeding edge, don't build SDL. Just use
+Emscripten's packaged version!
+
+Compile and link your app with `-sUSE_SDL=2` and it'll use a build of
+SDL packaged with Emscripten. This comes from the same source code and
+fixes the Emscripten project makes to SDL are generally merged into SDL's
+revision control, so often this is much easier for app developers.
+
+`-sUSE_SDL=1` will select Emscripten's JavaScript reimplementation of SDL
+1.2 instead; if you need SDL 1.2, this might be fine, but we generally
+recommend you don't use SDL 1.2 in modern times.
+
+
+If you want to build SDL, though...
+
+SDL currently requires at least Emscripten 3.1.35 to build. Newer versions
+are likely to work, as well.
+
+
+Build:
+
+This works on Linux/Unix and macOS. Please send comments about Windows.
+
+Make sure you've [installed emsdk](https://emscripten.org/docs/getting_started/downloads.html)
+first, and run `source emsdk_env.sh` at the command line so it finds the
+tools.
+
+(These configure options might be overkill, but this has worked for me.)
+
+```bash
+cd SDL
+mkdir build
+cd build
+emconfigure ../configure --host=wasm32-unknown-emscripten --disable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3"
+emmake make -j4
+```
+
+If you want to build with thread support, something like this works:
+
+```bash
+emconfigure ../configure --host=wasm32-unknown-emscripten --enable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3 -pthread" LDFLAGS="-pthread"
+```
+
+Or with cmake:
+
+```bash
+mkdir build
+cd build
+emcmake cmake ..
+emmake make -j4
+```
+
+To build one of the tests:
+
+```bash
+cd test/
+emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
+```
+
+## Building your app
+
+You need to compile with `emcc` instead of `gcc` or `clang` or whatever, but
+mostly it uses the same command line arguments as Clang.
+
+Link against the SDL/build/.libs/libSDL2.a file you generated by building SDL,
+link with `-sUSE_SDL=2` to use Emscripten's prepackaged SDL2 build.
+
+Usually you would produce a binary like this:
+
+```bash
+gcc -o mygame mygame.c  # or whatever
+```
+
+But for Emscripten, you want to output something else:
+
+```bash
+emcc -o index.html mygame.c
+```
+
+This will produce several files...support Javascript and WebAssembly (.wasm)
+files. The `-o index.html` will produce a simple HTML page that loads and
+runs your app. You will (probably) eventually want to replace or customize
+that file and do `-o index.js` instead to just build the code pieces.
+
+If you're working on a program of any serious size, you'll likely need to
+link with `-sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=1gb` to get access
+to more memory. If using pthreads, you'll need the `-sMAXIMUM_MEMORY=1gb`
+or the app will fail to start on iOS browsers, but this might be a bug that
+goes away in the future.
+
+
+## Data files
+
+Your game probably has data files. Here's how to access them.
+
+Filesystem access works like a Unix filesystem; you have a single directory
+tree, possibly interpolated from several mounted locations, no drive letters,
+'/' for a path separator. You can access them with standard file APIs like
+open() or fopen() or SDL_RWops. You can read or write from the filesystem.
+
+By default, you probably have a "MEMFS" filesystem (all files are stored in
+memory, but access to them is immediate and doesn't need to block). There are
+other options, like "IDBFS" (files are stored in a local database, so they
+don't need to be in RAM all the time and they can persist between runs of the
+program, but access is not synchronous). You can mix and match these file
+systems, mounting a MEMFS filesystem at one place and idbfs elsewhere, etc,
+but that's beyond the scope of this document. Please refer to Emscripten's
+[page on the topic](https://emscripten.org/docs/porting/files/file_systems_overview.html)
+for more info.
+
+The _easiest_ (but not the best) way to get at your data files is to embed
+them in the app itself. Emscripten's linker has support for automating this.
+
+```bash
+emcc -o index.html loopwave.c --embed-file=../test/sample.wav@/sounds/sample.wav
+```
+
+This will pack ../test/sample.wav in your app, and make it available at
+"/sounds/sample.wav" at runtime. Emscripten makes sure this data is available
+before your main() function runs, and since it's in MEMFS, you can just
+read it like you do on other platforms. `--embed-file` can also accept a
+directory to pack an entire tree, and you can specify the argument multiple
+times to pack unrelated things into the final installation.
+
+Note that this is absolutely the best approach if you have a few small
+files to include and shouldn't worry about the issue further. However, if you
+have hundreds of megabytes and/or thousands of files, this is not so great,
+since the user will download it all every time they load your page, and it
+all has to live in memory at runtime.
+
+[Emscripten's documentation on the matter](https://emscripten.org/docs/porting/files/packaging_files.html)
+gives other options and details, and is worth a read.
+
+
+## Debugging
+
+Debugging web apps is a mixed bag. You should compile and link with
+`-gsource-map`, which embeds a ton of source-level debugging information into
+the build, and make sure _the app source code is available on the web server_,
+which is often a scary proposition for various reasons.
+
+When you debug from the browser's tools and hit a breakpoint, you can step
+through the actual C/C++ source code, though, which can be nice.
+
+If you try debugging in Firefox and it doesn't work well for no apparent
+reason, try Chrome, and vice-versa. These tools are still relatively new,
+and improving all the time.
+
+SDL_Log() (or even plain old printf) will write to the Javascript console,
+and honestly I find printf-style debugging to be easier than setting up a build
+for proper debugging, so use whatever tools work best for you.
+
+
+## Questions?
+
+Please give us feedback on this document at [the SDL bug tracker](https://github.com/libsdl-org/SDL/issues).
+If something is wrong or unclear, we want to know!
+
+
+

+ 176 - 176
docs/README-gdk.md

@@ -1,176 +1,176 @@
-GDK
-=====
-
-This port allows SDL applications to run via Microsoft's Game Development Kit (GDK).
-
-Windows (GDK) and  Xbox One/Xbox Series (GDKX) are both supported and all the required code is included in this public SDL release. However, only licensed Xbox developers have access to the GDKX libraries which will allow you to build the Xbox targets.
-
-
-Requirements
-------------
-
-* Microsoft Visual Studio 2022 (in theory, it should also work in 2017 or 2019, but this has not been tested)
-* Microsoft GDK June 2022 or newer (public release [here](https://github.com/microsoft/GDK/releases/tag/June_2022))
-* For Xbox, you will need the corresponding GDKX version (licensed developers only)
-* To publish a package or successfully authenticate a user, you will need to create an app id/configure services in Partner Center. However, for local testing purposes (without authenticating on Xbox Live), the identifiers used by the GDK test programs in the included solution will work.
-
-
-Windows GDK Status
-------
-
-The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL.
-
-* Additionally, the GDK port adds the following:
-  * Compile-time platform detection for SDL programs. The `__GDK__` is `#define`d on every GDK platform, and the  `__WINGDK__` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.)
-  * GDK-specific setup:
-    * Initializing/uninitializing the game runtime, and initializing Xbox Live services
-    * Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue.
-
-  * An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
-  * Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`).
-  * You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak).
-
-* Single-player games have some additional features available:
-  * Call `SDL_GDKGetDefaultUser` to get the default XUserHandle pointer.
-  * `SDL_GetPrefPath` still works, but only for single-player titles.
-
-  These functions mostly wrap around async APIs, and thus should be treated as synchronous alternatives. Also note that the single-player functions return on any OS errors, so be sure to validate the return values!
-
-* What doesn't work:
-  * Compilation with anything other than through the included Visual C++ solution file
-
-## VisualC-GDK Solution
-
-The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration:
-
-* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64.
-* SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs.
-* tests/testgamecontroller - Standard SDL test program demonstrating controller functionality.
-* tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live.
-  *NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this.
-* tests/testsprite2 - Standard SDL test program demonstrating sprite drawing functionality.
-
-If you set one of the test programs as a startup project, you can run it directly from Visual Studio.
-
-Windows GDK Setup, Detailed Steps
----------------------
-
-These steps assume you already have a game using SDL that runs on Windows x64 along with a corresponding Visual Studio solution file for the x64 version. If you don't have this, it's easiest to use one of the test program vcxproj files in the `VisualC-GDK` directory as a starting point, though you will still need to do most of the steps below.
-
-### 1. Add a Gaming.Desktop.x64 Configuration ###
-
-In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration.
-
-### 2. Build SDL2 and SDL2main for GDK ###
-
-Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project.
-
-*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built.
-
-### 3. Configuring Project Settings ###
-
-While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration:
-
-*  Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced
-* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are
-* Under Linker > Input > Additional Dependencies, you need the following:
-  * `SDL2.lib`
-  * `SDL2main.lib` (unless not using)
-  * `xgameruntime.lib`
-  * `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib`
-* Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK.
-
-### 4. Setting up SDL_main ###
-
-Rather than using your own implementation of `WinMain`, it's recommended that you instead `#include "SDL_main.h"` and declare a standard main function. If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
-
-### 5. Required DLLs ###
-
-The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory:
-
-* Your SDL2.dll
-* "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll"
-* XCurl.dll
-
-You can either copy these in a post-build step, or you can add the dlls into the project and set its Configuration Properties > General > Item type to "Copy file," which will also copy them into the output directory.
-
-### 6. Setting up MicrosoftGame.config ###
-
-You can copy `VisualC-GDK/tests/testgdk/MicrosoftGame.config` and use that as a starting point in your project. Minimally, you will want to change the Executable Name attribute, the DefaultDisplayName, and the Description.
-
-This file must be copied into the same directory as the game's .exe file. As with the DLLs, you can either use a post-build step or the "Copy file" item type.
-
-For basic testing, you do not need to change anything else in `MicrosoftGame.config`. However, if you want to test any Xbox Live services (such as logging in users) _or_ publish a package, you will need to setup a Game app on Partner Center.
-
-Then, you need to set the following values to the values from Partner Center:
-
-* Identity tag - Name and Publisher attributes
-* TitleId
-* MSAAppId
-
-### 7. Adding Required Logos
-
-Several logo PNG files are required to be able to launch the game, even from the debugger. You can use the sample logos provided in `VisualC-GDK/logos`. As with the other files, they must be copied into the same directory as the game's .exe file.
-
-
-### 8. Copying any Data Files ###
-
-When debugging GDK games, there is no way to specify a working directory. Therefore, any required game data must also be copied into the output directory, likely in a post-build step.
-
-
-### 9. Build and Run from Visual Studio ###
-
-At this point, you should be able to build and run your game from the Visual Studio Debugger. If you get any linker errors, make sure you double-check that you referenced all the required libs.
-
-If you are testing Xbox Live functionality, it's likely you will need to change to the Sandbox for your title. To do this:
-
-1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
-2. Switch the sandbox name with:
-   `XblPCSandbox SANDBOX.#`
-3. (To switch back to the retail sandbox):
-   `XblPCSandbox RETAIL`
-
-### 10. Packaging and Installing Locally
-
-You can use one of the test program's `PackageLayout.xml` as a starting point. Minimally, you will need to change the exe to the correct name and also reference any required game data. As with the other data files, it's easiest if you have this copy to the output directory, although it's not a requirement as you can specify relative paths to files.
-
-To create the package:
-
-1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
-2. `cd` to the directory containing the `PackageLayout.xml` with the correct paths (if you use the local path as in the sample package layout, this would be from your .exe output directory)
-3. `mkdir Package` to create an output directory
-4. To package the file into the `Package` directory, use:
-    `makepkg pack /f PackageLayout.xml /lt /d . /nogameos /pc /pd Package`
-5. To install the package, use:
-   `wdapp install PACKAGENAME.msixvc`
-6. Once the package is installed, you can run it from the start menu.
-7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox.
-
-Xbox GDKX Setup
----------------------
-In general, the same process in the Windows GDK instructions work. There are just a few additional notes:
-* For Xbox One consoles, use the Gaming.Xbox.XboxOne.x64 target
-* For Xbox Series consoles, use the Gaming.Xbox.Scarlett.x64 target
-* The Xbox One target sets the `__XBOXONE__` define and the Xbox Series target sets the `__XBOXSERIES__` define
-* You don't need to link against the Xbox.Services Thunks lib nor include that dll in your package (it doesn't exist for Xbox)
-* The shader blobs for Xbox are created in a pre-build step for the Xbox targets, rather than included in the source (due to NDA and version compatability reasons)
-* To create a package, use:
-  `makepkg pack /f PackageLayout.xml /lt /d . /pd Package`
-* To install the package, use:
-  `xbapp install [PACKAGE].xvc`
-* For some reason, if you make changes that require SDL2.dll to build, and you are running through the debugger (instead of a package), you have to rebuild your .exe target for the debugger to recognize the dll has changed and needs to be transferred to the console again
-* While there are successful releases of Xbox titles using this port, it is not as extensively tested as other targets
-
-Troubleshooting
----------------
-
-#### Xbox Live Login does not work
-
-As of June 2022 GDK, you must have a valid Title Id and MSAAppId in order to test Xbox Live functionality such as user login. Make sure these are set correctly in the `MicrosoftGame.config`. This means that even testgdk will not let you login without setting these properties to valid values.
-
-Furthermore, confirm that your PC is set to the correct sandbox.
-
-
-#### "The current user has already installed an unpackaged version of this app. A packaged version cannot replace this." error when installing
-
-Prior to June 2022 GDK, running from the Visual Studio debugger would still locally register the app (and it would appear on the start menu). To fix this, you have to uninstall it (it's simplest to right click on it from the start menu to uninstall it).
+GDK
+=====
+
+This port allows SDL applications to run via Microsoft's Game Development Kit (GDK).
+
+Windows (GDK) and  Xbox One/Xbox Series (GDKX) are both supported and all the required code is included in this public SDL release. However, only licensed Xbox developers have access to the GDKX libraries which will allow you to build the Xbox targets.
+
+
+Requirements
+------------
+
+* Microsoft Visual Studio 2022 (in theory, it should also work in 2017 or 2019, but this has not been tested)
+* Microsoft GDK June 2022 or newer (public release [here](https://github.com/microsoft/GDK/releases/tag/June_2022))
+* For Xbox, you will need the corresponding GDKX version (licensed developers only)
+* To publish a package or successfully authenticate a user, you will need to create an app id/configure services in Partner Center. However, for local testing purposes (without authenticating on Xbox Live), the identifiers used by the GDK test programs in the included solution will work.
+
+
+Windows GDK Status
+------
+
+The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL.
+
+* Additionally, the GDK port adds the following:
+  * Compile-time platform detection for SDL programs. The `__GDK__` is `#define`d on every GDK platform, and the  `__WINGDK__` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.)
+  * GDK-specific setup:
+    * Initializing/uninitializing the game runtime, and initializing Xbox Live services
+    * Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue.
+
+  * An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
+  * Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`).
+  * You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak).
+
+* Single-player games have some additional features available:
+  * Call `SDL_GDKGetDefaultUser` to get the default XUserHandle pointer.
+  * `SDL_GetPrefPath` still works, but only for single-player titles.
+
+  These functions mostly wrap around async APIs, and thus should be treated as synchronous alternatives. Also note that the single-player functions return on any OS errors, so be sure to validate the return values!
+
+* What doesn't work:
+  * Compilation with anything other than through the included Visual C++ solution file
+
+## VisualC-GDK Solution
+
+The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration:
+
+* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64.
+* SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs.
+* tests/testgamecontroller - Standard SDL test program demonstrating controller functionality.
+* tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live.
+  *NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this.
+* tests/testsprite2 - Standard SDL test program demonstrating sprite drawing functionality.
+
+If you set one of the test programs as a startup project, you can run it directly from Visual Studio.
+
+Windows GDK Setup, Detailed Steps
+---------------------
+
+These steps assume you already have a game using SDL that runs on Windows x64 along with a corresponding Visual Studio solution file for the x64 version. If you don't have this, it's easiest to use one of the test program vcxproj files in the `VisualC-GDK` directory as a starting point, though you will still need to do most of the steps below.
+
+### 1. Add a Gaming.Desktop.x64 Configuration ###
+
+In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration.
+
+### 2. Build SDL2 and SDL2main for GDK ###
+
+Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project.
+
+*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built.
+
+### 3. Configuring Project Settings ###
+
+While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration:
+
+*  Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced
+* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are
+* Under Linker > Input > Additional Dependencies, you need the following:
+  * `SDL2.lib`
+  * `SDL2main.lib` (unless not using)
+  * `xgameruntime.lib`
+  * `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib`
+* Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK.
+
+### 4. Setting up SDL_main ###
+
+Rather than using your own implementation of `WinMain`, it's recommended that you instead `#include "SDL_main.h"` and declare a standard main function. If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
+
+### 5. Required DLLs ###
+
+The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory:
+
+* Your SDL2.dll
+* "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll"
+* XCurl.dll
+
+You can either copy these in a post-build step, or you can add the dlls into the project and set its Configuration Properties > General > Item type to "Copy file," which will also copy them into the output directory.
+
+### 6. Setting up MicrosoftGame.config ###
+
+You can copy `VisualC-GDK/tests/testgdk/MicrosoftGame.config` and use that as a starting point in your project. Minimally, you will want to change the Executable Name attribute, the DefaultDisplayName, and the Description.
+
+This file must be copied into the same directory as the game's .exe file. As with the DLLs, you can either use a post-build step or the "Copy file" item type.
+
+For basic testing, you do not need to change anything else in `MicrosoftGame.config`. However, if you want to test any Xbox Live services (such as logging in users) _or_ publish a package, you will need to setup a Game app on Partner Center.
+
+Then, you need to set the following values to the values from Partner Center:
+
+* Identity tag - Name and Publisher attributes
+* TitleId
+* MSAAppId
+
+### 7. Adding Required Logos
+
+Several logo PNG files are required to be able to launch the game, even from the debugger. You can use the sample logos provided in `VisualC-GDK/logos`. As with the other files, they must be copied into the same directory as the game's .exe file.
+
+
+### 8. Copying any Data Files ###
+
+When debugging GDK games, there is no way to specify a working directory. Therefore, any required game data must also be copied into the output directory, likely in a post-build step.
+
+
+### 9. Build and Run from Visual Studio ###
+
+At this point, you should be able to build and run your game from the Visual Studio Debugger. If you get any linker errors, make sure you double-check that you referenced all the required libs.
+
+If you are testing Xbox Live functionality, it's likely you will need to change to the Sandbox for your title. To do this:
+
+1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
+2. Switch the sandbox name with:
+   `XblPCSandbox SANDBOX.#`
+3. (To switch back to the retail sandbox):
+   `XblPCSandbox RETAIL`
+
+### 10. Packaging and Installing Locally
+
+You can use one of the test program's `PackageLayout.xml` as a starting point. Minimally, you will need to change the exe to the correct name and also reference any required game data. As with the other data files, it's easiest if you have this copy to the output directory, although it's not a requirement as you can specify relative paths to files.
+
+To create the package:
+
+1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
+2. `cd` to the directory containing the `PackageLayout.xml` with the correct paths (if you use the local path as in the sample package layout, this would be from your .exe output directory)
+3. `mkdir Package` to create an output directory
+4. To package the file into the `Package` directory, use:
+    `makepkg pack /f PackageLayout.xml /lt /d . /nogameos /pc /pd Package`
+5. To install the package, use:
+   `wdapp install PACKAGENAME.msixvc`
+6. Once the package is installed, you can run it from the start menu.
+7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox.
+
+Xbox GDKX Setup
+---------------------
+In general, the same process in the Windows GDK instructions work. There are just a few additional notes:
+* For Xbox One consoles, use the Gaming.Xbox.XboxOne.x64 target
+* For Xbox Series consoles, use the Gaming.Xbox.Scarlett.x64 target
+* The Xbox One target sets the `__XBOXONE__` define and the Xbox Series target sets the `__XBOXSERIES__` define
+* You don't need to link against the Xbox.Services Thunks lib nor include that dll in your package (it doesn't exist for Xbox)
+* The shader blobs for Xbox are created in a pre-build step for the Xbox targets, rather than included in the source (due to NDA and version compatability reasons)
+* To create a package, use:
+  `makepkg pack /f PackageLayout.xml /lt /d . /pd Package`
+* To install the package, use:
+  `xbapp install [PACKAGE].xvc`
+* For some reason, if you make changes that require SDL2.dll to build, and you are running through the debugger (instead of a package), you have to rebuild your .exe target for the debugger to recognize the dll has changed and needs to be transferred to the console again
+* While there are successful releases of Xbox titles using this port, it is not as extensively tested as other targets
+
+Troubleshooting
+---------------
+
+#### Xbox Live Login does not work
+
+As of June 2022 GDK, you must have a valid Title Id and MSAAppId in order to test Xbox Live functionality such as user login. Make sure these are set correctly in the `MicrosoftGame.config`. This means that even testgdk will not let you login without setting these properties to valid values.
+
+Furthermore, confirm that your PC is set to the correct sandbox.
+
+
+#### "The current user has already installed an unpackaged version of this app. A packaged version cannot replace this." error when installing
+
+Prior to June 2022 GDK, running from the Visual Studio debugger would still locally register the app (and it would appear on the start menu). To fix this, you have to uninstall it (it's simplest to right click on it from the start menu to uninstall it).

+ 71 - 71
docs/README-gesture.md

@@ -1,71 +1,71 @@
-Dollar Gestures
-===========================================================================
-SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
-
-Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
-
-Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.
-
-Recording:
-----------
-To begin recording on a touch device call:
-SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
-
-Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
-A SDL_DOLLARRECORD event is a dgesture with the following fields:
-
-* event.dgesture.touchId   - the Id of the touch used to record the gesture.
-* event.dgesture.gestureId - the unique id of the recorded gesture.
-
-
-Performing:
------------
-As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:
-
-* event.dgesture.touchId    - the Id of the touch which performed the gesture.
-* event.dgesture.gestureId  - the unique id of the closest gesture to the performed stroke.
-* event.dgesture.error      - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
-* event.dgesture.numFingers - the number of fingers used to draw the stroke.
-
-Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
-
-
-
-Saving:
--------
-To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored.
-
-To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored.
-
-Both functions return the number of gestures successfully saved.
-
-
-Loading:
---------
-To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
-
-SDL_LoadDollarTemplates returns the number of templates successfully loaded.
-
-
-
-===========================================================================
-Multi Gestures
-===========================================================================
-SDL provides simple support for pinch/rotate/swipe gestures.
-Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
-
-* event.mgesture.touchId - the Id of the touch on which the gesture was performed.
-* event.mgesture.x       - the normalized x coordinate of the gesture. (0..1)
-* event.mgesture.y       - the normalized y coordinate of the gesture. (0..1)
-* event.mgesture.dTheta  - the amount that the fingers rotated during this motion.
-* event.mgesture.dDist   - the amount that the fingers pinched during this motion.
-* event.mgesture.numFingers - the number of fingers used in the gesture.
-
-
-===========================================================================
-Notes
-===========================================================================
-For a complete example see test/testgesture.c
-
-Please direct questions/comments to:
-   [email protected]
+Dollar Gestures
+===========================================================================
+SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
+
+Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
+
+Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.
+
+Recording:
+----------
+To begin recording on a touch device call:
+SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
+
+Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
+A SDL_DOLLARRECORD event is a dgesture with the following fields:
+
+* event.dgesture.touchId   - the Id of the touch used to record the gesture.
+* event.dgesture.gestureId - the unique id of the recorded gesture.
+
+
+Performing:
+-----------
+As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:
+
+* event.dgesture.touchId    - the Id of the touch which performed the gesture.
+* event.dgesture.gestureId  - the unique id of the closest gesture to the performed stroke.
+* event.dgesture.error      - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
+* event.dgesture.numFingers - the number of fingers used to draw the stroke.
+
+Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
+
+
+
+Saving:
+-------
+To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored.
+
+To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored.
+
+Both functions return the number of gestures successfully saved.
+
+
+Loading:
+--------
+To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
+
+SDL_LoadDollarTemplates returns the number of templates successfully loaded.
+
+
+
+===========================================================================
+Multi Gestures
+===========================================================================
+SDL provides simple support for pinch/rotate/swipe gestures.
+Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
+
+* event.mgesture.touchId - the Id of the touch on which the gesture was performed.
+* event.mgesture.x       - the normalized x coordinate of the gesture. (0..1)
+* event.mgesture.y       - the normalized y coordinate of the gesture. (0..1)
+* event.mgesture.dTheta  - the amount that the fingers rotated during this motion.
+* event.mgesture.dDist   - the amount that the fingers pinched during this motion.
+* event.mgesture.numFingers - the number of fingers used in the gesture.
+
+
+===========================================================================
+Notes
+===========================================================================
+For a complete example see test/testgesture.c
+
+Please direct questions/comments to:
+   [email protected]

+ 19 - 19
docs/README-git.md

@@ -1,19 +1,19 @@
-git
-=========
-
-The latest development version of SDL is available via git.
-Git allows you to get up-to-the-minute fixes and enhancements;
-as a developer works on a source tree, you can use "git" to mirror that
-source tree instead of waiting for an official release. Please look
-at the Git website ( https://git-scm.com/ ) for more
-information on using git, where you can also download software for
-macOS, Windows, and Unix systems.
-
-    git clone https://github.com/libsdl-org/SDL
-
-If you are building SDL via configure, you will need to run autogen.sh
-before running configure.
-
-There is a web interface to the Git repository at:
-	http://github.com/libsdl-org/SDL/
-
+git
+=========
+
+The latest development version of SDL is available via git.
+Git allows you to get up-to-the-minute fixes and enhancements;
+as a developer works on a source tree, you can use "git" to mirror that
+source tree instead of waiting for an official release. Please look
+at the Git website ( https://git-scm.com/ ) for more
+information on using git, where you can also download software for
+macOS, Windows, and Unix systems.
+
+    git clone https://github.com/libsdl-org/SDL
+
+If you are building SDL via configure, you will need to run autogen.sh
+before running configure.
+
+There is a web interface to the Git repository at:
+	http://github.com/libsdl-org/SDL/
+

+ 4 - 4
docs/README-hg.md

@@ -1,4 +1,4 @@
-We are no longer hosted in Mercurial. Please see README-git.md for details.
-
-Thanks!
-
+We are no longer hosted in Mercurial. Please see README-git.md for details.
+
+Thanks!
+

+ 307 - 307
docs/README-ios.md

@@ -1,307 +1,307 @@
-iOS
-======
-
-Building the Simple DirectMedia Layer for iOS 9.0+
-==============================================================================
-
-Requirements: Mac OS X 10.9 or later and the iOS 9.0 or newer SDK.
-
-Instructions:
-
-1. Open SDL.xcodeproj (located in Xcode/SDL) in Xcode.
-2. Select your desired target, and hit build.
-
-
-Using the Simple DirectMedia Layer for iOS
-==============================================================================
-
-1. Run Xcode and create a new project using the iOS Game template, selecting the Objective C language and Metal game technology.
-2. In the main view, delete all files except for Assets and LaunchScreen
-3. Right click the project in the main view, select "Add Files...", and add the SDL project, Xcode/SDL/SDL.xcodeproj
-4. Select the project in the main view, go to the "Info" tab and under "Custom iOS Target Properties" remove the line "Main storyboard file base name"
-5. Select the project in the main view, go to the "Build Settings" tab, select "All", and edit "Header Search Path" and drag over the SDL "Public Headers" folder from the left
-6. Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL2.framework from "Framework-iOS"
-7. Select the project in the main view, go to the "General" tab, scroll down to "Frameworks, Libraries, and Embedded Content", and select "Embed & Sign" for the SDL library.
-8. In the main view, expand SDL -> Library Source -> main -> uikit and drag SDL_uikit_main.c into your game files
-9. Add the source files that you would normally have for an SDL program, making sure to have #include "SDL.h" at the top of the file containing your main() function.
-10. Add any assets that your application needs.
-11. Enjoy!
-
-
-TODO: Add information regarding App Store requirements such as icons, etc.
-
-
-Notes -- Retina / High-DPI and window sizes
-==============================================================================
-
-Window and display mode sizes in SDL are in "screen coordinates" (or "points",
-in Apple's terminology) rather than in pixels. On iOS this means that a window
-created on an iPhone 6 will have a size in screen coordinates of 375 x 667,
-rather than a size in pixels of 750 x 1334. All iOS apps are expected to
-size their content based on screen coordinates / points rather than pixels,
-as this allows different iOS devices to have different pixel densities
-(Retina versus non-Retina screens, etc.) without apps caring too much.
-
-By default SDL will not use the full pixel density of the screen on
-Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when
-creating your window to enable high-dpi support.
-
-When high-dpi support is enabled, SDL_GetWindowSize() and display mode sizes
-will still be in "screen coordinates" rather than pixels, but the window will
-have a much greater pixel density when the device supports it, and the
-SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() functions (depending on
-whether raw OpenGL or the SDL_Render API is used) can be queried to determine
-the size in pixels of the drawable screen framebuffer.
-
-Some OpenGL ES functions such as glViewport expect sizes in pixels rather than
-sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an
-orthographic projection matrix using the size in screen coordinates
-(SDL_GetWindowSize()) can be used in order to display content at the same scale
-no matter whether a Retina device is used or not.
-
-
-Notes -- Application events
-==============================================================================
-
-On iOS the application goes through a fixed life cycle and you will get
-notifications of state changes via application events. When these events
-are delivered you must handle them in an event callback because the OS may
-not give you any processing time after the events are delivered.
-
-e.g.
-
-    int HandleAppEvents(void *userdata, SDL_Event *event)
-    {
-        switch (event->type)
-        {
-        case SDL_APP_TERMINATING:
-            /* Terminate the app.
-               Shut everything down before returning from this function.
-            */
-            return 0;
-        case SDL_APP_LOWMEMORY:
-            /* You will get this when your app is paused and iOS wants more memory.
-               Release as much memory as possible.
-            */
-            return 0;
-        case SDL_APP_WILLENTERBACKGROUND:
-            /* Prepare your app to go into the background.  Stop loops, etc.
-               This gets called when the user hits the home button, or gets a call.
-            */
-            return 0;
-        case SDL_APP_DIDENTERBACKGROUND:
-            /* This will get called if the user accepted whatever sent your app to the background.
-               If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
-               When you get this, you have 5 seconds to save all your state or the app will be terminated.
-               Your app is NOT active at this point.
-            */
-            return 0;
-        case SDL_APP_WILLENTERFOREGROUND:
-            /* This call happens when your app is coming back to the foreground.
-               Restore all your state here.
-            */
-            return 0;
-        case SDL_APP_DIDENTERFOREGROUND:
-            /* Restart your loops here.
-               Your app is interactive and getting CPU again.
-            */
-            return 0;
-        default:
-            /* No special processing, add it to the event queue */
-            return 1;
-        }
-    }
-
-    int main(int argc, char *argv[])
-    {
-        SDL_SetEventFilter(HandleAppEvents, NULL);
-
-        ... run your main loop
-
-        return 0;
-    }
-
-
-Notes -- Accelerometer as Joystick
-==============================================================================
-
-SDL for iPhone supports polling the built in accelerometer as a joystick device.  For an example on how to do this, see the accelerometer.c in the demos directory.
-
-The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis() reports joystick values as signed integers.  Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver.  To convert SDL_JoystickGetAxis() reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
-
-
-Notes -- OpenGL ES
-==============================================================================
-
-Your SDL application for iOS uses OpenGL ES for video by default.
-
-OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute().
-
-If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0.
-
-Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 0.
-
-OpenGL ES on iOS doesn't use the traditional system-framebuffer setup provided in other operating systems. Special care must be taken because of this:
-
-- The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow() is called.
-- The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow() is called.
-- If multisample antialiasing (MSAA) is used and glReadPixels is used on the screen, the drawable framebuffer must be resolved to the MSAA resolve framebuffer (via glBlitFramebuffer or glResolveMultisampleFramebufferAPPLE), and the MSAA resolve framebuffer must be bound to the GL_READ_FRAMEBUFFER binding point, before glReadPixels is called.
-
-The above objects can be obtained via SDL_GetWindowWMInfo() (in SDL_syswm.h).
-
-
-Notes -- Keyboard
-==============================================================================
-
-The SDL keyboard API has been extended to support on-screen keyboards:
-
-void SDL_StartTextInput()
-	-- enables text events and reveals the onscreen keyboard.
-
-void SDL_StopTextInput()
-	-- disables text events and hides the onscreen keyboard.
-
-SDL_bool SDL_IsTextInputActive()
-	-- returns whether or not text events are enabled (and the onscreen keyboard is visible)
-
-
-Notes -- Mouse
-==============================================================================
-
-iOS now supports Bluetooth mice on iPad, but by default will provide the mouse input as touch. In order for SDL to see the real mouse events, you should set the key UIApplicationSupportsIndirectInputEvents to true in your Info.plist
-
-
-Notes -- Reading and Writing files
-==============================================================================
-
-Each application installed on iPhone resides in a sandbox which includes its own Application Home directory.  Your application may not access files outside this directory.
-
-Once your application is installed its directory tree looks like:
-
-    MySDLApp Home/
-        MySDLApp.app
-        Documents/
-        Library/
-            Preferences/
-        tmp/
-
-When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored.  You cannot write to this directory.  Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".
-
-More information on this subject is available here:
-http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
-
-
-Notes -- xcFramework
-==============================================================================
-
-The SDL.xcodeproj file now includes a target to build SDL2.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform.
-
-In the past, iOS devices were always an ARM variant processor, and the simulator was always i386 or x86_64, and thus libraries could be combined into a single framework for both simulator and device. With the introduction of the Apple Silicon ARM-based machines, regular frameworks would collide as CPU type was no longer sufficient to differentiate the platform. So Apple created the new xcframework library package.
-
-The xcframework target builds into a Products directory alongside the SDL.xcodeproj file, as SDL2.xcframework. This can be brought in to any iOS project and will function properly for both simulator and device, no matter their CPUs. Note that Intel Macs cannot cross-compile for Apple Silicon Macs. If you need AS compatibility, perform this build on an Apple Silicon Mac.
-
-This target requires Xcode 11 or later. The target will simply fail to build if attempted on older Xcodes.
-
-In addition, on Apple platforms, main() cannot be in a dynamically loaded library. This means that iOS apps which used the statically-linked libSDL2.lib and now link with the xcframwork will need to define their own main() to call SDL_UIKitRunApp(), like this:
-
-#ifndef SDL_MAIN_HANDLED
-#ifdef main
-#undef main
-#endif
-
-int
-main(int argc, char *argv[])
-{
-	return SDL_UIKitRunApp(argc, argv, SDL_main);
-}
-#endif /* !SDL_MAIN_HANDLED */
-
-Using an xcFramework is similar to using a regular framework. However, issues have been seen with the build system not seeing the headers in the xcFramework. To remedy this, add the path to the xcFramework in your app's target ==> Build Settings ==> Framework Search Paths and mark it recursive (this is critical). Also critical is to remove "*.framework" from Build Settings ==> Sub-Directories to Exclude in Recursive Searches. Clean the build folder, and on your next build the build system should be able to see any of these in your code, as expected:
-
-#include "SDL_main.h"
-#include <SDL.h>
-#include <SDL_main.h>
-
-
-Notes -- iPhone SDL limitations
-==============================================================================
-
-Windows:
-	Full-size, single window applications only.  You cannot create multi-window SDL applications for iPhone OS.  The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow() the flag SDL_WINDOW_BORDERLESS).
-
-Textures:
-	The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats.
-
-Loading Shared Objects:
-	This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_iphoneos.h.
-
-
-Notes -- CoreBluetooth.framework
-==============================================================================
-
-SDL_JOYSTICK_HIDAPI is disabled by default. It can give you access to a lot
-more game controller devices, but it requires permission from the user before
-your app will be able to talk to the Bluetooth hardware. "Made For iOS"
-branded controllers do not need this as we don't have to speak to them
-directly with raw bluetooth, so many apps can live without this.
-
-You'll need to link with CoreBluetooth.framework and add something like this
-to your Info.plist:
-
-<key>NSBluetoothPeripheralUsageDescription</key>
-<string>MyApp would like to remain connected to nearby bluetooth Game Controllers and Game Pads even when you're not using the app.</string>
-
-
-Game Center
-==============================================================================
-
-Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
-
-    int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
-
-This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
-
-e.g.
-
-    extern "C"
-    void ShowFrame(void*)
-    {
-        ... do event handling, frame logic and rendering ...
-    }
-
-    int main(int argc, char *argv[])
-    {
-        ... initialize game ...
-
-    #ifdef __IPHONEOS__
-        // Initialize the Game Center for scoring and matchmaking
-        InitGameCenter();
-
-        // Set up the game to run in the window animation callback on iOS
-        // so that Game Center and so forth works correctly.
-        SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
-    #else
-        while ( running ) {
-            ShowFrame(0);
-            DelayFrame();
-        }
-    #endif
-        return 0;
-    }
-
-
-Deploying to older versions of iOS
-==============================================================================
-
-SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0
-
-In order to do that you need to download an older version of Xcode:
-https://developer.apple.com/download/more/?name=Xcode
-
-Open the package contents of the older Xcode and your newer version of Xcode and copy over the folders in Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
-
-Then open the file Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist and add the versions of iOS you want to deploy to the key Root/DefaultProperties/DEPLOYMENT_TARGET_SUGGESTED_VALUES
-
-Open your project and set your deployment target to the desired version of iOS
-
-Finally, remove GameController from the list of frameworks linked by your application and edit the build settings for "Other Linker Flags" and add -weak_framework GameController
+iOS
+======
+
+Building the Simple DirectMedia Layer for iOS 9.0+
+==============================================================================
+
+Requirements: Mac OS X 10.9 or later and the iOS 9.0 or newer SDK.
+
+Instructions:
+
+1. Open SDL.xcodeproj (located in Xcode/SDL) in Xcode.
+2. Select your desired target, and hit build.
+
+
+Using the Simple DirectMedia Layer for iOS
+==============================================================================
+
+1. Run Xcode and create a new project using the iOS Game template, selecting the Objective C language and Metal game technology.
+2. In the main view, delete all files except for Assets and LaunchScreen
+3. Right click the project in the main view, select "Add Files...", and add the SDL project, Xcode/SDL/SDL.xcodeproj
+4. Select the project in the main view, go to the "Info" tab and under "Custom iOS Target Properties" remove the line "Main storyboard file base name"
+5. Select the project in the main view, go to the "Build Settings" tab, select "All", and edit "Header Search Path" and drag over the SDL "Public Headers" folder from the left
+6. Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL2.framework from "Framework-iOS"
+7. Select the project in the main view, go to the "General" tab, scroll down to "Frameworks, Libraries, and Embedded Content", and select "Embed & Sign" for the SDL library.
+8. In the main view, expand SDL -> Library Source -> main -> uikit and drag SDL_uikit_main.c into your game files
+9. Add the source files that you would normally have for an SDL program, making sure to have #include "SDL.h" at the top of the file containing your main() function.
+10. Add any assets that your application needs.
+11. Enjoy!
+
+
+TODO: Add information regarding App Store requirements such as icons, etc.
+
+
+Notes -- Retina / High-DPI and window sizes
+==============================================================================
+
+Window and display mode sizes in SDL are in "screen coordinates" (or "points",
+in Apple's terminology) rather than in pixels. On iOS this means that a window
+created on an iPhone 6 will have a size in screen coordinates of 375 x 667,
+rather than a size in pixels of 750 x 1334. All iOS apps are expected to
+size their content based on screen coordinates / points rather than pixels,
+as this allows different iOS devices to have different pixel densities
+(Retina versus non-Retina screens, etc.) without apps caring too much.
+
+By default SDL will not use the full pixel density of the screen on
+Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when
+creating your window to enable high-dpi support.
+
+When high-dpi support is enabled, SDL_GetWindowSize() and display mode sizes
+will still be in "screen coordinates" rather than pixels, but the window will
+have a much greater pixel density when the device supports it, and the
+SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() functions (depending on
+whether raw OpenGL or the SDL_Render API is used) can be queried to determine
+the size in pixels of the drawable screen framebuffer.
+
+Some OpenGL ES functions such as glViewport expect sizes in pixels rather than
+sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an
+orthographic projection matrix using the size in screen coordinates
+(SDL_GetWindowSize()) can be used in order to display content at the same scale
+no matter whether a Retina device is used or not.
+
+
+Notes -- Application events
+==============================================================================
+
+On iOS the application goes through a fixed life cycle and you will get
+notifications of state changes via application events. When these events
+are delivered you must handle them in an event callback because the OS may
+not give you any processing time after the events are delivered.
+
+e.g.
+
+    int HandleAppEvents(void *userdata, SDL_Event *event)
+    {
+        switch (event->type)
+        {
+        case SDL_APP_TERMINATING:
+            /* Terminate the app.
+               Shut everything down before returning from this function.
+            */
+            return 0;
+        case SDL_APP_LOWMEMORY:
+            /* You will get this when your app is paused and iOS wants more memory.
+               Release as much memory as possible.
+            */
+            return 0;
+        case SDL_APP_WILLENTERBACKGROUND:
+            /* Prepare your app to go into the background.  Stop loops, etc.
+               This gets called when the user hits the home button, or gets a call.
+            */
+            return 0;
+        case SDL_APP_DIDENTERBACKGROUND:
+            /* This will get called if the user accepted whatever sent your app to the background.
+               If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
+               When you get this, you have 5 seconds to save all your state or the app will be terminated.
+               Your app is NOT active at this point.
+            */
+            return 0;
+        case SDL_APP_WILLENTERFOREGROUND:
+            /* This call happens when your app is coming back to the foreground.
+               Restore all your state here.
+            */
+            return 0;
+        case SDL_APP_DIDENTERFOREGROUND:
+            /* Restart your loops here.
+               Your app is interactive and getting CPU again.
+            */
+            return 0;
+        default:
+            /* No special processing, add it to the event queue */
+            return 1;
+        }
+    }
+
+    int main(int argc, char *argv[])
+    {
+        SDL_SetEventFilter(HandleAppEvents, NULL);
+
+        ... run your main loop
+
+        return 0;
+    }
+
+
+Notes -- Accelerometer as Joystick
+==============================================================================
+
+SDL for iPhone supports polling the built in accelerometer as a joystick device.  For an example on how to do this, see the accelerometer.c in the demos directory.
+
+The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis() reports joystick values as signed integers.  Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver.  To convert SDL_JoystickGetAxis() reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
+
+
+Notes -- OpenGL ES
+==============================================================================
+
+Your SDL application for iOS uses OpenGL ES for video by default.
+
+OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute().
+
+If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0.
+
+Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 0.
+
+OpenGL ES on iOS doesn't use the traditional system-framebuffer setup provided in other operating systems. Special care must be taken because of this:
+
+- The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow() is called.
+- The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow() is called.
+- If multisample antialiasing (MSAA) is used and glReadPixels is used on the screen, the drawable framebuffer must be resolved to the MSAA resolve framebuffer (via glBlitFramebuffer or glResolveMultisampleFramebufferAPPLE), and the MSAA resolve framebuffer must be bound to the GL_READ_FRAMEBUFFER binding point, before glReadPixels is called.
+
+The above objects can be obtained via SDL_GetWindowWMInfo() (in SDL_syswm.h).
+
+
+Notes -- Keyboard
+==============================================================================
+
+The SDL keyboard API has been extended to support on-screen keyboards:
+
+void SDL_StartTextInput()
+	-- enables text events and reveals the onscreen keyboard.
+
+void SDL_StopTextInput()
+	-- disables text events and hides the onscreen keyboard.
+
+SDL_bool SDL_IsTextInputActive()
+	-- returns whether or not text events are enabled (and the onscreen keyboard is visible)
+
+
+Notes -- Mouse
+==============================================================================
+
+iOS now supports Bluetooth mice on iPad, but by default will provide the mouse input as touch. In order for SDL to see the real mouse events, you should set the key UIApplicationSupportsIndirectInputEvents to true in your Info.plist
+
+
+Notes -- Reading and Writing files
+==============================================================================
+
+Each application installed on iPhone resides in a sandbox which includes its own Application Home directory.  Your application may not access files outside this directory.
+
+Once your application is installed its directory tree looks like:
+
+    MySDLApp Home/
+        MySDLApp.app
+        Documents/
+        Library/
+            Preferences/
+        tmp/
+
+When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored.  You cannot write to this directory.  Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".
+
+More information on this subject is available here:
+http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
+
+
+Notes -- xcFramework
+==============================================================================
+
+The SDL.xcodeproj file now includes a target to build SDL2.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform.
+
+In the past, iOS devices were always an ARM variant processor, and the simulator was always i386 or x86_64, and thus libraries could be combined into a single framework for both simulator and device. With the introduction of the Apple Silicon ARM-based machines, regular frameworks would collide as CPU type was no longer sufficient to differentiate the platform. So Apple created the new xcframework library package.
+
+The xcframework target builds into a Products directory alongside the SDL.xcodeproj file, as SDL2.xcframework. This can be brought in to any iOS project and will function properly for both simulator and device, no matter their CPUs. Note that Intel Macs cannot cross-compile for Apple Silicon Macs. If you need AS compatibility, perform this build on an Apple Silicon Mac.
+
+This target requires Xcode 11 or later. The target will simply fail to build if attempted on older Xcodes.
+
+In addition, on Apple platforms, main() cannot be in a dynamically loaded library. This means that iOS apps which used the statically-linked libSDL2.lib and now link with the xcframwork will need to define their own main() to call SDL_UIKitRunApp(), like this:
+
+#ifndef SDL_MAIN_HANDLED
+#ifdef main
+#undef main
+#endif
+
+int
+main(int argc, char *argv[])
+{
+	return SDL_UIKitRunApp(argc, argv, SDL_main);
+}
+#endif /* !SDL_MAIN_HANDLED */
+
+Using an xcFramework is similar to using a regular framework. However, issues have been seen with the build system not seeing the headers in the xcFramework. To remedy this, add the path to the xcFramework in your app's target ==> Build Settings ==> Framework Search Paths and mark it recursive (this is critical). Also critical is to remove "*.framework" from Build Settings ==> Sub-Directories to Exclude in Recursive Searches. Clean the build folder, and on your next build the build system should be able to see any of these in your code, as expected:
+
+#include "SDL_main.h"
+#include <SDL.h>
+#include <SDL_main.h>
+
+
+Notes -- iPhone SDL limitations
+==============================================================================
+
+Windows:
+	Full-size, single window applications only.  You cannot create multi-window SDL applications for iPhone OS.  The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow() the flag SDL_WINDOW_BORDERLESS).
+
+Textures:
+	The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats.
+
+Loading Shared Objects:
+	This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_iphoneos.h.
+
+
+Notes -- CoreBluetooth.framework
+==============================================================================
+
+SDL_JOYSTICK_HIDAPI is disabled by default. It can give you access to a lot
+more game controller devices, but it requires permission from the user before
+your app will be able to talk to the Bluetooth hardware. "Made For iOS"
+branded controllers do not need this as we don't have to speak to them
+directly with raw bluetooth, so many apps can live without this.
+
+You'll need to link with CoreBluetooth.framework and add something like this
+to your Info.plist:
+
+<key>NSBluetoothPeripheralUsageDescription</key>
+<string>MyApp would like to remain connected to nearby bluetooth Game Controllers and Game Pads even when you're not using the app.</string>
+
+
+Game Center
+==============================================================================
+
+Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
+
+    int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
+
+This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
+
+e.g.
+
+    extern "C"
+    void ShowFrame(void*)
+    {
+        ... do event handling, frame logic and rendering ...
+    }
+
+    int main(int argc, char *argv[])
+    {
+        ... initialize game ...
+
+    #ifdef __IPHONEOS__
+        // Initialize the Game Center for scoring and matchmaking
+        InitGameCenter();
+
+        // Set up the game to run in the window animation callback on iOS
+        // so that Game Center and so forth works correctly.
+        SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
+    #else
+        while ( running ) {
+            ShowFrame(0);
+            DelayFrame();
+        }
+    #endif
+        return 0;
+    }
+
+
+Deploying to older versions of iOS
+==============================================================================
+
+SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0
+
+In order to do that you need to download an older version of Xcode:
+https://developer.apple.com/download/more/?name=Xcode
+
+Open the package contents of the older Xcode and your newer version of Xcode and copy over the folders in Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
+
+Then open the file Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist and add the versions of iOS you want to deploy to the key Root/DefaultProperties/DEPLOYMENT_TARGET_SUGGESTED_VALUES
+
+Open your project and set your deployment target to the desired version of iOS
+
+Finally, remove GameController from the list of frameworks linked by your application and edit the build settings for "Other Linker Flags" and add -weak_framework GameController

+ 27 - 27
docs/README-kmsbsd.md

@@ -1,27 +1,27 @@
-KMSDRM on *BSD
-==================================================
-
-KMSDRM is supported on FreeBSD and OpenBSD. DragonFlyBSD works but requires being a root user. NetBSD isn't supported yet because the application will crash when creating the KMSDRM screen.
-
-WSCONS support has been brought back, but only as an input backend. It will not be brought back as a video backend to ease maintenance.
-
-OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices.
-
-
-SDL2 WSCONS input backend features
-===================================================
-1. It is keymap-aware; it will work properly with different keymaps.
-2. It has mouse support.
-3. Accent input is supported.
-4. Compose keys are supported.
-5. AltGr and Meta Shift keys work as intended.
-
-Partially working or no input on OpenBSD/NetBSD.
-==================================================
-
-The WSCONS input backend needs read/write access to the /dev/wskbd* devices, without which it will not work properly. /dev/wsmouse must also be read/write accessible, otherwise mouse input will not work.
-
-Partially working or no input on FreeBSD.
-==================================================
-
-The evdev devices are only accessible to the root user by default. Edit devfs rules to allow access to such devices. The /dev/kbd* devices are also only accessible to the root user by default. Edit devfs rules to allow access to such devices.
+KMSDRM on *BSD
+==================================================
+
+KMSDRM is supported on FreeBSD and OpenBSD. DragonFlyBSD works but requires being a root user. NetBSD isn't supported yet because the application will crash when creating the KMSDRM screen.
+
+WSCONS support has been brought back, but only as an input backend. It will not be brought back as a video backend to ease maintenance.
+
+OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices.
+
+
+SDL2 WSCONS input backend features
+===================================================
+1. It is keymap-aware; it will work properly with different keymaps.
+2. It has mouse support.
+3. Accent input is supported.
+4. Compose keys are supported.
+5. AltGr and Meta Shift keys work as intended.
+
+Partially working or no input on OpenBSD/NetBSD.
+==================================================
+
+The WSCONS input backend needs read/write access to the /dev/wskbd* devices, without which it will not work properly. /dev/wsmouse must also be read/write accessible, otherwise mouse input will not work.
+
+Partially working or no input on FreeBSD.
+==================================================
+
+The evdev devices are only accessible to the root user by default. Edit devfs rules to allow access to such devices. The /dev/kbd* devices are also only accessible to the root user by default. Edit devfs rules to allow access to such devices.

+ 96 - 96
docs/README-linux.md

@@ -1,96 +1,96 @@
-Linux
-================================================================================
-
-By default SDL will only link against glibc, the rest of the features will be
-enabled dynamically at runtime depending on the available features on the target
-system. So, for example if you built SDL with XRandR support and the target
-system does not have the XRandR libraries installed, it will be disabled
-at runtime, and you won't get a missing library error, at least with the
-default configuration parameters.
-
-
-Build Dependencies
---------------------------------------------------------------------------------
-
-Ubuntu 18.04, all available features enabled:
-
-    sudo apt-get install build-essential git make autoconf automake libtool \
-    pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
-    libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
-    libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
-    libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
-    libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
-
-Ubuntu 22.04+ can also add `libpipewire-0.3-dev libdecor-0-dev` to that command line.
-
-Fedora 35, all available features enabled:
-
-    sudo yum install gcc git-core make cmake autoconf automake libtool \
-    alsa-lib-devel pulseaudio-libs-devel nas-devel pipewire-devel \
-    libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \
-    libXi-devel libXScrnSaver-devel dbus-devel ibus-devel fcitx-devel \
-    systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel \
-    mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel \
-    libdrm-devel mesa-libgbm-devel libusb-devel libdecor-devel \
-    libsamplerate-devel pipewire-jack-audio-connection-kit-devel \
-
-NOTES:
-- This includes all the audio targets except arts and esd, because Ubuntu
-  (and/or Debian) pulled their packages, but in theory SDL still supports them.
-  The sndio audio target is also unavailable on Fedora.
-- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
-  for higher-quality audio resampling. SDL will work without it if the library
-  is missing, so it's safe to build in support even if the end user doesn't
-  have this library installed.
-- DirectFB isn't included because the configure script (currently) fails to find
-  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the
-  configure script to include DirectFB support. Send patches.  :)
-
-
-Joystick does not work
---------------------------------------------------------------------------------
-
-If you compiled or are using a version of SDL with udev support (and you should!)
-there's a few issues that may cause SDL to fail to detect your joystick. To
-debug this, start by installing the evtest utility. On Ubuntu/Debian:
-
-    sudo apt-get install evtest
-
-Then run:
-
-    sudo evtest
-
-You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
-Now run:
-
-    cat /dev/input/event/XX
-
-If you get a permission error, you need to set a udev rule to change the mode of
-your device (see below)
-
-Also, try:
-
-    sudo udevadm info --query=all --name=input/eventXX
-
-If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
-you need to set up an udev rule to force this variable.
-
-A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks
-like:
-
-    SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
-    SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
-
-You can set up similar rules for your device by changing the values listed in
-idProduct and idVendor. To obtain these values, try:
-
-    sudo udevadm info -a --name=input/eventXX | grep idVendor
-    sudo udevadm info -a --name=input/eventXX | grep idProduct
-
-If multiple values come up for each of these, the one you want is the first one of each.
-
-On other systems which ship with an older udev (such as CentOS), you may need
-to set up a rule such as:
-
-    SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
-
+Linux
+================================================================================
+
+By default SDL will only link against glibc, the rest of the features will be
+enabled dynamically at runtime depending on the available features on the target
+system. So, for example if you built SDL with XRandR support and the target
+system does not have the XRandR libraries installed, it will be disabled
+at runtime, and you won't get a missing library error, at least with the
+default configuration parameters.
+
+
+Build Dependencies
+--------------------------------------------------------------------------------
+
+Ubuntu 18.04, all available features enabled:
+
+    sudo apt-get install build-essential git make autoconf automake libtool \
+    pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
+    libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
+    libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
+    libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
+    libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
+
+Ubuntu 22.04+ can also add `libpipewire-0.3-dev libdecor-0-dev` to that command line.
+
+Fedora 35, all available features enabled:
+
+    sudo yum install gcc git-core make cmake autoconf automake libtool \
+    alsa-lib-devel pulseaudio-libs-devel nas-devel pipewire-devel \
+    libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \
+    libXi-devel libXScrnSaver-devel dbus-devel ibus-devel fcitx-devel \
+    systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel \
+    mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel \
+    libdrm-devel mesa-libgbm-devel libusb-devel libdecor-devel \
+    libsamplerate-devel pipewire-jack-audio-connection-kit-devel \
+
+NOTES:
+- This includes all the audio targets except arts and esd, because Ubuntu
+  (and/or Debian) pulled their packages, but in theory SDL still supports them.
+  The sndio audio target is also unavailable on Fedora.
+- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
+  for higher-quality audio resampling. SDL will work without it if the library
+  is missing, so it's safe to build in support even if the end user doesn't
+  have this library installed.
+- DirectFB isn't included because the configure script (currently) fails to find
+  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the
+  configure script to include DirectFB support. Send patches.  :)
+
+
+Joystick does not work
+--------------------------------------------------------------------------------
+
+If you compiled or are using a version of SDL with udev support (and you should!)
+there's a few issues that may cause SDL to fail to detect your joystick. To
+debug this, start by installing the evtest utility. On Ubuntu/Debian:
+
+    sudo apt-get install evtest
+
+Then run:
+
+    sudo evtest
+
+You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
+Now run:
+
+    cat /dev/input/event/XX
+
+If you get a permission error, you need to set a udev rule to change the mode of
+your device (see below)
+
+Also, try:
+
+    sudo udevadm info --query=all --name=input/eventXX
+
+If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
+you need to set up an udev rule to force this variable.
+
+A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks
+like:
+
+    SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
+    SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
+
+You can set up similar rules for your device by changing the values listed in
+idProduct and idVendor. To obtain these values, try:
+
+    sudo udevadm info -a --name=input/eventXX | grep idVendor
+    sudo udevadm info -a --name=input/eventXX | grep idProduct
+
+If multiple values come up for each of these, the one you want is the first one of each.
+
+On other systems which ship with an older udev (such as CentOS), you may need
+to set up a rule such as:
+
+    SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
+

+ 285 - 285
docs/README-macos.md

@@ -1,285 +1,285 @@
-# Mac OS X (aka macOS).
-
-These instructions are for people using Apple's Mac OS X (pronounced
-"ten"), which in newer versions is just referred to as "macOS".
-
-From the developer's point of view, macOS is a sort of hybrid Mac and
-Unix system, and you have the option of using either traditional
-command line tools or Apple's IDE Xcode.
-
-# Command Line Build
-
-To build SDL using the command line, use the standard configure and make
-process:
-
-```bash
-mkdir build
-cd build
-../configure
-make
-sudo make install
-```
-
-CMake is also known to work, although it continues to be a work in progress:
-
-```bash
-mkdir build
-cd build
-cmake -DCMAKE_BUILD_TYPE=Release ..
-make
-sudo make install
-```
-
-
-You can also build SDL as a Universal library (a single binary for both
-64-bit Intel and ARM architectures), by using the build-scripts/clang-fat.sh
-script.
-
-```bash
-mkdir build
-cd build
-CC=$PWD/../build-scripts/clang-fat.sh ../configure
-make
-sudo make install
-```
-
-This script builds SDL with 10.9 ABI compatibility on 64-bit Intel and 11.0
-ABI compatibility on ARM64 architectures.  For best compatibility you
-should compile your application the same way.
-
-Please note that building SDL requires at least Xcode 6 and the 10.9 SDK.
-PowerPC support for macOS has been officially dropped as of SDL 2.0.2.
-32-bit Intel and macOS 10.8 runtime support has been officially dropped as
-of SDL 2.24.0.
-
-To use the library once it's built, you essential have two possibilities:
-use the traditional autoconf/automake/make method, or use Xcode.
-
-
-# Caveats for using SDL with Mac OS X
-
-If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
-SDL will not register its own. This means that SDL will not terminate using
-SDL_Quit if it receives a termination request, it will terminate like a
-normal app, and it will not send a SDL_DROPFILE when you request to open a
-file with the app. To solve these issues, put the following code in your
-NSApplicationDelegate implementation:
-
-
-```objc
-- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
-{
-    if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
-        SDL_Event event;
-        event.type = SDL_QUIT;
-        SDL_PushEvent(&event);
-    }
-
-    return NSTerminateCancel;
-}
-
-- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
-{
-    if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
-        SDL_Event event;
-        event.type = SDL_DROPFILE;
-        event.drop.file = SDL_strdup([filename UTF8String]);
-        return (SDL_PushEvent(&event) > 0);
-    }
-
-    return NO;
-}
-```
-
-# Using the Simple DirectMedia Layer with a traditional Makefile
-
-An existing autoconf/automake build system for your SDL app has good chances
-to work almost unchanged on macOS. However, to produce a "real" Mac binary
-that you can distribute to users, you need to put the generated binary into a
-so called "bundle", which is basically a fancy folder with a name like
-"MyCoolGame.app".
-
-To get this build automatically, add something like the following rule to
-your Makefile.am:
-
-```make
-bundle_contents = APP_NAME.app/Contents
-APP_NAME_bundle: EXE_NAME
-	mkdir -p $(bundle_contents)/MacOS
-	mkdir -p $(bundle_contents)/Resources
-	echo "APPL????" > $(bundle_contents)/PkgInfo
-	$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
-```
-
-You should replace `EXE_NAME` with the name of the executable. `APP_NAME` is
-what will be visible to the user in the Finder. Usually it will be the same
-as `EXE_NAME` but capitalized. E.g. if `EXE_NAME` is "testgame" then `APP_NAME`
-usually is "TestGame". You might also want to use `@PACKAGE@` to use the
-package name as specified in your configure.ac file.
-
-If your project builds more than one application, you will have to do a bit
-more. For each of your target applications, you need a separate rule.
-
-If you want the created bundles to be installed, you may want to add this
-rule to your Makefile.am:
-
-```make
-install-exec-hook: APP_NAME_bundle
-	rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
-	mkdir -p $(DESTDIR)$(prefix)/Applications/
-	cp -r $< /$(DESTDIR)$(prefix)Applications/
-```
-
-This rule takes the Bundle created by the rule from step 3 and installs them
-into "$(DESTDIR)$(prefix)/Applications/".
-
-Again, if you want to install multiple applications, you will have to augment
-the make rule accordingly.
-
-But beware! That is only part of the story! With the above, you end up with
-a barebones .app bundle, which is double-clickable from the Finder. But
-there are some more things you should do before shipping your product...
-
-1. The bundle right now probably is dynamically linked against SDL. That
-   means that when you copy it to another computer, *it will not run*,
-   unless you also install SDL on that other computer. A good solution
-   for this dilemma is to static link against SDL. On OS X, you can
-   achieve that by linking against the libraries listed by
-
-   ```bash
-   sdl-config --static-libs
-   ```
-
-   instead of those listed by
-
-   ```bash
-   sdl-config --libs
-   ```
-
-   Depending on how exactly SDL is integrated into your build systems, the
-   way to achieve that varies, so I won't describe it here in detail
-
-2. Add an 'Info.plist' to your application. That is a special XML file which
-   contains some meta-information about your application (like some copyright
-   information, the version of your app, the name of an optional icon file,
-   and other things). Part of that information is displayed by the Finder
-   when you click on the .app, or if you look at the "Get Info" window.
-   More information about Info.plist files can be found on Apple's homepage.
-
-
-As a final remark, let me add that I use some of the techniques (and some
-variations of them) in [Exult](https://github.com/exult/exult) and
-[ScummVM](https://github.com/scummvm/scummvm); both are available in source on
-the net, so feel free to take a peek at them for inspiration!
-
-
-# Using the Simple DirectMedia Layer with Xcode
-
-These instructions are for using Apple's Xcode IDE to build SDL applications.
-
-## First steps
-
-The first thing to do is to unpack the Xcode.tar.gz archive in the
-top level SDL directory (where the Xcode.tar.gz archive resides).
-Because Stuffit Expander will unpack the archive into a subdirectory,
-you should unpack the archive manually from the command line:
-
-```bash
-cd [path_to_SDL_source]
-tar zxf Xcode.tar.gz
-```
-
-This will create a new folder called Xcode, which you can browse
-normally from the Finder.
-
-## Building the Framework
-
-The SDL Library is packaged as a framework bundle, an organized
-relocatable folder hierarchy of executable code, interface headers,
-and additional resources. For practical purposes, you can think of a
-framework as a more user and system-friendly shared library, whose library
-file behaves more or less like a standard UNIX shared library.
-
-To build the framework, simply open the framework project and build it.
-By default, the framework bundle "SDL.framework" is installed in
-/Library/Frameworks. Therefore, the testers and project stationary expect
-it to be located there. However, it will function the same in any of the
-following locations:
-
-* ~/Library/Frameworks
-* /Local/Library/Frameworks
-* /System/Library/Frameworks
-
-## Build Options
-
-There are two "Build Styles" (See the "Targets" tab) for SDL.
-"Deployment" should be used if you aren't tweaking the SDL library.
-"Development" should be used to debug SDL apps or the library itself.
-
-## Building the Testers
-
-Open the SDLTest project and build away!
-
-## Using the Project Stationary
-
-Copy the stationary to the indicated folders to access it from
-the "New Project" and "Add target" menus. What could be easier?
-
-## Setting up a new project by hand
-
-Some of you won't want to use the Stationary so I'll give some tips:
-
-(this is accurate as of Xcode 12.5.)
-
-* Click "File" -> "New" -> "Project...
-* Choose "macOS" and then "App" from the "Application" section.
-* Fill out the options in the next window. User interface is "XIB" and
-  Language is "Objective-C".
-* Remove "main.m" from your project
-* Remove "MainMenu.xib" from your project
-* Remove "AppDelegates.*" from your project
-* Add "\$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
-* Add "\$(HOME)/Library/Frameworks" to the frameworks search path
-* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
-* Add your files
-* Clean and build
-
-## Building from command line
-
-Use `xcode-build` in the same directory as your .pbxproj file
-
-## Running your app
-
-You can send command line args to your app by either invoking it from
-the command line (in *.app/Contents/MacOS) or by entering them in the
-Executables" panel of the target settings.
-
-# Implementation Notes
-
-Some things that may be of interest about how it all works...
-
-## Working directory
-
-In SDL 1.2, the working directory of your SDL app is by default set to its
-parent, but this is no longer the case in SDL 2.0. SDL2 does change the
-working directory, which means it'll be whatever the command line prompt
-that launched the program was using, or if launched by double-clicking in
-the finger, it will be "/", the _root of the filesystem_. Plan accordingly!
-You can use SDL_GetBasePath() to find where the program is running from and
-chdir() there directly.
-
-
-## You have a Cocoa App!
-
-Your SDL app is essentially a Cocoa application. When your app
-starts up and the libraries finish loading, a Cocoa procedure is called,
-which sets up the working directory and calls your main() method.
-You are free to modify your Cocoa app with generally no consequence
-to SDL. You cannot, however, easily change the SDL window itself.
-Functionality may be added in the future to help this.
-
-# Bug reports
-
-Bugs are tracked at [the GitHub issue tracker](https://github.com/libsdl-org/SDL/issues/).
-Please feel free to report bugs there!
-
+# Mac OS X (aka macOS).
+
+These instructions are for people using Apple's Mac OS X (pronounced
+"ten"), which in newer versions is just referred to as "macOS".
+
+From the developer's point of view, macOS is a sort of hybrid Mac and
+Unix system, and you have the option of using either traditional
+command line tools or Apple's IDE Xcode.
+
+# Command Line Build
+
+To build SDL using the command line, use the standard configure and make
+process:
+
+```bash
+mkdir build
+cd build
+../configure
+make
+sudo make install
+```
+
+CMake is also known to work, although it continues to be a work in progress:
+
+```bash
+mkdir build
+cd build
+cmake -DCMAKE_BUILD_TYPE=Release ..
+make
+sudo make install
+```
+
+
+You can also build SDL as a Universal library (a single binary for both
+64-bit Intel and ARM architectures), by using the build-scripts/clang-fat.sh
+script.
+
+```bash
+mkdir build
+cd build
+CC=$PWD/../build-scripts/clang-fat.sh ../configure
+make
+sudo make install
+```
+
+This script builds SDL with 10.9 ABI compatibility on 64-bit Intel and 11.0
+ABI compatibility on ARM64 architectures.  For best compatibility you
+should compile your application the same way.
+
+Please note that building SDL requires at least Xcode 6 and the 10.9 SDK.
+PowerPC support for macOS has been officially dropped as of SDL 2.0.2.
+32-bit Intel and macOS 10.8 runtime support has been officially dropped as
+of SDL 2.24.0.
+
+To use the library once it's built, you essential have two possibilities:
+use the traditional autoconf/automake/make method, or use Xcode.
+
+
+# Caveats for using SDL with Mac OS X
+
+If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
+SDL will not register its own. This means that SDL will not terminate using
+SDL_Quit if it receives a termination request, it will terminate like a
+normal app, and it will not send a SDL_DROPFILE when you request to open a
+file with the app. To solve these issues, put the following code in your
+NSApplicationDelegate implementation:
+
+
+```objc
+- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
+{
+    if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
+        SDL_Event event;
+        event.type = SDL_QUIT;
+        SDL_PushEvent(&event);
+    }
+
+    return NSTerminateCancel;
+}
+
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
+{
+    if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
+        SDL_Event event;
+        event.type = SDL_DROPFILE;
+        event.drop.file = SDL_strdup([filename UTF8String]);
+        return (SDL_PushEvent(&event) > 0);
+    }
+
+    return NO;
+}
+```
+
+# Using the Simple DirectMedia Layer with a traditional Makefile
+
+An existing autoconf/automake build system for your SDL app has good chances
+to work almost unchanged on macOS. However, to produce a "real" Mac binary
+that you can distribute to users, you need to put the generated binary into a
+so called "bundle", which is basically a fancy folder with a name like
+"MyCoolGame.app".
+
+To get this build automatically, add something like the following rule to
+your Makefile.am:
+
+```make
+bundle_contents = APP_NAME.app/Contents
+APP_NAME_bundle: EXE_NAME
+	mkdir -p $(bundle_contents)/MacOS
+	mkdir -p $(bundle_contents)/Resources
+	echo "APPL????" > $(bundle_contents)/PkgInfo
+	$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
+```
+
+You should replace `EXE_NAME` with the name of the executable. `APP_NAME` is
+what will be visible to the user in the Finder. Usually it will be the same
+as `EXE_NAME` but capitalized. E.g. if `EXE_NAME` is "testgame" then `APP_NAME`
+usually is "TestGame". You might also want to use `@PACKAGE@` to use the
+package name as specified in your configure.ac file.
+
+If your project builds more than one application, you will have to do a bit
+more. For each of your target applications, you need a separate rule.
+
+If you want the created bundles to be installed, you may want to add this
+rule to your Makefile.am:
+
+```make
+install-exec-hook: APP_NAME_bundle
+	rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
+	mkdir -p $(DESTDIR)$(prefix)/Applications/
+	cp -r $< /$(DESTDIR)$(prefix)Applications/
+```
+
+This rule takes the Bundle created by the rule from step 3 and installs them
+into "$(DESTDIR)$(prefix)/Applications/".
+
+Again, if you want to install multiple applications, you will have to augment
+the make rule accordingly.
+
+But beware! That is only part of the story! With the above, you end up with
+a barebones .app bundle, which is double-clickable from the Finder. But
+there are some more things you should do before shipping your product...
+
+1. The bundle right now probably is dynamically linked against SDL. That
+   means that when you copy it to another computer, *it will not run*,
+   unless you also install SDL on that other computer. A good solution
+   for this dilemma is to static link against SDL. On OS X, you can
+   achieve that by linking against the libraries listed by
+
+   ```bash
+   sdl-config --static-libs
+   ```
+
+   instead of those listed by
+
+   ```bash
+   sdl-config --libs
+   ```
+
+   Depending on how exactly SDL is integrated into your build systems, the
+   way to achieve that varies, so I won't describe it here in detail
+
+2. Add an 'Info.plist' to your application. That is a special XML file which
+   contains some meta-information about your application (like some copyright
+   information, the version of your app, the name of an optional icon file,
+   and other things). Part of that information is displayed by the Finder
+   when you click on the .app, or if you look at the "Get Info" window.
+   More information about Info.plist files can be found on Apple's homepage.
+
+
+As a final remark, let me add that I use some of the techniques (and some
+variations of them) in [Exult](https://github.com/exult/exult) and
+[ScummVM](https://github.com/scummvm/scummvm); both are available in source on
+the net, so feel free to take a peek at them for inspiration!
+
+
+# Using the Simple DirectMedia Layer with Xcode
+
+These instructions are for using Apple's Xcode IDE to build SDL applications.
+
+## First steps
+
+The first thing to do is to unpack the Xcode.tar.gz archive in the
+top level SDL directory (where the Xcode.tar.gz archive resides).
+Because Stuffit Expander will unpack the archive into a subdirectory,
+you should unpack the archive manually from the command line:
+
+```bash
+cd [path_to_SDL_source]
+tar zxf Xcode.tar.gz
+```
+
+This will create a new folder called Xcode, which you can browse
+normally from the Finder.
+
+## Building the Framework
+
+The SDL Library is packaged as a framework bundle, an organized
+relocatable folder hierarchy of executable code, interface headers,
+and additional resources. For practical purposes, you can think of a
+framework as a more user and system-friendly shared library, whose library
+file behaves more or less like a standard UNIX shared library.
+
+To build the framework, simply open the framework project and build it.
+By default, the framework bundle "SDL.framework" is installed in
+/Library/Frameworks. Therefore, the testers and project stationary expect
+it to be located there. However, it will function the same in any of the
+following locations:
+
+* ~/Library/Frameworks
+* /Local/Library/Frameworks
+* /System/Library/Frameworks
+
+## Build Options
+
+There are two "Build Styles" (See the "Targets" tab) for SDL.
+"Deployment" should be used if you aren't tweaking the SDL library.
+"Development" should be used to debug SDL apps or the library itself.
+
+## Building the Testers
+
+Open the SDLTest project and build away!
+
+## Using the Project Stationary
+
+Copy the stationary to the indicated folders to access it from
+the "New Project" and "Add target" menus. What could be easier?
+
+## Setting up a new project by hand
+
+Some of you won't want to use the Stationary so I'll give some tips:
+
+(this is accurate as of Xcode 12.5.)
+
+* Click "File" -> "New" -> "Project...
+* Choose "macOS" and then "App" from the "Application" section.
+* Fill out the options in the next window. User interface is "XIB" and
+  Language is "Objective-C".
+* Remove "main.m" from your project
+* Remove "MainMenu.xib" from your project
+* Remove "AppDelegates.*" from your project
+* Add "\$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
+* Add "\$(HOME)/Library/Frameworks" to the frameworks search path
+* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
+* Add your files
+* Clean and build
+
+## Building from command line
+
+Use `xcode-build` in the same directory as your .pbxproj file
+
+## Running your app
+
+You can send command line args to your app by either invoking it from
+the command line (in *.app/Contents/MacOS) or by entering them in the
+Executables" panel of the target settings.
+
+# Implementation Notes
+
+Some things that may be of interest about how it all works...
+
+## Working directory
+
+In SDL 1.2, the working directory of your SDL app is by default set to its
+parent, but this is no longer the case in SDL 2.0. SDL2 does change the
+working directory, which means it'll be whatever the command line prompt
+that launched the program was using, or if launched by double-clicking in
+the finger, it will be "/", the _root of the filesystem_. Plan accordingly!
+You can use SDL_GetBasePath() to find where the program is running from and
+chdir() there directly.
+
+
+## You have a Cocoa App!
+
+Your SDL app is essentially a Cocoa application. When your app
+starts up and the libraries finish loading, a Cocoa procedure is called,
+which sets up the working directory and calls your main() method.
+You are free to modify your Cocoa app with generally no consequence
+to SDL. You cannot, however, easily change the SDL window itself.
+Functionality may be added in the future to help this.
+
+# Bug reports
+
+Bugs are tracked at [the GitHub issue tracker](https://github.com/libsdl-org/SDL/issues/).
+Please feel free to report bugs there!
+

+ 28 - 28
docs/README-n3ds.md

@@ -1,28 +1,28 @@
-# Nintendo 3DS
-
-SDL port for the Nintendo 3DS [Homebrew toolchain](https://devkitpro.org/) contributed by:
-
--   [Pierre Wendling](https://github.com/FtZPetruska)
-
-Credits to:
-
--   The awesome people who ported SDL to other homebrew platforms.
--   The Devkitpro team for making all the tools necessary to achieve this.
-
-## Building
-
-To build for the Nintendo 3DS, make sure you have devkitARM and cmake installed and run:
-
-```bash
-cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release
-cmake --build build
-cmake --install build
-```
-
-## Notes
-
--   Currently only software rendering is supported.
--   SDL2main should be used to ensure ROMFS is enabled.
--   By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function.
--   `SDL_GetBasePath` returns the romfs root instead of the executable's directory.
--   The Nintendo 3DS uses a cooperative threading model on a single core, meaning a thread will never yield unless done manually through the `SDL_Delay` functions, or blocking waits (`SDL_LockMutex`, `SDL_SemWait`, `SDL_CondWait`, `SDL_WaitThread`). To avoid starving other threads, `SDL_SemTryWait` and `SDL_SemWaitTimeout` will yield if they fail to acquire the semaphore, see https://github.com/libsdl-org/SDL/pull/6776 for more information.
+# Nintendo 3DS
+
+SDL port for the Nintendo 3DS [Homebrew toolchain](https://devkitpro.org/) contributed by:
+
+-   [Pierre Wendling](https://github.com/FtZPetruska)
+
+Credits to:
+
+-   The awesome people who ported SDL to other homebrew platforms.
+-   The Devkitpro team for making all the tools necessary to achieve this.
+
+## Building
+
+To build for the Nintendo 3DS, make sure you have devkitARM and cmake installed and run:
+
+```bash
+cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release
+cmake --build build
+cmake --install build
+```
+
+## Notes
+
+-   Currently only software rendering is supported.
+-   SDL2main should be used to ensure ROMFS is enabled.
+-   By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function.
+-   `SDL_GetBasePath` returns the romfs root instead of the executable's directory.
+-   The Nintendo 3DS uses a cooperative threading model on a single core, meaning a thread will never yield unless done manually through the `SDL_Delay` functions, or blocking waits (`SDL_LockMutex`, `SDL_SemWait`, `SDL_CondWait`, `SDL_WaitThread`). To avoid starving other threads, `SDL_SemTryWait` and `SDL_SemWaitTimeout` will yield if they fail to acquire the semaphore, see https://github.com/libsdl-org/SDL/pull/6776 for more information.

+ 103 - 103
docs/README-nacl.md

@@ -1,103 +1,103 @@
-Native Client
-================================================================================
-
-Requirements:
-
-* Native Client SDK (https://developer.chrome.com/native-client),
-  (tested with Pepper version 33 or higher).
-
-The SDL backend for Chrome's Native Client has been tested only with the PNaCl
-toolchain, which generates binaries designed to run on ARM and x86_32/64
-platforms. This does not mean it won't work with the other toolchains!
-
-================================================================================
-Building SDL for NaCl
-================================================================================
-
-Set up the right environment variables (see naclbuild.sh), then configure SDL with:
-
-    configure --host=pnacl --prefix some/install/destination
-
-Then "make".
-
-As an example of how to create a deployable app a Makefile project is provided
-in test/nacl/Makefile, which includes some monkey patching of the common.mk file
-provided by NaCl, without which linking properly to SDL won't work (the search
-path can't be modified externally, so the linker won't find SDL's binaries unless
-you dump them into the SDK path, which is inconvenient).
-Also provided in test/nacl is the required support file, such as index.html,
-manifest.json, etc.
-SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure.
-This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem),
-hiding the asynchronous nature of the browser behind the scenes...which is not the
-same as making it disappear!
-
-
-================================================================================
-Running tests
-================================================================================
-
-Due to the nature of NaCl programs, building and running SDL tests is not as
-straightforward as one would hope. The script naclbuild.sh in build-scripts
-automates the process and should serve as a guide for users of SDL trying to build
-their own applications.
-
-Basic usage:
-
-    ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
-
-This will build testgles2.c by default.
-
-If you want to build a different test, for example testrendercopyex.c:
-
-    SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
-
-Once the build finishes, you have to serve the contents with a web server (the
-script will give you instructions on how to do that with Python).
-
-================================================================================
-RWops and nacl_io
-================================================================================
-
-SDL_RWops work transparently with nacl_io. Two functions control the mount points:
-
-    int mount(const char* source, const char* target,
-                      const char* filesystemtype,
-                      unsigned long mountflags, const void *data);
-    int umount(const char *target);
-
-    For convenience, SDL will by default mount an httpfs tree at / before calling
-the app's main function. Such setting can be overridden by calling:
-
-    umount("/");
-
-And then mounting a different filesystem at /
-
-It's important to consider that the asynchronous nature of file operations on a
-browser is hidden from the application, effectively providing the developer with
-a set of blocking file operations just like you get in a regular desktop
-environment, which eases the job of porting to Native Client, but also introduces
-a set of challenges of its own, in particular when big file sizes and slow
-connections are involved.
-
-For more information on how nacl_io and mount points work, see:
-
-    https://developer.chrome.com/native-client/devguide/coding/nacl_io
-    https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
-
-To be able to save into the directory "/save/" (like backup of game) :
-
-    mount("", "/save", "html5fs", 0, "type=PERSISTENT");
-
-And add to manifest.json :
-
-    "permissions": [
-        "unlimitedStorage"
-    ]
-
-================================================================================
-TODO - Known Issues
-================================================================================
-* Testing of all systems with a real application (something other than SDL's tests)
-* Key events don't seem to work properly
-
+Native Client
+================================================================================
+
+Requirements:
+
+* Native Client SDK (https://developer.chrome.com/native-client),
+  (tested with Pepper version 33 or higher).
+
+The SDL backend for Chrome's Native Client has been tested only with the PNaCl
+toolchain, which generates binaries designed to run on ARM and x86_32/64
+platforms. This does not mean it won't work with the other toolchains!
+
+================================================================================
+Building SDL for NaCl
+================================================================================
+
+Set up the right environment variables (see naclbuild.sh), then configure SDL with:
+
+    configure --host=pnacl --prefix some/install/destination
+
+Then "make".
+
+As an example of how to create a deployable app a Makefile project is provided
+in test/nacl/Makefile, which includes some monkey patching of the common.mk file
+provided by NaCl, without which linking properly to SDL won't work (the search
+path can't be modified externally, so the linker won't find SDL's binaries unless
+you dump them into the SDK path, which is inconvenient).
+Also provided in test/nacl is the required support file, such as index.html,
+manifest.json, etc.
+SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure.
+This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem),
+hiding the asynchronous nature of the browser behind the scenes...which is not the
+same as making it disappear!
+
+
+================================================================================
+Running tests
+================================================================================
+
+Due to the nature of NaCl programs, building and running SDL tests is not as
+straightforward as one would hope. The script naclbuild.sh in build-scripts
+automates the process and should serve as a guide for users of SDL trying to build
+their own applications.
+
+Basic usage:
+
+    ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
+
+This will build testgles2.c by default.
+
+If you want to build a different test, for example testrendercopyex.c:
+
+    SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
+
+Once the build finishes, you have to serve the contents with a web server (the
+script will give you instructions on how to do that with Python).
+
+================================================================================
+RWops and nacl_io
+================================================================================
+
+SDL_RWops work transparently with nacl_io. Two functions control the mount points:
+
+    int mount(const char* source, const char* target,
+                      const char* filesystemtype,
+                      unsigned long mountflags, const void *data);
+    int umount(const char *target);
+
+    For convenience, SDL will by default mount an httpfs tree at / before calling
+the app's main function. Such setting can be overridden by calling:
+
+    umount("/");
+
+And then mounting a different filesystem at /
+
+It's important to consider that the asynchronous nature of file operations on a
+browser is hidden from the application, effectively providing the developer with
+a set of blocking file operations just like you get in a regular desktop
+environment, which eases the job of porting to Native Client, but also introduces
+a set of challenges of its own, in particular when big file sizes and slow
+connections are involved.
+
+For more information on how nacl_io and mount points work, see:
+
+    https://developer.chrome.com/native-client/devguide/coding/nacl_io
+    https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
+
+To be able to save into the directory "/save/" (like backup of game) :
+
+    mount("", "/save", "html5fs", 0, "type=PERSISTENT");
+
+And add to manifest.json :
+
+    "permissions": [
+        "unlimitedStorage"
+    ]
+
+================================================================================
+TODO - Known Issues
+================================================================================
+* Testing of all systems with a real application (something other than SDL's tests)
+* Key events don't seem to work properly
+

+ 44 - 44
docs/README-ngage.md

@@ -1,44 +1,44 @@
-Nokia N-Gage
-============
-
-SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage
-(Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev).
-
-Compiling
----------
-
-SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project.
-The library is included in the
-[toolchain](https://github.com/ngagesdk/ngage-toolchain) as a
-sub-module.
-
-A complete example project based on SDL2 can be found in the GitHub
-account of the SDK: [Wordle](https://github.com/ngagesdk/wordle).
-
-Current level of implementation
--------------------------------
-
-The video driver currently provides full screen video support with
-keyboard input.
-
-At the moment only the software renderer works.
-
-Audio is not yet implemented.
-
-Acknowledgements
-----------------
-
-Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the
-valuable insight into Symbian programming.  Without the SDL 1.2 port
-which was specially developed for CDoom (Doom for the Nokia 9210), this
-adaptation would not have been possible.
-
-I would like to thank my friends
-[Razvan](https://twitter.com/bewarerazvan) and [Dan
-Whelan](https://danwhelan.ie/), for their continuous support.  Without
-you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would
-have lost my patience long ago.
-
-Last but not least, I would like to thank the development team of
-[EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your
-patience and support in troubleshooting helped me a lot.
+Nokia N-Gage
+============
+
+SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage
+(Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev).
+
+Compiling
+---------
+
+SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project.
+The library is included in the
+[toolchain](https://github.com/ngagesdk/ngage-toolchain) as a
+sub-module.
+
+A complete example project based on SDL2 can be found in the GitHub
+account of the SDK: [Wordle](https://github.com/ngagesdk/wordle).
+
+Current level of implementation
+-------------------------------
+
+The video driver currently provides full screen video support with
+keyboard input.
+
+At the moment only the software renderer works.
+
+Audio is not yet implemented.
+
+Acknowledgements
+----------------
+
+Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the
+valuable insight into Symbian programming.  Without the SDL 1.2 port
+which was specially developed for CDoom (Doom for the Nokia 9210), this
+adaptation would not have been possible.
+
+I would like to thank my friends
+[Razvan](https://twitter.com/bewarerazvan) and [Dan
+Whelan](https://danwhelan.ie/), for their continuous support.  Without
+you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would
+have lost my patience long ago.
+
+Last but not least, I would like to thank the development team of
+[EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your
+patience and support in troubleshooting helped me a lot.

+ 92 - 92
docs/README-os2.md

@@ -1,92 +1,92 @@
-Simple DirectMedia Layer 2 for OS/2 & eComStation
-================================================================================
-SDL port for OS/2, authored by Andrey Vasilkin <[email protected]>, 2016
-
-
-OpenGL not supported by this port.
-
-Additional optional environment variables:
-
-SDL_AUDIO_SHARE
-  Values: 0 or 1, default is 0
-  Initializes the device as shareable or exclusively acquired.
-
-SDL_VIDEODRIVER
-  Values: DIVE or VMAN, default is DIVE
-  Use video subsystem: Direct interface video extensions (DIVE) or
-  Video Manager (VMAN).
-
-You may significantly increase video output speed with OS4 kernel and patched
-files vman.dll and dive.dll or with latest versions of ACPI support and video
-driver Panorama.
-
-Latest versions of OS/4 kernel:
-  http://gus.biysk.ru/os4/
- (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4)
-
-Patched files vman.dll and dive.dll:
-  http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR
-
-
-Compiling:
-----------
-
-Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see:
-https://github.com/open-watcom/ and https://open-watcom.github.io
-WATCOM environment variable must to be set to the Open Watcom install
-directory. To compile, run: wmake -f Makefile.os2
-
-
-Installing:
------------
-
-- eComStation:
-
-  If you have previously installed SDL2, make a Backup copy of SDL2.dll
-  located in D:\ecs\dll (where D: is disk on which installed eComStation).
-  Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll
-
-- OS/2:
-
-  Copy SDL2.dll to any directory on your LIBPATH.  If you have a previous
-  version installed, close all SDL2 applications before replacing the old
-  copy.  Also make sure that any other older versions of DLLs are removed
-  from your system.
-
-
-Joysticks in SDL2:
-------------------
-
-The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version.
-Here is the original documentation from SDL-1.2:
-
-The Joystick detection only works for standard joysticks (2 buttons, 2 axes
-and the like). Therefore, if you use a non-standard joystick, you should
-specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
-file or CONFIG.SYS, so SDL applications can provide full capability to your
-device. The syntax is:
-
-SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
-
-So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
-the line should be:
-
-SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
-
-If you want to add spaces in your joystick name, just surround it with
-quotes or double-quotes:
-
-SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
-
-or
-
-SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
-
-   Note however that Balls and Hats are not supported under OS/2, and the
-value will be ignored... but it is wise to define these correctly because
-in the future those can be supported.
-
-   Also the number of buttons is limited to 2 when using two joysticks,
-4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
-and 8 when using a joystick with 2 axes. Notice however these are limitations
-of the Joystick Port hardware, not OS/2.
+Simple DirectMedia Layer 2 for OS/2 & eComStation
+================================================================================
+SDL port for OS/2, authored by Andrey Vasilkin <[email protected]>, 2016
+
+
+OpenGL not supported by this port.
+
+Additional optional environment variables:
+
+SDL_AUDIO_SHARE
+  Values: 0 or 1, default is 0
+  Initializes the device as shareable or exclusively acquired.
+
+SDL_VIDEODRIVER
+  Values: DIVE or VMAN, default is DIVE
+  Use video subsystem: Direct interface video extensions (DIVE) or
+  Video Manager (VMAN).
+
+You may significantly increase video output speed with OS4 kernel and patched
+files vman.dll and dive.dll or with latest versions of ACPI support and video
+driver Panorama.
+
+Latest versions of OS/4 kernel:
+  http://gus.biysk.ru/os4/
+ (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4)
+
+Patched files vman.dll and dive.dll:
+  http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR
+
+
+Compiling:
+----------
+
+Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see:
+https://github.com/open-watcom/ and https://open-watcom.github.io
+WATCOM environment variable must to be set to the Open Watcom install
+directory. To compile, run: wmake -f Makefile.os2
+
+
+Installing:
+-----------
+
+- eComStation:
+
+  If you have previously installed SDL2, make a Backup copy of SDL2.dll
+  located in D:\ecs\dll (where D: is disk on which installed eComStation).
+  Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll
+
+- OS/2:
+
+  Copy SDL2.dll to any directory on your LIBPATH.  If you have a previous
+  version installed, close all SDL2 applications before replacing the old
+  copy.  Also make sure that any other older versions of DLLs are removed
+  from your system.
+
+
+Joysticks in SDL2:
+------------------
+
+The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version.
+Here is the original documentation from SDL-1.2:
+
+The Joystick detection only works for standard joysticks (2 buttons, 2 axes
+and the like). Therefore, if you use a non-standard joystick, you should
+specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
+file or CONFIG.SYS, so SDL applications can provide full capability to your
+device. The syntax is:
+
+SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
+
+So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
+the line should be:
+
+SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
+
+If you want to add spaces in your joystick name, just surround it with
+quotes or double-quotes:
+
+SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
+
+or
+
+SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
+
+   Note however that Balls and Hats are not supported under OS/2, and the
+value will be ignored... but it is wise to define these correctly because
+in the future those can be supported.
+
+   Also the number of buttons is limited to 2 when using two joysticks,
+4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
+and 8 when using a joystick with 2 axes. Notice however these are limitations
+of the Joystick Port hardware, not OS/2.

+ 17 - 17
docs/README-pandora.md

@@ -1,17 +1,17 @@
-Pandora
-=====================================================================
-
-( http://openpandora.org/ )
-- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
-support to work on the pandora under the framebuffer. This driver do not have
-input support for now, so if you use it you will have to add your own control code.
-The video driver name is "pandora" so if you have problem running it from
-the framebuffer, try to set the following variable before starting your application :
-"export SDL_VIDEODRIVER=pandora"
-
-- OpenGL ES support was added to the x11 driver, so it's working like the normal
-x11 driver one with OpenGLX support, with SDL input event's etc..
-
-
-David Carré (Cpasjuste)
[email protected]
+Pandora
+=====================================================================
+
+( http://openpandora.org/ )
+- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
+support to work on the pandora under the framebuffer. This driver do not have
+input support for now, so if you use it you will have to add your own control code.
+The video driver name is "pandora" so if you have problem running it from
+the framebuffer, try to set the following variable before starting your application :
+"export SDL_VIDEODRIVER=pandora"
+
+- OpenGL ES support was added to the x11 driver, so it's working like the normal
+x11 driver one with OpenGLX support, with SDL input event's etc..
+
+
+David Carré (Cpasjuste)
[email protected]

+ 8 - 8
docs/README-platforms.md

@@ -1,8 +1,8 @@
-Platforms
-=========
-
-We maintain the list of supported platforms on our wiki now, and how to
-build and install SDL for those platforms:
-
-    https://wiki.libsdl.org/Installation
-
+Platforms
+=========
+
+We maintain the list of supported platforms on our wiki now, and how to
+build and install SDL for those platforms:
+
+    https://wiki.libsdl.org/Installation
+

+ 68 - 68
docs/README-porting.md

@@ -1,68 +1,68 @@
-Porting
-=======
-
-* Porting To A New Platform
-
-  The first thing you have to do when porting to a new platform, is look at
-include/SDL_platform.h and create an entry there for your operating system.
-The standard format is "__PLATFORM__", where PLATFORM is the name of the OS.
-Ideally SDL_platform.h will be able to auto-detect the system it's building
-on based on C preprocessor symbols.
-
-There are two basic ways of building SDL at the moment:
-
-1. The "UNIX" way:  ./configure; make; make install
-
-   If you have a GNUish system, then you might try this.  Edit configure.ac,
-   take a look at the large section labelled:
-
-	"Set up the configuration based on the host platform!"
-
-   Add a section for your platform, and then re-run autogen.sh and build!
-
-2. Using an IDE:
-
-   If you're using an IDE or other non-configure build system, you'll probably
-   want to create a custom SDL_config.h for your platform.  Edit SDL_config.h,
-   add a section for your platform, and create a custom SDL_config_{platform}.h,
-   based on SDL_config_minimal.h and SDL_config.h.in
-
-   Add the top level include directory to the header search path, and then add
-   the following sources to the project:
-
-	src/*.c
-	src/atomic/*.c
-	src/audio/*.c
-	src/cpuinfo/*.c
-	src/events/*.c
-	src/file/*.c
-	src/haptic/*.c
-	src/joystick/*.c
-	src/power/*.c
-	src/render/*.c
-	src/render/software/*.c
-	src/stdlib/*.c
-	src/thread/*.c
-	src/timer/*.c
-	src/video/*.c
-	src/audio/disk/*.c
-	src/audio/dummy/*.c
-	src/filesystem/dummy/*.c
-	src/video/dummy/*.c
-	src/haptic/dummy/*.c
-	src/joystick/dummy/*.c
-	src/main/dummy/*.c
-	src/thread/generic/*.c
-	src/timer/dummy/*.c
-	src/loadso/dummy/*.c
-
-
-Once you have a working library without any drivers, you can go back to each
-of the major subsystems and start implementing drivers for your platform.
-
-If you have any questions, don't hesitate to ask on the SDL mailing list:
-	http://www.libsdl.org/mailing-list.php
-
-Enjoy!
-	Sam Lantinga				([email protected])
-
+Porting
+=======
+
+* Porting To A New Platform
+
+  The first thing you have to do when porting to a new platform, is look at
+include/SDL_platform.h and create an entry there for your operating system.
+The standard format is "__PLATFORM__", where PLATFORM is the name of the OS.
+Ideally SDL_platform.h will be able to auto-detect the system it's building
+on based on C preprocessor symbols.
+
+There are two basic ways of building SDL at the moment:
+
+1. The "UNIX" way:  ./configure; make; make install
+
+   If you have a GNUish system, then you might try this.  Edit configure.ac,
+   take a look at the large section labelled:
+
+	"Set up the configuration based on the host platform!"
+
+   Add a section for your platform, and then re-run autogen.sh and build!
+
+2. Using an IDE:
+
+   If you're using an IDE or other non-configure build system, you'll probably
+   want to create a custom SDL_config.h for your platform.  Edit SDL_config.h,
+   add a section for your platform, and create a custom SDL_config_{platform}.h,
+   based on SDL_config_minimal.h and SDL_config.h.in
+
+   Add the top level include directory to the header search path, and then add
+   the following sources to the project:
+
+	src/*.c
+	src/atomic/*.c
+	src/audio/*.c
+	src/cpuinfo/*.c
+	src/events/*.c
+	src/file/*.c
+	src/haptic/*.c
+	src/joystick/*.c
+	src/power/*.c
+	src/render/*.c
+	src/render/software/*.c
+	src/stdlib/*.c
+	src/thread/*.c
+	src/timer/*.c
+	src/video/*.c
+	src/audio/disk/*.c
+	src/audio/dummy/*.c
+	src/filesystem/dummy/*.c
+	src/video/dummy/*.c
+	src/haptic/dummy/*.c
+	src/joystick/dummy/*.c
+	src/main/dummy/*.c
+	src/thread/generic/*.c
+	src/timer/dummy/*.c
+	src/loadso/dummy/*.c
+
+
+Once you have a working library without any drivers, you can go back to each
+of the major subsystems and start implementing drivers for your platform.
+
+If you have any questions, don't hesitate to ask on the SDL mailing list:
+	http://www.libsdl.org/mailing-list.php
+
+Enjoy!
+	Sam Lantinga				([email protected])
+

+ 51 - 51
docs/README-ps2.md

@@ -1,51 +1,51 @@
-PS2
-======
-SDL2 port for the Sony Playstation 2 contributed by:
-- Francisco Javier Trujillo Mata
-
-
-Credit to
-   - The guys that ported SDL to PSP & Vita because I'm taking them as reference.
-   - David G. F. for helping me with several issues and tests.
-
-## Building
-To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run:
-```bash
-cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake
-cmake --build build
-cmake --install build
-```
-
-## Hints
-The PS2 port has a special Hint for having a dynamic VSYNC. The Hint is `SDL_HINT_PS2_DYNAMIC_VSYNC`.
-If you enabled the dynamic vsync having as well `SDL_RENDERER_PRESENTVSYNC` enabled, then if the app is not able to run at 60 FPS, automatically the `vsync` will be disabled having a better performance, instead of droping FPS to 30.
-
-## Notes
-If you trying to debug a SDL app through [ps2client](https://github.com/ps2dev/ps2client) you need to avoid the IOP reset, otherwise you will lose the conection with your computer.
-So to avoid the reset of the IOP CPU, you need to call to the macro `SDL_PS2_SKIP_IOP_RESET();`.
-It could be something similar as:
-```c
-.....
-
-SDL_PS2_SKIP_IOP_RESET();
-
-int main(int argc, char *argv[])
-{
-.....
-```
-For a release binary is recommendable to reset the IOP always.
-
-Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_SKIP_IOP_RESET` otherwise the change won't be reflected.
-
-## Getting PS2 Dev
-[Installing PS2 Dev](https://github.com/ps2dev/ps2dev)
-
-## Running on PCSX2 Emulator
-[PCSX2](https://github.com/PCSX2/pcsx2)
-
-[More PCSX2 information](https://pcsx2.net/)
-
-## To Do
-- PS2 Screen Keyboard
-- Dialogs
-- Others
+PS2
+======
+SDL2 port for the Sony Playstation 2 contributed by:
+- Francisco Javier Trujillo Mata
+
+
+Credit to
+   - The guys that ported SDL to PSP & Vita because I'm taking them as reference.
+   - David G. F. for helping me with several issues and tests.
+
+## Building
+To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run:
+```bash
+cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake
+cmake --build build
+cmake --install build
+```
+
+## Hints
+The PS2 port has a special Hint for having a dynamic VSYNC. The Hint is `SDL_HINT_PS2_DYNAMIC_VSYNC`.
+If you enabled the dynamic vsync having as well `SDL_RENDERER_PRESENTVSYNC` enabled, then if the app is not able to run at 60 FPS, automatically the `vsync` will be disabled having a better performance, instead of droping FPS to 30.
+
+## Notes
+If you trying to debug a SDL app through [ps2client](https://github.com/ps2dev/ps2client) you need to avoid the IOP reset, otherwise you will lose the conection with your computer.
+So to avoid the reset of the IOP CPU, you need to call to the macro `SDL_PS2_SKIP_IOP_RESET();`.
+It could be something similar as:
+```c
+.....
+
+SDL_PS2_SKIP_IOP_RESET();
+
+int main(int argc, char *argv[])
+{
+.....
+```
+For a release binary is recommendable to reset the IOP always.
+
+Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_SKIP_IOP_RESET` otherwise the change won't be reflected.
+
+## Getting PS2 Dev
+[Installing PS2 Dev](https://github.com/ps2dev/ps2dev)
+
+## Running on PCSX2 Emulator
+[PCSX2](https://github.com/PCSX2/pcsx2)
+
+[More PCSX2 information](https://pcsx2.net/)
+
+## To Do
+- PS2 Screen Keyboard
+- Dialogs
+- Others

+ 36 - 36
docs/README-psp.md

@@ -1,36 +1,36 @@
-PSP
-======
-SDL2 port for the Sony PSP contributed by:
-- Captian Lex
-- Francisco Javier Trujillo Mata
-- Wouter Wijsman
-
-
-Credit to
-   Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
-   Geecko for his PSP GU lib "Glib2d"
-
-## Building
-To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run:
-```bash
-cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake
-cmake --build build
-cmake --install build
-```
-
-
-## Getting PSP Dev
-[Installing PSP Dev](https://github.com/pspdev/pspdev)
-
-## Running on PPSSPP Emulator
-[PPSSPP](https://github.com/hrydgard/ppsspp)
-
-[Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions)
-
-
-## Compiling a HelloWorld
-[PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world)
-
-## To Do
-- PSP Screen Keyboard
-- Dialogs
+PSP
+======
+SDL2 port for the Sony PSP contributed by:
+- Captian Lex
+- Francisco Javier Trujillo Mata
+- Wouter Wijsman
+
+
+Credit to
+   Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
+   Geecko for his PSP GU lib "Glib2d"
+
+## Building
+To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run:
+```bash
+cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake
+cmake --build build
+cmake --install build
+```
+
+
+## Getting PSP Dev
+[Installing PSP Dev](https://github.com/pspdev/pspdev)
+
+## Running on PPSSPP Emulator
+[PPSSPP](https://github.com/hrydgard/ppsspp)
+
+[Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions)
+
+
+## Compiling a HelloWorld
+[PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world)
+
+## To Do
+- PSP Screen Keyboard
+- Dialogs

+ 180 - 180
docs/README-raspberrypi.md

@@ -1,180 +1,180 @@
-Raspberry Pi
-============
-
-Requirements:
-
-Raspbian (other Linux distros may work as well).
-
-Features
---------
-
-* Works without X11
-* Hardware accelerated OpenGL ES 2.x
-* Sound via ALSA
-* Input (mouse/keyboard/joystick) via EVDEV
-* Hotplugging of input devices via UDEV
-
-
-Raspbian Build Dependencies
----------------------------
-
-sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev
-
-You also need the VideoCore binary stuff that ships in /opt/vc for EGL and
-OpenGL ES 2.x, it usually comes pre-installed, but in any case:
-
-sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev
-
-
-NEON
-----
-
-If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so
-that SDL will select some otherwise-disabled highly-optimized code. The
-original Pi units don't have NEON, the Pi2 probably does, and the Pi3
-definitely does.
-
-
-Cross compiling from x86 Linux
-------------------------------
-
-To cross compile SDL for Raspbian from your desktop machine, you'll need a
-Raspbian system root and the cross compilation tools. We'll assume these tools
-will be placed in /opt/rpi-tools
-
-    sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools
-
-You'll also need a Raspbian binary image.
-Get it from: http://downloads.raspberrypi.org/raspbian_latest
-After unzipping, you'll get file with a name like: "<date>-wheezy-raspbian.img"
-Let's assume the sysroot will be built in /opt/rpi-sysroot.
-
-    export SYSROOT=/opt/rpi-sysroot
-    sudo kpartx -a -v <path_to_raspbian_image>.img
-    sudo mount -o loop /dev/mapper/loop0p2 /mnt
-    sudo cp -r /mnt $SYSROOT
-    sudo apt-get install qemu binfmt-support qemu-user-static
-    sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin
-    sudo mount --bind /dev $SYSROOT/dev
-    sudo mount --bind /proc $SYSROOT/proc
-    sudo mount --bind /sys $SYSROOT/sys
-
-Now, before chrooting into the ARM sysroot, you'll need to apply a workaround,
-edit $SYSROOT/etc/ld.so.preload and comment out all lines in it.
-
-    sudo chroot $SYSROOT
-    apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev
-    exit
-    sudo umount $SYSROOT/dev
-    sudo umount $SYSROOT/proc
-    sudo umount $SYSROOT/sys
-    sudo umount /mnt
-
-There's one more fix required, as the libdl.so symlink uses an absolute path
-which doesn't quite work in our setup.
-
-    sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
-    sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
-
-The final step is compiling SDL itself.
-
-    export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux"
-    cd <SDL SOURCE>
-    mkdir -p build;cd build
-    LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd
-    make
-    make install
-
-To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths:
-
-    perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config
-
-Apps don't work or poor video/audio performance
------------------------------------------------
-
-If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to
-update the RPi's firmware. Note that doing so will fix these problems, but it
-will also render the CMA - Dynamic Memory Split functionality useless.
-
-Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too
-low in general, specially if a 1080p TV is hooked up.
-
-See here how to configure this setting: http://elinux.org/RPiconfig
-
-Using a fixed gpu_mem=128 is the best option (specially if you updated the
-firmware, using CMA probably won't work, at least it's the current case).
-
-No input
---------
-
-Make sure you belong to the "input" group.
-
-    sudo usermod -aG input `whoami`
-
-No HDMI Audio
--------------
-
-If you notice that ALSA works but there's no audio over HDMI, try adding:
-
-    hdmi_drive=2
-
-to your config.txt file and reboot.
-
-Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062
-
-Text Input API support
-----------------------
-
-The Text Input API is supported, with translation of scan codes done via the
-kernel symbol tables. For this to work, SDL needs access to a valid console.
-If you notice there's no SDL_TEXTINPUT message being emitted, double check that
-your app has read access to one of the following:
-
-* /proc/self/fd/0
-* /dev/tty
-* /dev/tty[0...6]
-* /dev/vc/0
-* /dev/console
-
-This is usually not a problem if you run from the physical terminal (as opposed
-to running from a pseudo terminal, such as via SSH). If running from a PTS, a
-quick workaround is to run your app as root or add yourself to the tty group,
-then re-login to the system.
-
-    sudo usermod -aG tty `whoami`
-
-The keyboard layout used by SDL is the same as the one the kernel uses.
-To configure the layout on Raspbian:
-
-    sudo dpkg-reconfigure keyboard-configuration
-
-To configure the locale, which controls which keys are interpreted as letters,
-this determining the CAPS LOCK behavior:
-
-    sudo dpkg-reconfigure locales
-
-
-OpenGL problems
----------------
-
-If you have desktop OpenGL headers installed at build time in your RPi or cross
-compilation environment, support for it will be built in. However, the chipset
-does not actually have support for it, which causes issues in certain SDL apps
-since the presence of OpenGL support supersedes the ES/ES2 variants.
-The workaround is to disable OpenGL at configuration time:
-
-    ./configure --disable-video-opengl
-
-Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER
-environment variable:
-
-    export SDL_RENDER_DRIVER=opengles2
-
-Notes
------
-
-* When launching apps remotely (via SSH), SDL can prevent local keystrokes from
-  leaking into the console only if it has root privileges. Launching apps locally
-  does not suffer from this issue.
-
-
+Raspberry Pi
+============
+
+Requirements:
+
+Raspbian (other Linux distros may work as well).
+
+Features
+--------
+
+* Works without X11
+* Hardware accelerated OpenGL ES 2.x
+* Sound via ALSA
+* Input (mouse/keyboard/joystick) via EVDEV
+* Hotplugging of input devices via UDEV
+
+
+Raspbian Build Dependencies
+---------------------------
+
+sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev
+
+You also need the VideoCore binary stuff that ships in /opt/vc for EGL and
+OpenGL ES 2.x, it usually comes pre-installed, but in any case:
+
+sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev
+
+
+NEON
+----
+
+If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so
+that SDL will select some otherwise-disabled highly-optimized code. The
+original Pi units don't have NEON, the Pi2 probably does, and the Pi3
+definitely does.
+
+
+Cross compiling from x86 Linux
+------------------------------
+
+To cross compile SDL for Raspbian from your desktop machine, you'll need a
+Raspbian system root and the cross compilation tools. We'll assume these tools
+will be placed in /opt/rpi-tools
+
+    sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools
+
+You'll also need a Raspbian binary image.
+Get it from: http://downloads.raspberrypi.org/raspbian_latest
+After unzipping, you'll get file with a name like: "<date>-wheezy-raspbian.img"
+Let's assume the sysroot will be built in /opt/rpi-sysroot.
+
+    export SYSROOT=/opt/rpi-sysroot
+    sudo kpartx -a -v <path_to_raspbian_image>.img
+    sudo mount -o loop /dev/mapper/loop0p2 /mnt
+    sudo cp -r /mnt $SYSROOT
+    sudo apt-get install qemu binfmt-support qemu-user-static
+    sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin
+    sudo mount --bind /dev $SYSROOT/dev
+    sudo mount --bind /proc $SYSROOT/proc
+    sudo mount --bind /sys $SYSROOT/sys
+
+Now, before chrooting into the ARM sysroot, you'll need to apply a workaround,
+edit $SYSROOT/etc/ld.so.preload and comment out all lines in it.
+
+    sudo chroot $SYSROOT
+    apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev
+    exit
+    sudo umount $SYSROOT/dev
+    sudo umount $SYSROOT/proc
+    sudo umount $SYSROOT/sys
+    sudo umount /mnt
+
+There's one more fix required, as the libdl.so symlink uses an absolute path
+which doesn't quite work in our setup.
+
+    sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
+    sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
+
+The final step is compiling SDL itself.
+
+    export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux"
+    cd <SDL SOURCE>
+    mkdir -p build;cd build
+    LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd
+    make
+    make install
+
+To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths:
+
+    perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config
+
+Apps don't work or poor video/audio performance
+-----------------------------------------------
+
+If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to
+update the RPi's firmware. Note that doing so will fix these problems, but it
+will also render the CMA - Dynamic Memory Split functionality useless.
+
+Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too
+low in general, specially if a 1080p TV is hooked up.
+
+See here how to configure this setting: http://elinux.org/RPiconfig
+
+Using a fixed gpu_mem=128 is the best option (specially if you updated the
+firmware, using CMA probably won't work, at least it's the current case).
+
+No input
+--------
+
+Make sure you belong to the "input" group.
+
+    sudo usermod -aG input `whoami`
+
+No HDMI Audio
+-------------
+
+If you notice that ALSA works but there's no audio over HDMI, try adding:
+
+    hdmi_drive=2
+
+to your config.txt file and reboot.
+
+Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062
+
+Text Input API support
+----------------------
+
+The Text Input API is supported, with translation of scan codes done via the
+kernel symbol tables. For this to work, SDL needs access to a valid console.
+If you notice there's no SDL_TEXTINPUT message being emitted, double check that
+your app has read access to one of the following:
+
+* /proc/self/fd/0
+* /dev/tty
+* /dev/tty[0...6]
+* /dev/vc/0
+* /dev/console
+
+This is usually not a problem if you run from the physical terminal (as opposed
+to running from a pseudo terminal, such as via SSH). If running from a PTS, a
+quick workaround is to run your app as root or add yourself to the tty group,
+then re-login to the system.
+
+    sudo usermod -aG tty `whoami`
+
+The keyboard layout used by SDL is the same as the one the kernel uses.
+To configure the layout on Raspbian:
+
+    sudo dpkg-reconfigure keyboard-configuration
+
+To configure the locale, which controls which keys are interpreted as letters,
+this determining the CAPS LOCK behavior:
+
+    sudo dpkg-reconfigure locales
+
+
+OpenGL problems
+---------------
+
+If you have desktop OpenGL headers installed at build time in your RPi or cross
+compilation environment, support for it will be built in. However, the chipset
+does not actually have support for it, which causes issues in certain SDL apps
+since the presence of OpenGL support supersedes the ES/ES2 variants.
+The workaround is to disable OpenGL at configuration time:
+
+    ./configure --disable-video-opengl
+
+Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER
+environment variable:
+
+    export SDL_RENDER_DRIVER=opengles2
+
+Notes
+-----
+
+* When launching apps remotely (via SSH), SDL can prevent local keystrokes from
+  leaking into the console only if it has root privileges. Launching apps locally
+  does not suffer from this issue.
+
+

+ 41 - 41
docs/README-riscos.md

@@ -1,41 +1,41 @@
-RISC OS
-=======
-
-Requirements:
-
-* RISC OS 3.5 or later.
-* [SharedUnixLibrary](http://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibraryarm).
-* [DigitalRenderer](http://www.riscos.info/packages/LibraryDetails.html#DRendererarm), for audio support.
-* [Iconv](http://www.netsurf-browser.org/projects/iconv/), for `SDL_iconv` and related functions.
-
-
-Compiling:
-----------
-
-Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported.
-
-The following commands can be used to build SDL2 for RISC OS using autoconf:
-
-    ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics
-    make
-    make install
-
-The following commands can be used to build SDL2 for RISC OS using CMake:
-
-    cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF
-    cmake --build build-riscos
-    cmake --build build-riscos --target install
-
-
-Current level of implementation
--------------------------------
-
-The video driver currently provides full screen video support with keyboard and mouse input. Windowed mode is not yet supported, but is planned in the future. Only software rendering is supported.
-
-The filesystem APIs return either Unix-style paths or RISC OS-style paths based on the value of the `__riscosify_control` symbol, as is standard for UnixLib functions.
-
-The audio, loadso, thread and timer APIs are currently provided by UnixLib.
-
-GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake.
-
-The joystick, locale and power APIs are not yet implemented.
+RISC OS
+=======
+
+Requirements:
+
+* RISC OS 3.5 or later.
+* [SharedUnixLibrary](http://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibraryarm).
+* [DigitalRenderer](http://www.riscos.info/packages/LibraryDetails.html#DRendererarm), for audio support.
+* [Iconv](http://www.netsurf-browser.org/projects/iconv/), for `SDL_iconv` and related functions.
+
+
+Compiling:
+----------
+
+Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported.
+
+The following commands can be used to build SDL2 for RISC OS using autoconf:
+
+    ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics
+    make
+    make install
+
+The following commands can be used to build SDL2 for RISC OS using CMake:
+
+    cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF
+    cmake --build build-riscos
+    cmake --build build-riscos --target install
+
+
+Current level of implementation
+-------------------------------
+
+The video driver currently provides full screen video support with keyboard and mouse input. Windowed mode is not yet supported, but is planned in the future. Only software rendering is supported.
+
+The filesystem APIs return either Unix-style paths or RISC OS-style paths based on the value of the `__riscosify_control` symbol, as is standard for UnixLib functions.
+
+The audio, loadso, thread and timer APIs are currently provided by UnixLib.
+
+GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake.
+
+The joystick, locale and power APIs are not yet implemented.

+ 86 - 86
docs/README-touch.md

@@ -1,86 +1,86 @@
-Touch
-===========================================================================
-System Specific Notes
-===========================================================================
-Linux:
-The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at [email protected] and I will help you get support for it.
-
-Mac:
-The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
-
-iPhone:
-Works out of box.
-
-Windows:
-Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at [email protected]
-
-===========================================================================
-Events
-===========================================================================
-SDL_FINGERDOWN:
-Sent when a finger (or stylus) is placed on a touch device.
-Fields:
-* event.tfinger.touchId  - the Id of the touch device.
-* event.tfinger.fingerId - the Id of the finger which just went down.
-* event.tfinger.x        - the x coordinate of the touch (0..1)
-* event.tfinger.y        - the y coordinate of the touch (0..1)
-* event.tfinger.pressure - the pressure of the touch (0..1)
-
-SDL_FINGERMOTION:
-Sent when a finger (or stylus) is moved on the touch device.
-Fields:
-Same as SDL_FINGERDOWN but with additional:
-* event.tfinger.dx       - change in x coordinate during this motion event.
-* event.tfinger.dy       - change in y coordinate during this motion event.
-
-SDL_FINGERUP:
-Sent when a finger (or stylus) is lifted from the touch device.
-Fields:
-Same as SDL_FINGERDOWN.
-
-
-===========================================================================
-Functions
-===========================================================================
-SDL provides the ability to access the underlying SDL_Finger structures.
-These structures should _never_ be modified.
-
-The following functions are included from SDL_touch.h
-
-To get a SDL_TouchID call SDL_GetTouchDevice(int index).
-This returns a SDL_TouchID.
-IMPORTANT: If the touch has been removed, or there is no touch with the given index, SDL_GetTouchDevice() will return 0. Be sure to check for this!
-
-The number of touch devices can be queried with SDL_GetNumTouchDevices().
-
-A SDL_TouchID may be used to get pointers to SDL_Finger.
-
-SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
-
-The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
-
-      float x = event.tfinger.x;
-      float y = event.tfinger.y;
-
-
-
-To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger.
-This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed.
-A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
-As a result, be very careful to check for NULL return values.
-
-A SDL_Finger has the following fields:
-* x, y:
-	The current coordinates of the touch.
-* pressure:
-	The pressure of the touch.
-
-
-===========================================================================
-Notes
-===========================================================================
-For a complete example see test/testgesture.c
-
-Please direct questions/comments to:
-   [email protected]
-   (original author, API was changed since)
+Touch
+===========================================================================
+System Specific Notes
+===========================================================================
+Linux:
+The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at [email protected] and I will help you get support for it.
+
+Mac:
+The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
+
+iPhone:
+Works out of box.
+
+Windows:
+Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at [email protected]
+
+===========================================================================
+Events
+===========================================================================
+SDL_FINGERDOWN:
+Sent when a finger (or stylus) is placed on a touch device.
+Fields:
+* event.tfinger.touchId  - the Id of the touch device.
+* event.tfinger.fingerId - the Id of the finger which just went down.
+* event.tfinger.x        - the x coordinate of the touch (0..1)
+* event.tfinger.y        - the y coordinate of the touch (0..1)
+* event.tfinger.pressure - the pressure of the touch (0..1)
+
+SDL_FINGERMOTION:
+Sent when a finger (or stylus) is moved on the touch device.
+Fields:
+Same as SDL_FINGERDOWN but with additional:
+* event.tfinger.dx       - change in x coordinate during this motion event.
+* event.tfinger.dy       - change in y coordinate during this motion event.
+
+SDL_FINGERUP:
+Sent when a finger (or stylus) is lifted from the touch device.
+Fields:
+Same as SDL_FINGERDOWN.
+
+
+===========================================================================
+Functions
+===========================================================================
+SDL provides the ability to access the underlying SDL_Finger structures.
+These structures should _never_ be modified.
+
+The following functions are included from SDL_touch.h
+
+To get a SDL_TouchID call SDL_GetTouchDevice(int index).
+This returns a SDL_TouchID.
+IMPORTANT: If the touch has been removed, or there is no touch with the given index, SDL_GetTouchDevice() will return 0. Be sure to check for this!
+
+The number of touch devices can be queried with SDL_GetNumTouchDevices().
+
+A SDL_TouchID may be used to get pointers to SDL_Finger.
+
+SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
+
+The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
+
+      float x = event.tfinger.x;
+      float y = event.tfinger.y;
+
+
+
+To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger.
+This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed.
+A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
+As a result, be very careful to check for NULL return values.
+
+A SDL_Finger has the following fields:
+* x, y:
+	The current coordinates of the touch.
+* pressure:
+	The pressure of the touch.
+
+
+===========================================================================
+Notes
+===========================================================================
+For a complete example see test/testgesture.c
+
+Please direct questions/comments to:
+   [email protected]
+   (original author, API was changed since)

+ 60 - 60
docs/README-versions.md

@@ -1,60 +1,60 @@
-# Versioning
-
-## Since 2.23.0
-
-SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak
-and older versions of the Linux kernel:
-
-* The major version (first part) increases when backwards compatibility
-    is broken, which will happen infrequently.
-
-* If the minor version (second part) is divisible by 2
-    (for example 2.24.x, 2.26.x), this indicates a version of SDL that
-    is believed to be stable and suitable for production use.
-
-    * In stable releases, the patchlevel or micro version (third part)
-        indicates bugfix releases. Bugfix releases should not add or
-        remove ABI, so the ".0" release (for example 2.24.0) should be
-        forwards-compatible with all the bugfix releases from the
-        same cycle (for example 2.24.1).
-
-    * The minor version increases when new API or ABI is added, or when
-        other significant changes are made. Newer minor versions are
-        backwards-compatible, but not fully forwards-compatible.
-        For example, programs built against SDL 2.24.x should work fine
-        with SDL 2.26.x, but programs built against SDL 2.26.x will not
-        necessarily work with 2.24.x.
-
-* If the minor version (second part) is not divisible by 2
-    (for example 2.23.x, 2.25.x), this indicates a development prerelease
-    of SDL that is not suitable for stable software distributions.
-    Use with caution.
-
-    * The patchlevel or micro version (third part) increases with
-        each prerelease.
-
-    * Each prerelease might add new API and/or ABI.
-
-    * Prereleases are backwards-compatible with older stable branches.
-        For example, 2.25.x will be backwards-compatible with 2.24.x.
-
-    * Prereleases are not guaranteed to be backwards-compatible with
-        each other. For example, new API or ABI added in 2.25.1
-        might be removed or changed in 2.25.2.
-        If this would be a problem for you, please do not use prereleases.
-
-    * Only upgrade to a prerelease if you can guarantee that you will
-        promptly upgrade to the stable release that follows it.
-        For example, do not upgrade to 2.23.x unless you will be able to
-        upgrade to 2.24.0 when it becomes available.
-
-    * Software distributions that have a freeze policy (in particular Linux
-        distributions with a release cycle, such as Debian and Fedora)
-        should usually only package stable releases, and not prereleases.
-
-## Before 2.23.0
-
-Older versions of SDL followed a similar policy, but instead of the
-odd/even rule applying to the minor version, it applied to the patchlevel
-(micro version, third part). For example, 2.0.22 was a stable release
-and 2.0.21 was a prerelease.
+# Versioning
+
+## Since 2.23.0
+
+SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak
+and older versions of the Linux kernel:
+
+* The major version (first part) increases when backwards compatibility
+    is broken, which will happen infrequently.
+
+* If the minor version (second part) is divisible by 2
+    (for example 2.24.x, 2.26.x), this indicates a version of SDL that
+    is believed to be stable and suitable for production use.
+
+    * In stable releases, the patchlevel or micro version (third part)
+        indicates bugfix releases. Bugfix releases should not add or
+        remove ABI, so the ".0" release (for example 2.24.0) should be
+        forwards-compatible with all the bugfix releases from the
+        same cycle (for example 2.24.1).
+
+    * The minor version increases when new API or ABI is added, or when
+        other significant changes are made. Newer minor versions are
+        backwards-compatible, but not fully forwards-compatible.
+        For example, programs built against SDL 2.24.x should work fine
+        with SDL 2.26.x, but programs built against SDL 2.26.x will not
+        necessarily work with 2.24.x.
+
+* If the minor version (second part) is not divisible by 2
+    (for example 2.23.x, 2.25.x), this indicates a development prerelease
+    of SDL that is not suitable for stable software distributions.
+    Use with caution.
+
+    * The patchlevel or micro version (third part) increases with
+        each prerelease.
+
+    * Each prerelease might add new API and/or ABI.
+
+    * Prereleases are backwards-compatible with older stable branches.
+        For example, 2.25.x will be backwards-compatible with 2.24.x.
+
+    * Prereleases are not guaranteed to be backwards-compatible with
+        each other. For example, new API or ABI added in 2.25.1
+        might be removed or changed in 2.25.2.
+        If this would be a problem for you, please do not use prereleases.
+
+    * Only upgrade to a prerelease if you can guarantee that you will
+        promptly upgrade to the stable release that follows it.
+        For example, do not upgrade to 2.23.x unless you will be able to
+        upgrade to 2.24.0 when it becomes available.
+
+    * Software distributions that have a freeze policy (in particular Linux
+        distributions with a release cycle, such as Debian and Fedora)
+        should usually only package stable releases, and not prereleases.
+
+## Before 2.23.0
+
+Older versions of SDL followed a similar policy, but instead of the
+odd/even rule applying to the minor version, it applied to the patchlevel
+(micro version, third part). For example, 2.0.22 was a stable release
+and 2.0.21 was a prerelease.

+ 114 - 114
docs/README-visualc.md

@@ -1,114 +1,114 @@
-Using SDL with Microsoft Visual C++
-===================================
-
-### by Lion Kimbro with additions by James Turk
-
-You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL
-yourself.
-
-### Building SDL
-
-0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from
-the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web).
-_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_
-
-1. Open the Visual Studio solution file at `./VisualC/SDL.sln`.
-
-2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog,
-all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with
-the `Platform Toolset`.
-
-If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`.
-
-3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_
-panel in the _FileView_ tab), and selecting `Build`.
-
-You may get a few warnings, but you should not get any errors.
-
-Later, we will refer to the following `.lib` and `.dll` files that have just been generated:
-
--   `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll`
--   `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib`
--   `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib`
-
-_Note for the `x64` versions, just replace `Win32` in the path with `x64`_
-
-### Creating a Project with SDL
-
-- Create a project as a `Win32 Application`.
-
-- Create a C++ file for your project.
-
-- Set the C runtime to `Multi-threaded DLL` in the menu:
-`Project|Settings|C/C++                  tab|Code Generation|Runtime Library `.
-
-- Add the SDL `include` directory to your list of includes in the menu:
-`Project|Settings|C/C++ tab|Preprocessor|Additional include directories `
-
-*VC7 Specific: Instead of doing this, I find it easier to add the
-include and library directories to the list that VC7 keeps. Do this by
-selecting Tools|Options|Projects|VC++ Directories and under the "Show
-Directories For:" dropbox select "Include Files", and click the "New
-Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you
-installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the
-dropbox selection to "Library Files" and add [SDLROOT]\\lib.*
-
-The "include directory" I am referring to is the `./include` folder.
-
-Now we're going to use the files that we had created earlier in the *Build SDL* step.
-
-Copy the following file into your Project directory:
-
--   `SDL2.dll`
-
-Add the following files to your project (It is not necessary to copy them to your project directory):
-
--   `SDL2.lib`
--   `SDL2main.lib`
-
-To add them to your project, right click on your project, and select
-`Add files to project`.
-
-**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line
-and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration
-(e.g. Release,Debug).**
-
-### Hello SDL2
-
-Here's a sample SDL snippet to verify everything is setup in your IDE:
-
-```
-    #include "SDL.h"
-
-    int main( int argc, char* argv[] )
-    {
-        const int WIDTH = 640;
-        const int HEIGHT = 480;
-        SDL_Window* window = NULL;
-        SDL_Renderer* renderer = NULL;
-
-        SDL_Init(SDL_INIT_VIDEO);
-        window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
-        renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
-
-        SDL_DestroyRenderer(renderer);
-        SDL_DestroyWindow(window);
-        SDL_Quit();
-        return 0;
-    }
- ```
-
-### That's it!
-
-I hope that this document has helped you get through the most difficult part of using the SDL: installing it.
-Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues).
-
-### Credits
-
-Thanks to [Paulus Esterhazy](mailto:[email protected]), for the work on VC++ port.
-
-This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:[email protected]).
-
-Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:[email protected]).
-
-Minor Fixes and Visual C++ 7 Information (In Green) was added by [James Turk](mailto:[email protected])
+Using SDL with Microsoft Visual C++
+===================================
+
+### by Lion Kimbro with additions by James Turk
+
+You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL
+yourself.
+
+### Building SDL
+
+0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from
+the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web).
+_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_
+
+1. Open the Visual Studio solution file at `./VisualC/SDL.sln`.
+
+2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog,
+all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with
+the `Platform Toolset`.
+
+If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`.
+
+3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_
+panel in the _FileView_ tab), and selecting `Build`.
+
+You may get a few warnings, but you should not get any errors.
+
+Later, we will refer to the following `.lib` and `.dll` files that have just been generated:
+
+-   `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll`
+-   `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib`
+-   `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib`
+
+_Note for the `x64` versions, just replace `Win32` in the path with `x64`_
+
+### Creating a Project with SDL
+
+- Create a project as a `Win32 Application`.
+
+- Create a C++ file for your project.
+
+- Set the C runtime to `Multi-threaded DLL` in the menu:
+`Project|Settings|C/C++                  tab|Code Generation|Runtime Library `.
+
+- Add the SDL `include` directory to your list of includes in the menu:
+`Project|Settings|C/C++ tab|Preprocessor|Additional include directories `
+
+*VC7 Specific: Instead of doing this, I find it easier to add the
+include and library directories to the list that VC7 keeps. Do this by
+selecting Tools|Options|Projects|VC++ Directories and under the "Show
+Directories For:" dropbox select "Include Files", and click the "New
+Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you
+installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the
+dropbox selection to "Library Files" and add [SDLROOT]\\lib.*
+
+The "include directory" I am referring to is the `./include` folder.
+
+Now we're going to use the files that we had created earlier in the *Build SDL* step.
+
+Copy the following file into your Project directory:
+
+-   `SDL2.dll`
+
+Add the following files to your project (It is not necessary to copy them to your project directory):
+
+-   `SDL2.lib`
+-   `SDL2main.lib`
+
+To add them to your project, right click on your project, and select
+`Add files to project`.
+
+**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line
+and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration
+(e.g. Release,Debug).**
+
+### Hello SDL2
+
+Here's a sample SDL snippet to verify everything is setup in your IDE:
+
+```
+    #include "SDL.h"
+
+    int main( int argc, char* argv[] )
+    {
+        const int WIDTH = 640;
+        const int HEIGHT = 480;
+        SDL_Window* window = NULL;
+        SDL_Renderer* renderer = NULL;
+
+        SDL_Init(SDL_INIT_VIDEO);
+        window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
+        renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
+
+        SDL_DestroyRenderer(renderer);
+        SDL_DestroyWindow(window);
+        SDL_Quit();
+        return 0;
+    }
+ ```
+
+### That's it!
+
+I hope that this document has helped you get through the most difficult part of using the SDL: installing it.
+Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues).
+
+### Credits
+
+Thanks to [Paulus Esterhazy](mailto:[email protected]), for the work on VC++ port.
+
+This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:[email protected]).
+
+Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:[email protected]).
+
+Minor Fixes and Visual C++ 7 Information (In Green) was added by [James Turk](mailto:[email protected])

+ 33 - 33
docs/README-vita.md

@@ -1,33 +1,33 @@
-PS Vita
-=======
-SDL port for the Sony Playstation Vita and Sony Playstation TV
-
-Credit to
-* xerpi, cpasjuste and rsn8887 for initial (vita2d) port
-* vitasdk/dolcesdk devs
-* CBPS discord (Namely Graphene and SonicMastr)
-
-Building
---------
-To build for the PSVita, make sure you have vitasdk and cmake installed and run:
-```
-   cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
-   cmake --build build
-   cmake --install build
-```
-
-
-Notes
------
-* gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON`
-  These renderers support 720p and 1080i resolutions. These can be specified with:
-  `SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);`
-* Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK.
-  They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);`
-  anytime before video subsystem initialization.
-* gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON`
-* By default SDL emits mouse events for touch events on every touchscreen.
-  Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead.
-  Individual touchscreens can be disabled with:
-  `SDL_setenv("VITA_DISABLE_TOUCH_FRONT", "1", 1);` and `SDL_setenv("VITA_DISABLE_TOUCH_BACK", "1", 1);`
-* Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita.
+PS Vita
+=======
+SDL port for the Sony Playstation Vita and Sony Playstation TV
+
+Credit to
+* xerpi, cpasjuste and rsn8887 for initial (vita2d) port
+* vitasdk/dolcesdk devs
+* CBPS discord (Namely Graphene and SonicMastr)
+
+Building
+--------
+To build for the PSVita, make sure you have vitasdk and cmake installed and run:
+```
+   cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
+   cmake --build build
+   cmake --install build
+```
+
+
+Notes
+-----
+* gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON`
+  These renderers support 720p and 1080i resolutions. These can be specified with:
+  `SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);`
+* Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK.
+  They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);`
+  anytime before video subsystem initialization.
+* gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON`
+* By default SDL emits mouse events for touch events on every touchscreen.
+  Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead.
+  Individual touchscreens can be disabled with:
+  `SDL_setenv("VITA_DISABLE_TOUCH_FRONT", "1", 1);` and `SDL_setenv("VITA_DISABLE_TOUCH_BACK", "1", 1);`
+* Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita.

+ 10 - 10
docs/README-wince.md

@@ -1,10 +1,10 @@
-WinCE
-=====
-
-Windows CE is no longer supported by SDL.
-
-We have left the CE support in SDL 1.2 for those that must have it, and we
-have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3.
-
---ryan.
-
+WinCE
+=====
+
+Windows CE is no longer supported by SDL.
+
+We have left the CE support in SDL 1.2 for those that must have it, and we
+have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3.
+
+--ryan.
+

+ 58 - 58
docs/README-windows.md

@@ -1,58 +1,58 @@
-# Windows
-
-## LLVM and Intel C++ compiler support
-
-SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++
-compiler, but you'll have to manually add the "-msse3" command line option
-to at least the SDL_audiocvt.c source file, and possibly others. This may
-not be necessary if you build SDL with CMake instead of the included Visual
-Studio solution.
-
-Details are here: https://github.com/libsdl-org/SDL/issues/5186
-
-
-## OpenGL ES 2.x support
-
-SDL has support for OpenGL ES 2.x under Windows via two alternative
-implementations.
-
-The most straightforward method consists in running your app in a system with
-a graphic card paired with a relatively recent (as of November of 2013) driver
-which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
-to ship said extension on Windows currently include nVidia and Intel.
-
-The other method involves using the
-[ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x
-context is requested and no WGL_EXT_create_context_es2_profile extension is
-found, SDL will try to load the libEGL.dll library provided by ANGLE.
-
-To obtain the ANGLE binaries, you can either compile from source from
-https://chromium.googlesource.com/angle/angle or copy the relevant binaries
-from a recent Chrome/Chromium install for Windows. The files you need are:
-
-- libEGL.dll
-- libGLESv2.dll
-- d3dcompiler_46.dll (supports Windows Vista or later, better shader
-  compiler) *or* d3dcompiler_43.dll (supports Windows XP or later)
-
-If you compile ANGLE from source, you can configure it so it does not need the
-d3dcompiler_* DLL at all (for details on this, see their documentation).
-However, by default SDL will try to preload the d3dcompiler_46.dll to
-comply with ANGLE's requirements. If you wish SDL to preload
-d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you
-can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more
-details).
-
-Known Bugs:
-
-- SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
-  that there's a bug in the library which prevents the window contents from
-  refreshing if this is set to anything other than the default value.
-
-## Vulkan Surface Support
-
-Support for creating Vulkan surfaces is configured on by default. To disable
-it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You
-must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to
-use Vulkan graphics in your application.
-
+# Windows
+
+## LLVM and Intel C++ compiler support
+
+SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++
+compiler, but you'll have to manually add the "-msse3" command line option
+to at least the SDL_audiocvt.c source file, and possibly others. This may
+not be necessary if you build SDL with CMake instead of the included Visual
+Studio solution.
+
+Details are here: https://github.com/libsdl-org/SDL/issues/5186
+
+
+## OpenGL ES 2.x support
+
+SDL has support for OpenGL ES 2.x under Windows via two alternative
+implementations.
+
+The most straightforward method consists in running your app in a system with
+a graphic card paired with a relatively recent (as of November of 2013) driver
+which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
+to ship said extension on Windows currently include nVidia and Intel.
+
+The other method involves using the
+[ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x
+context is requested and no WGL_EXT_create_context_es2_profile extension is
+found, SDL will try to load the libEGL.dll library provided by ANGLE.
+
+To obtain the ANGLE binaries, you can either compile from source from
+https://chromium.googlesource.com/angle/angle or copy the relevant binaries
+from a recent Chrome/Chromium install for Windows. The files you need are:
+
+- libEGL.dll
+- libGLESv2.dll
+- d3dcompiler_46.dll (supports Windows Vista or later, better shader
+  compiler) *or* d3dcompiler_43.dll (supports Windows XP or later)
+
+If you compile ANGLE from source, you can configure it so it does not need the
+d3dcompiler_* DLL at all (for details on this, see their documentation).
+However, by default SDL will try to preload the d3dcompiler_46.dll to
+comply with ANGLE's requirements. If you wish SDL to preload
+d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you
+can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more
+details).
+
+Known Bugs:
+
+- SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
+  that there's a bug in the library which prevents the window contents from
+  refreshing if this is set to anything other than the default value.
+
+## Vulkan Surface Support
+
+Support for creating Vulkan surfaces is configured on by default. To disable
+it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You
+must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to
+use Vulkan graphics in your application.
+

+ 519 - 519
docs/README-winrt.md

@@ -1,519 +1,519 @@
-WinRT
-=====
-
-This port allows SDL applications to run on Microsoft's platforms that require
-use of "Windows Runtime", aka. "WinRT", APIs.  Microsoft may, in some cases,
-refer to them as either "Windows Store", or for Windows 10, "UWP" apps.
-
-In the past, SDL has supported Windows RT 8.x, Windows Phone, etc, but in
-modern times this port is focused on UWP apps, which run on Windows 10,
-and modern Xbox consoles.
-
-
-Requirements
-------------
-
-* Microsoft Visual C++ (aka Visual Studio) 2019.
-  - Free, "Community" or "Express" editions may be used, so long as they
-    include support for either "Windows Store" or "Windows Phone" apps.
-    "Express" versions marked as supporting "Windows Desktop" development
-    typically do not include support for creating WinRT apps, to note.
-    (The "Community" editions of Visual C++ do, however, support both
-    desktop/Win32 and WinRT development).
-* A valid Microsoft account - This requirement is not imposed by SDL, but
-  rather by Microsoft's Visual C++ toolchain.  This is required to launch or
-  debug apps.
-
-
-Status
-------
-
-Here is a rough list of what works, and what doesn't:
-
-* What works:
-  * compilation via Visual C++ 2019.
-  * compile-time platform detection for SDL programs.  The C/C++ #define,
-    `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT.
-  * GPU-accelerated 2D rendering, via SDL_Renderer.
-  * OpenGL ES 2, via the ANGLE library (included separately from SDL)
-  * software rendering, via either SDL_Surface (optionally in conjunction with
-    SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the
-    SDL_Renderer APIs
-  * threads
-  * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(),
-    SDL_GetPerformanceFrequency(), etc.)
-  * file I/O via SDL_RWops
-  * mouse input  (unsupported on Windows Phone)
-  * audio, via SDL's WASAPI backend (if you want to record, your app must
-    have "Microphone" capabilities enabled in its manifest, and the user must
-    not have blocked access. Otherwise, capture devices will fail to work,
-    presenting as a device disconnect shortly after opening it.)
-  * .DLL file loading.  Libraries *MUST* be packaged inside applications.  Loading
-    anything outside of the app is not supported.
-  * system path retrieval via SDL's filesystem APIs
-  * game controllers.  Support is provided via the SDL_Joystick and
-    SDL_GameController APIs, and is backed by Microsoft's XInput API.  Please
-    note, however, that Windows limits game-controller support in UWP apps to,
-    "Xbox compatible controllers" (many controllers that work in Win32 apps,
-    do not work in UWP, due to restrictions in UWP itself.)
-  * multi-touch input
-  * app events.  SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as
-    appropriate.
-  * window events
-  * using Direct3D 11.x APIs outside of SDL.  Non-XAML / Direct3D-only apps can
-    choose to render content directly via Direct3D, using SDL to manage the
-    internal WinRT window, as well as input and audio.  (Use
-    SDL_GetWindowWMInfo() to get the WinRT 'CoreWindow', and pass it into
-    IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.)
-
-* What partially works:
-  * keyboard input.  Most of WinRT's documented virtual keys are supported, as
-    well as many keys with documented hardware scancodes.  Converting
-    SDL_Scancodes to or from SDL_Keycodes may not work, due to missing APIs
-    (MapVirtualKey()) in Microsoft's Windows Store / UWP APIs.
-  * SDLmain.  WinRT uses a different signature for each app's main() function.
-    SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp
-    (in `SDL\src\main\winrt\`) directly in order for their C-style main()
-    functions to be called.
-
-* What doesn't work:
-  * compilation with anything other than Visual C++
-  * programmatically-created custom cursors.  These don't appear to be supported
-    by WinRT.  Different OS-provided cursors can, however, be created via
-    SDL_CreateSystemCursor() (unsupported on Windows Phone)
-  * SDL_WarpMouseInWindow() or SDL_WarpMouseGlobal().  This are not currently
-    supported by WinRT itself.
-  * joysticks and game controllers that either are not supported by
-    Microsoft's XInput API, or are not supported within UWP apps (many
-    controllers that work in Win32, do not work in UWP, due to restrictions in
-    UWP itself).
-  * turning off VSync when rendering on Windows Phone.  Attempts to turn VSync
-    off on Windows Phone result either in Direct3D not drawing anything, or it
-    forcing VSync back on.  As such, SDL_RENDERER_PRESENTVSYNC will always get
-    turned-on on Windows Phone.  This limitation is not present in non-Phone
-    WinRT (such as Windows 8.x), where turning off VSync appears to work.
-  * probably anything else that's not listed as supported
-
-
-
-Upgrade Notes
--------------
-
-#### SDL_GetPrefPath() usage when upgrading WinRT apps from SDL 2.0.3
-
-SDL 2.0.4 fixes two bugs found in the WinRT version of SDL_GetPrefPath().
-The fixes may affect older, SDL 2.0.3-based apps' save data.  Please note
-that these changes only apply to SDL-based WinRT apps, and not to apps for
-any other platform.
-
-1. SDL_GetPrefPath() would return an invalid path, one in which the path's
-   directory had not been created.  Attempts to create files there
-   (via fopen(), for example), would fail, unless that directory was
-   explicitly created beforehand.
-
-2. SDL_GetPrefPath(), for non-WinPhone-based apps, would return a path inside
-   a WinRT 'Roaming' folder, the contents of which get automatically
-   synchronized across multiple devices.  This process can occur while an
-   application runs, and can cause existing save-data to be overwritten
-   at unexpected times, with data from other devices.  (Windows Phone apps
-   written with SDL 2.0.3 did not utilize a Roaming folder, due to API
-   restrictions in Windows Phone 8.0).
-
-
-SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by:
-
-1. making sure that SDL_GetPrefPath() returns a directory in which data
-   can be written to immediately, without first needing to create directories.
-
-2. basing SDL_GetPrefPath() off of a different, non-Roaming folder, the
-   contents of which do not automatically get synchronized across devices
-   (and which require less work to use safely, in terms of data integrity).
-
-Apps that wish to get their Roaming folder's path can do so either by using
-SDL_WinRTGetFSPathUTF8(), SDL_WinRTGetFSPathUNICODE() (which returns a
-UCS-2/wide-char string), or directly through the WinRT class,
-Windows.Storage.ApplicationData.
-
-
-
-Setup, High-Level Steps
------------------------
-
-The steps for setting up a project for an SDL/WinRT app looks like the
-following, at a high-level:
-
-1. create a new Visual C++ project using Microsoft's template for a,
-   "Direct3D App".
-2. remove most of the files from the project.
-3. make your app's project directly reference SDL/WinRT's own Visual C++
-   project file, via use of Visual C++'s "References" dialog.  This will setup
-   the linker, and will copy SDL's .dll files to your app's final output.
-4. adjust your app's build settings, at minimum, telling it where to find SDL's
-   header files.
-5. add files that contains a WinRT-appropriate main function, along with some
-   data to make sure mouse-cursor-hiding (via SDL_ShowCursor(SDL_DISABLE) calls)
-   work properly.
-6. add SDL-specific app code.
-7. build and run your app.
-
-
-Setup, Detailed Steps
----------------------
-
-### 1. Create a new project ###
-
-Create a new project using one of Visual C++'s templates for a plain, non-XAML,
-"Direct3D App" (XAML support for SDL/WinRT is not yet ready for use).  If you
-don't see one of these templates, in Visual C++'s 'New Project' dialog, try
-using the textbox titled, 'Search Installed Templates' to look for one.
-
-
-### 2. Remove unneeded files from the project ###
-
-In the new project, delete any file that has one of the following extensions:
-
-- .cpp
-- .h
-- .hlsl
-
-When you are done, you should be left with a few files, each of which will be a
-necessary part of your app's project.  These files will consist of:
-
-- an .appxmanifest file, which contains metadata on your WinRT app.  This is
-  similar to an Info.plist file on iOS, or an AndroidManifest.xml on Android.
-- a few .png files, one of which is a splash screen (displayed when your app
-  launches), others are app icons.
-- a .pfx file, used for code signing purposes.
-
-
-### 3. Add references to SDL's project files ###
-
-SDL/WinRT can be built in multiple variations, spanning across three different
-CPU architectures (x86, x64, and ARM) and two different configurations
-(Debug and Release).  WinRT and Visual C++ do not currently provide a means
-for combining multiple variations of one library into a single file.
-Furthermore, it does not provide an easy means for copying pre-built .dll files
-into your app's final output (via Post-Build steps, for example).  It does,
-however, provide a system whereby an app can reference the MSVC projects of
-libraries such that, when the app is built:
-
-1. each library gets built for the appropriate CPU architecture(s) and WinRT
-   platform(s).
-2. each library's output, such as .dll files, get copied to the app's build
-   output.
-
-To set this up for SDL/WinRT, you'll need to run through the following steps:
-
-1. open up the Solution Explorer inside Visual C++ (under the "View" menu, then
-   "Solution Explorer")
-2. right click on your app's solution.
-3. navigate to "Add", then to "Existing Project..."
-4. find SDL/WinRT's Visual C++ project file and open it, in the `VisualC-WinRT`
-   directory.
-5. once the project has been added, right-click on your app's project and
-   select, "References..."
-6. click on the button titled, "Add New Reference..."
-7. check the box next to SDL
-8. click OK to close the dialog
-9. SDL will now show up in the list of references.  Click OK to close that
-   dialog.
-
-Your project is now linked to SDL's project, insofar that when the app is
-built, SDL will be built as well, with its build output getting included with
-your app.
-
-
-### 4. Adjust Your App's Build Settings ###
-
-Some build settings need to be changed in your app's project.  This guide will
-outline the following:
-
-- making sure that the compiler knows where to find SDL's header files
-- **Optional for C++, but NECESSARY for compiling C code:** telling the
-  compiler not to use Microsoft's C++ extensions for WinRT development.
-- **Optional:** telling the compiler not generate errors due to missing
-  precompiled header files.
-
-To change these settings:
-
-1. right-click on the project
-2. choose "Properties"
-3. in the drop-down box next to "Configuration", choose, "All Configurations"
-4. in the drop-down box next to "Platform", choose, "All Platforms"
-5. in the left-hand list, expand the "C/C++" section
-6. select "General"
-7. edit the "Additional Include Directories" setting, and add a path to SDL's
-   "include" directory
-8. **Optional: to enable compilation of C code:** change the setting for
-   "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No".  If you're
-   working with a completely C++ based project, this step can usually be
-   omitted.
-9. **Optional: to disable precompiled headers (which can produce
-   'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand
-   list, select "Precompiled Headers", then change the setting for "Precompiled
-   Header" from "Use (/Yu)" to "Not Using Precompiled Headers".
-10. close the dialog, saving settings, by clicking the "OK" button
-
-
-### 5. Add a WinRT-appropriate main function, and a blank-cursor image, to the app. ###
-
-A few files should be included directly in your app's MSVC project, specifically:
-1. a WinRT-appropriate main function (which is different than main() functions on
-   other platforms)
-2. a Win32-style cursor resource, used by SDL_ShowCursor() to hide the mouse cursor
-   (if and when the app needs to do so).  *If this cursor resource is not
-   included, mouse-position reporting may fail if and when the cursor is
-   hidden, due to possible bugs/design-oddities in Windows itself.*
-
-To include these files for C/C++ projects:
-
-1. right-click on your project (again, in Visual C++'s Solution Explorer),
-   navigate to "Add", then choose "Existing Item...".
-2. navigate to the directory containing SDL's source code, then into its
-   subdirectory, 'src/main/winrt/'.  Select, then add, the following files:
-   - `SDL_winrt_main_NonXAML.cpp`
-   - `SDL2-WinRTResources.rc`
-   - `SDL2-WinRTResource_BlankCursor.cur`
-3. right-click on the file `SDL_winrt_main_NonXAML.cpp` (as listed in your
-   project), then click on "Properties...".
-4. in the drop-down box next to "Configuration", choose, "All Configurations"
-5. in the drop-down box next to "Platform", choose, "All Platforms"
-6. in the left-hand list, click on "C/C++"
-7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)".
-8. click the OK button.  This will close the dialog.
-
-**NOTE: C++/CX compilation is currently required in at least one file of your
-app's project.  This is to make sure that Visual C++'s linker builds a 'Windows
-Metadata' file (.winmd) for your app.  Not doing so can lead to build errors.**
-
-For non-C++ projects, you will need to call SDL_WinRTRunApp from your language's
-main function, and generate SDL2-WinRTResources.res manually by using `rc` via
-the Developer Command Prompt and including it as a <Win32Resource> within the
-first <PropertyGroup> block in your Visual Studio project file.
-
-### 6. Add app code and assets ###
-
-At this point, you can add in SDL-specific source code.  Be sure to include a
-C-style main function (ie: `int main(int argc, char *argv[])`).  From there you
-should be able to create a single `SDL_Window` (WinRT apps can only have one
-window, at present), as well as an `SDL_Renderer`.  Direct3D will be used to
-draw content.  Events are received via SDL's usual event functions
-(`SDL_PollEvent`, etc.)  If you have a set of existing source files and assets,
-you can start adding them to the project now.  If not, or if you would like to
-make sure that you're setup correctly, some short and simple sample code is
-provided below.
-
-
-#### 6.A. ... when creating a new app ####
-
-If you are creating a new app (rather than porting an existing SDL-based app),
-or if you would just like a simple app to test SDL/WinRT with before trying to
-get existing code working, some working SDL/WinRT code is provided below.  To
-set this up:
-
-1. right click on your app's project
-2. select Add, then New Item.  An "Add New Item" dialog will show up.
-3. from the left-hand list, choose "Visual C++"
-4. from the middle/main list, choose "C++ File (.cpp)"
-5. near the bottom of the dialog, next to "Name:", type in a name for your
-source file, such as, "main.cpp".
-6. click on the Add button.  This will close the dialog, add the new file to
-your project, and open the file in Visual C++'s text editor.
-7. Copy and paste the following code into the new file, then save it.
-
-```c
-#include <SDL.h>
-
-int main(int argc, char **argv)
-{
-    SDL_DisplayMode mode;
-    SDL_Window * window = NULL;
-    SDL_Renderer * renderer = NULL;
-    SDL_Event evt;
-    SDL_bool keep_going = SDL_TRUE;
-
-    if (SDL_Init(SDL_INIT_VIDEO) != 0) {
-        return 1;
-    } else if (SDL_GetCurrentDisplayMode(0, &mode) != 0) {
-        return 1;
-    } else if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) {
-        return 1;
-    }
-
-    while (keep_going) {
-        while (SDL_PollEvent(&evt)) {
-            if ((evt.type == SDL_KEYDOWN) && (evt.key.keysym.sym == SDLK_ESCAPE)) {
-                keep_going = SDL_FALSE;
-            }
-        }
-
-        SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
-        SDL_RenderClear(renderer);
-        SDL_RenderPresent(renderer);
-    }
-
-    SDL_Quit();
-    return 0;
-}
-```
-
-#### 6.B. Adding code and assets ####
-
-If you have existing code and assets that you'd like to add, you should be able
-to add them now.  The process for adding a set of files is as such.
-
-1. right click on the app's project
-2. select Add, then click on "New Item..."
-3. open any source, header, or asset files as appropriate.  Support for C and
-C++ is available.
-
-Do note that WinRT only supports a subset of the APIs that are available to
-Win32-based apps.  Many portions of the Win32 API and the C runtime are not
-available.
-
-A list of unsupported C APIs can be found at
-<http://msdn.microsoft.com/en-us/library/windows/apps/jj606124.aspx>
-
-General information on using the C runtime in WinRT can be found at
-<https://msdn.microsoft.com/en-us/library/hh972425.aspx>
-
-A list of supported Win32 APIs for WinRT apps can be found at
-<http://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx>.  To note,
-the list of supported Win32 APIs for Windows Phone 8.0 is different.
-That list can be found at
-<http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662956(v=vs.105).aspx>
-
-
-### 7. Build and run your app ###
-
-Your app project should now be setup, and you should be ready to build your app.
-To run it on the local machine, open the Debug menu and choose "Start
-Debugging".  This will build your app, then run your app full-screen.  To switch
-out of your app, press the Windows key.  Alternatively, you can choose to run
-your app in a window.  To do this, before building and running your app, find
-the drop-down menu in Visual C++'s toolbar that says, "Local Machine".  Expand
-this by clicking on the arrow on the right side of the list, then click on
-Simulator.  Once you do that, any time you build and run the app, the app will
-launch in window, rather than full-screen.
-
-
-#### 7.A. Running apps on older, ARM-based, "Windows RT" devices ####
-
-**These instructions do not include Windows Phone, despite Windows Phone
-typically running on ARM processors.**  They are specifically for devices
-that use the "Windows RT" operating system, which was a modified version of
-Windows 8.x that ran primarily on ARM-based tablet computers.
-
-To build and run the app on ARM-based, "Windows RT" devices, you'll need to:
-
-- install Microsoft's "Remote Debugger" on the device.  Visual C++ installs and
-  debugs ARM-based apps via IP networks.
-- change a few options on the development machine, both to make sure it builds
-  for ARM (rather than x86 or x64), and to make sure it knows how to find the
-  Windows RT device (on the network).
-
-Microsoft's Remote Debugger can be found at
-<https://msdn.microsoft.com/en-us/library/hh441469.aspx>.  Please note
-that separate versions of this debugger exist for different versions of Visual
-C++, one each for MSVC 2015, 2013, and 2012.
-
-To setup Visual C++ to launch your app on an ARM device:
-
-1. make sure the Remote Debugger is running on your ARM device, and that it's on
-   the same IP network as your development machine.
-2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32".  Click
-   it, then change the value to "ARM".
-3. make sure Visual C++ knows the hostname or IP address of the ARM device.  To
-   do this:
-    1. open the app project's properties
-    2. select "Debugging"
-    3. next to "Machine Name", enter the hostname or IP address of the ARM
-       device
-    4. if, and only if, you've turned off authentication in the Remote Debugger,
-       then change the setting for "Require Authentication" to No
-    5. click "OK"
-4. build and run the app (from Visual C++).  The first time you do this, a
-   prompt will show up on the ARM device, asking for a Microsoft Account.  You
-   do, unfortunately, need to log in here, and will need to follow the
-   subsequent registration steps in order to launch the app.  After you do so,
-   if the app didn't already launch, try relaunching it again from within Visual
-   C++.
-
-
-Troubleshooting
----------------
-
-#### Build fails with message, "error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker'"
-
-Try adding the following to your linker flags.  In MSVC, this can be done by
-right-clicking on the app project, navigating to Configuration Properties ->
-Linker -> Command Line, then adding them to the Additional Options
-section.
-
-* For Release builds / MSVC-Configurations, add:
-
-    /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib
-
-* For Debug builds / MSVC-Configurations, add:
-
-    /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib
-
-
-#### Mouse-motion events fail to get sent, or SDL_GetMouseState() fails to return updated values
-
-This may be caused by a bug in Windows itself, whereby hiding the mouse
-cursor can cause mouse-position reporting to fail.
-
-SDL provides a workaround for this, but it requires that an app links to a
-set of Win32-style cursor image-resource files.  A copy of suitable resource
-files can be found in `src/main/winrt/`.  Adding them to an app's Visual C++
-project file should be sufficient to get the app to use them.
-
-
-#### SDL's Visual Studio project file fails to open, with message, "The system can't find the file specified."
-
-This can be caused for any one of a few reasons, which Visual Studio can
-report, but won't always do so in an up-front manner.
-
-To help determine why this error comes up:
-
-1. open a copy of Visual Studio without opening a project file.  This can be
-   accomplished via Windows' Start Menu, among other means.
-2. show Visual Studio's Output window.  This can be done by going to VS'
-   menu bar, then to View, and then to Output.
-3. try opening the SDL project file directly by going to VS' menu bar, then
-   to File, then to Open, then to Project/Solution.  When a File-Open dialog
-   appears, open the SDL project (such as the one in SDL's source code, in its
-   directory, VisualC-WinRT/UWP_VS2015/).
-4. after attempting to open SDL's Visual Studio project file, additional error
-   information will be output to the Output window.
-
-If Visual Studio reports (via its Output window) that the project:
-
-"could not be loaded because it's missing install components. To fix this launch Visual Studio setup with the following selections:
-Microsoft.VisualStudio.ComponentGroup.UWP.VC"
-
-... then you will need to re-launch Visual Studio's installer, and make sure that
-the workflow for "Universal Windows Platform development" is checked, and that its
-optional component, "C++ Universal Windows Platform tools" is also checked.  While
-you are there, if you are planning on targeting UWP / Windows 10, also make sure
-that you check the optional component, "Windows 10 SDK (10.0.10240.0)".  After
-making sure these items are checked as-appropriate, install them.
-
-Once you install these components, try re-launching Visual Studio, and re-opening
-the SDL project file.  If you still get the error dialog, try using the Output
-window, again, seeing what Visual Studio says about it.
-
-
-#### Game controllers / joysticks aren't working!
-
-Windows only permits certain game controllers and joysticks to work within
-WinRT / UWP apps.  Even if a game controller or joystick works in a Win32
-app, that device is not guaranteed to work inside a WinRT / UWP app.
-
-According to Microsoft, "Xbox compatible controllers" should work inside
-UWP apps, potentially with more working in the future.  This includes, but
-may not be limited to, Microsoft-made Xbox controllers and USB adapters.
-(Source: https://social.msdn.microsoft.com/Forums/en-US/9064838b-e8c3-4c18-8a83-19bf0dfe150d/xinput-fails-to-detect-game-controllers?forum=wpdevelop)
-
-
+WinRT
+=====
+
+This port allows SDL applications to run on Microsoft's platforms that require
+use of "Windows Runtime", aka. "WinRT", APIs.  Microsoft may, in some cases,
+refer to them as either "Windows Store", or for Windows 10, "UWP" apps.
+
+In the past, SDL has supported Windows RT 8.x, Windows Phone, etc, but in
+modern times this port is focused on UWP apps, which run on Windows 10,
+and modern Xbox consoles.
+
+
+Requirements
+------------
+
+* Microsoft Visual C++ (aka Visual Studio) 2019.
+  - Free, "Community" or "Express" editions may be used, so long as they
+    include support for either "Windows Store" or "Windows Phone" apps.
+    "Express" versions marked as supporting "Windows Desktop" development
+    typically do not include support for creating WinRT apps, to note.
+    (The "Community" editions of Visual C++ do, however, support both
+    desktop/Win32 and WinRT development).
+* A valid Microsoft account - This requirement is not imposed by SDL, but
+  rather by Microsoft's Visual C++ toolchain.  This is required to launch or
+  debug apps.
+
+
+Status
+------
+
+Here is a rough list of what works, and what doesn't:
+
+* What works:
+  * compilation via Visual C++ 2019.
+  * compile-time platform detection for SDL programs.  The C/C++ #define,
+    `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT.
+  * GPU-accelerated 2D rendering, via SDL_Renderer.
+  * OpenGL ES 2, via the ANGLE library (included separately from SDL)
+  * software rendering, via either SDL_Surface (optionally in conjunction with
+    SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the
+    SDL_Renderer APIs
+  * threads
+  * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(),
+    SDL_GetPerformanceFrequency(), etc.)
+  * file I/O via SDL_RWops
+  * mouse input  (unsupported on Windows Phone)
+  * audio, via SDL's WASAPI backend (if you want to record, your app must
+    have "Microphone" capabilities enabled in its manifest, and the user must
+    not have blocked access. Otherwise, capture devices will fail to work,
+    presenting as a device disconnect shortly after opening it.)
+  * .DLL file loading.  Libraries *MUST* be packaged inside applications.  Loading
+    anything outside of the app is not supported.
+  * system path retrieval via SDL's filesystem APIs
+  * game controllers.  Support is provided via the SDL_Joystick and
+    SDL_GameController APIs, and is backed by Microsoft's XInput API.  Please
+    note, however, that Windows limits game-controller support in UWP apps to,
+    "Xbox compatible controllers" (many controllers that work in Win32 apps,
+    do not work in UWP, due to restrictions in UWP itself.)
+  * multi-touch input
+  * app events.  SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as
+    appropriate.
+  * window events
+  * using Direct3D 11.x APIs outside of SDL.  Non-XAML / Direct3D-only apps can
+    choose to render content directly via Direct3D, using SDL to manage the
+    internal WinRT window, as well as input and audio.  (Use
+    SDL_GetWindowWMInfo() to get the WinRT 'CoreWindow', and pass it into
+    IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.)
+
+* What partially works:
+  * keyboard input.  Most of WinRT's documented virtual keys are supported, as
+    well as many keys with documented hardware scancodes.  Converting
+    SDL_Scancodes to or from SDL_Keycodes may not work, due to missing APIs
+    (MapVirtualKey()) in Microsoft's Windows Store / UWP APIs.
+  * SDLmain.  WinRT uses a different signature for each app's main() function.
+    SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp
+    (in `SDL\src\main\winrt\`) directly in order for their C-style main()
+    functions to be called.
+
+* What doesn't work:
+  * compilation with anything other than Visual C++
+  * programmatically-created custom cursors.  These don't appear to be supported
+    by WinRT.  Different OS-provided cursors can, however, be created via
+    SDL_CreateSystemCursor() (unsupported on Windows Phone)
+  * SDL_WarpMouseInWindow() or SDL_WarpMouseGlobal().  This are not currently
+    supported by WinRT itself.
+  * joysticks and game controllers that either are not supported by
+    Microsoft's XInput API, or are not supported within UWP apps (many
+    controllers that work in Win32, do not work in UWP, due to restrictions in
+    UWP itself).
+  * turning off VSync when rendering on Windows Phone.  Attempts to turn VSync
+    off on Windows Phone result either in Direct3D not drawing anything, or it
+    forcing VSync back on.  As such, SDL_RENDERER_PRESENTVSYNC will always get
+    turned-on on Windows Phone.  This limitation is not present in non-Phone
+    WinRT (such as Windows 8.x), where turning off VSync appears to work.
+  * probably anything else that's not listed as supported
+
+
+
+Upgrade Notes
+-------------
+
+#### SDL_GetPrefPath() usage when upgrading WinRT apps from SDL 2.0.3
+
+SDL 2.0.4 fixes two bugs found in the WinRT version of SDL_GetPrefPath().
+The fixes may affect older, SDL 2.0.3-based apps' save data.  Please note
+that these changes only apply to SDL-based WinRT apps, and not to apps for
+any other platform.
+
+1. SDL_GetPrefPath() would return an invalid path, one in which the path's
+   directory had not been created.  Attempts to create files there
+   (via fopen(), for example), would fail, unless that directory was
+   explicitly created beforehand.
+
+2. SDL_GetPrefPath(), for non-WinPhone-based apps, would return a path inside
+   a WinRT 'Roaming' folder, the contents of which get automatically
+   synchronized across multiple devices.  This process can occur while an
+   application runs, and can cause existing save-data to be overwritten
+   at unexpected times, with data from other devices.  (Windows Phone apps
+   written with SDL 2.0.3 did not utilize a Roaming folder, due to API
+   restrictions in Windows Phone 8.0).
+
+
+SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by:
+
+1. making sure that SDL_GetPrefPath() returns a directory in which data
+   can be written to immediately, without first needing to create directories.
+
+2. basing SDL_GetPrefPath() off of a different, non-Roaming folder, the
+   contents of which do not automatically get synchronized across devices
+   (and which require less work to use safely, in terms of data integrity).
+
+Apps that wish to get their Roaming folder's path can do so either by using
+SDL_WinRTGetFSPathUTF8(), SDL_WinRTGetFSPathUNICODE() (which returns a
+UCS-2/wide-char string), or directly through the WinRT class,
+Windows.Storage.ApplicationData.
+
+
+
+Setup, High-Level Steps
+-----------------------
+
+The steps for setting up a project for an SDL/WinRT app looks like the
+following, at a high-level:
+
+1. create a new Visual C++ project using Microsoft's template for a,
+   "Direct3D App".
+2. remove most of the files from the project.
+3. make your app's project directly reference SDL/WinRT's own Visual C++
+   project file, via use of Visual C++'s "References" dialog.  This will setup
+   the linker, and will copy SDL's .dll files to your app's final output.
+4. adjust your app's build settings, at minimum, telling it where to find SDL's
+   header files.
+5. add files that contains a WinRT-appropriate main function, along with some
+   data to make sure mouse-cursor-hiding (via SDL_ShowCursor(SDL_DISABLE) calls)
+   work properly.
+6. add SDL-specific app code.
+7. build and run your app.
+
+
+Setup, Detailed Steps
+---------------------
+
+### 1. Create a new project ###
+
+Create a new project using one of Visual C++'s templates for a plain, non-XAML,
+"Direct3D App" (XAML support for SDL/WinRT is not yet ready for use).  If you
+don't see one of these templates, in Visual C++'s 'New Project' dialog, try
+using the textbox titled, 'Search Installed Templates' to look for one.
+
+
+### 2. Remove unneeded files from the project ###
+
+In the new project, delete any file that has one of the following extensions:
+
+- .cpp
+- .h
+- .hlsl
+
+When you are done, you should be left with a few files, each of which will be a
+necessary part of your app's project.  These files will consist of:
+
+- an .appxmanifest file, which contains metadata on your WinRT app.  This is
+  similar to an Info.plist file on iOS, or an AndroidManifest.xml on Android.
+- a few .png files, one of which is a splash screen (displayed when your app
+  launches), others are app icons.
+- a .pfx file, used for code signing purposes.
+
+
+### 3. Add references to SDL's project files ###
+
+SDL/WinRT can be built in multiple variations, spanning across three different
+CPU architectures (x86, x64, and ARM) and two different configurations
+(Debug and Release).  WinRT and Visual C++ do not currently provide a means
+for combining multiple variations of one library into a single file.
+Furthermore, it does not provide an easy means for copying pre-built .dll files
+into your app's final output (via Post-Build steps, for example).  It does,
+however, provide a system whereby an app can reference the MSVC projects of
+libraries such that, when the app is built:
+
+1. each library gets built for the appropriate CPU architecture(s) and WinRT
+   platform(s).
+2. each library's output, such as .dll files, get copied to the app's build
+   output.
+
+To set this up for SDL/WinRT, you'll need to run through the following steps:
+
+1. open up the Solution Explorer inside Visual C++ (under the "View" menu, then
+   "Solution Explorer")
+2. right click on your app's solution.
+3. navigate to "Add", then to "Existing Project..."
+4. find SDL/WinRT's Visual C++ project file and open it, in the `VisualC-WinRT`
+   directory.
+5. once the project has been added, right-click on your app's project and
+   select, "References..."
+6. click on the button titled, "Add New Reference..."
+7. check the box next to SDL
+8. click OK to close the dialog
+9. SDL will now show up in the list of references.  Click OK to close that
+   dialog.
+
+Your project is now linked to SDL's project, insofar that when the app is
+built, SDL will be built as well, with its build output getting included with
+your app.
+
+
+### 4. Adjust Your App's Build Settings ###
+
+Some build settings need to be changed in your app's project.  This guide will
+outline the following:
+
+- making sure that the compiler knows where to find SDL's header files
+- **Optional for C++, but NECESSARY for compiling C code:** telling the
+  compiler not to use Microsoft's C++ extensions for WinRT development.
+- **Optional:** telling the compiler not generate errors due to missing
+  precompiled header files.
+
+To change these settings:
+
+1. right-click on the project
+2. choose "Properties"
+3. in the drop-down box next to "Configuration", choose, "All Configurations"
+4. in the drop-down box next to "Platform", choose, "All Platforms"
+5. in the left-hand list, expand the "C/C++" section
+6. select "General"
+7. edit the "Additional Include Directories" setting, and add a path to SDL's
+   "include" directory
+8. **Optional: to enable compilation of C code:** change the setting for
+   "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No".  If you're
+   working with a completely C++ based project, this step can usually be
+   omitted.
+9. **Optional: to disable precompiled headers (which can produce
+   'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand
+   list, select "Precompiled Headers", then change the setting for "Precompiled
+   Header" from "Use (/Yu)" to "Not Using Precompiled Headers".
+10. close the dialog, saving settings, by clicking the "OK" button
+
+
+### 5. Add a WinRT-appropriate main function, and a blank-cursor image, to the app. ###
+
+A few files should be included directly in your app's MSVC project, specifically:
+1. a WinRT-appropriate main function (which is different than main() functions on
+   other platforms)
+2. a Win32-style cursor resource, used by SDL_ShowCursor() to hide the mouse cursor
+   (if and when the app needs to do so).  *If this cursor resource is not
+   included, mouse-position reporting may fail if and when the cursor is
+   hidden, due to possible bugs/design-oddities in Windows itself.*
+
+To include these files for C/C++ projects:
+
+1. right-click on your project (again, in Visual C++'s Solution Explorer),
+   navigate to "Add", then choose "Existing Item...".
+2. navigate to the directory containing SDL's source code, then into its
+   subdirectory, 'src/main/winrt/'.  Select, then add, the following files:
+   - `SDL_winrt_main_NonXAML.cpp`
+   - `SDL2-WinRTResources.rc`
+   - `SDL2-WinRTResource_BlankCursor.cur`
+3. right-click on the file `SDL_winrt_main_NonXAML.cpp` (as listed in your
+   project), then click on "Properties...".
+4. in the drop-down box next to "Configuration", choose, "All Configurations"
+5. in the drop-down box next to "Platform", choose, "All Platforms"
+6. in the left-hand list, click on "C/C++"
+7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)".
+8. click the OK button.  This will close the dialog.
+
+**NOTE: C++/CX compilation is currently required in at least one file of your
+app's project.  This is to make sure that Visual C++'s linker builds a 'Windows
+Metadata' file (.winmd) for your app.  Not doing so can lead to build errors.**
+
+For non-C++ projects, you will need to call SDL_WinRTRunApp from your language's
+main function, and generate SDL2-WinRTResources.res manually by using `rc` via
+the Developer Command Prompt and including it as a <Win32Resource> within the
+first <PropertyGroup> block in your Visual Studio project file.
+
+### 6. Add app code and assets ###
+
+At this point, you can add in SDL-specific source code.  Be sure to include a
+C-style main function (ie: `int main(int argc, char *argv[])`).  From there you
+should be able to create a single `SDL_Window` (WinRT apps can only have one
+window, at present), as well as an `SDL_Renderer`.  Direct3D will be used to
+draw content.  Events are received via SDL's usual event functions
+(`SDL_PollEvent`, etc.)  If you have a set of existing source files and assets,
+you can start adding them to the project now.  If not, or if you would like to
+make sure that you're setup correctly, some short and simple sample code is
+provided below.
+
+
+#### 6.A. ... when creating a new app ####
+
+If you are creating a new app (rather than porting an existing SDL-based app),
+or if you would just like a simple app to test SDL/WinRT with before trying to
+get existing code working, some working SDL/WinRT code is provided below.  To
+set this up:
+
+1. right click on your app's project
+2. select Add, then New Item.  An "Add New Item" dialog will show up.
+3. from the left-hand list, choose "Visual C++"
+4. from the middle/main list, choose "C++ File (.cpp)"
+5. near the bottom of the dialog, next to "Name:", type in a name for your
+source file, such as, "main.cpp".
+6. click on the Add button.  This will close the dialog, add the new file to
+your project, and open the file in Visual C++'s text editor.
+7. Copy and paste the following code into the new file, then save it.
+
+```c
+#include <SDL.h>
+
+int main(int argc, char **argv)
+{
+    SDL_DisplayMode mode;
+    SDL_Window * window = NULL;
+    SDL_Renderer * renderer = NULL;
+    SDL_Event evt;
+    SDL_bool keep_going = SDL_TRUE;
+
+    if (SDL_Init(SDL_INIT_VIDEO) != 0) {
+        return 1;
+    } else if (SDL_GetCurrentDisplayMode(0, &mode) != 0) {
+        return 1;
+    } else if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) {
+        return 1;
+    }
+
+    while (keep_going) {
+        while (SDL_PollEvent(&evt)) {
+            if ((evt.type == SDL_KEYDOWN) && (evt.key.keysym.sym == SDLK_ESCAPE)) {
+                keep_going = SDL_FALSE;
+            }
+        }
+
+        SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
+        SDL_RenderClear(renderer);
+        SDL_RenderPresent(renderer);
+    }
+
+    SDL_Quit();
+    return 0;
+}
+```
+
+#### 6.B. Adding code and assets ####
+
+If you have existing code and assets that you'd like to add, you should be able
+to add them now.  The process for adding a set of files is as such.
+
+1. right click on the app's project
+2. select Add, then click on "New Item..."
+3. open any source, header, or asset files as appropriate.  Support for C and
+C++ is available.
+
+Do note that WinRT only supports a subset of the APIs that are available to
+Win32-based apps.  Many portions of the Win32 API and the C runtime are not
+available.
+
+A list of unsupported C APIs can be found at
+<http://msdn.microsoft.com/en-us/library/windows/apps/jj606124.aspx>
+
+General information on using the C runtime in WinRT can be found at
+<https://msdn.microsoft.com/en-us/library/hh972425.aspx>
+
+A list of supported Win32 APIs for WinRT apps can be found at
+<http://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx>.  To note,
+the list of supported Win32 APIs for Windows Phone 8.0 is different.
+That list can be found at
+<http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662956(v=vs.105).aspx>
+
+
+### 7. Build and run your app ###
+
+Your app project should now be setup, and you should be ready to build your app.
+To run it on the local machine, open the Debug menu and choose "Start
+Debugging".  This will build your app, then run your app full-screen.  To switch
+out of your app, press the Windows key.  Alternatively, you can choose to run
+your app in a window.  To do this, before building and running your app, find
+the drop-down menu in Visual C++'s toolbar that says, "Local Machine".  Expand
+this by clicking on the arrow on the right side of the list, then click on
+Simulator.  Once you do that, any time you build and run the app, the app will
+launch in window, rather than full-screen.
+
+
+#### 7.A. Running apps on older, ARM-based, "Windows RT" devices ####
+
+**These instructions do not include Windows Phone, despite Windows Phone
+typically running on ARM processors.**  They are specifically for devices
+that use the "Windows RT" operating system, which was a modified version of
+Windows 8.x that ran primarily on ARM-based tablet computers.
+
+To build and run the app on ARM-based, "Windows RT" devices, you'll need to:
+
+- install Microsoft's "Remote Debugger" on the device.  Visual C++ installs and
+  debugs ARM-based apps via IP networks.
+- change a few options on the development machine, both to make sure it builds
+  for ARM (rather than x86 or x64), and to make sure it knows how to find the
+  Windows RT device (on the network).
+
+Microsoft's Remote Debugger can be found at
+<https://msdn.microsoft.com/en-us/library/hh441469.aspx>.  Please note
+that separate versions of this debugger exist for different versions of Visual
+C++, one each for MSVC 2015, 2013, and 2012.
+
+To setup Visual C++ to launch your app on an ARM device:
+
+1. make sure the Remote Debugger is running on your ARM device, and that it's on
+   the same IP network as your development machine.
+2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32".  Click
+   it, then change the value to "ARM".
+3. make sure Visual C++ knows the hostname or IP address of the ARM device.  To
+   do this:
+    1. open the app project's properties
+    2. select "Debugging"
+    3. next to "Machine Name", enter the hostname or IP address of the ARM
+       device
+    4. if, and only if, you've turned off authentication in the Remote Debugger,
+       then change the setting for "Require Authentication" to No
+    5. click "OK"
+4. build and run the app (from Visual C++).  The first time you do this, a
+   prompt will show up on the ARM device, asking for a Microsoft Account.  You
+   do, unfortunately, need to log in here, and will need to follow the
+   subsequent registration steps in order to launch the app.  After you do so,
+   if the app didn't already launch, try relaunching it again from within Visual
+   C++.
+
+
+Troubleshooting
+---------------
+
+#### Build fails with message, "error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker'"
+
+Try adding the following to your linker flags.  In MSVC, this can be done by
+right-clicking on the app project, navigating to Configuration Properties ->
+Linker -> Command Line, then adding them to the Additional Options
+section.
+
+* For Release builds / MSVC-Configurations, add:
+
+    /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib
+
+* For Debug builds / MSVC-Configurations, add:
+
+    /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib
+
+
+#### Mouse-motion events fail to get sent, or SDL_GetMouseState() fails to return updated values
+
+This may be caused by a bug in Windows itself, whereby hiding the mouse
+cursor can cause mouse-position reporting to fail.
+
+SDL provides a workaround for this, but it requires that an app links to a
+set of Win32-style cursor image-resource files.  A copy of suitable resource
+files can be found in `src/main/winrt/`.  Adding them to an app's Visual C++
+project file should be sufficient to get the app to use them.
+
+
+#### SDL's Visual Studio project file fails to open, with message, "The system can't find the file specified."
+
+This can be caused for any one of a few reasons, which Visual Studio can
+report, but won't always do so in an up-front manner.
+
+To help determine why this error comes up:
+
+1. open a copy of Visual Studio without opening a project file.  This can be
+   accomplished via Windows' Start Menu, among other means.
+2. show Visual Studio's Output window.  This can be done by going to VS'
+   menu bar, then to View, and then to Output.
+3. try opening the SDL project file directly by going to VS' menu bar, then
+   to File, then to Open, then to Project/Solution.  When a File-Open dialog
+   appears, open the SDL project (such as the one in SDL's source code, in its
+   directory, VisualC-WinRT/UWP_VS2015/).
+4. after attempting to open SDL's Visual Studio project file, additional error
+   information will be output to the Output window.
+
+If Visual Studio reports (via its Output window) that the project:
+
+"could not be loaded because it's missing install components. To fix this launch Visual Studio setup with the following selections:
+Microsoft.VisualStudio.ComponentGroup.UWP.VC"
+
+... then you will need to re-launch Visual Studio's installer, and make sure that
+the workflow for "Universal Windows Platform development" is checked, and that its
+optional component, "C++ Universal Windows Platform tools" is also checked.  While
+you are there, if you are planning on targeting UWP / Windows 10, also make sure
+that you check the optional component, "Windows 10 SDK (10.0.10240.0)".  After
+making sure these items are checked as-appropriate, install them.
+
+Once you install these components, try re-launching Visual Studio, and re-opening
+the SDL project file.  If you still get the error dialog, try using the Output
+window, again, seeing what Visual Studio says about it.
+
+
+#### Game controllers / joysticks aren't working!
+
+Windows only permits certain game controllers and joysticks to work within
+WinRT / UWP apps.  Even if a game controller or joystick works in a Win32
+app, that device is not guaranteed to work inside a WinRT / UWP app.
+
+According to Microsoft, "Xbox compatible controllers" should work inside
+UWP apps, potentially with more working in the future.  This includes, but
+may not be limited to, Microsoft-made Xbox controllers and USB adapters.
+(Source: https://social.msdn.microsoft.com/Forums/en-US/9064838b-e8c3-4c18-8a83-19bf0dfe150d/xinput-fails-to-detect-game-controllers?forum=wpdevelop)
+
+

+ 3 - 2
include/SDL_atomic.h

@@ -257,8 +257,9 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
 
 
 /**
- * \brief A type representing an atomic integer value.  It is a struct
- *        so people don't accidentally use numeric operations on it.
+ * A type representing an atomic integer value.
+ *
+ * It is a struct so people don't accidentally use numeric operations on it.
  */
 typedef struct SDL_atomic_t {
     int value;

+ 26 - 22
include/SDL_audio.h

@@ -166,16 +166,19 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
                                             int len);
 
 /**
- *  The calculated values in this structure are calculated by SDL_OpenAudio().
- *
- *  For multi-channel audio, the default SDL channel mapping is:
- *  2:  FL  FR                          (stereo)
- *  3:  FL  FR LFE                      (2.1 surround)
- *  4:  FL  FR  BL  BR                  (quad)
- *  5:  FL  FR LFE  BL  BR              (4.1 surround)
- *  6:  FL  FR  FC LFE  SL  SR          (5.1 surround - last two can also be BL BR)
- *  7:  FL  FR  FC LFE  BC  SL  SR      (6.1 surround)
- *  8:  FL  FR  FC LFE  BL  BR  SL  SR  (7.1 surround)
+ * The calculated values in this structure are calculated by SDL_OpenAudio().
+ *
+ * For multi-channel audio, the default SDL channel mapping is:
+ *
+ * ```
+ * 2:  FL  FR                          (stereo)
+ * 3:  FL  FR LFE                      (2.1 surround)
+ * 4:  FL  FR  BL  BR                  (quad)
+ * 5:  FL  FR LFE  BL  BR              (4.1 surround)
+ * 6:  FL  FR  FC LFE  SL  SR          (5.1 surround - last two can also be BL BR)
+ * 7:  FL  FR  FC LFE  BC  SL  SR      (6.1 surround)
+ * 8:  FL  FR  FC LFE  BL  BR  SL  SR  (7.1 surround)
+ * ```
  */
 typedef struct SDL_AudioSpec
 {
@@ -196,11 +199,11 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
                                           SDL_AudioFormat format);
 
 /**
- *  \brief Upper limit of filters in SDL_AudioCVT
+ * Upper limit of filters in SDL_AudioCVT
  *
- *  The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
- *  currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
- *  one of which is the terminating NULL pointer.
+ * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
+ * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, one
+ * of which is the terminating NULL pointer.
  */
 #define SDL_AUDIOCVT_MAX_FILTERS 9
 
@@ -408,13 +411,13 @@ extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
                                           SDL_AudioSpec * obtained);
 
 /**
- *  SDL Audio Device IDs.
+ * SDL Audio Device IDs.
  *
- *  A successful call to SDL_OpenAudio() is always device id 1, and legacy
- *  SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
- *  always returns devices >= 2 on success. The legacy calls are good both
- *  for backwards compatibility and when you don't care about multiple,
- *  specific, or capture devices.
+ * A successful call to SDL_OpenAudio() is always device id 1, and legacy SDL
+ * audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
+ * always returns devices >= 2 on success. The legacy calls are good both for
+ * backwards compatibility and when you don't care about multiple, specific,
+ * or capture devices.
  */
 typedef Uint32 SDL_AudioDeviceID;
 
@@ -874,8 +877,9 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
                                                       Uint32 * audio_len);
 
 /**
- *  Loads a WAV from a file.
- *  Compatibility convenience function.
+ * Loads a WAV from a file.
+ *
+ * Compatibility convenience function.
  */
 #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
     SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)

+ 6 - 0
include/SDL_bits.h

@@ -56,6 +56,12 @@ extern __inline int _SDL_bsr_watcom(Uint32);
     modify exact [eax] nomemory;
 #endif
 
+/**
+ * Use this function to get the index of the most significant (set) bit in a
+ *
+ * \param x the number to find the MSB of
+ * \returns the index of the most significant bit of x, or -1 if x is 0.
+ */
 SDL_FORCE_INLINE int
 SDL_MostSignificantBitIndex32(Uint32 x)
 {

+ 4 - 3
include/SDL_blendmode.h

@@ -35,7 +35,7 @@ extern "C" {
 #endif
 
 /**
- *  \brief The blend mode used in SDL_RenderCopy() and drawing operations.
+ * The blend mode used in SDL_RenderCopy() and drawing operations.
  */
 typedef enum SDL_BlendMode
 {
@@ -60,7 +60,8 @@ typedef enum SDL_BlendMode
 } SDL_BlendMode;
 
 /**
- *  \brief The blend operation used when combining source and destination pixel components
+ * The blend operation used when combining source and destination pixel
+ * components
  */
 typedef enum SDL_BlendOperation
 {
@@ -72,7 +73,7 @@ typedef enum SDL_BlendOperation
 } SDL_BlendOperation;
 
 /**
- *  \brief The normalized factor used to multiply pixel components
+ * The normalized factor used to multiply pixel components
  */
 typedef enum SDL_BlendFactor
 {

+ 39 - 0
include/SDL_endian.h

@@ -180,6 +180,16 @@ extern __inline Uint16 SDL_Swap16(Uint16);
   parm   [ax]   \
   modify [ax];
 #else
+
+/**
+ * Use this function to swap the byte order of a 16-bit value.
+ *
+ * \param x the value to be swapped
+ * \returns the swapped value.
+ *
+ * \sa SDL_SwapBE16
+ * \sa SDL_SwapLE16
+ */
 SDL_FORCE_INLINE Uint16
 SDL_Swap16(Uint16 x)
 {
@@ -231,6 +241,16 @@ extern __inline Uint32 SDL_Swap32(Uint32);
   parm   [eax] \
   modify [eax];
 #else
+
+/**
+ * Use this function to swap the byte order of a 32-bit value.
+ *
+ * \param x the value to be swapped
+ * \returns the swapped value.
+ *
+ * \sa SDL_SwapBE32
+ * \sa SDL_SwapLE32
+ */
 SDL_FORCE_INLINE Uint32
 SDL_Swap32(Uint32 x)
 {
@@ -276,6 +296,16 @@ extern __inline Uint64 SDL_Swap64(Uint64);
   parm [eax edx]  \
   modify [eax edx];
 #else
+
+/**
+ * Use this function to swap the byte order of a 64-bit value.
+ *
+ * \param x the value to be swapped
+ * \returns the swapped value.
+ *
+ * \sa SDL_SwapBE64
+ * \sa SDL_SwapLE64
+ */
 SDL_FORCE_INLINE Uint64
 SDL_Swap64(Uint64 x)
 {
@@ -293,6 +323,15 @@ SDL_Swap64(Uint64 x)
 #endif
 
 
+/**
+ * Use this function to swap the byte order of a floating point value.
+ *
+ * \param x the value to be swapped
+ * \returns the swapped value.
+ *
+ * \sa SDL_SwapFloatBE
+ * \sa SDL_SwapFloatLE
+ */
 SDL_FORCE_INLINE float
 SDL_SwapFloat(float x)
 {

+ 86 - 81
include/SDL_events.h

@@ -167,7 +167,7 @@ typedef enum SDL_EventType
     /* Internal events */
     SDL_POLLSENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
 
-    /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
+    /** Events SDL_USEREVENT through SDL_LASTEVENT are for your use,
      *  and should be allocated with SDL_RegisterEvents()
      */
     SDL_USEREVENT    = 0x8000,
@@ -179,7 +179,7 @@ typedef enum SDL_EventType
 } SDL_EventType;
 
 /**
- *  \brief Fields shared by every event
+ * Fields shared by every event
  */
 typedef struct SDL_CommonEvent
 {
@@ -188,14 +188,14 @@ typedef struct SDL_CommonEvent
 } SDL_CommonEvent;
 
 /**
- *  \brief Display state change event data (event.display.*)
+ * Display state change event data (event.display.*)
  */
 typedef struct SDL_DisplayEvent
 {
-    Uint32 type;        /**< ::SDL_DISPLAYEVENT */
+    Uint32 type;        /**< SDL_DISPLAYEVENT */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 display;     /**< The associated display index */
-    Uint8 event;        /**< ::SDL_DisplayEventID */
+    Uint8 event;        /**< SDL_DisplayEventID */
     Uint8 padding1;
     Uint8 padding2;
     Uint8 padding3;
@@ -203,14 +203,14 @@ typedef struct SDL_DisplayEvent
 } SDL_DisplayEvent;
 
 /**
- *  \brief Window state change event data (event.window.*)
+ * Window state change event data (event.window.*)
  */
 typedef struct SDL_WindowEvent
 {
-    Uint32 type;        /**< ::SDL_WINDOWEVENT */
+    Uint32 type;        /**< SDL_WINDOWEVENT */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The associated window */
-    Uint8 event;        /**< ::SDL_WindowEventID */
+    Uint8 event;        /**< SDL_WindowEventID */
     Uint8 padding1;
     Uint8 padding2;
     Uint8 padding3;
@@ -219,14 +219,14 @@ typedef struct SDL_WindowEvent
 } SDL_WindowEvent;
 
 /**
- *  \brief Keyboard button event structure (event.key.*)
+ * Keyboard button event structure (event.key.*)
  */
 typedef struct SDL_KeyboardEvent
 {
-    Uint32 type;        /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
+    Uint32 type;        /**< SDL_KEYDOWN or SDL_KEYUP */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with keyboard focus, if any */
-    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
+    Uint8 state;        /**< SDL_PRESSED or SDL_RELEASED */
     Uint8 repeat;       /**< Non-zero if this is a key repeat */
     Uint8 padding2;
     Uint8 padding3;
@@ -234,12 +234,13 @@ typedef struct SDL_KeyboardEvent
 } SDL_KeyboardEvent;
 
 #define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
+
 /**
- *  \brief Keyboard text editing event structure (event.edit.*)
+ * Keyboard text editing event structure (event.edit.*)
  */
 typedef struct SDL_TextEditingEvent
 {
-    Uint32 type;                                /**< ::SDL_TEXTEDITING */
+    Uint32 type;                                /**< SDL_TEXTEDITING */
     Uint32 timestamp;                           /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;                            /**< The window with keyboard focus, if any */
     char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];  /**< The editing text */
@@ -248,12 +249,12 @@ typedef struct SDL_TextEditingEvent
 } SDL_TextEditingEvent;
 
 /**
- *  \brief Extended keyboard text editing event structure (event.editExt.*) when text would be
- *  truncated if stored in the text buffer SDL_TextEditingEvent
+ * Extended keyboard text editing event structure (event.editExt.*) when text
+ * would be truncated if stored in the text buffer SDL_TextEditingEvent
  */
 typedef struct SDL_TextEditingExtEvent
 {
-    Uint32 type;                                /**< ::SDL_TEXTEDITING_EXT */
+    Uint32 type;                                /**< SDL_TEXTEDITING_EXT */
     Uint32 timestamp;                           /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;                            /**< The window with keyboard focus, if any */
     char* text;                                 /**< The editing text, which should be freed with SDL_free(), and will not be NULL */
@@ -262,23 +263,24 @@ typedef struct SDL_TextEditingExtEvent
 } SDL_TextEditingExtEvent;
 
 #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
+
 /**
- *  \brief Keyboard text input event structure (event.text.*)
+ * Keyboard text input event structure (event.text.*)
  */
 typedef struct SDL_TextInputEvent
 {
-    Uint32 type;                              /**< ::SDL_TEXTINPUT */
+    Uint32 type;                              /**< SDL_TEXTINPUT */
     Uint32 timestamp;                         /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;                          /**< The window with keyboard focus, if any */
     char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];  /**< The input text */
 } SDL_TextInputEvent;
 
 /**
- *  \brief Mouse motion event structure (event.motion.*)
+ * Mouse motion event structure (event.motion.*)
  */
 typedef struct SDL_MouseMotionEvent
 {
-    Uint32 type;        /**< ::SDL_MOUSEMOTION */
+    Uint32 type;        /**< SDL_MOUSEMOTION */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@@ -290,16 +292,16 @@ typedef struct SDL_MouseMotionEvent
 } SDL_MouseMotionEvent;
 
 /**
- *  \brief Mouse button event structure (event.button.*)
+ * Mouse button event structure (event.button.*)
  */
 typedef struct SDL_MouseButtonEvent
 {
-    Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
+    Uint32 type;        /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Uint8 button;       /**< The mouse button index */
-    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
+    Uint8 state;        /**< SDL_PRESSED or SDL_RELEASED */
     Uint8 clicks;       /**< 1 for single-click, 2 for double-click, etc. */
     Uint8 padding1;
     Sint32 x;           /**< X coordinate, relative to window */
@@ -307,11 +309,11 @@ typedef struct SDL_MouseButtonEvent
 } SDL_MouseButtonEvent;
 
 /**
- *  \brief Mouse wheel event structure (event.wheel.*)
+ * Mouse wheel event structure (event.wheel.*)
  */
 typedef struct SDL_MouseWheelEvent
 {
-    Uint32 type;        /**< ::SDL_MOUSEWHEEL */
+    Uint32 type;        /**< SDL_MOUSEWHEEL */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@@ -325,11 +327,11 @@ typedef struct SDL_MouseWheelEvent
 } SDL_MouseWheelEvent;
 
 /**
- *  \brief Joystick axis motion event structure (event.jaxis.*)
+ * Joystick axis motion event structure (event.jaxis.*)
  */
 typedef struct SDL_JoyAxisEvent
 {
-    Uint32 type;        /**< ::SDL_JOYAXISMOTION */
+    Uint32 type;        /**< SDL_JOYAXISMOTION */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 axis;         /**< The joystick axis index */
@@ -341,11 +343,11 @@ typedef struct SDL_JoyAxisEvent
 } SDL_JoyAxisEvent;
 
 /**
- *  \brief Joystick trackball motion event structure (event.jball.*)
+ * Joystick trackball motion event structure (event.jball.*)
  */
 typedef struct SDL_JoyBallEvent
 {
-    Uint32 type;        /**< ::SDL_JOYBALLMOTION */
+    Uint32 type;        /**< SDL_JOYBALLMOTION */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 ball;         /**< The joystick trackball index */
@@ -357,18 +359,18 @@ typedef struct SDL_JoyBallEvent
 } SDL_JoyBallEvent;
 
 /**
- *  \brief Joystick hat position change event structure (event.jhat.*)
+ * Joystick hat position change event structure (event.jhat.*)
  */
 typedef struct SDL_JoyHatEvent
 {
-    Uint32 type;        /**< ::SDL_JOYHATMOTION */
+    Uint32 type;        /**< SDL_JOYHATMOTION */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 hat;          /**< The joystick hat index */
     Uint8 value;        /**< The hat position value.
-                         *   \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
-                         *   \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
-                         *   \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
+                         *   \sa SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
+                         *   \sa SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
+                         *   \sa SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
                          *
                          *   Note that zero means the POV is centered.
                          */
@@ -377,46 +379,46 @@ typedef struct SDL_JoyHatEvent
 } SDL_JoyHatEvent;
 
 /**
- *  \brief Joystick button event structure (event.jbutton.*)
+ * Joystick button event structure (event.jbutton.*)
  */
 typedef struct SDL_JoyButtonEvent
 {
-    Uint32 type;        /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
+    Uint32 type;        /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 button;       /**< The joystick button index */
-    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
+    Uint8 state;        /**< SDL_PRESSED or SDL_RELEASED */
     Uint8 padding1;
     Uint8 padding2;
 } SDL_JoyButtonEvent;
 
 /**
- *  \brief Joystick device event structure (event.jdevice.*)
+ * Joystick device event structure (event.jdevice.*)
  */
 typedef struct SDL_JoyDeviceEvent
 {
-    Uint32 type;        /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
+    Uint32 type;        /**< SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Sint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
 } SDL_JoyDeviceEvent;
 
 /**
- *  \brief Joysick battery level change event structure (event.jbattery.*)
+ * Joysick battery level change event structure (event.jbattery.*)
  */
 typedef struct SDL_JoyBatteryEvent
 {
-    Uint32 type;        /**< ::SDL_JOYBATTERYUPDATED */
+    Uint32 type;        /**< SDL_JOYBATTERYUPDATED */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     SDL_JoystickPowerLevel level; /**< The joystick battery level */
 } SDL_JoyBatteryEvent;
 
 /**
- *  \brief Game controller axis motion event structure (event.caxis.*)
+ * Game controller axis motion event structure (event.caxis.*)
  */
 typedef struct SDL_ControllerAxisEvent
 {
-    Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
+    Uint32 type;        /**< SDL_CONTROLLERAXISMOTION */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 axis;         /**< The controller axis (SDL_GameControllerAxis) */
@@ -429,36 +431,36 @@ typedef struct SDL_ControllerAxisEvent
 
 
 /**
- *  \brief Game controller button event structure (event.cbutton.*)
+ * Game controller button event structure (event.cbutton.*)
  */
 typedef struct SDL_ControllerButtonEvent
 {
-    Uint32 type;        /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
+    Uint32 type;        /**< SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 button;       /**< The controller button (SDL_GameControllerButton) */
-    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
+    Uint8 state;        /**< SDL_PRESSED or SDL_RELEASED */
     Uint8 padding1;
     Uint8 padding2;
 } SDL_ControllerButtonEvent;
 
 
 /**
- *  \brief Controller device event structure (event.cdevice.*)
+ * Controller device event structure (event.cdevice.*)
  */
 typedef struct SDL_ControllerDeviceEvent
 {
-    Uint32 type;        /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, ::SDL_CONTROLLERDEVICEREMAPPED, or ::SDL_CONTROLLERSTEAMHANDLEUPDATED */
+    Uint32 type;        /**< SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED, or SDL_CONTROLLERSTEAMHANDLEUPDATED */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Sint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
 } SDL_ControllerDeviceEvent;
 
 /**
- *  \brief Game controller touchpad event structure (event.ctouchpad.*)
+ * Game controller touchpad event structure (event.ctouchpad.*)
  */
 typedef struct SDL_ControllerTouchpadEvent
 {
-    Uint32 type;        /**< ::SDL_CONTROLLERTOUCHPADDOWN or ::SDL_CONTROLLERTOUCHPADMOTION or ::SDL_CONTROLLERTOUCHPADUP */
+    Uint32 type;        /**< SDL_CONTROLLERTOUCHPADDOWN or SDL_CONTROLLERTOUCHPADMOTION or SDL_CONTROLLERTOUCHPADUP */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Sint32 touchpad;    /**< The index of the touchpad */
@@ -469,24 +471,24 @@ typedef struct SDL_ControllerTouchpadEvent
 } SDL_ControllerTouchpadEvent;
 
 /**
- *  \brief Game controller sensor event structure (event.csensor.*)
+ * Game controller sensor event structure (event.csensor.*)
  */
 typedef struct SDL_ControllerSensorEvent
 {
-    Uint32 type;        /**< ::SDL_CONTROLLERSENSORUPDATE */
+    Uint32 type;        /**< SDL_CONTROLLERSENSORUPDATE */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
-    Sint32 sensor;      /**< The type of the sensor, one of the values of ::SDL_SensorType */
+    Sint32 sensor;      /**< The type of the sensor, one of the values of SDL_SensorType */
     float data[3];      /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */
     Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */
 } SDL_ControllerSensorEvent;
 
 /**
- *  \brief Audio device event structure (event.adevice.*)
+ * Audio device event structure (event.adevice.*)
  */
 typedef struct SDL_AudioDeviceEvent
 {
-    Uint32 type;        /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
+    Uint32 type;        /**< SDL_AUDIODEVICEADDED, or SDL_AUDIODEVICEREMOVED */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 which;       /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
     Uint8 iscapture;    /**< zero if an output device, non-zero if a capture device. */
@@ -497,11 +499,11 @@ typedef struct SDL_AudioDeviceEvent
 
 
 /**
- *  \brief Touch finger event structure (event.tfinger.*)
+ * Touch finger event structure (event.tfinger.*)
  */
 typedef struct SDL_TouchFingerEvent
 {
-    Uint32 type;        /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
+    Uint32 type;        /**< SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_TouchID touchId; /**< The touch device id */
     SDL_FingerID fingerId;
@@ -515,11 +517,11 @@ typedef struct SDL_TouchFingerEvent
 
 
 /**
- *  \brief Multiple Finger Gesture Event (event.mgesture.*)
+ * Multiple Finger Gesture Event (event.mgesture.*)
  */
 typedef struct SDL_MultiGestureEvent
 {
-    Uint32 type;        /**< ::SDL_MULTIGESTURE */
+    Uint32 type;        /**< SDL_MULTIGESTURE */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_TouchID touchId; /**< The touch device id */
     float dTheta;
@@ -532,11 +534,11 @@ typedef struct SDL_MultiGestureEvent
 
 
 /**
- * \brief Dollar Gesture Event (event.dgesture.*)
+ * Dollar Gesture Event (event.dgesture.*)
  */
 typedef struct SDL_DollarGestureEvent
 {
-    Uint32 type;        /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
+    Uint32 type;        /**< SDL_DOLLARGESTURE or SDL_DOLLARRECORD */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_TouchID touchId; /**< The touch device id */
     SDL_GestureID gestureId;
@@ -548,13 +550,15 @@ typedef struct SDL_DollarGestureEvent
 
 
 /**
- *  \brief An event used to request a file open by the system (event.drop.*)
- *         This event is enabled by default, you can disable it with SDL_EventState().
- *  \note If this event is enabled, you must free the filename in the event.
+ * An event used to request a file open by the system (event.drop.*)
+ *
+ * This event is enabled by default, you can disable it with SDL_EventState().
+ *
+ * If this event is enabled, you must free the filename in the event.
  */
 typedef struct SDL_DropEvent
 {
-    Uint32 type;        /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
+    Uint32 type;        /**< SDL_DROPBEGIN or SDL_DROPFILE or SDL_DROPTEXT or SDL_DROPCOMPLETE */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     char *file;         /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
     Uint32 windowID;    /**< The window that was dropped on, if any */
@@ -562,11 +566,11 @@ typedef struct SDL_DropEvent
 
 
 /**
- *  \brief Sensor event structure (event.sensor.*)
+ * Sensor event structure (event.sensor.*)
  */
 typedef struct SDL_SensorEvent
 {
-    Uint32 type;        /**< ::SDL_SENSORUPDATE */
+    Uint32 type;        /**< SDL_SENSORUPDATE */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Sint32 which;       /**< The instance ID of the sensor */
     float data[6];      /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
@@ -574,20 +578,20 @@ typedef struct SDL_SensorEvent
 } SDL_SensorEvent;
 
 /**
- *  \brief The "quit requested" event
+ * The "quit requested" event
  */
 typedef struct SDL_QuitEvent
 {
-    Uint32 type;        /**< ::SDL_QUIT */
+    Uint32 type;        /**< SDL_QUIT */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
 } SDL_QuitEvent;
 
 /**
- *  \brief A user-defined event type (event.user.*)
+ * A user-defined event type (event.user.*)
  */
 typedef struct SDL_UserEvent
 {
-    Uint32 type;        /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
+    Uint32 type;        /**< SDL_USEREVENT through SDL_LASTEVENT-1 */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The associated window if any */
     Sint32 code;        /**< User defined event code */
@@ -600,20 +604,21 @@ struct SDL_SysWMmsg;
 typedef struct SDL_SysWMmsg SDL_SysWMmsg;
 
 /**
- *  \brief A video driver dependent system event (event.syswm.*)
- *         This event is disabled by default, you can enable it with SDL_EventState()
+ * A video driver dependent system event (event.syswm.*)
+ *
+ * This event is disabled by default, you can enable it with SDL_EventState()
  *
- *  \note If you want to use this event, you should include SDL_syswm.h.
+ * If you want to use this event, you should include SDL_syswm.h.
  */
 typedef struct SDL_SysWMEvent
 {
-    Uint32 type;        /**< ::SDL_SYSWMEVENT */
+    Uint32 type;        /**< SDL_SYSWMEVENT */
     Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_SysWMmsg *msg;  /**< driver dependent data, defined in SDL_syswm.h */
 } SDL_SysWMEvent;
 
 /**
- *  \brief General event structure
+ * General event structure
  */
 typedef union SDL_Event
 {
@@ -961,11 +966,11 @@ extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
 /**
  * A function pointer used for callbacks that watch the event queue.
  *
- * \param userdata what was passed as `userdata` to SDL_SetEventFilter()
- *        or SDL_AddEventWatch, etc
+ * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or
+ *                 SDL_AddEventWatch, etc
  * \param event the event that triggered the callback
- * \returns 1 to permit event to be added to the queue, and 0 to disallow
- *          it. When used with SDL_AddEventWatch, the return value is ignored.
+ * \returns 1 to permit event to be added to the queue, and 0 to disallow it.
+ *          When used with SDL_AddEventWatch, the return value is ignored.
  *
  * \sa SDL_SetEventFilter
  * \sa SDL_AddEventWatch
@@ -988,7 +993,7 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
  * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
  * application at the next event poll.
  *
- * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
+ * There is one caveat when dealing with the SDL_QuitEvent event type. The
  * event filter is only called when the window manager desires to close the
  * application window. If the event filter returns 1, then the window will be
  * closed, otherwise the window will remain open if possible.

+ 15 - 12
include/SDL_gamecontroller.h

@@ -44,7 +44,7 @@ extern "C" {
  *  \file SDL_gamecontroller.h
  *
  *  In order to use these functions, SDL_Init() must have been called
- *  with the ::SDL_INIT_GAMECONTROLLER flag.  This causes SDL to scan the system
+ *  with the SDL_INIT_GAMECONTROLLER flag.  This causes SDL to scan the system
  *  for game controllers, and load appropriate drivers.
  *
  *  If you would like to receive controller updates while the application
@@ -86,7 +86,7 @@ typedef enum SDL_GameControllerBindType
 } SDL_GameControllerBindType;
 
 /**
- *  Get the SDL joystick layer binding for this controller button/axis mapping
+ * Get the SDL joystick layer binding for this controller button/axis mapping
  */
 typedef struct SDL_GameControllerButtonBind
 {
@@ -166,9 +166,10 @@ typedef struct SDL_GameControllerButtonBind
 extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
 
 /**
- *  Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
+ * Load a set of mappings from a file, filtered by the current
+ * SDL_GetPlatform()
  *
- *  Convenience macro.
+ * Convenience macro.
  */
 #define SDL_GameControllerAddMappingsFromFile(file)   SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
 
@@ -607,15 +608,17 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
 
 
 /**
- *  The list of axes available from a controller
+ * The list of axes available from a controller
  *
- *  Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
- *  and are centered within ~8000 of zero, though advanced UI will allow users to set
- *  or autodetect the dead zone, which varies between controllers.
+ * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to
+ * SDL_JOYSTICK_AXIS_MAX, and are centered within ~8000 of zero, though
+ * advanced UI will allow users to set or autodetect the dead zone, which
+ * varies between controllers.
  *
- *  Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX
- *  (fully pressed) when reported by SDL_GameControllerGetAxis(). Note that this is not the
- *  same range that will be reported by the lower-level SDL_GetJoystickAxis().
+ * Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX (fully
+ * pressed) when reported by SDL_GameControllerGetAxis(). Note that this is
+ * not the same range that will be reported by the lower-level
+ * SDL_GetJoystickAxis().
  */
 typedef enum SDL_GameControllerAxis
 {
@@ -724,7 +727,7 @@ extern DECLSPEC Sint16 SDLCALL
 SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
 
 /**
- *  The list of buttons available from a controller
+ * The list of buttons available from a controller
  */
 typedef enum SDL_GameControllerButton
 {

+ 16 - 16
include/SDL_guid.h

@@ -22,7 +22,7 @@
 /**
  *  \file SDL_guid.h
  *
- *  Include file for handling ::SDL_GUID values.
+ *  Include file for handling SDL_GUID values.
  */
 
 #ifndef SDL_guid_h_
@@ -38,19 +38,19 @@ extern "C" {
 #endif
 
 /**
- * An SDL_GUID is a 128-bit identifier for an input device that
- *   identifies that device across runs of SDL programs on the same
- *   platform.  If the device is detached and then re-attached to a
- *   different port, or if the base system is rebooted, the device
- *   should still report the same GUID.
+ * An SDL_GUID is a 128-bit identifier for an input device that identifies
+ * that device across runs of SDL programs on the same platform.
  *
- * GUIDs are as precise as possible but are not guaranteed to
- *   distinguish physically distinct but equivalent devices.  For
- *   example, two game controllers from the same vendor with the same
- *   product ID and revision may have the same GUID.
+ * If the device is detached and then re-attached to a different port, or if
+ * the base system is rebooted, the device should still report the same GUID.
  *
- * GUIDs may be platform-dependent (i.e., the same device may report
- *   different GUIDs on different operating systems).
+ * GUIDs are as precise as possible but are not guaranteed to distinguish
+ * physically distinct but equivalent devices. For example, two game
+ * controllers from the same vendor with the same product ID and revision may
+ * have the same GUID.
+ *
+ * GUIDs may be platform-dependent (i.e., the same device may report different
+ * GUIDs on different operating systems).
  */
 typedef struct SDL_GUID {
     Uint8 data[16];
@@ -59,11 +59,11 @@ typedef struct SDL_GUID {
 /* Function prototypes */
 
 /**
- * Get an ASCII string representation for a given ::SDL_GUID.
+ * Get an ASCII string representation for a given SDL_GUID.
  *
  * You should supply at least 33 bytes for pszGUID.
  *
- * \param guid the ::SDL_GUID you wish to convert to string
+ * \param guid the SDL_GUID you wish to convert to string
  * \param pszGUID buffer in which to write the ASCII string
  * \param cbGUID the size of pszGUID
  *
@@ -74,14 +74,14 @@ typedef struct SDL_GUID {
 extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
 
 /**
- * Convert a GUID string into a ::SDL_GUID structure.
+ * Convert a GUID string into a SDL_GUID structure.
  *
  * Performs no error checking. If this function is given a string containing
  * an invalid GUID, the function will silently succeed, but the GUID generated
  * will not be useful.
  *
  * \param pchGUID string containing an ASCII representation of a GUID
- * \returns a ::SDL_GUID structure.
+ * \returns a SDL_GUID structure.
  *
  * \since This function is available since SDL 2.24.0.
  *

+ 318 - 306
include/SDL_haptic.h

@@ -26,18 +26,19 @@
  *         devices.
  *
  *  The basic usage is as follows:
- *   - Initialize the subsystem (::SDL_INIT_HAPTIC).
+ *   - Initialize the subsystem (SDL_INIT_HAPTIC).
  *   - Open a haptic device.
  *    - SDL_HapticOpen() to open from index.
  *    - SDL_HapticOpenFromJoystick() to open from an existing joystick.
- *   - Create an effect (::SDL_HapticEffect).
+ *   - Create an effect (SDL_HapticEffect).
  *   - Upload the effect with SDL_HapticNewEffect().
  *   - Run the effect with SDL_HapticRunEffect().
  *   - (optional) Free the effect with SDL_HapticDestroyEffect().
  *   - Close the haptic device with SDL_HapticClose().
  *
  * \par Simple rumble example:
- * \code
+ *
+ * ```c
  *    SDL_Haptic *haptic;
  *
  *    // Open the device
@@ -56,10 +57,11 @@
  *
  *    // Clean up
  *    SDL_HapticClose( haptic );
- * \endcode
+ * ```
+ *
+ * Complete example:
  *
- * \par Complete example:
- * \code
+ * ```c
  * int test_haptic( SDL_Joystick * joystick ) {
  *    SDL_Haptic *haptic;
  *    SDL_HapticEffect effect;
@@ -101,7 +103,7 @@
  *
  *    return 0; // Success
  * }
- * \endcode
+ * ```
  */
 
 #ifndef SDL_haptic_h_
@@ -154,31 +156,29 @@ typedef struct _SDL_Haptic SDL_Haptic;
 /* @{ */
 
 /**
- *  \brief Constant effect supported.
+ * Constant effect supported.
  *
- *  Constant haptic effect.
+ * Constant haptic effect.
  *
- *  \sa SDL_HapticCondition
+ * \sa SDL_HapticCondition
  */
 #define SDL_HAPTIC_CONSTANT   (1u<<0)
 
 /**
- *  \brief Sine wave effect supported.
+ * Sine wave effect supported.
  *
- *  Periodic haptic effect that simulates sine waves.
+ * Periodic haptic effect that simulates sine waves.
  *
- *  \sa SDL_HapticPeriodic
+ * \sa SDL_HapticPeriodic
  */
 #define SDL_HAPTIC_SINE       (1u<<1)
 
 /**
- *  \brief Left/Right effect supported.
+ * Left/Right effect supported.
  *
- *  Haptic effect for direct control over high/low frequency motors.
+ * Haptic effect for direct control over high/low frequency motors.
  *
- *  \sa SDL_HapticLeftRight
- * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
- *          we ran out of bits, and this is important for XInput devices.
+ * \sa SDL_HapticLeftRight
  */
 #define SDL_HAPTIC_LEFTRIGHT     (1u<<2)
 
@@ -186,85 +186,85 @@ typedef struct _SDL_Haptic SDL_Haptic;
 /* #define SDL_HAPTIC_SQUARE     (1<<2) */
 
 /**
- *  \brief Triangle wave effect supported.
+ * Triangle wave effect supported.
  *
- *  Periodic haptic effect that simulates triangular waves.
+ * Periodic haptic effect that simulates triangular waves.
  *
- *  \sa SDL_HapticPeriodic
+ * \sa SDL_HapticPeriodic
  */
 #define SDL_HAPTIC_TRIANGLE   (1u<<3)
 
 /**
- *  \brief Sawtoothup wave effect supported.
+ * Sawtoothup wave effect supported.
  *
- *  Periodic haptic effect that simulates saw tooth up waves.
+ * Periodic haptic effect that simulates saw tooth up waves.
  *
- *  \sa SDL_HapticPeriodic
+ * \sa SDL_HapticPeriodic
  */
 #define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
 
 /**
- *  \brief Sawtoothdown wave effect supported.
+ * Sawtoothdown wave effect supported.
  *
- *  Periodic haptic effect that simulates saw tooth down waves.
+ * Periodic haptic effect that simulates saw tooth down waves.
  *
- *  \sa SDL_HapticPeriodic
+ * \sa SDL_HapticPeriodic
  */
 #define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5)
 
 /**
- *  \brief Ramp effect supported.
+ * Ramp effect supported.
  *
- *  Ramp haptic effect.
+ * Ramp haptic effect.
  *
- *  \sa SDL_HapticRamp
+ * \sa SDL_HapticRamp
  */
 #define SDL_HAPTIC_RAMP       (1u<<6)
 
 /**
- *  \brief Spring effect supported - uses axes position.
+ * Spring effect supported - uses axes position.
  *
- *  Condition haptic effect that simulates a spring.  Effect is based on the
- *  axes position.
+ * Condition haptic effect that simulates a spring. Effect is based on the
+ * axes position.
  *
- *  \sa SDL_HapticCondition
+ * \sa SDL_HapticCondition
  */
 #define SDL_HAPTIC_SPRING     (1u<<7)
 
 /**
- *  \brief Damper effect supported - uses axes velocity.
+ * Damper effect supported - uses axes velocity.
  *
- *  Condition haptic effect that simulates dampening.  Effect is based on the
- *  axes velocity.
+ * Condition haptic effect that simulates dampening. Effect is based on the
+ * axes velocity.
  *
- *  \sa SDL_HapticCondition
+ * \sa SDL_HapticCondition
  */
 #define SDL_HAPTIC_DAMPER     (1u<<8)
 
 /**
- *  \brief Inertia effect supported - uses axes acceleration.
+ * Inertia effect supported - uses axes acceleration.
  *
- *  Condition haptic effect that simulates inertia.  Effect is based on the axes
- *  acceleration.
+ * Condition haptic effect that simulates inertia. Effect is based on the axes
+ * acceleration.
  *
- *  \sa SDL_HapticCondition
+ * \sa SDL_HapticCondition
  */
 #define SDL_HAPTIC_INERTIA    (1u<<9)
 
 /**
- *  \brief Friction effect supported - uses axes movement.
+ * Friction effect supported - uses axes movement.
  *
- *  Condition haptic effect that simulates friction.  Effect is based on the
- *  axes movement.
+ * Condition haptic effect that simulates friction. Effect is based on the
+ * axes movement.
  *
- *  \sa SDL_HapticCondition
+ * \sa SDL_HapticCondition
  */
 #define SDL_HAPTIC_FRICTION   (1u<<10)
 
 /**
- *  \brief Custom effect is supported.
+ * Custom effect is supported.
  *
- *  User defined custom haptic effect.
+ * User defined custom haptic effect.
  */
 #define SDL_HAPTIC_CUSTOM     (1u<<11)
 
@@ -273,39 +273,39 @@ typedef struct _SDL_Haptic SDL_Haptic;
 /* These last few are features the device has, not effects */
 
 /**
- *  \brief Device can set global gain.
+ * Device can set global gain.
  *
- *  Device supports setting the global gain.
+ * Device supports setting the global gain.
  *
- *  \sa SDL_HapticSetGain
+ * \sa SDL_HapticSetGain
  */
 #define SDL_HAPTIC_GAIN       (1u<<12)
 
 /**
- *  \brief Device can set autocenter.
+ * Device can set autocenter.
  *
- *  Device supports setting autocenter.
+ * Device supports setting autocenter.
  *
- *  \sa SDL_HapticSetAutocenter
+ * \sa SDL_HapticSetAutocenter
  */
 #define SDL_HAPTIC_AUTOCENTER (1u<<13)
 
 /**
- *  \brief Device can be queried for effect status.
+ * Device can be queried for effect status.
  *
- *  Device supports querying effect status.
+ * Device supports querying effect status.
  *
- *  \sa SDL_HapticGetEffectStatus
+ * \sa SDL_HapticGetEffectStatus
  */
 #define SDL_HAPTIC_STATUS     (1u<<14)
 
 /**
- *  \brief Device can be paused.
+ * Device can be paused.
  *
- *  Devices supports being paused.
+ * Devices supports being paused.
  *
- *  \sa SDL_HapticPause
- *  \sa SDL_HapticUnpause
+ * \sa SDL_HapticPause
+ * \sa SDL_HapticUnpause
  */
 #define SDL_HAPTIC_PAUSE      (1u<<15)
 
@@ -316,31 +316,33 @@ typedef struct _SDL_Haptic SDL_Haptic;
 /* @{ */
 
 /**
- *  \brief Uses polar coordinates for the direction.
+ * Uses polar coordinates for the direction.
  *
- *  \sa SDL_HapticDirection
+ * \sa SDL_HapticDirection
  */
 #define SDL_HAPTIC_POLAR      0
 
 /**
- *  \brief Uses cartesian coordinates for the direction.
+ * Uses cartesian coordinates for the direction.
  *
- *  \sa SDL_HapticDirection
+ * \sa SDL_HapticDirection
  */
 #define SDL_HAPTIC_CARTESIAN  1
 
 /**
- *  \brief Uses spherical coordinates for the direction.
+ * Uses spherical coordinates for the direction.
  *
- *  \sa SDL_HapticDirection
+ * \sa SDL_HapticDirection
  */
 #define SDL_HAPTIC_SPHERICAL  2
 
 /**
- *  \brief Use this value to play an effect on the steering wheel axis. This 
- *  provides better compatibility across platforms and devices as SDL will guess 
- *  the correct axis.
- *  \sa SDL_HapticDirection
+ * Use this value to play an effect on the steering wheel axis.
+ *
+ * This provides better compatibility across platforms and devices as SDL will
+ * guess the correct axis.
+ *
+ * \sa SDL_HapticDirection
  */
 #define SDL_HAPTIC_STEERING_AXIS 3
 
@@ -353,7 +355,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  */
 
 /**
- * \brief Used to play a device an infinite number of times.
+ * Used to play a device an infinite number of times.
  *
  * \sa SDL_HapticRunEffect
  */
@@ -361,77 +363,82 @@ typedef struct _SDL_Haptic SDL_Haptic;
 
 
 /**
- *  \brief Structure that represents a haptic direction.
- *
- *  This is the direction where the force comes from,
- *  instead of the direction in which the force is exerted.
- *
- *  Directions can be specified by:
- *   - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
- *   - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
- *   - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
- *
- *  Cardinal directions of the haptic device are relative to the positioning
- *  of the device.  North is considered to be away from the user.
- *
- *  The following diagram represents the cardinal directions:
- *  \verbatim
-                 .--.
-                 |__| .-------.
-                 |=.| |.-----.|
-                 |--| ||     ||
-                 |  | |'-----'|
-                 |__|~')_____('
-                   [ COMPUTER ]
-
-
-                     North (0,-1)
-                         ^
-                         |
-                         |
-   (-1,0)  West <----[ HAPTIC ]----> East (1,0)
-                         |
-                         |
-                         v
-                      South (0,1)
-
-
-                      [ USER ]
-                        \|||/
-                        (o o)
-                  ---ooO-(_)-Ooo---
-    \endverbatim
- *
- *  If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
- *  degree starting north and turning clockwise.  ::SDL_HAPTIC_POLAR only uses
- *  the first \c dir parameter.  The cardinal directions would be:
- *   - North: 0 (0 degrees)
- *   - East: 9000 (90 degrees)
- *   - South: 18000 (180 degrees)
- *   - West: 27000 (270 degrees)
- *
- *  If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
- *  (X axis, Y axis and Z axis (with 3 axes)).  ::SDL_HAPTIC_CARTESIAN uses
- *  the first three \c dir parameters.  The cardinal directions would be:
- *   - North:  0,-1, 0
- *   - East:   1, 0, 0
- *   - South:  0, 1, 0
- *   - West:  -1, 0, 0
- *
- *  The Z axis represents the height of the effect if supported, otherwise
- *  it's unused.  In cartesian encoding (1, 2) would be the same as (2, 4), you
- *  can use any multiple you want, only the direction matters.
- *
- *  If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
- *  The first two \c dir parameters are used.  The \c dir parameters are as
- *  follows (all values are in hundredths of degrees):
- *   - Degrees from (1, 0) rotated towards (0, 1).
- *   - Degrees towards (0, 0, 1) (device needs at least 3 axes).
- *
- *
- *  Example of force coming from the south with all encodings (force coming
- *  from the south means the user will have to pull the stick to counteract):
- *  \code
+ * Structure that represents a haptic direction.
+ *
+ * This is the direction where the force comes from, instead of the direction
+ * in which the force is exerted.
+ *
+ * Directions can be specified by:
+ *
+ * - SDL_HAPTIC_POLAR : Specified by polar coordinates.
+ * - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
+ * - SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
+ *
+ * Cardinal directions of the haptic device are relative to the positioning of
+ * the device. North is considered to be away from the user.
+ *
+ * The following diagram represents the cardinal directions:
+ *
+ * ```
+ *                .--.
+ *                |__| .-------.
+ *                |=.| |.-----.|
+ *                |--| ||     ||
+ *                |  | |'-----'|
+ *                |__|~')_____('
+ *                  [ COMPUTER ]
+ *
+ *
+ *                    North (0,-1)
+ *                        ^
+ *                        |
+ *                        |
+ *  (-1,0)  West <----[ HAPTIC ]----> East (1,0)
+ *                        |
+ *                        |
+ *                        v
+ *                     South (0,1)
+ *
+ *
+ *                     [ USER ]
+ *                       \|||/
+ *                       (o o)
+ *                 ---ooO-(_)-Ooo---
+ * ```
+ *
+ * If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a degree
+ * starting north and turning clockwise. SDL_HAPTIC_POLAR only uses the first
+ * `dir` parameter. The cardinal directions would be:
+ *
+ * - North: 0 (0 degrees)
+ * - East: 9000 (90 degrees)
+ * - South: 18000 (180 degrees)
+ * - West: 27000 (270 degrees)
+ *
+ * If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions (X
+ * axis, Y axis and Z axis (with 3 axes)). SDL_HAPTIC_CARTESIAN uses the first
+ * three `dir` parameters. The cardinal directions would be:
+ *
+ * - North: 0,-1, 0
+ * - East: 1, 0, 0
+ * - South: 0, 1, 0
+ * - West: -1, 0, 0
+ *
+ * The Z axis represents the height of the effect if supported, otherwise it's
+ * unused. In cartesian encoding (1, 2) would be the same as (2, 4), you can
+ * use any multiple you want, only the direction matters.
+ *
+ * If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. The
+ * first two `dir` parameters are used. The `dir` parameters are as follows
+ * (all values are in hundredths of degrees):
+ *
+ * - Degrees from (1, 0) rotated towards (0, 1).
+ * - Degrees towards (0, 0, 1) (device needs at least 3 axes).
+ *
+ * Example of force coming from the south with all encodings (force coming
+ * from the south means the user will have to pull the stick to counteract):
+ *
+ * ```c
  *  SDL_HapticDirection direction;
  *
  *  // Cartesian directions
@@ -447,14 +454,14 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *  // Spherical coordinates
  *  direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
  *  direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
- *  \endcode
+ * ```
  *
- *  \sa SDL_HAPTIC_POLAR
- *  \sa SDL_HAPTIC_CARTESIAN
- *  \sa SDL_HAPTIC_SPHERICAL
- *  \sa SDL_HAPTIC_STEERING_AXIS
- *  \sa SDL_HapticEffect
- *  \sa SDL_HapticNumAxes
+ * \sa SDL_HAPTIC_POLAR
+ * \sa SDL_HAPTIC_CARTESIAN
+ * \sa SDL_HAPTIC_SPHERICAL
+ * \sa SDL_HAPTIC_STEERING_AXIS
+ * \sa SDL_HapticEffect
+ * \sa SDL_HapticNumAxes
  */
 typedef struct SDL_HapticDirection
 {
@@ -464,20 +471,20 @@ typedef struct SDL_HapticDirection
 
 
 /**
- *  \brief A structure containing a template for a Constant effect.
+ * A structure containing a template for a Constant effect.
  *
- *  This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
+ * This struct is exclusively for the SDL_HAPTIC_CONSTANT effect.
  *
- *  A constant effect applies a constant force in the specified direction
- *  to the joystick.
+ * A constant effect applies a constant force in the specified direction to
+ * the joystick.
  *
- *  \sa SDL_HAPTIC_CONSTANT
- *  \sa SDL_HapticEffect
+ * \sa SDL_HAPTIC_CONSTANT
+ * \sa SDL_HapticEffect
  */
 typedef struct SDL_HapticConstant
 {
     /* Header */
-    Uint16 type;            /**< ::SDL_HAPTIC_CONSTANT */
+    Uint16 type;            /**< SDL_HAPTIC_CONSTANT */
     SDL_HapticDirection direction;  /**< Direction of the effect. */
 
     /* Replay */
@@ -499,68 +506,71 @@ typedef struct SDL_HapticConstant
 } SDL_HapticConstant;
 
 /**
- *  \brief A structure containing a template for a Periodic effect.
- *
- *  The struct handles the following effects:
- *   - ::SDL_HAPTIC_SINE
- *   - ::SDL_HAPTIC_LEFTRIGHT
- *   - ::SDL_HAPTIC_TRIANGLE
- *   - ::SDL_HAPTIC_SAWTOOTHUP
- *   - ::SDL_HAPTIC_SAWTOOTHDOWN
- *
- *  A periodic effect consists in a wave-shaped effect that repeats itself
- *  over time.  The type determines the shape of the wave and the parameters
- *  determine the dimensions of the wave.
- *
- *  Phase is given by hundredth of a degree meaning that giving the phase a value
- *  of 9000 will displace it 25% of its period.  Here are sample values:
- *   -     0: No phase displacement.
- *   -  9000: Displaced 25% of its period.
- *   - 18000: Displaced 50% of its period.
- *   - 27000: Displaced 75% of its period.
- *   - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
- *
- *  Examples:
- *  \verbatim
-    SDL_HAPTIC_SINE
-      __      __      __      __
-     /  \    /  \    /  \    /
-    /    \__/    \__/    \__/
-
-    SDL_HAPTIC_SQUARE
-     __    __    __    __    __
-    |  |  |  |  |  |  |  |  |  |
-    |  |__|  |__|  |__|  |__|  |
-
-    SDL_HAPTIC_TRIANGLE
-      /\    /\    /\    /\    /\
-     /  \  /  \  /  \  /  \  /
-    /    \/    \/    \/    \/
-
-    SDL_HAPTIC_SAWTOOTHUP
-      /|  /|  /|  /|  /|  /|  /|
-     / | / | / | / | / | / | / |
-    /  |/  |/  |/  |/  |/  |/  |
-
-    SDL_HAPTIC_SAWTOOTHDOWN
-    \  |\  |\  |\  |\  |\  |\  |
-     \ | \ | \ | \ | \ | \ | \ |
-      \|  \|  \|  \|  \|  \|  \|
-    \endverbatim
- *
- *  \sa SDL_HAPTIC_SINE
- *  \sa SDL_HAPTIC_LEFTRIGHT
- *  \sa SDL_HAPTIC_TRIANGLE
- *  \sa SDL_HAPTIC_SAWTOOTHUP
- *  \sa SDL_HAPTIC_SAWTOOTHDOWN
- *  \sa SDL_HapticEffect
+ * A structure containing a template for a Periodic effect.
+ *
+ * The struct handles the following effects:
+ *
+ * - SDL_HAPTIC_SINE
+ * - SDL_HAPTIC_SQUARE
+ * - SDL_HAPTIC_TRIANGLE
+ * - SDL_HAPTIC_SAWTOOTHUP
+ * - SDL_HAPTIC_SAWTOOTHDOWN
+ *
+ * A periodic effect consists in a wave-shaped effect that repeats itself over
+ * time. The type determines the shape of the wave and the parameters
+ * determine the dimensions of the wave.
+ *
+ * Phase is given by hundredth of a degree meaning that giving the phase a
+ * value of 9000 will displace it 25% of its period. Here are sample values:
+ *
+ * - 0: No phase displacement.
+ * - 9000: Displaced 25% of its period.
+ * - 18000: Displaced 50% of its period.
+ * - 27000: Displaced 75% of its period.
+ * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
+ *
+ * Examples:
+ *
+ * ```
+ *   SDL_HAPTIC_SINE
+ *     __      __      __      __
+ *    /  \    /  \    /  \    /
+ *   /    \__/    \__/    \__/
+ *
+ *   SDL_HAPTIC_SQUARE
+ *    __    __    __    __    __
+ *   |  |  |  |  |  |  |  |  |  |
+ *   |  |__|  |__|  |__|  |__|  |
+ *
+ *   SDL_HAPTIC_TRIANGLE
+ *     /\    /\    /\    /\    /\
+ *    /  \  /  \  /  \  /  \  /
+ *   /    \/    \/    \/    \/
+ *
+ *   SDL_HAPTIC_SAWTOOTHUP
+ *     /|  /|  /|  /|  /|  /|  /|
+ *    / | / | / | / | / | / | / |
+ *   /  |/  |/  |/  |/  |/  |/  |
+ *
+ *   SDL_HAPTIC_SAWTOOTHDOWN
+ *   \  |\  |\  |\  |\  |\  |\  |
+ *    \ | \ | \ | \ | \ | \ | \ |
+ *     \|  \|  \|  \|  \|  \|  \|
+ * ```
+ *
+ * \sa SDL_HAPTIC_SINE
+ * \sa SDL_HAPTIC_LEFTRIGHT
+ * \sa SDL_HAPTIC_TRIANGLE
+ * \sa SDL_HAPTIC_SAWTOOTHUP
+ * \sa SDL_HAPTIC_SAWTOOTHDOWN
+ * \sa SDL_HapticEffect
  */
 typedef struct SDL_HapticPeriodic
 {
     /* Header */
-    Uint16 type;        /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT,
-                             ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
-                             ::SDL_HAPTIC_SAWTOOTHDOWN */
+    Uint16 type;        /**< SDL_HAPTIC_SINE, SDL_HAPTIC_LEFTRIGHT,
+                             SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or
+                             SDL_HAPTIC_SAWTOOTHDOWN */
     SDL_HapticDirection direction;  /**< Direction of the effect. */
 
     /* Replay */
@@ -585,34 +595,35 @@ typedef struct SDL_HapticPeriodic
 } SDL_HapticPeriodic;
 
 /**
- *  \brief A structure containing a template for a Condition effect.
+ * A structure containing a template for a Condition effect.
+ *
+ * The struct handles the following effects:
  *
- *  The struct handles the following effects:
- *   - ::SDL_HAPTIC_SPRING: Effect based on axes position.
- *   - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
- *   - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
- *   - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
+ * - SDL_HAPTIC_SPRING: Effect based on axes position.
+ * - SDL_HAPTIC_DAMPER: Effect based on axes velocity.
+ * - SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
+ * - SDL_HAPTIC_FRICTION: Effect based on axes movement.
  *
- *  Direction is handled by condition internals instead of a direction member.
- *  The condition effect specific members have three parameters.  The first
- *  refers to the X axis, the second refers to the Y axis and the third
- *  refers to the Z axis.  The right terms refer to the positive side of the
- *  axis and the left terms refer to the negative side of the axis.  Please
- *  refer to the ::SDL_HapticDirection diagram for which side is positive and
- *  which is negative.
+ * Direction is handled by condition internals instead of a direction member.
+ * The condition effect specific members have three parameters. The first
+ * refers to the X axis, the second refers to the Y axis and the third refers
+ * to the Z axis. The right terms refer to the positive side of the axis and
+ * the left terms refer to the negative side of the axis. Please refer to the
+ * SDL_HapticDirection diagram for which side is positive and which is
+ * negative.
  *
- *  \sa SDL_HapticDirection
- *  \sa SDL_HAPTIC_SPRING
- *  \sa SDL_HAPTIC_DAMPER
- *  \sa SDL_HAPTIC_INERTIA
- *  \sa SDL_HAPTIC_FRICTION
- *  \sa SDL_HapticEffect
+ * \sa SDL_HapticDirection
+ * \sa SDL_HAPTIC_SPRING
+ * \sa SDL_HAPTIC_DAMPER
+ * \sa SDL_HAPTIC_INERTIA
+ * \sa SDL_HAPTIC_FRICTION
+ * \sa SDL_HapticEffect
  */
 typedef struct SDL_HapticCondition
 {
     /* Header */
-    Uint16 type;            /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER,
-                                 ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */
+    Uint16 type;            /**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER,
+                                 SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION */
     SDL_HapticDirection direction;  /**< Direction of the effect - Not used ATM. */
 
     /* Replay */
@@ -633,22 +644,22 @@ typedef struct SDL_HapticCondition
 } SDL_HapticCondition;
 
 /**
- *  \brief A structure containing a template for a Ramp effect.
+ * A structure containing a template for a Ramp effect.
  *
- *  This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
+ * This struct is exclusively for the SDL_HAPTIC_RAMP effect.
  *
- *  The ramp effect starts at start strength and ends at end strength.
- *  It augments in linear fashion.  If you use attack and fade with a ramp
- *  the effects get added to the ramp effect making the effect become
- *  quadratic instead of linear.
+ * The ramp effect starts at start strength and ends at end strength. It
+ * augments in linear fashion. If you use attack and fade with a ramp the
+ * effects get added to the ramp effect making the effect become quadratic
+ * instead of linear.
  *
- *  \sa SDL_HAPTIC_RAMP
- *  \sa SDL_HapticEffect
+ * \sa SDL_HAPTIC_RAMP
+ * \sa SDL_HapticEffect
  */
 typedef struct SDL_HapticRamp
 {
     /* Header */
-    Uint16 type;            /**< ::SDL_HAPTIC_RAMP */
+    Uint16 type;            /**< SDL_HAPTIC_RAMP */
     SDL_HapticDirection direction;  /**< Direction of the effect. */
 
     /* Replay */
@@ -671,9 +682,9 @@ typedef struct SDL_HapticRamp
 } SDL_HapticRamp;
 
 /**
- * \brief A structure containing a template for a Left/Right effect.
+ * A structure containing a template for a Left/Right effect.
  *
- * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
+ * This struct is exclusively for the SDL_HAPTIC_LEFTRIGHT effect.
  *
  * The Left/Right effect is used to explicitly control the large and small
  * motors, commonly found in modern game controllers. The small (right) motor
@@ -685,7 +696,7 @@ typedef struct SDL_HapticRamp
 typedef struct SDL_HapticLeftRight
 {
     /* Header */
-    Uint16 type;            /**< ::SDL_HAPTIC_LEFTRIGHT */
+    Uint16 type;            /**< SDL_HAPTIC_LEFTRIGHT */
 
     /* Replay */
     Uint32 length;          /**< Duration of the effect in milliseconds. */
@@ -696,24 +707,24 @@ typedef struct SDL_HapticLeftRight
 } SDL_HapticLeftRight;
 
 /**
- *  \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
+ * A structure containing a template for the SDL_HAPTIC_CUSTOM effect.
  *
- *  This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
+ * This struct is exclusively for the SDL_HAPTIC_CUSTOM effect.
  *
- *  A custom force feedback effect is much like a periodic effect, where the
- *  application can define its exact shape.  You will have to allocate the
- *  data yourself.  Data should consist of channels * samples Uint16 samples.
+ * A custom force feedback effect is much like a periodic effect, where the
+ * application can define its exact shape. You will have to allocate the data
+ * yourself. Data should consist of channels * samples Uint16 samples.
  *
- *  If channels is one, the effect is rotated using the defined direction.
- *  Otherwise it uses the samples in data for the different axes.
+ * If channels is one, the effect is rotated using the defined direction.
+ * Otherwise it uses the samples in data for the different axes.
  *
- *  \sa SDL_HAPTIC_CUSTOM
- *  \sa SDL_HapticEffect
+ * \sa SDL_HAPTIC_CUSTOM
+ * \sa SDL_HapticEffect
  */
 typedef struct SDL_HapticCustom
 {
     /* Header */
-    Uint16 type;            /**< ::SDL_HAPTIC_CUSTOM */
+    Uint16 type;            /**< SDL_HAPTIC_CUSTOM */
     SDL_HapticDirection direction;  /**< Direction of the effect. */
 
     /* Replay */
@@ -738,27 +749,28 @@ typedef struct SDL_HapticCustom
 } SDL_HapticCustom;
 
 /**
- *  \brief The generic template for any haptic effect.
+ * The generic template for any haptic effect.
+ *
+ * All values max at 32767 (0x7FFF). Signed values also can be negative. Time
+ * values unless specified otherwise are in milliseconds.
  *
- *  All values max at 32767 (0x7FFF).  Signed values also can be negative.
- *  Time values unless specified otherwise are in milliseconds.
+ * You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value.
+ * Neither delay, interval, attack_length nor fade_length support
+ * SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
  *
- *  You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
- *  value.  Neither delay, interval, attack_length nor fade_length support
- *  ::SDL_HAPTIC_INFINITY.  Fade will also not be used since effect never ends.
+ * Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of
+ * SDL_HAPTIC_INFINITY.
  *
- *  Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
- *  ::SDL_HAPTIC_INFINITY.
+ * Button triggers may not be supported on all devices, it is advised to not
+ * use them if possible. Buttons start at index 1 instead of index 0 like the
+ * joystick.
  *
- *  Button triggers may not be supported on all devices, it is advised to not
- *  use them if possible.  Buttons start at index 1 instead of index 0 like
- *  the joystick.
+ * If both attack_length and fade_level are 0, the envelope is not used,
+ * otherwise both values are used.
  *
- *  If both attack_length and fade_level are 0, the envelope is not used,
- *  otherwise both values are used.
+ * Common parts:
  *
- *  Common parts:
- *  \code
+ * ```c
  *  // Replay - All effects have this
  *  Uint32 length;        // Duration of effect (ms).
  *  Uint16 delay;         // Delay before starting effect.
@@ -772,39 +784,39 @@ typedef struct SDL_HapticCustom
  *  Uint16 attack_level;  // Level at the start of the attack.
  *  Uint16 fade_length;   // Duration of the fade out (ms).
  *  Uint16 fade_level;    // Level at the end of the fade.
- *  \endcode
- *
- *
- *  Here we have an example of a constant effect evolution in time:
- *  \verbatim
-    Strength
-    ^
-    |
-    |    effect level -->  _________________
-    |                     /                 \
-    |                    /                   \
-    |                   /                     \
-    |                  /                       \
-    | attack_level --> |                        \
-    |                  |                        |  <---  fade_level
-    |
-    +--------------------------------------------------> Time
-                       [--]                 [---]
-                       attack_length        fade_length
-
-    [------------------][-----------------------]
-    delay               length
-    \endverbatim
- *
- *  Note either the attack_level or the fade_level may be above the actual
- *  effect level.
- *
- *  \sa SDL_HapticConstant
- *  \sa SDL_HapticPeriodic
- *  \sa SDL_HapticCondition
- *  \sa SDL_HapticRamp
- *  \sa SDL_HapticLeftRight
- *  \sa SDL_HapticCustom
+ * ```
+ *
+ * Here we have an example of a constant effect evolution in time:
+ *
+ * ```
+ *  Strength
+ *  ^
+ *  |
+ *  |    effect level -->  _________________
+ *  |                     /                 \
+ *  |                    /                   \
+ *  |                   /                     \
+ *  |                  /                       \
+ *  | attack_level --> |                        \
+ *  |                  |                        |  <---  fade_level
+ *  |
+ *  +--------------------------------------------------> Time
+ *                     [--]                 [---]
+ *                     attack_length        fade_length
+ *
+ *  [------------------][-----------------------]
+ *  delay               length
+ * ```
+ *
+ * Note either the attack_level or the fade_level may be above the actual
+ * effect level.
+ *
+ * \sa SDL_HapticConstant
+ * \sa SDL_HapticPeriodic
+ * \sa SDL_HapticCondition
+ * \sa SDL_HapticRamp
+ * \sa SDL_HapticLeftRight
+ * \sa SDL_HapticCustom
  */
 typedef union SDL_HapticEffect
 {

+ 3 - 2
include/SDL_hidapi.h

@@ -71,14 +71,15 @@ extern "C" {
 #endif
 
 /**
- *  \brief  A handle representing an open HID device
+ * A handle representing an open HID device
  */
 struct SDL_hid_device_;
 typedef struct SDL_hid_device_ SDL_hid_device; /**< opaque hidapi structure */
 
 /** hidapi info structure */
+
 /**
- *  \brief  Information about a connected HID device
+ * Information about a connected HID device
  */
 typedef struct SDL_hid_device_info
 {

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 1119 - 835
include/SDL_hints.h


+ 12 - 8
include/SDL_joystick.h

@@ -56,7 +56,7 @@ extern "C" {
  *  \file SDL_joystick.h
  *
  *  In order to use these functions, SDL_Init() must have been called
- *  with the ::SDL_INIT_JOYSTICK flag.  This causes SDL to scan the system
+ *  with the SDL_INIT_JOYSTICK flag.  This causes SDL to scan the system
  *  for joysticks, and load appropriate drivers.
  *
  *  If you would like to receive joystick updates while the application
@@ -77,11 +77,13 @@ typedef struct _SDL_Joystick SDL_Joystick;
 typedef SDL_GUID SDL_JoystickGUID;
 
 /**
- * This is a unique ID for a joystick for the time it is connected to the system,
- * and is never reused for the lifetime of the application. If the joystick is
- * disconnected and reconnected, it will get a new ID.
+ * This is a unique ID for a joystick for the time it is connected to the
+ * system, and is never reused for the lifetime of the application.
  *
- * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ * If the joystick is disconnected and reconnected, it will get a new ID.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an
+ * invalid ID.
  */
 typedef Sint32 SDL_JoystickID;
 
@@ -358,8 +360,10 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
 /**
  * The structure that defines an extended virtual joystick description
  *
- * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx()
- *  All other elements of this structure are optional and can be left 0.
+ * The caller must zero the structure and then initialize the version with
+ * `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to
+ * SDL_JoystickAttachVirtualEx() All other elements of this structure are
+ * optional and can be left 0.
  *
  * \sa SDL_JoystickAttachVirtualEx
  */
@@ -390,7 +394,7 @@ typedef struct SDL_VirtualJoystickDesc
 } SDL_VirtualJoystickDesc;
 
 /**
- * \brief The current version of the SDL_VirtualJoystickDesc structure
+ * The current version of the SDL_VirtualJoystickDesc structure
  */
 #define SDL_VIRTUAL_JOYSTICK_DESC_VERSION   1
 

+ 5 - 4
include/SDL_keyboard.h

@@ -40,14 +40,15 @@ extern "C" {
 #endif
 
 /**
- *  \brief The SDL keysym structure, used in key events.
+ * The SDL keysym structure, used in key events.
  *
- *  \note  If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
+ * If you are looking for translated character input, see the SDL_TEXTINPUT
+ * event.
  */
 typedef struct SDL_Keysym
 {
-    SDL_Scancode scancode;      /**< SDL physical key code - see ::SDL_Scancode for details */
-    SDL_Keycode sym;            /**< SDL virtual key code - see ::SDL_Keycode for details */
+    SDL_Scancode scancode;      /**< SDL physical key code - see SDL_Scancode for details */
+    SDL_Keycode sym;            /**< SDL virtual key code - see SDL_Keycode for details */
     Uint16 mod;                 /**< current key modifiers */
     Uint32 unused;
 } SDL_Keysym;

+ 8 - 8
include/SDL_keycode.h

@@ -32,15 +32,15 @@
 #include "SDL_scancode.h"
 
 /**
- *  \brief The SDL virtual key representation.
+ * The SDL virtual key representation.
  *
- *  Values of this type are used to represent keyboard keys using the current
- *  layout of the keyboard.  These values include Unicode values representing
- *  the unmodified character that would be generated by pressing the key, or
- *  an SDLK_* constant for those keys that do not generate characters.
+ * Values of this type are used to represent keyboard keys using the current
+ * layout of the keyboard. These values include Unicode values representing
+ * the unmodified character that would be generated by pressing the key, or an
+ * SDLK_* constant for those keys that do not generate characters.
  *
- *  A special exception is the number keys at the top of the keyboard which
- *  map to SDLK_0...SDLK_9 on AZERTY layouts.
+ * A special exception is the number keys at the top of the keyboard which map
+ * to SDLK_0...SDLK_9 on AZERTY layouts.
  */
 typedef Sint32 SDL_Keycode;
 
@@ -327,7 +327,7 @@ typedef enum SDL_KeyCode
 } SDL_KeyCode;
 
 /**
- * \brief Enumeration of valid key mods (possibly OR'd together).
+ * Enumeration of valid key mods (possibly OR'd together).
  */
 typedef enum SDL_Keymod
 {

+ 7 - 8
include/SDL_log.h

@@ -47,19 +47,18 @@ extern "C" {
 
 
 /**
- *  \brief The maximum size of a log message prior to SDL 2.0.24
+ * The maximum size of a log message prior to SDL 2.0.24
  *
- *  As of 2.0.24 there is no limit to the length of SDL log messages.
+ * As of 2.0.24 there is no limit to the length of SDL log messages.
  */
 #define SDL_MAX_LOG_MESSAGE 4096
 
 /**
- *  \brief The predefined log categories
+ * The predefined log categories
  *
- *  By default the application category is enabled at the INFO level,
- *  the assert category is enabled at the WARN level, test is enabled
- *  at the VERBOSE level and all other categories are enabled at the
- *  ERROR level.
+ * By default the application category is enabled at the INFO level, the
+ * assert category is enabled at the WARN level, test is enabled at the
+ * VERBOSE level and all other categories are enabled at the ERROR level.
  */
 typedef enum SDL_LogCategory
 {
@@ -97,7 +96,7 @@ typedef enum SDL_LogCategory
 } SDL_LogCategory;
 
 /**
- *  \brief The predefined log priorities
+ * The predefined log priorities
  */
 typedef enum SDL_LogPriority
 {

+ 3 - 3
include/SDL_main.h

@@ -129,14 +129,14 @@
  *
  *  The application's main() function must be called with C linkage,
  *  and should be declared like this:
- *  \code
+ *  ```c
  *  #ifdef __cplusplus
  *  extern "C"
  *  #endif
  *  int main(int argc, char *argv[])
  *  {
  *  }
- *  \endcode
+ *  ```
  */
 
 #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
@@ -149,7 +149,7 @@ extern "C" {
 #endif
 
 /**
- *  The prototype for the application's main() function
+ * The prototype for the application's main() function
  */
 typedef int (*SDL_main_func)(int argc, char *argv[]);
 extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);

+ 6 - 4
include/SDL_messagebox.h

@@ -32,7 +32,9 @@ extern "C" {
 #endif
 
 /**
- * SDL_MessageBox flags. If supported will display warning icon, etc.
+ * SDL_MessageBox flags.
+ *
+ * If supported will display warning icon, etc.
  */
 typedef enum SDL_MessageBoxFlags
 {
@@ -57,7 +59,7 @@ typedef enum SDL_MessageBoxButtonFlags
  */
 typedef struct SDL_MessageBoxButtonData
 {
-    Uint32 flags;       /**< ::SDL_MessageBoxButtonFlags */
+    Uint32 flags;       /**< SDL_MessageBoxButtonFlags */
     int buttonid;       /**< User defined button id (value returned via SDL_ShowMessageBox) */
     const char * text;  /**< The UTF-8 button text */
 } SDL_MessageBoxButtonData;
@@ -93,7 +95,7 @@ typedef struct SDL_MessageBoxColorScheme
  */
 typedef struct SDL_MessageBoxData
 {
-    Uint32 flags;                       /**< ::SDL_MessageBoxFlags */
+    Uint32 flags;                       /**< SDL_MessageBoxFlags */
     SDL_Window *window;                 /**< Parent window, can be NULL */
     const char *title;                  /**< UTF-8 title */
     const char *message;                /**< UTF-8 message text */
@@ -101,7 +103,7 @@ typedef struct SDL_MessageBoxData
     int numbuttons;
     const SDL_MessageBoxButtonData *buttons;
 
-    const SDL_MessageBoxColorScheme *colorScheme;   /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
+    const SDL_MessageBoxColorScheme *colorScheme;   /**< SDL_MessageBoxColorScheme, can be NULL to use system settings */
 } SDL_MessageBoxData;
 
 /**

+ 2 - 2
include/SDL_metal.h

@@ -37,9 +37,9 @@ extern "C" {
 #endif
 
 /**
- *  \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
+ * A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
  *
- *  \note This can be cast directly to an NSView or UIView.
+ * This can be cast directly to an NSView or UIView.
  */
 typedef void *SDL_MetalView;
 

+ 5 - 5
include/SDL_mouse.h

@@ -41,7 +41,7 @@ extern "C" {
 typedef struct SDL_Cursor SDL_Cursor;   /**< Implementation dependent */
 
 /**
- * \brief Cursor types for SDL_CreateSystemCursor().
+ * Cursor types for SDL_CreateSystemCursor().
  */
 typedef enum SDL_SystemCursor
 {
@@ -61,7 +61,7 @@ typedef enum SDL_SystemCursor
 } SDL_SystemCursor;
 
 /**
- * \brief Scroll direction types for the Scroll event
+ * Scroll direction types for the Scroll event
  */
 typedef enum SDL_MouseWheelDirection
 {
@@ -437,9 +437,9 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
 /**
  * Used as a mask when testing buttons in buttonstate.
  *
- * - Button 1:  Left mouse button
- * - Button 2:  Middle mouse button
- * - Button 3:  Right mouse button
+ * - Button 1: Left mouse button
+ * - Button 2: Middle mouse button
+ * - Button 3: Right mouse button
  */
 #define SDL_BUTTON(X)       (1 << ((X)-1))
 #define SDL_BUTTON_LEFT     1

+ 3 - 3
include/SDL_mutex.h

@@ -112,13 +112,13 @@ extern "C" {
 #endif
 
 /**
- *  Synchronization functions which can time out return this value
- *  if they time out.
+ * Synchronization functions which can time out return this value if they time
+ * out.
  */
 #define SDL_MUTEX_TIMEDOUT  1
 
 /**
- *  This is the timeout value which corresponds to never time out.
+ * This is the timeout value which corresponds to never time out.
  */
 #define SDL_MUTEX_MAXWAIT   (~(Uint32)0)
 

+ 28 - 4
include/SDL_pixels.h

@@ -320,9 +320,10 @@ typedef enum
 } SDL_PixelFormatEnum;
 
 /**
- * The bits of this structure can be directly reinterpreted as an integer-packed
- * color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888
- * on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
+ * The bits of this structure can be directly reinterpreted as an
+ * integer-packed color which uses the SDL_PIXELFORMAT_RGBA32 format
+ * (SDL_PIXELFORMAT_ABGR8888 on little-endian systems and
+ * SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
  */
 typedef struct SDL_Color
 {
@@ -342,7 +343,30 @@ typedef struct SDL_Palette
 } SDL_Palette;
 
 /**
- *  \note Everything in the pixel format structure is read-only.
+ * A structure that contains pixel format information.
+ *
+ * Everything in the pixel format structure is read-only.
+ *
+ * A pixel format has either a palette or masks. If a palette is used `Rmask`,
+ * `Gmask`, `Bmask`, and `Amask` will be 0.
+ *
+ * An SDL_PixelFormat describes the format of the pixel data stored at the
+ * `pixels` field of an SDL_Surface. Every surface stores an SDL_PixelFormat
+ * in the `format` field.
+ *
+ * If you wish to do pixel level modifications on a surface, then
+ * understanding how SDL stores its color information is essential.
+ *
+ * For information on modern pixel color spaces, see the following Wikipedia
+ * article: http://en.wikipedia.org/wiki/RGBA_color_space
+ *
+ * \sa SDL_ConvertSurface
+ * \sa SDL_GetRGB
+ * \sa SDL_GetRGBA
+ * \sa SDL_MapRGB
+ * \sa SDL_MapRGBA
+ * \sa SDL_AllocFormat
+ * \sa SDL_FreeFormat
  */
 typedef struct SDL_PixelFormat
 {

+ 1 - 1
include/SDL_power.h

@@ -37,7 +37,7 @@ extern "C" {
 #endif
 
 /**
- *  The basic state for the system's power supply.
+ * The basic state for the system's power supply.
  */
 typedef enum SDL_PowerState
 {

+ 3 - 3
include/SDL_quit.h

@@ -34,7 +34,7 @@
 /**
  *  \file SDL_quit.h
  *
- *  An ::SDL_QUIT event is generated when the user tries to close the application
+ *  An SDL_QUIT event is generated when the user tries to close the application
  *  window.  If it is ignored or filtered out, the window will remain open.
  *  If it is not ignored or filtered, it is queued normally and the window
  *  is allowed to close.  When the window is closed, screen updates will
@@ -42,8 +42,8 @@
  *
  *  SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
  *  and SIGTERM (system termination request), if handlers do not already
- *  exist, that generate ::SDL_QUIT events as well.  There is no way
- *  to determine the cause of an ::SDL_QUIT event, but setting a signal
+ *  exist, that generate SDL_QUIT events as well.  There is no way
+ *  to determine the cause of an SDL_QUIT event, but setting a signal
  *  handler in your application will override the default generation of
  *  quit events for that signal.
  *

+ 2 - 2
include/SDL_render.h

@@ -78,7 +78,7 @@ typedef enum SDL_RendererFlags
 typedef struct SDL_RendererInfo
 {
     const char *name;           /**< The name of the renderer */
-    Uint32 flags;               /**< Supported ::SDL_RendererFlags */
+    Uint32 flags;               /**< Supported SDL_RendererFlags */
     Uint32 num_texture_formats; /**< The number of available texture formats */
     Uint32 texture_formats[16]; /**< The available texture formats */
     int max_texture_width;      /**< The maximum texture width */
@@ -86,7 +86,7 @@ typedef struct SDL_RendererInfo
 } SDL_RendererInfo;
 
 /**
- *  Vertex structure
+ * Vertex structure
  */
 typedef struct SDL_Vertex
 {

+ 5 - 5
include/SDL_rwops.h

@@ -57,7 +57,7 @@ typedef struct SDL_RWops
     Sint64 (SDLCALL * size) (struct SDL_RWops * context);
 
     /**
-     *  Seek to \c offset relative to \c whence, one of stdio's whence values:
+     *  Seek to `offset` relative to `whence`, one of stdio's whence values:
      *  RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
      *
      *  \return the final offset in the data stream, or -1 on error.
@@ -66,8 +66,8 @@ typedef struct SDL_RWops
                              int whence);
 
     /**
-     *  Read up to \c maxnum objects each of size \c size from the data
-     *  stream to the area pointed at by \c ptr.
+     *  Read up to `maxnum` objects each of size `size` from the data
+     *  stream to the area pointed at by `ptr`.
      *
      *  \return the number of objects read, or 0 at error or end of file.
      */
@@ -75,8 +75,8 @@ typedef struct SDL_RWops
                              size_t size, size_t maxnum);
 
     /**
-     *  Write exactly \c num objects each of size \c size from the area
-     *  pointed at by \c ptr to data stream.
+     *  Write exactly `num` objects each of size `size` from the area
+     *  pointed at by `ptr` to data stream.
      *
      *  \return the number of objects written, or 0 at error or end of file.
      */

+ 6 - 6
include/SDL_scancode.h

@@ -31,14 +31,14 @@
 #include "SDL_stdinc.h"
 
 /**
- *  \brief The SDL keyboard scancode representation.
+ * The SDL keyboard scancode representation.
  *
- *  Values of this type are used to represent keyboard keys, among other places
- *  in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
- *  SDL_Event structure.
+ * Values of this type are used to represent keyboard keys, among other places
+ * in the SDL_Keysym::scancode key.keysym.scancode field of the SDL_Event
+ * structure.
  *
- *  The values in this enumeration are based on the USB usage page standard:
- *  https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
+ * The values in this enumeration are based on the USB usage page standard:
+ * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
  */
 typedef enum SDL_Scancode
 {

+ 59 - 51
include/SDL_sensor.h

@@ -44,7 +44,7 @@ extern "C" {
  *  \brief SDL_sensor.h
  *
  *  In order to use these functions, SDL_Init() must have been called
- *  with the ::SDL_INIT_SENSOR flag.  This causes SDL to scan the system
+ *  with the SDL_INIT_SENSOR flag.  This causes SDL to scan the system
  *  for sensors, and load appropriate drivers.
  */
 
@@ -52,21 +52,67 @@ struct _SDL_Sensor;
 typedef struct _SDL_Sensor SDL_Sensor;
 
 /**
- * This is a unique ID for a sensor for the time it is connected to the system,
- * and is never reused for the lifetime of the application.
+ * This is a unique ID for a sensor for the time it is connected to the
+ * system, and is never reused for the lifetime of the application.
  *
- * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ * The ID value starts at 0 and increments from there. The value -1 is an
+ * invalid ID.
  */
 typedef Sint32 SDL_SensorID;
 
-/* The different sensors defined by SDL
+/**
+ * The different sensors defined by SDL.
  *
  * Additional sensors may be available, using platform dependent semantics.
  *
- * Hare are the additional Android sensors:
+ * Here are the additional Android sensors:
+ *
  * https://developer.android.com/reference/android/hardware/SensorEvent.html#values
+ *
+ * Accelerometer sensor notes:
+ *
+ * The accelerometer returns the current acceleration in SI meters per second
+ * squared. This measurement includes the force of gravity, so a device at
+ * rest will have an value of SDL_STANDARD_GRAVITY away from the center of the
+ * earth, which is a positive Y value.
+ *
+ * - `values[0]`: Acceleration on the x axis
+ * - `values[1]`: Acceleration on the y axis
+ * - `values[2]`: Acceleration on the z axis
+ *
+ * For phones and tablets held in natural orientation and game controllers
+ * held in front of you, the axes are defined as follows:
+ *
+ * - -X ... +X : left ... right
+ * - -Y ... +Y : bottom ... top
+ * - -Z ... +Z : farther ... closer
+ *
+ * The accelerometer axis data is not changed when the device is rotated.
+ *
+ * Gyroscope sensor notes:
+ *
+ * The gyroscope returns the current rate of rotation in radians per second.
+ * The rotation is positive in the counter-clockwise direction. That is, an
+ * observer looking from a positive location on one of the axes would see
+ * positive rotation on that axis when it appeared to be rotating
+ * counter-clockwise.
+ *
+ * - `values[0]`: Angular speed around the x axis (pitch)
+ * - `values[1]`: Angular speed around the y axis (yaw)
+ * - `values[2]`: Angular speed around the z axis (roll)
+ *
+ * For phones and tablets held in natural orientation and game controllers
+ * held in front of you, the axes are defined as follows:
+ *
+ * - -X ... +X : left ... right
+ * - -Y ... +Y : bottom ... top
+ * - -Z ... +Z : farther ... closer
+ *
+ * The gyroscope axis data is not changed when the device is rotated.
+ *
+ * \sa SDL_GetDisplayOrientation
  */
-typedef enum
+typedef enum SDL_SensorType
 {
     SDL_SENSOR_INVALID = -1,    /**< Returned for an invalid sensor */
     SDL_SENSOR_UNKNOWN,         /**< Unknown sensor type */
@@ -79,52 +125,14 @@ typedef enum
 } SDL_SensorType;
 
 /**
- * Accelerometer sensor
- *
- * The accelerometer returns the current acceleration in SI meters per
- * second squared. This measurement includes the force of gravity, so
- * a device at rest will have an value of SDL_STANDARD_GRAVITY away
- * from the center of the earth, which is a positive Y value.
- *
- * values[0]: Acceleration on the x axis
- * values[1]: Acceleration on the y axis
- * values[2]: Acceleration on the z axis
- *
- * For phones held in portrait mode and game controllers held in front of you,
- * the axes are defined as follows:
- * -X ... +X : left ... right
- * -Y ... +Y : bottom ... top
- * -Z ... +Z : farther ... closer
- * 
- * The axis data is not changed when the phone is rotated.
- *
- * \sa SDL_GetDisplayOrientation()
- */
-#define SDL_STANDARD_GRAVITY    9.80665f
-
-/**
- * Gyroscope sensor
+ * A constant to represent standard gravity for accelerometer sensors.
  *
- * The gyroscope returns the current rate of rotation in radians per second.
- * The rotation is positive in the counter-clockwise direction. That is,
- * an observer looking from a positive location on one of the axes would
- * see positive rotation on that axis when it appeared to be rotating
- * counter-clockwise.
- *
- * values[0]: Angular speed around the x axis (pitch)
- * values[1]: Angular speed around the y axis (yaw)
- * values[2]: Angular speed around the z axis (roll)
- *
- * For phones held in portrait mode and game controllers held in front of you,
- * the axes are defined as follows:
- * -X ... +X : left ... right
- * -Y ... +Y : bottom ... top
- * -Z ... +Z : farther ... closer
- * 
- * The axis data is not changed when the phone or controller is rotated.
- *
- * \sa SDL_GetDisplayOrientation()
+ * The accelerometer returns the current acceleration in SI meters per second
+ * squared. This measurement includes the force of gravity, so a device at
+ * rest will have an value of SDL_STANDARD_GRAVITY away from the center of the
+ * earth, which is a positive Y value.
  */
+#define SDL_STANDARD_GRAVITY    9.80665f
 
 /* Function prototypes */
 

+ 9 - 9
include/SDL_shape.h

@@ -48,18 +48,18 @@ extern "C" {
  * and flags.
  *
  * \param title The title of the window, in UTF-8 encoding.
- * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
- *          ::SDL_WINDOWPOS_UNDEFINED.
- * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
- *          ::SDL_WINDOWPOS_UNDEFINED.
+ * \param x The x position of the window, SDL_WINDOWPOS_CENTERED, or
+ *          SDL_WINDOWPOS_UNDEFINED.
+ * \param y The y position of the window, SDL_WINDOWPOS_CENTERED, or
+ *          SDL_WINDOWPOS_UNDEFINED.
  * \param w The width of the window.
  * \param h The height of the window.
  * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with
- *              any of the following: ::SDL_WINDOW_OPENGL,
- *              ::SDL_WINDOW_INPUT_GRABBED, ::SDL_WINDOW_HIDDEN,
- *              ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
- *              ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_BORDERLESS is always set,
- *              and ::SDL_WINDOW_FULLSCREEN is always unset.
+ *              any of the following: SDL_WINDOW_OPENGL,
+ *              SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_HIDDEN,
+ *              SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED,
+ *              SDL_WINDOW_MINIMIZED, SDL_WINDOW_BORDERLESS is always set, and
+ *              SDL_WINDOW_FULLSCREEN is always unset.
  * \return the window created, or NULL if window creation failed.
  *
  * \since This function is available since SDL 2.0.0.

+ 27 - 15
include/SDL_stdinc.h

@@ -129,15 +129,19 @@ void *alloca(size_t);
 #endif
 
 /**
- *  The number of elements in an array.
+ * The number of elements in an array.
  */
 #define SDL_arraysize(array)    (sizeof(array)/sizeof(array[0]))
 #define SDL_TABLESIZE(table)    SDL_arraysize(table)
 
 /**
- *  Macro useful for building other macros with strings in them
+ * Macro useful for building other macros with strings in them
  *
- *  e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
+ * e.g:
+ *
+ * ```c
+ * #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
+ * ```
  */
 #define SDL_STRINGIFY_ARG(arg)  #arg
 
@@ -185,50 +189,56 @@ typedef enum
 #endif
 
 /**
- * \brief A signed 8-bit integer type.
+ * A signed 8-bit integer type.
  */
 #define SDL_MAX_SINT8   ((Sint8)0x7F)           /* 127 */
 #define SDL_MIN_SINT8   ((Sint8)(~0x7F))        /* -128 */
 typedef int8_t Sint8;
+
 /**
- * \brief An unsigned 8-bit integer type.
+ * An unsigned 8-bit integer type.
  */
 #define SDL_MAX_UINT8   ((Uint8)0xFF)           /* 255 */
 #define SDL_MIN_UINT8   ((Uint8)0x00)           /* 0 */
 typedef uint8_t Uint8;
+
 /**
- * \brief A signed 16-bit integer type.
+ * A signed 16-bit integer type.
  */
 #define SDL_MAX_SINT16  ((Sint16)0x7FFF)        /* 32767 */
 #define SDL_MIN_SINT16  ((Sint16)(~0x7FFF))     /* -32768 */
 typedef int16_t Sint16;
+
 /**
- * \brief An unsigned 16-bit integer type.
+ * An unsigned 16-bit integer type.
  */
 #define SDL_MAX_UINT16  ((Uint16)0xFFFF)        /* 65535 */
 #define SDL_MIN_UINT16  ((Uint16)0x0000)        /* 0 */
 typedef uint16_t Uint16;
+
 /**
- * \brief A signed 32-bit integer type.
+ * A signed 32-bit integer type.
  */
 #define SDL_MAX_SINT32  ((Sint32)0x7FFFFFFF)    /* 2147483647 */
 #define SDL_MIN_SINT32  ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
 typedef int32_t Sint32;
+
 /**
- * \brief An unsigned 32-bit integer type.
+ * An unsigned 32-bit integer type.
  */
 #define SDL_MAX_UINT32  ((Uint32)0xFFFFFFFFu)   /* 4294967295 */
 #define SDL_MIN_UINT32  ((Uint32)0x00000000)    /* 0 */
 typedef uint32_t Uint32;
 
 /**
- * \brief A signed 64-bit integer type.
+ * A signed 64-bit integer type.
  */
 #define SDL_MAX_SINT64  ((Sint64)0x7FFFFFFFFFFFFFFFll)      /* 9223372036854775807 */
 #define SDL_MIN_SINT64  ((Sint64)(~0x7FFFFFFFFFFFFFFFll))   /* -9223372036854775808 */
 typedef int64_t Sint64;
+
 /**
- * \brief An unsigned 64-bit integer type.
+ * An unsigned 64-bit integer type.
  */
 #define SDL_MAX_UINT64  ((Uint64)0xFFFFFFFFFFFFFFFFull)     /* 18446744073709551615 */
 #define SDL_MIN_UINT64  ((Uint64)(0x0000000000000000ull))   /* 0 */
@@ -775,8 +785,9 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B
 }
 
 /**
- * If a * b would overflow, return -1. Otherwise store a * b via ret
- * and return 0.
+ * If a * b would overflow, return -1.
+ *
+ * Otherwise store a * b via ret and return 0.
  *
  * \since This function is available since SDL 2.24.0.
  */
@@ -805,8 +816,9 @@ SDL_FORCE_INLINE int _SDL_size_mul_overflow_builtin (size_t a,
 #endif
 
 /**
- * If a + b would overflow, return -1. Otherwise store a + b via ret
- * and return 0.
+ * If a + b would overflow, return -1.
+ *
+ * Otherwise store a + b via ret and return 0.
  *
  * \since This function is available since SDL 2.24.0.
  */

+ 66 - 64
include/SDL_surface.h

@@ -22,7 +22,7 @@
 /**
  *  \file SDL_surface.h
  *
- *  Header file for ::SDL_Surface definition and management functions.
+ *  Header file for SDL_Surface definition and management functions.
  */
 
 #ifndef SDL_surface_h_
@@ -43,7 +43,7 @@ extern "C" {
 /**
  *  \name Surface flags
  *
- *  These are the currently supported flags for the ::SDL_Surface.
+ *  These are the currently supported flags for the SDL_Surface.
  *
  *  \internal
  *  Used internally (read-only).
@@ -57,17 +57,17 @@ extern "C" {
 /* @} *//* Surface flags */
 
 /**
- *  Evaluates to true if the surface needs to be locked before access.
+ * Evaluates to true if the surface needs to be locked before access.
  */
 #define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
 
 typedef struct SDL_BlitMap SDL_BlitMap;  /* this is an opaque type. */
 
 /**
- * \brief A collection of pixels used in software blitting.
+ * A collection of pixels used in software blitting.
  *
- * \note  This structure should be treated as read-only, except for \c pixels,
- *        which, if not NULL, contains the raw pixel data for the surface.
+ * This structure should be treated as read-only, except for `pixels`, which,
+ * if not NULL, contains the raw pixel data for the surface.
  */
 typedef struct SDL_Surface
 {
@@ -103,7 +103,7 @@ typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
                                  struct SDL_Surface * dst, SDL_Rect * dstrect);
 
 /**
- * \brief The formula used for converting between YUV and RGB
+ * The formula used for converting between YUV and RGB
  */
 typedef enum SDL_YUV_CONVERSION_MODE
 {
@@ -378,9 +378,9 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
     (SDL_Surface * surface, SDL_RWops * dst, int freedst);
 
 /**
- *  Save a surface to a file.
+ * Save a surface to a file.
  *
- *  Convenience macro.
+ * Convenience macro.
  */
 #define SDL_SaveBMP(surface, file) \
         SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
@@ -801,62 +801,64 @@ extern DECLSPEC int SDLCALL SDL_FillRects
     (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
 
 /* !!! FIXME: merge this documentation with the wiki */
+
 /**
- *  Performs a fast blit from the source surface to the destination surface.
- *
- *  This assumes that the source and destination rectangles are
- *  the same size.  If either \c srcrect or \c dstrect are NULL, the entire
- *  surface (\c src or \c dst) is copied.  The final blit rectangles are saved
- *  in \c srcrect and \c dstrect after all clipping is performed.
- *
- *  \returns 0 if the blit is successful, otherwise it returns -1.
- *
- *  The blit function should not be called on a locked surface.
- *
- *  The blit semantics for surfaces with and without blending and colorkey
- *  are defined as follows:
- *  \verbatim
-    RGBA->RGB:
-      Source surface blend mode set to SDL_BLENDMODE_BLEND:
-        alpha-blend (using the source alpha-channel and per-surface alpha)
-        SDL_SRCCOLORKEY ignored.
-      Source surface blend mode set to SDL_BLENDMODE_NONE:
-        copy RGB.
-        if SDL_SRCCOLORKEY set, only copy the pixels matching the
-        RGB values of the source color key, ignoring alpha in the
-        comparison.
-
-    RGB->RGBA:
-      Source surface blend mode set to SDL_BLENDMODE_BLEND:
-        alpha-blend (using the source per-surface alpha)
-      Source surface blend mode set to SDL_BLENDMODE_NONE:
-        copy RGB, set destination alpha to source per-surface alpha value.
-      both:
-        if SDL_SRCCOLORKEY set, only copy the pixels matching the
-        source color key.
-
-    RGBA->RGBA:
-      Source surface blend mode set to SDL_BLENDMODE_BLEND:
-        alpha-blend (using the source alpha-channel and per-surface alpha)
-        SDL_SRCCOLORKEY ignored.
-      Source surface blend mode set to SDL_BLENDMODE_NONE:
-        copy all of RGBA to the destination.
-        if SDL_SRCCOLORKEY set, only copy the pixels matching the
-        RGB values of the source color key, ignoring alpha in the
-        comparison.
-
-    RGB->RGB:
-      Source surface blend mode set to SDL_BLENDMODE_BLEND:
-        alpha-blend (using the source per-surface alpha)
-      Source surface blend mode set to SDL_BLENDMODE_NONE:
-        copy RGB.
-      both:
-        if SDL_SRCCOLORKEY set, only copy the pixels matching the
-        source color key.
-    \endverbatim
- *
- *  You should call SDL_BlitSurface() unless you know exactly how SDL
- *  blitting works internally and how to use the other blit functions.
+ * Performs a fast blit from the source surface to the destination surface.
+ *
+ * This assumes that the source and destination rectangles are the same size.
+ * If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or
+ * `dst`) is copied. The final blit rectangles are saved in `srcrect` and
+ * `dstrect` after all clipping is performed.
+ *
+ * The blit function should not be called on a locked surface.
+ *
+ * The blit semantics for surfaces with and without blending and colorkey are
+ * defined as follows:
+ *
+ * ```
+ *   RGBA->RGB:
+ *     Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ *       alpha-blend (using the source alpha-channel and per-surface alpha)
+ *       SDL_SRCCOLORKEY ignored.
+ *     Source surface blend mode set to SDL_BLENDMODE_NONE:
+ *       copy RGB.
+ *       if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ *       RGB values of the source color key, ignoring alpha in the
+ *       comparison.
+ *
+ *   RGB->RGBA:
+ *     Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ *       alpha-blend (using the source per-surface alpha)
+ *     Source surface blend mode set to SDL_BLENDMODE_NONE:
+ *       copy RGB, set destination alpha to source per-surface alpha value.
+ *     both:
+ *       if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ *       source color key.
+ *
+ *   RGBA->RGBA:
+ *     Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ *       alpha-blend (using the source alpha-channel and per-surface alpha)
+ *       SDL_SRCCOLORKEY ignored.
+ *     Source surface blend mode set to SDL_BLENDMODE_NONE:
+ *       copy all of RGBA to the destination.
+ *       if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ *       RGB values of the source color key, ignoring alpha in the
+ *       comparison.
+ *
+ *   RGB->RGB:
+ *     Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ *       alpha-blend (using the source per-surface alpha)
+ *     Source surface blend mode set to SDL_BLENDMODE_NONE:
+ *       copy RGB.
+ *     both:
+ *       if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ *       source color key.
+ * ```
+ *
+ * You should call SDL_BlitSurface() unless you know exactly how SDL blitting
+ * works internally and how to use the other blit functions.
+ *
+ * \returns 0 if the blit is successful, otherwise it returns -1.
  */
 #define SDL_BlitSurface SDL_UpperBlit
 

+ 5 - 5
include/SDL_system.h

@@ -356,9 +356,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
 extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
 
 /**
-   See the official Android developer guide for more information:
-   http://developer.android.com/guide/topics/data/data-storage.html
-*/
+ * See the official Android developer guide for more information:
+ * http://developer.android.com/guide/topics/data/data-storage.html
+ */
 #define SDL_ANDROID_EXTERNAL_STORAGE_READ   0x01
 #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE  0x02
 
@@ -470,7 +470,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param);
 #ifdef __WINRT__
 
 /**
- *  \brief WinRT / Windows Phone path types
+ * WinRT / Windows Phone path types
  */
 typedef enum SDL_WinRT_Path
 {
@@ -494,7 +494,7 @@ typedef enum SDL_WinRT_Path
 
 
 /**
- *  \brief WinRT Device Family
+ * WinRT Device Family
  */
 typedef enum SDL_WinRT_DeviceFamily
 {

+ 7 - 6
include/SDL_syswm.h

@@ -36,7 +36,7 @@
 /*
  *  \file SDL_syswm.h
  *
- *  Your application has access to a special type of event ::SDL_SYSWMEVENT,
+ *  Your application has access to a special type of event SDL_SYSWMEVENT,
  *  which contains window-manager specific information and arrives whenever
  *  an unhandled window event occurs.  This event is ignored by default, but
  *  you can enable it with SDL_EventState().
@@ -130,8 +130,9 @@ extern "C" {
 #endif
 
 #if !defined(SDL_PROTOTYPES_ONLY)
+
 /**
- *  These are the various supported windowing subsystems
+ * These are the various supported windowing subsystems
  */
 typedef enum SDL_SYSWM_TYPE
 {
@@ -153,7 +154,7 @@ typedef enum SDL_SYSWM_TYPE
 } SDL_SYSWM_TYPE;
 
 /**
- *  The custom event structure.
+ * The custom event structure.
  */
 struct SDL_SysWMmsg
 {
@@ -219,10 +220,10 @@ struct SDL_SysWMmsg
 };
 
 /**
- *  The custom window manager information structure.
+ * The custom window manager information structure.
  *
- *  When this structure is returned, it holds information about which
- *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
+ * When this structure is returned, it holds information about which low level
+ * system it is using, and will be one of SDL_SYSWM_TYPE.
  */
 struct SDL_SysWMinfo
 {

+ 1 - 1
include/SDL_test.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test.h
  *
  *  Include file for SDL test framework.

+ 9 - 9
include/SDL_test_assert.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_assert.h
  *
  *  Include file for SDL test framework.
@@ -42,17 +42,17 @@
 extern "C" {
 #endif
 
-/**
+/*
  * \brief Fails the assert.
  */
 #define ASSERT_FAIL     0
 
-/**
+/*
  * \brief Passes the assert.
  */
 #define ASSERT_PASS     1
 
-/**
+/*
  * \brief Assert that logs and break execution flow on failures.
  *
  * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
@@ -60,7 +60,7 @@ extern "C" {
  */
 void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
 
-/**
+/*
  * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
  *
  * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
@@ -70,25 +70,25 @@ void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *as
  */
 int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
 
-/**
+/*
  * \brief Explicitly pass without checking an assertion condition. Updates assertion counter.
  *
  * \param assertDescription Message to log with the assert describing it.
  */
 void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1);
 
-/**
+/*
  * \brief Resets the assert summary counters to zero.
  */
 void SDLTest_ResetAssertSummary(void);
 
-/**
+/*
  * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
  */
 void SDLTest_LogAssertSummary(void);
 
 
-/**
+/*
  * \brief Converts the current assert summary state to a test result.
  *
  * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT

+ 10 - 10
include/SDL_test_common.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_common.h
  *
  *  Include file for SDL test framework.
@@ -129,7 +129,7 @@ extern "C" {
 
 /* Function prototypes */
 
-/**
+/*
  * \brief Parse command line parameters and create common state.
  *
  * \param argv Array of command line parameters
@@ -139,7 +139,7 @@ extern "C" {
  */
 SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
 
-/**
+/*
  * \brief Process one common argument.
  *
  * \param state The common state describing the test window to create.
@@ -150,7 +150,7 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
 int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
 
 
-/**
+/*
  * \brief Logs command line usage info.
  *
  * This logs the appropriate command line options for the subsystems in use
@@ -164,7 +164,7 @@ int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
  */
 void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options);
 
-/**
+/*
  * \brief Returns common usage information
  *
  * You should (probably) be using SDLTest_CommonLogUsage() instead, but this
@@ -177,7 +177,7 @@ void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, cons
  */
 const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
 
-/**
+/*
  * \brief Open test window.
  *
  * \param state The common state describing the test window to create.
@@ -186,7 +186,7 @@ const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
  */
 SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
 
-/**
+/*
  * \brief Easy argument handling when test app doesn't need any custom args.
  *
  * \param state The common state describing the test window to create.
@@ -197,7 +197,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
  */
 SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc, char **argv);
 
-/**
+/*
  * \brief Common event handler for test windows.
  *
  * \param state The common state used to create test window.
@@ -207,7 +207,7 @@ SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc,
  */
 void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done);
 
-/**
+/*
  * \brief Close test window.
  *
  * \param state The common state used to create test window.
@@ -215,7 +215,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *do
  */
 void SDLTest_CommonQuit(SDLTest_CommonState * state);
 
-/**
+/*
  * \brief Draws various window information (position, size, etc.) to the renderer.
  *
  * \param renderer The renderer to draw to.

+ 2 - 2
include/SDL_test_compare.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_compare.h
  *
  *  Include file for SDL test framework.
@@ -46,7 +46,7 @@
 extern "C" {
 #endif
 
-/**
+/*
  * \brief Compares a surface and with reference image data for equality
  *
  * \param surface Surface used in comparison

+ 11 - 11
include/SDL_test_font.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_font.h
  *
  *  Include file for SDL test framework.
@@ -41,7 +41,7 @@ extern "C" {
 #define FONT_CHARACTER_SIZE 8
 #define FONT_LINE_HEIGHT    (FONT_CHARACTER_SIZE + 2)
 
-/**
+/*
  *  \brief Draw a string in the currently set font.
  *
  *  \param renderer The renderer to draw on.
@@ -53,7 +53,7 @@ extern "C" {
  */
 int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c);
 
-/**
+/*
  *  \brief Draw a UTF-8 string in the currently set font.
  *
  *  The font currently only supports characters in the Basic Latin and Latin-1 Supplement sets.
@@ -67,7 +67,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c);
  */
 int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
 
-/**
+/*
  *  \brief Data used for multi-line text output
  */
 typedef struct SDLTest_TextWindow
@@ -78,7 +78,7 @@ typedef struct SDLTest_TextWindow
     char **lines;
 } SDLTest_TextWindow;
 
-/**
+/*
  *  \brief Create a multi-line text output window
  *
  *  \param x The X coordinate of the upper left corner of the window.
@@ -92,7 +92,7 @@ typedef struct SDLTest_TextWindow
  */
 SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h);
 
-/**
+/*
  *  \brief Display a multi-line text output window
  *
  *  This function should be called every frame to display the text
@@ -104,7 +104,7 @@ SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h);
  */
 void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer);
 
-/**
+/*
  *  \brief Add text to a multi-line text output window
  *
  *  Adds UTF-8 text to the end of the current text. The newline character starts a
@@ -119,7 +119,7 @@ void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *render
  */
 void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
 
-/**
+/*
  *  \brief Add text to a multi-line text output window
  *
  *  Adds UTF-8 text to the end of the current text. The newline character starts a
@@ -134,7 +134,7 @@ void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_ST
  */
 void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len);
 
-/**
+/*
  *  \brief Clear the text in a multi-line text output window
  *
  *  \param textwin The text output window
@@ -143,7 +143,7 @@ void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char
  */
 void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin);
 
-/**
+/*
  *  \brief Free the storage associated with a multi-line text output window
  *
  *  \param textwin The text output window
@@ -152,7 +152,7 @@ void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin);
  */
 void SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin);
 
-/**
+/*
  *  \brief Cleanup textures used by font drawing functions.
  */
 void SDLTest_CleanupTextDrawing(void);

+ 29 - 28
include/SDL_test_fuzzer.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_fuzzer.h
  *
  *  Include file for SDL test framework.
@@ -48,13 +48,13 @@ extern "C" {
 */
 
 
-/**
+/*
  * \file
  * Note: The fuzzer implementation uses a static instance of random context
  * internally which makes it thread-UNsafe.
  */
 
-/**
+/*
  * Initializes the fuzzer for a test
  *
  * \param execKey Execution "Key" that initializes the random number generator uniquely for the test.
@@ -63,14 +63,14 @@ extern "C" {
 void SDLTest_FuzzerInit(Uint64 execKey);
 
 
-/**
+/*
  * Returns a random Uint8
  *
  * \returns a generated integer
  */
 Uint8 SDLTest_RandomUint8(void);
 
-/**
+/*
  * Returns a random Sint8
  *
  * \returns a generated signed integer
@@ -78,14 +78,14 @@ Uint8 SDLTest_RandomUint8(void);
 Sint8 SDLTest_RandomSint8(void);
 
 
-/**
+/*
  * Returns a random Uint16
  *
  * \returns a generated integer
  */
 Uint16 SDLTest_RandomUint16(void);
 
-/**
+/*
  * Returns a random Sint16
  *
  * \returns a generated signed integer
@@ -93,7 +93,7 @@ Uint16 SDLTest_RandomUint16(void);
 Sint16 SDLTest_RandomSint16(void);
 
 
-/**
+/*
  * Returns a random integer
  *
  * \returns a generated integer
@@ -101,14 +101,14 @@ Sint16 SDLTest_RandomSint16(void);
 Sint32 SDLTest_RandomSint32(void);
 
 
-/**
+/*
  * Returns a random positive integer
  *
  * \returns a generated integer
  */
 Uint32 SDLTest_RandomUint32(void);
 
-/**
+/*
  * Returns random Uint64.
  *
  * \returns a generated integer
@@ -116,36 +116,36 @@ Uint32 SDLTest_RandomUint32(void);
 Uint64 SDLTest_RandomUint64(void);
 
 
-/**
+/*
  * Returns random Sint64.
  *
  * \returns a generated signed integer
  */
 Sint64 SDLTest_RandomSint64(void);
 
-/**
+/*
  * \returns a random float in range [0.0 - 1.0]
  */
 float SDLTest_RandomUnitFloat(void);
 
-/**
+/*
  * \returns a random double in range [0.0 - 1.0]
  */
 double SDLTest_RandomUnitDouble(void);
 
-/**
+/*
  * \returns a random float.
  *
  */
 float SDLTest_RandomFloat(void);
 
-/**
+/*
  * \returns a random double.
  *
  */
 double SDLTest_RandomDouble(void);
 
-/**
+/*
  * Returns a random boundary value for Uint8 within the given boundaries.
  * Boundaries are inclusive, see the usage examples below. If validDomain
  * is true, the function will only return valid boundaries, otherwise non-valid
@@ -166,7 +166,7 @@ double SDLTest_RandomDouble(void);
  */
 Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
 
-/**
+/*
  * Returns a random boundary value for Uint16 within the given boundaries.
  * Boundaries are inclusive, see the usage examples below. If validDomain
  * is true, the function will only return valid boundaries, otherwise non-valid
@@ -187,7 +187,7 @@ Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_boo
  */
 Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
 
-/**
+/*
  * Returns a random boundary value for Uint32 within the given boundaries.
  * Boundaries are inclusive, see the usage examples below. If validDomain
  * is true, the function will only return valid boundaries, otherwise non-valid
@@ -208,7 +208,7 @@ Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL
  */
 Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
 
-/**
+/*
  * Returns a random boundary value for Uint64 within the given boundaries.
  * Boundaries are inclusive, see the usage examples below. If validDomain
  * is true, the function will only return valid boundaries, otherwise non-valid
@@ -229,7 +229,7 @@ Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL
  */
 Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
 
-/**
+/*
  * Returns a random boundary value for Sint8 within the given boundaries.
  * Boundaries are inclusive, see the usage examples below. If validDomain
  * is true, the function will only return valid boundaries, otherwise non-valid
@@ -251,7 +251,7 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL
 Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
 
 
-/**
+/*
  * Returns a random boundary value for Sint16 within the given boundaries.
  * Boundaries are inclusive, see the usage examples below. If validDomain
  * is true, the function will only return valid boundaries, otherwise non-valid
@@ -272,7 +272,7 @@ Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_boo
  */
 Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
 
-/**
+/*
  * Returns a random boundary value for Sint32 within the given boundaries.
  * Boundaries are inclusive, see the usage examples below. If validDomain
  * is true, the function will only return valid boundaries, otherwise non-valid
@@ -293,7 +293,7 @@ Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL
  */
 Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
 
-/**
+/*
  * Returns a random boundary value for Sint64 within the given boundaries.
  * Boundaries are inclusive, see the usage examples below. If validDomain
  * is true, the function will only return valid boundaries, otherwise non-valid
@@ -315,7 +315,7 @@ Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL
 Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
 
 
-/**
+/*
  * Returns integer in range [min, max] (inclusive).
  * Min and max values can be negative values.
  * If Max in smaller than min, then the values are swapped.
@@ -329,7 +329,7 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL
 Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
 
 
-/**
+/*
  * Generates random null-terminated string. The minimum length for
  * the string is 1 character, maximum length for the string is 255
  * characters and it can contain ASCII characters from 32 to 126.
@@ -341,7 +341,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
 char * SDLTest_RandomAsciiString(void);
 
 
-/**
+/*
  * Generates random null-terminated string. The maximum length for
  * the string is defined by the maxLength parameter.
  * String can contain ASCII characters from 32 to 126.
@@ -355,7 +355,7 @@ char * SDLTest_RandomAsciiString(void);
 char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
 
 
-/**
+/*
  * Generates random null-terminated string. The length for
  * the string is defined by the size parameter.
  * String can contain ASCII characters from 32 to 126.
@@ -368,7 +368,8 @@ char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
  */
 char * SDLTest_RandomAsciiStringOfSize(int size);
 
-/**
+
+/*
  * Get the invocation count for the fuzzer since last ...FuzzerInit.
  *
  * \returns the invocation count.

+ 5 - 5
include/SDL_test_harness.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_harness.h
  *
  *  Include file for SDL test framework.
@@ -69,7 +69,7 @@ typedef int (*SDLTest_TestCaseFp)(void *arg);
 /* !< Function pointer to a test case teardown function (run after every test) */
 typedef void  (*SDLTest_TestCaseTearDownFp)(void *arg);
 
-/**
+/*
  * Holds information about a single test case.
  */
 typedef struct SDLTest_TestCaseReference {
@@ -83,7 +83,7 @@ typedef struct SDLTest_TestCaseReference {
     int enabled;
 } SDLTest_TestCaseReference;
 
-/**
+/*
  * Holds information about a test suite (multiple test cases).
  */
 typedef struct SDLTest_TestSuiteReference {
@@ -98,7 +98,7 @@ typedef struct SDLTest_TestSuiteReference {
 } SDLTest_TestSuiteReference;
 
 
-/**
+/*
  * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).
  *
  * Note: The returned string needs to be deallocated by the caller.
@@ -109,7 +109,7 @@ typedef struct SDLTest_TestSuiteReference {
  */
 char *SDLTest_GenerateRunSeed(const int length);
 
-/**
+/*
  * \brief Execute a test suite using the given run seed and execution key.
  *
  * \param testSuites Suites containing the test case.

+ 2 - 2
include/SDL_test_images.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_images.h
  *
  *  Include file for SDL test framework.
@@ -44,7 +44,7 @@
 extern "C" {
 #endif
 
-/**
+/*
  *Type for test images.
  */
 typedef struct SDLTest_SurfaceImage_s {

+ 3 - 3
include/SDL_test_log.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_log.h
  *
  *  Include file for SDL test framework.
@@ -42,14 +42,14 @@
 extern "C" {
 #endif
 
-/**
+/*
  * \brief Prints given message with a timestamp in the TEST category and INFO priority.
  *
  * \param fmt Message to be logged
  */
 void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
 
-/**
+/*
  * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
  *
  * \param fmt Message to be logged

+ 4 - 4
include/SDL_test_md5.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_md5.h
  *
  *  Include file for SDL test framework.
@@ -77,7 +77,7 @@ extern "C" {
 
 /* ---------- Function Prototypes ------------- */
 
-/**
+/*
  * \brief initialize the context
  *
  * \param  mdContext        pointer to context variable
@@ -89,7 +89,7 @@ extern "C" {
  void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
 
 
-/**
+/*
  * \brief update digest from variable length data
  *
  * \param  mdContext       pointer to context variable
@@ -105,7 +105,7 @@ extern "C" {
                  unsigned int inLen);
 
 
-/**
+/*
  * \brief complete digest computation
  *
  * \param mdContext     pointer to context variable

+ 3 - 3
include/SDL_test_memory.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_memory.h
  *
  *  Include file for SDL test framework.
@@ -37,14 +37,14 @@ extern "C" {
 #endif
 
 
-/**
+/*
  * \brief Start tracking SDL memory allocations
  * 
  * \note This should be called before any other SDL functions for complete tracking coverage
  */
 int SDLTest_TrackAllocations(void);
 
-/**
+/*
  * \brief Print a log of any outstanding allocations
  *
  * \note This can be called after SDL_Quit()

+ 4 - 4
include/SDL_test_random.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-/**
+/*
  *  \file SDL_test_random.h
  *
  *  Include file for SDL test framework.
@@ -67,7 +67,7 @@ extern "C" {
 
 /* --- Function prototypes */
 
-/**
+/*
  *  \brief Initialize random number generator with two integers.
  *
  *  Note: The random sequence of numbers returned by ...Random() is the
@@ -81,7 +81,7 @@ extern "C" {
  void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi,
                   unsigned int ci);
 
-/**
+/*
  *  \brief Initialize random number generator based on current system time.
  *
  *  \param rndContext     pointer to context structure
@@ -90,7 +90,7 @@ extern "C" {
  void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext);
 
 
-/**
+/*
  *  \brief Initialize random number generator based on current system time.
  *
  *  Note: ...RandomInit() or ...RandomInitTime() must have been called

+ 8 - 6
include/SDL_thread.h

@@ -63,14 +63,16 @@ typedef unsigned long SDL_threadID;
 typedef unsigned int SDL_TLSID;
 
 /**
- *  The SDL thread priority.
+ * The SDL thread priority.
  *
- *  SDL will make system changes as necessary in order to apply the thread priority.
- *  Code which attempts to control thread state related to priority should be aware
- *  that calling SDL_SetThreadPriority may alter such state.
- *  SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this behavior.
+ * SDL will make system changes as necessary in order to apply the thread
+ * priority. Code which attempts to control thread state related to priority
+ * should be aware that calling SDL_SetThreadPriority may alter such state.
+ * SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this
+ * behavior.
  *
- *  \note On many systems you require special privileges to set high or time critical priority.
+ * On many systems you require special privileges to set high or time critical
+ * priority.
  */
 typedef enum SDL_ThreadPriority {
     SDL_THREAD_PRIORITY_LOW,

+ 9 - 9
include/SDL_timer.h

@@ -89,8 +89,8 @@ extern DECLSPEC Uint64 SDLCALL SDL_GetTicks64(void);
  * days, but should _not_ be used with SDL_GetTicks64(), which does not have
  * that problem.
  *
- * For example, with SDL_GetTicks(), if you want to wait 100 ms, you could
- * do this:
+ * For example, with SDL_GetTicks(), if you want to wait 100 ms, you could do
+ * this:
  *
  * ```c
  * const Uint32 timeout = SDL_GetTicks() + 100;
@@ -99,9 +99,9 @@ extern DECLSPEC Uint64 SDLCALL SDL_GetTicks64(void);
  * }
  * ```
  *
- * Note that this does not handle tick differences greater
- * than 2^31 so take care when using the above kind of code
- * with large timeout delays (tens of days).
+ * Note that this does not handle tick differences greater than 2^31 so take
+ * care when using the above kind of code with large timeout delays (tens of
+ * days).
  */
 #define SDL_TICKS_PASSED(A, B)  ((Sint32)((B) - (A)) <= 0)
 
@@ -149,10 +149,10 @@ extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
 /**
  * Function prototype for the timer callback function.
  *
- * The callback function is passed the current timer interval and returns
- * the next timer interval. If the returned value is the same as the one
- * passed in, the periodic alarm continues, otherwise a new alarm is
- * scheduled. If the callback returns 0, the periodic alarm is cancelled.
+ * The callback function is passed the current timer interval and returns the
+ * next timer interval. If the returned value is the same as the one passed
+ * in, the periodic alarm continues, otherwise a new alarm is scheduled. If
+ * the callback returns 0, the periodic alarm is cancelled.
  */
 typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
 

+ 26 - 25
include/SDL_version.h

@@ -40,10 +40,9 @@ extern "C" {
  * Information about the version of SDL in use.
  *
  * Represents the library's version as three levels: major revision
- * (increments with massive changes, additions, and enhancements),
- * minor revision (increments with backwards-compatible changes to the
- * major revision), and patchlevel (increments with fixes to the minor
- * revision).
+ * (increments with massive changes, additions, and enhancements), minor
+ * revision (increments with backwards-compatible changes to the major
+ * revision), and patchlevel (increments with fixes to the minor revision).
  *
  * \sa SDL_VERSION
  * \sa SDL_GetVersion
@@ -64,12 +63,11 @@ typedef struct SDL_version
 /**
  * Macro to determine SDL version program was compiled against.
  *
- * This macro fills in a SDL_version structure with the version of the
- * library you compiled against. This is determined by what header the
- * compiler uses. Note that if you dynamically linked the library, you might
- * have a slightly newer or older version at runtime. That version can be
- * determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
- * is not a macro.
+ * This macro fills in a SDL_version structure with the version of the library
+ * you compiled against. This is determined by what header the compiler uses.
+ * Note that if you dynamically linked the library, you might have a slightly
+ * newer or older version at runtime. That version can be determined with
+ * SDL_GetVersion(), which, unlike SDL_VERSION(), is not a macro.
  *
  * \param x A pointer to a SDL_version struct to initialize.
  *
@@ -85,37 +83,40 @@ typedef struct SDL_version
 
 /* TODO: Remove this whole block in SDL 3 */
 #if SDL_MAJOR_VERSION < 3
+
 /**
- *  This macro turns the version numbers into a numeric value:
- *  \verbatim
-    (1,2,3) -> (1203)
-    \endverbatim
+ * This macro turns the version numbers into a numeric value:
+ *
+ * ```
+ * (1,2,3) -> (1203)
+ * ```
+ *
+ * This assumes that there will never be more than 100 patchlevels.
  *
- *  This assumes that there will never be more than 100 patchlevels.
+ * In versions higher than 2.9.0, the minor version overflows into the
+ * thousands digit: for example, 2.23.0 is encoded as 4300, and 2.255.99 would
+ * be encoded as 25799.
  *
- *  In versions higher than 2.9.0, the minor version overflows into
- *  the thousands digit: for example, 2.23.0 is encoded as 4300,
- *  and 2.255.99 would be encoded as 25799.
- *  This macro will not be available in SDL 3.x.
+ * This macro will not be available in SDL 3.x.
  */
 #define SDL_VERSIONNUM(X, Y, Z)                     \
     ((X)*1000 + (Y)*100 + (Z))
 
 /**
- *  This is the version number macro for the current SDL version.
+ * This is the version number macro for the current SDL version.
  *
- *  In versions higher than 2.9.0, the minor version overflows into
- *  the thousands digit: for example, 2.23.0 is encoded as 4300.
- *  This macro will not be available in SDL 3.x.
+ * In versions higher than 2.9.0, the minor version overflows into the
+ * thousands digit: for example, 2.23.0 is encoded as 4300. This macro will
+ * not be available in SDL 3.x.
  *
- *  Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead.
+ * Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead.
  */
 #define SDL_COMPILEDVERSION \
     SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
 #endif /* SDL_MAJOR_VERSION < 3 */
 
 /**
- *  This macro will evaluate to true if compiled with SDL at least X.Y.Z.
+ * This macro will evaluate to true if compiled with SDL at least X.Y.Z.
  */
 #define SDL_VERSION_ATLEAST(X, Y, Z) \
     ((SDL_MAJOR_VERSION >= X) && \

+ 49 - 49
include/SDL_video.h

@@ -40,15 +40,15 @@ extern "C" {
 #endif
 
 /**
- *  \brief  The structure that defines a display mode
+ * The structure that defines a display mode
  *
- *  \sa SDL_GetNumDisplayModes()
- *  \sa SDL_GetDisplayMode()
- *  \sa SDL_GetDesktopDisplayMode()
- *  \sa SDL_GetCurrentDisplayMode()
- *  \sa SDL_GetClosestDisplayMode()
- *  \sa SDL_SetWindowDisplayMode()
- *  \sa SDL_GetWindowDisplayMode()
+ * \sa SDL_GetNumDisplayModes
+ * \sa SDL_GetDisplayMode
+ * \sa SDL_GetDesktopDisplayMode
+ * \sa SDL_GetCurrentDisplayMode
+ * \sa SDL_GetClosestDisplayMode
+ * \sa SDL_SetWindowDisplayMode
+ * \sa SDL_GetWindowDisplayMode
  */
 typedef struct SDL_DisplayMode
 {
@@ -60,44 +60,44 @@ typedef struct SDL_DisplayMode
 } SDL_DisplayMode;
 
 /**
- *  \brief The type used to identify a window
- *
- *  \sa SDL_CreateWindow()
- *  \sa SDL_CreateWindowFrom()
- *  \sa SDL_DestroyWindow()
- *  \sa SDL_FlashWindow()
- *  \sa SDL_GetWindowData()
- *  \sa SDL_GetWindowFlags()
- *  \sa SDL_GetWindowGrab()
- *  \sa SDL_GetWindowKeyboardGrab()
- *  \sa SDL_GetWindowMouseGrab()
- *  \sa SDL_GetWindowPosition()
- *  \sa SDL_GetWindowSize()
- *  \sa SDL_GetWindowTitle()
- *  \sa SDL_HideWindow()
- *  \sa SDL_MaximizeWindow()
- *  \sa SDL_MinimizeWindow()
- *  \sa SDL_RaiseWindow()
- *  \sa SDL_RestoreWindow()
- *  \sa SDL_SetWindowData()
- *  \sa SDL_SetWindowFullscreen()
- *  \sa SDL_SetWindowGrab()
- *  \sa SDL_SetWindowKeyboardGrab()
- *  \sa SDL_SetWindowMouseGrab()
- *  \sa SDL_SetWindowIcon()
- *  \sa SDL_SetWindowPosition()
- *  \sa SDL_SetWindowSize()
- *  \sa SDL_SetWindowBordered()
- *  \sa SDL_SetWindowResizable()
- *  \sa SDL_SetWindowTitle()
- *  \sa SDL_ShowWindow()
+ * The type used to identify a window
+ *
+ * \sa SDL_CreateWindow
+ * \sa SDL_CreateWindowFrom
+ * \sa SDL_DestroyWindow
+ * \sa SDL_FlashWindow
+ * \sa SDL_GetWindowData
+ * \sa SDL_GetWindowFlags
+ * \sa SDL_GetWindowGrab
+ * \sa SDL_GetWindowKeyboardGrab
+ * \sa SDL_GetWindowMouseGrab
+ * \sa SDL_GetWindowPosition
+ * \sa SDL_GetWindowSize
+ * \sa SDL_GetWindowTitle
+ * \sa SDL_HideWindow
+ * \sa SDL_MaximizeWindow
+ * \sa SDL_MinimizeWindow
+ * \sa SDL_RaiseWindow
+ * \sa SDL_RestoreWindow
+ * \sa SDL_SetWindowData
+ * \sa SDL_SetWindowFullscreen
+ * \sa SDL_SetWindowGrab
+ * \sa SDL_SetWindowKeyboardGrab
+ * \sa SDL_SetWindowMouseGrab
+ * \sa SDL_SetWindowIcon
+ * \sa SDL_SetWindowPosition
+ * \sa SDL_SetWindowSize
+ * \sa SDL_SetWindowBordered
+ * \sa SDL_SetWindowResizable
+ * \sa SDL_SetWindowTitle
+ * \sa SDL_ShowWindow
  */
 typedef struct SDL_Window SDL_Window;
 
 /**
- *  \brief The flags on a window
+ * The flags on a window
  *
- *  \sa SDL_GetWindowFlags()
+ * \sa SDL_GetWindowFlags
  */
 typedef enum SDL_WindowFlags
 {
@@ -131,7 +131,7 @@ typedef enum SDL_WindowFlags
 } SDL_WindowFlags;
 
 /**
- *  \brief Used to indicate that you don't care what the window position is.
+ * Used to indicate that you don't care what the window position is.
  */
 #define SDL_WINDOWPOS_UNDEFINED_MASK    0x1FFF0000u
 #define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)  (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
@@ -140,7 +140,7 @@ typedef enum SDL_WindowFlags
             (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
 
 /**
- *  \brief Used to indicate that the window position should be centered.
+ * Used to indicate that the window position should be centered.
  */
 #define SDL_WINDOWPOS_CENTERED_MASK    0x2FFF0000u
 #define SDL_WINDOWPOS_CENTERED_DISPLAY(X)  (SDL_WINDOWPOS_CENTERED_MASK|(X))
@@ -149,7 +149,7 @@ typedef enum SDL_WindowFlags
             (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
 
 /**
- *  \brief Event subtype for window events
+ * Event subtype for window events
  */
 typedef enum SDL_WindowEventID
 {
@@ -180,7 +180,7 @@ typedef enum SDL_WindowEventID
 } SDL_WindowEventID;
 
 /**
- *  \brief Event subtype for display events
+ * Event subtype for display events
  */
 typedef enum SDL_DisplayEventID
 {
@@ -192,7 +192,7 @@ typedef enum SDL_DisplayEventID
 } SDL_DisplayEventID;
 
 /**
- *  \brief Display orientation
+ * Display orientation
  */
 typedef enum SDL_DisplayOrientation
 {
@@ -204,7 +204,7 @@ typedef enum SDL_DisplayOrientation
 } SDL_DisplayOrientation;
 
 /**
- *  \brief Window flash operation
+ * Window flash operation
  */
 typedef enum SDL_FlashOperation
 {
@@ -214,12 +214,12 @@ typedef enum SDL_FlashOperation
 } SDL_FlashOperation;
 
 /**
- *  \brief An opaque handle to an OpenGL context.
+ * An opaque handle to an OpenGL context.
  */
 typedef void *SDL_GLContext;
 
 /**
- *  \brief OpenGL configuration attributes
+ * OpenGL configuration attributes
  */
 typedef enum SDL_GLattr
 {

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно