Merge branch 'main' into set-window-report-error

This commit is contained in:
Sylvain Becker 2023-02-12 20:58:18 +01:00 committed by GitHub
commit b6605df9e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
474 changed files with 17036 additions and 15489 deletions

58
.clang-tidy Normal file
View file

@ -0,0 +1,58 @@
---
Checks: >
-*,
bugprone-assert-side-effect,
bugprone-assignment-in-if-condition,
bugprone-bool-pointer-implicit-conversion,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-infinite-loop,
bugprone-integer-division,
bugprone-macro-repeated-side-effects,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-misplaced-pointer-arithmetic-in-alloc,
bugprone-misplaced-widening-cast,
bugprone-not-null-terminated-result,
bugprone-posix-return,
bugprone-redundant-branch-condition,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-memset-usage,
bugprone-suspicious-semicolon,
bugprone-suspicious-string-compare,
bugprone-too-small-loop-variable,
bugprone-unused-return-value,
cert-err33-c,
clang-analyzer-core.*,
clang-analyzer-valist.*,
clang-analyzer-unix.Malloc,
google-readability-casting,
misc-misleading-bidirectional,
misc-misleading-identifier,
misc-misplaced-const,
misc-redundant-expression,
objc-*,
performance-type-promotion-in-math-fn,
readability-avoid-const-params-in-decls,
readability-braces-around-statements,
readability-const-return-type,
readability-duplicate-include,
readability-inconsistent-declaration-parameter-name,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-redundant-control-flow,
readability-redundant-declaration,
readability-redundant-function-ptr-dereference,
readability-redundant-preprocessor,
readability-simplify-boolean-expr
CheckOptions:
- key: bugprone-assert-side-effect.AssertMacros
value: "SDL_assert, SDL_assert_release, SDL_assert_paranoid, SDL_assert_always, SDL_COMPILE_TIME_ASSERT"
- key: bugprone-misplaced-widening-cast.CheckImplicitCasts
value: true
- key: bugprone-not-null-terminated-result.WantToUseSafeFunctions
value: false # Do not recommend _s functions
FormatStyle: "file"
HeaderFilterRegex: "*.h$"
WarningsAsErrors: ""

View file

@ -4,7 +4,7 @@
root = true
[*.{c,cg,cpp,gradle,h,java,m,metal,pl,py,S,sh,txt}]
[*.{c,cc,cg,cpp,gradle,h,java,m,metal,pl,py,S,sh,txt}]
indent_size = 4
indent_style = space
insert_final_newline = true
@ -13,6 +13,7 @@ trim_trailing_whitespace = true
[*.{html,js,json,m4,yml,yaml,vcxproj,vcxproj.filters}]
indent_size = 2
indent_style = space
trim_tailing_whitespace = true
[*.xml]
indent_size = 4

16
.github/cmake/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.0)
project(ci_utils C CXX)
set(txt "CC=${CMAKE_C_COMPILER}
CXX=${CMAKE_CXX_COMPILER}
CFLAGS=${CMAKE_C_FLAGS}
CXXFLAGS=${CMAKE_CXX_FLAGS}
LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_C_STANDARD_LIBRARIES}
")
message("${txt}")
set(VAR_PATH "/tmp/env.txt" CACHE PATH "Where to write environment file")
message(STATUS "Writing CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS environment to ${VAR_PATH}")
file(WRITE "${VAR_PATH}" "${txt}")

View file

@ -16,7 +16,7 @@ jobs:
matrix:
platform:
- { name: Android.mk }
- { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" }
- { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-android-arm64" }
steps:
- uses: actions/checkout@v3
@ -36,9 +36,11 @@ jobs:
- name: Configure (CMake)
if: ${{ matrix.platform.name == 'CMake' }}
run: |
cmake -B build \
cmake -S . -B build \
-Wdeprecated -Wdev -Werror \
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
-DSDL_WERROR=ON \
-DSDL_CLANG_TIDY=ON \
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
-DSDL_STATIC_PIC=ON \
@ -56,6 +58,10 @@ jobs:
cmake --install build --config Release
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
( cd prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack)
if: ${{ matrix.platform.name == 'CMake' }}
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
if: ${{ matrix.platform.name == 'CMake' }}
run: |
@ -72,8 +78,9 @@ jobs:
export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
- name: Verify Android.mk
- uses: actions/upload-artifact@v3
if: ${{ matrix.platform.name == 'CMake' }}
run: |
export NDK_MODULE_PATH=${{ env.SDL3_DIR }}/share/ndk-modules
ndk-build -C ${{ github.workspace }}/cmake/test APP_PLATFORM=android-${{ matrix.platform.android_platform }} APP_ABI=${{ matrix.platform.android_abi }} NDK_OUT=$PWD NDK_LIBS_OUT=$PWD V=1
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: build/dist/SDL3*

View file

@ -18,16 +18,17 @@ jobs:
run: |
sudo apt-get -y update
sudo apt-get install -y ninja-build
- name: Configure CMake
- name: Configure (CMake)
run: |
emcmake cmake -S . -B build \
-Wdeprecated -Wdev -Werror \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix \
-GNinja
- name: Build
- name: Build (CMake)
run: cmake --build build/ --verbose
- name: Run build-time tests
run: |
@ -35,10 +36,13 @@ jobs:
export SDL_TESTS_QUICK=1
# FIXME: enable Emscripten build time tests
# ctest -VV --test-dir build/
- name: Install
- name: Install (CMake)
run: |
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build/
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
run: |
emcmake cmake -S cmake/test -B cmake_config_build \
@ -47,3 +51,8 @@ jobs:
-DTEST_SHARED=FALSE \
-DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }}
cmake --build cmake_config_build --verbose
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-emscripten
path: build/dist/SDL3*

View file

@ -18,22 +18,29 @@ jobs:
run: |
container-init & timeout 600 vmshell exit 0
- name: Setup Haiku dependencies
run: vmshell pkgman install -y cmd:cmake cmd:gcc cmd:ld cmd:ninja cmd:pkg_config haiku_devel devel:libgl devel:libglu
run: |
vmshell pkgman install -y cmd:cmake cmd:gcc cmd:ld cmd:ninja cmd:pkg_config haiku_devel devel:libgl devel:libglu
- name: Restart VM
run: |
sv force-restart qemu || true
timeout 600 vmshell exit 0
- uses: actions/checkout@v3
- name: Copy project to VM
run: |
vmshell mkdir ./src/
tar -cf - ./ | vmshell tar -xf - -C ./src/
- name: Configure (CMake)
run: vmshell cmake -S src -B build -GNinja \
-DSDL_TESTS=ON \
-DSDL_WERROR=ON \
-DSDL_INSTALL_TESTS=ON \
-DSDL_VENDOR_INFO=Github_Workflow \
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON \
-DSDL_TESTS_TIMEOUT_MULTIPLIER=10
run: |
vmshell cmake -S src -B build -GNinja \
-Wdeprecated -Wdev -Werror \
-DSDL_TESTS=ON \
-DSDL_WERROR=ON \
-DSDL_INSTALL_TESTS=ON \
-DSDL_VENDOR_INFO=Github_Workflow \
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON \
-DSDL_TESTS_TIMEOUT_MULTIPLIER=10
- name: Build (CMake)
run: |
vmshell cmake --build ./build/ --config Release --verbose --parallel
@ -43,6 +50,9 @@ jobs:
- name: Install (CMake)
run: |
vmshell cmake --install ./build/ --config Release
- name: Package (CPack)
run: |
vmshell cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
run: |
vmshell cmake -S ./src/cmake/test -B cmake_config_build -G Ninja \
@ -52,3 +62,11 @@ jobs:
- name: Verify sdl3.pc
run: |
vmshell CC=c++ PKG_CONFIG_PATH=\$PWD/cmake_prefix/lib/pkgconfig src/cmake/test/test_pkgconfig.sh
- name: Copy package from VM
run: |
vmshell tar -cf - build/dist/ | tar -xf - -C ./
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-haiku
path: build/dist/SDL3*

View file

@ -19,14 +19,15 @@ jobs:
fail-fast: false
matrix:
platform:
- { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
- { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686 }
- { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64 }
- { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64 }
- { name: Ubuntu 20.04, os: ubuntu-20.04, shell: sh }
- { name: Ubuntu 22.04, os: ubuntu-22.04, shell: sh }
- { name: MacOS, os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' }
- { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, artifact: 'SDL-mingw32' }
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, artifact: 'SDL-mingw64' }
- { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, artifact: 'SDL-msys2-clang32' }
- { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64, artifact: 'SDL-msys2-clang64' }
- { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64, artifact: 'SDL-msys2-ucrt64' }
- { name: Ubuntu 20.04, os: ubuntu-20.04, shell: sh, artifact: 'SDL-ubuntu20.04' }
- { name: Ubuntu 22.04, os: ubuntu-22.04, shell: sh, artifact: 'SDL-ubuntu22.04' }
- { name: MacOS (Framework), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DSDL_FRAMEWORK=ON -DSDL_CLANG_TIDY=OFF', skip_test_pkgconfig: true, artifact: 'SDL-macos-framework' }
- { name: MacOS (GNU prefix), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64" -DCLANG_TIDY_BINARY="$(brew --prefix llvm)/bin/clang-tidy"', artifact: 'SDL-macos-gnu' }
steps:
- name: Set up MSYS2
@ -39,6 +40,7 @@ jobs:
${{ matrix.platform.msys-env }}-cmake
${{ matrix.platform.msys-env }}-ninja
${{ matrix.platform.msys-env }}-pkg-config
${{ matrix.platform.msys-env }}-clang-tools-extra
- name: Setup Linux dependencies
if: runner.os == 'Linux'
@ -60,7 +62,8 @@ jobs:
if: runner.os == 'macOS'
run: |
brew install \
ninja
ninja \
llvm
- uses: actions/checkout@v3
- name: Check that versioning is consistent
# We only need to run this once: arbitrarily use the Linux/CMake build
@ -69,13 +72,15 @@ jobs:
- name: Configure (CMake)
run: |
cmake -S . -B build -G Ninja \
-DSDL_TESTS=ON \
-DSDL_WERROR=ON \
-DSDL_INSTALL_TESTS=ON \
-DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
-DCMAKE_BUILD_TYPE=Release \
${{ matrix.platform.cmake }}
-Wdeprecated -Wdev -Werror \
-DSDL_TESTS=ON \
-DSDL_WERROR=ON \
-DSDL_INSTALL_TESTS=ON \
-DSDL_VENDOR_INFO="Github Workflow" \
-DSDL_CLANG_TIDY=ON \
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
-DCMAKE_BUILD_TYPE=Release \
${{ matrix.platform.cmake }}
- name: Build (CMake)
run: |
cmake --build build/ --config Release --verbose --parallel
@ -92,15 +97,25 @@ jobs:
run: |
set -eu
cmake --install build/ --config Release
echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV
( cd cmake_prefix; find . ) | LC_ALL=C sort -u
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
-DTEST_SHARED=ON \
-DTEST_STATIC=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }}
-DCMAKE_PREFIX_PATH=$(echo "${{ github.workspace }}/cmake_prefix" | sed -e 's#\\#/#g')
cmake --build cmake_config_build --verbose
- name: Verify sdl3.pc
if: ${{ !matrix.platform.skip_test_pkgconfig }}
run: |
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
export PKG_CONFIG_PATH=$(echo "${{ github.workspace }}/cmake_prefix/lib/pkgconfig" | sed -e 's#\\#/#g')
cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: build/dist/SDL3*

View file

@ -15,16 +15,16 @@ jobs:
fail-fast: false
matrix:
platform:
- { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64' }
- { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32' }
- { name: Windows static VCRT (x64), flags: -A x64 -DSDL_FORCE_STATIC_VCRT=ON }
- { name: Windows static VCRT (x86), flags: -A Win32 -DSDL_FORCE_STATIC_VCRT=ON }
- { name: Windows (clang-cl x64), flags: -T ClangCL -A x64 }
- { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32 }
- { name: Windows (ARM), flags: -A ARM }
- { name: Windows (ARM64), flags: -A ARM64 }
- { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64', artifact: 'SDL-VC-x64' }
- { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32', artifact: 'SDL-VC-x86' }
- { name: Windows static VCRT (x64), flags: -A x64 -DSDL_FORCE_STATIC_VCRT=ON, artifact: 'SDL-VC-static-VCRT-x64' }
- { name: Windows static VCRT (x86), flags: -A Win32 -DSDL_FORCE_STATIC_VCRT=ON, artifact: 'SDL-VC-static-VCRT-x86' }
- { name: Windows (clang-cl x64), flags: -T ClangCL -A x64, artifact: 'SDL-clang-cl-x64' }
- { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32, artifact: 'SDL-clang-cl-x86' }
- { name: Windows (ARM), flags: -A ARM, artifact: 'SDL-VC-arm32' }
- { name: Windows (ARM64), flags: -A ARM64, artifact: 'SDL-VC-arm64' }
- { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF, nowerror: true,
project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0' }
project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0', artifact: 'SDL-VC-UWP' }
steps:
- uses: actions/checkout@v3
@ -44,11 +44,13 @@ jobs:
"""))
- name: Configure (CMake)
run: cmake -S build -B build `
-Wdeprecated -Wdev -Werror `
-DSDL_WERROR=${{ !matrix.platform.nowerror }} `
-DSDL_TESTS=ON `
-DSDL_INSTALL_TESTS=ON `
-DSDL_VENDOR_INFO="Github Workflow" `
-DSDL3_DISABLE_INSTALL=OFF `
-DSDL_DISABLE_INSTALL=OFF `
-DSDL_DISABLE_INSTALL_CPACK=OFF `
${{ matrix.platform.flags }} `
-DCMAKE_INSTALL_PREFIX=prefix
- name: Build (CMake)
@ -62,6 +64,9 @@ jobs:
run: |
echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV
cmake --install build/
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target PACKAGE
- name: Verify CMake configuration files
if: ${{ !contains(matrix.platform.name, 'UWP') }} # FIXME: cmake/test/CMakeLists.txt should support UWP
run: |
@ -76,3 +81,8 @@ jobs:
- name: Build msbuild
if: ${{ matrix.platform.project != '' }}
run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }}
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: build/dist/SDL3*

View file

@ -17,9 +17,10 @@ jobs:
run: |
apt update
apt install ninja-build
- name: Configure CMake
- name: Configure (CMake)
run: |
cmake -S . -B build -G Ninja \
-Wdeprecated -Wdev -Werror \
-DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
@ -27,13 +28,17 @@ jobs:
-DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix
- name: Build
run: cmake --build build --verbose
- name: Install CMake
- name: Build (CMake)
run: |
cmake --build build --verbose
- name: Install (CMake)
run: |
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build/
( cd prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
@ -42,5 +47,19 @@ jobs:
-DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \
-DCMAKE_BUILD_TYPE=Release
cmake --build cmake_config_build --verbose
# Not running test_pkgconfig.sh and test_sdlconfig.sh
# as invoking the compiler manually is not supported
- name: Extract CC/CXX/CFLAGS/CXXFLAGS from CMake toolchain
run: |
cmake -S .github/cmake -B /tmp/cmake_extract \
-DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DVAR_PATH=/tmp/n3ds_env.txt
cat /tmp/n3ds_env.txt >> $GITHUB_ENV
- name: Verify sdl3.pc
run: |
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-n3ds
path: build/dist/SDL3*

View file

@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- name: Setup dependencies
run: |
apk update
apk update
apk add cmake gmp mpc1 mpfr4 ninja pkgconf make git
# To be removed once ps2_drivers is part of PS2DEV
@ -32,9 +32,10 @@ jobs:
-DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
-DCMAKE_BUILD_TYPE=Release
- name: Build
- name: Build (CMake)
run: cmake --build build --config Release --verbose --parallel
- name: Install (CMake)
run: |
@ -42,10 +43,14 @@ jobs:
cmake --install build/ --config Release
echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV
( cd cmake_prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
-Wdeprecated -Wdev -Werror \
-DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \
-DTEST_SHARED=FALSE \
-DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \
@ -54,18 +59,11 @@ jobs:
- name: Verify sdl3.pc
run: |
export CC=mips64r5900el-ps2-elf-gcc
export EXTRA_LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib"
export LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib"
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
- name: Upload artifacts
if: ${{ success() }}
uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v3
with:
name: tests-${{ steps.slug.outputs.sha8 }}
path: |
build/test
if-no-files-found: error
name: SDL-ps2
path: build/dist/SDL3*

View file

@ -14,24 +14,28 @@ jobs:
- uses: actions/checkout@v3
- name: Setup dependencies
run: |
apk update
apk update
apk add cmake gmp mpc1 mpfr4 make pkgconf
- name: Configure CMake
- name: Configure (CMake)
run: |
cmake -S . -B build \
-Wdeprecated -Wdev -Werror \
-DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix
- name: Build
- name: Build (CMake)
run: cmake --build build --config Release --verbose
- name: Install
- name: Install (CMake)
run: |
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build --config Release
( cd prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build \
@ -43,6 +47,11 @@ jobs:
- name: Verify sdl3.pc
run: |
export CC=psp-gcc
export LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-psp
path: build/dist/SDL3*

View file

@ -26,6 +26,7 @@ jobs:
if: ${{ contains(matrix.platform.name, 'CMake') }}
run: |
cmake -S . -B build -G Ninja \
-Wdeprecated -Wdev -Werror \
-DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \
-DRISCOS:BOOL=ON \
-DSDL_GCC_ATOMICS=OFF \
@ -43,6 +44,9 @@ jobs:
echo "SDL3_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV
cmake --install build/
( cd ${{ github.workspace }}/prefix_cmake; find ) | LC_ALL=C sort -u
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
@ -51,3 +55,8 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \
${{ matrix.platform.test_args }}
cmake --build cmake_config_build --verbose
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-riscos
path: build/dist/SDL3*

View file

@ -12,31 +12,81 @@ defaults:
jobs:
vita:
name: ${{ matrix.platform.name }}
runs-on: ubuntu-latest
container:
container:
image: vitasdk/vitasdk:latest
strategy:
fail-fast: false
matrix:
platform:
- { name: Vita (GLES w/ pib), os: windows-latest, pib: true, artifact: SDL-vita-pib }
- { name: Vita (GLES w/ PVR_PSP2 + gles4vita), os: windows-latest, pvr: true, artifact: SDL-vita-pvr }
steps:
- uses: actions/checkout@v3
- name: Install build requirements
run: |
apk update
apk update
apk add cmake ninja pkgconf bash
- name: Configure CMake
- name: Configure PVR_PSP2 (GLES)
if: ${{ !!matrix.platform.pvr }}
run: |
pvr_psp2_version=3.9
# Configure PVR_PSP2 headers
wget https://github.com/GrapheneCt/PVR_PSP2/archive/refs/tags/v$pvr_psp2_version.zip -P/tmp
unzip /tmp/v$pvr_psp2_version.zip -d/tmp
cp -r /tmp/PVR_PSP2-$pvr_psp2_version/include/* ${VITASDK}/arm-vita-eabi/include
rm /tmp/v$pvr_psp2_version.zip
# include guard of PVR_PSP2's khrplatform.h does not match the usual one
sed -i -e s/__drvkhrplatform_h_/__khrplatform_h_/ ${VITASDK}/arm-vita-eabi/include/KHR/khrplatform.h
# Configure PVR_PSP2 stub libraries
wget https://github.com/GrapheneCt/PVR_PSP2/releases/download/v$pvr_psp2_version/vitasdk_stubs.zip -P/tmp
unzip /tmp/vitasdk_stubs.zip -d/tmp/pvr_psp2_stubs
find /tmp/pvr_psp2_stubs -type f -name "*.a" -exec cp {} ${VITASDK}/arm-vita-eabi/lib \;
rm /tmp/vitasdk_stubs.zip
rm -rf /tmp/pvr_psp2_stubs
- name: Configure gl4es4vita (OpenGL)
if: ${{ !!matrix.platform.pvr }}
run: |
gl4es4vita_version=1.1.4
# Configure gl4es4vita headers
wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/include.zip -P/tmp
unzip -o /tmp/include.zip -d${VITASDK}/arm-vita-eabi/include
rm /tmp/include.zip
# Configure gl4es4vita stub libraries
wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp
unzip /tmp/vitasdk_stubs.zip -d${VITASDK}/arm-vita-eabi/lib
- name: Configure (CMake)
run: |
cmake -S . -B build -G Ninja \
-Wdeprecated -Wdev -Werror \
-DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \
-DVIDEO_VITA_PIB=${{ !!matrix.platform.pib }} \
-DVIDEO_VITA_PVR=${{ !!matrix.platform.pvr }} \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix
- name: Build
- name: Build (CMake)
run: cmake --build build --verbose
- name: Install CMake
- name: Install (CMake)
run: |
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build/
( cd prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
@ -50,3 +100,8 @@ jobs:
export CC=arm-vita-eabi-gcc
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: build/dist/SDL3*

View file

@ -49,6 +49,14 @@ jobs:
run: |
cmake -S . -B build -GNinja \
-Wdeprecated -Wdev -Werror \
-DCMAKE_BUILD_TYPE=Release \
-DSDL_CHECK_REQUIRED_INCLUDES="/usr/local/include" \
-DSDL_CHECK_REQUIRED_LINK_OPTIONS="-L/usr/local/lib"
cmake --build build --verbose -- -j`sysctl -n hw.ncpu`
cmake --build build/ --config Release --verbose -- -j`sysctl -n hw.ncpu`
cmake --build build/ --config Release --target package
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-freebsd
path: build/dist/SDL3*

View file

@ -1,6 +1,6 @@
projectfullname = SDL
projectshortname = SDL
incsubdir = include
incsubdir = include/SDL3
wikisubdir =
apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_)
mainincludefname = SDL.h
@ -13,4 +13,4 @@ projecturl = https://libsdl.org/
wikiurl = https://wiki.libsdl.org
bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
warn_about_missing = 0
wikipreamble = (This is the documentation for SDL3, which is under heavy development and the API is changing! SDL2 is the current stable version!)
wikipreamble = (This is the documentation for SDL3, which is under heavy development and the API is changing! [SDL2](https://wiki.libsdl.org/SDL2/) is the current stable version!)

View file

@ -56,8 +56,7 @@ LOCAL_SRC_FILES := \
$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c) \
$(wildcard $(LOCAL_PATH)/src/test/*.c))
$(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c))
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_CFLAGS += \
@ -89,6 +88,29 @@ LOCAL_STATIC_LIBRARIES := cpufeatures
include $(BUILD_SHARED_LIBRARY)
###########################
#
# SDL_test static library
#
###########################
LOCAL_MODULE := SDL3_test
LOCAL_MODULE_FILENAME := libSDL3_test
LOCAL_SRC_FILES := \
$(subst $(LOCAL_PATH)/,, \
$(wildcard $(LOCAL_PATH)/src/test/*.c))
LOCAL_LDLIBS :=
LOCAL_LDFLAGS :=
LOCAL_EXPORT_LDLIBS :=
include $(BUILD_STATIC_LIBRARY)
###########################
#
# SDL static library
@ -108,3 +130,4 @@ LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid
include $(BUILD_STATIC_LIBRARY)
$(call import-module,android/cpufeatures)

View file

@ -1,9 +1,11 @@
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
cmake_minimum_required(VERSION 3.0.0)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the SDL source code and run \"cmake -S ${CMAKE_SOURCE_DIR} -B .\" from there")
endif()
cmake_minimum_required(VERSION 3.0.0)
project(SDL3 C CXX)
# See docs/release_checklist.md
project(SDL3 LANGUAGES C CXX VERSION "3.0.0")
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(SDL3_SUBPROJECT OFF)
@ -44,16 +46,6 @@ if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
# !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property
# !!! FIXME: for the SDL shared library (so you get an
# !!! FIXME: install_name ("soname") of "@rpath/libSDL-whatever.dylib"
# !!! FIXME: instead of "/usr/local/lib/libSDL-whatever.dylib"), but I'm
# !!! FIXME: punting for now and leaving the existing behavior. Until this
# !!! FIXME: properly resolved, this line silences a warning in CMake 3.0+.
# !!! FIXME: remove it and this comment entirely once the problem is
# !!! FIXME: properly resolved.
#cmake_policy(SET CMP0042 OLD)
include(CheckLibraryExists)
include(CheckIncludeFile)
include(CheckLanguage)
@ -64,6 +56,7 @@ include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckStructHasMember)
include(CMakeDependentOption)
include(CMakeParseArguments)
include(CMakePushCheckState)
include(GNUInstallDirs)
@ -72,9 +65,11 @@ find_package(PkgConfig)
list(APPEND CMAKE_MODULE_PATH "${SDL3_SOURCE_DIR}/cmake")
include(${SDL3_SOURCE_DIR}/cmake/macros.cmake)
include(${SDL3_SOURCE_DIR}/cmake/sdlchecks.cmake)
include(${SDL3_SOURCE_DIR}/cmake/sdlfind.cmake)
include(${SDL3_SOURCE_DIR}/cmake/sdlplatform.cmake)
include(${SDL3_SOURCE_DIR}/cmake/CheckCPUArchitecture.cmake)
include(${SDL3_SOURCE_DIR}/cmake/GetGitRevisionDescription.cmake)
include(${SDL3_SOURCE_DIR}/cmake/3rdparty.cmake)
# Enable large file support on 32-bit glibc, so that we can access files
# with large inode numbers
@ -83,44 +78,42 @@ if (LIBC_IS_GLIBC AND CMAKE_SIZEOF_VOID_P EQUAL 4)
target_compile_definitions(sdl-build-options INTERFACE "_FILE_OFFSET_BITS=64")
endif()
# See docs/release_checklist.md
set(SDL_MAJOR_VERSION 3)
set(SDL_MINOR_VERSION 0)
set(SDL_MICRO_VERSION 0)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
if(CMAKE_VERSION VERSION_LESS "3.26")
set(build_local_interface "BUILD_INTERFACE")
else()
set(build_local_interface "BUILD_LOCAL_INTERFACE")
endif()
# Increment this if there is an incompatible change - but if that happens,
# we should rename the library from SDL3 to SDL4, at which point this would
# reset to 0 anyway.
set(SDL_SO_VERSION_MAJOR "0")
set(SDL_SO_VERSION_MINOR "${SDL_MINOR_VERSION}")
set(SDL_SO_VERSION_MICRO "${SDL_MICRO_VERSION}")
set(SDL_SO_VERSION "${SDL_SO_VERSION_MAJOR}.${SDL_SO_VERSION_MINOR}.${SDL_SO_VERSION_MICRO}")
set(SDL_SO_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(SDL_SO_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(SDL_SO_VERSION "${SDL_SO_VERSION_MAJOR}.${SDL_SO_VERSION_MINOR}.${SDL_SO_VERSION_PATCH}")
if(SDL_MINOR_VERSION MATCHES "[02468]$")
math(EXPR SDL_DYLIB_COMPAT_VERSION_MAJOR "100 * ${SDL_MINOR_VERSION} + 1")
if(PROJECT_VERSION_MINOR MATCHES "[02468]$")
math(EXPR SDL_DYLIB_COMPAT_VERSION_MAJOR "100 * ${PROJECT_VERSION_MINOR} + 1")
set(SDL_DYLIB_COMPAT_VERSION_MINOR "0")
math(EXPR SDL_DYLIB_CURRENT_VERSION_MAJOR "${SDL_DYLIB_COMPAT_VERSION_MAJOR}")
set(SDL_DYLIB_CURRENT_VERSION_MINOR "${SDL_MICRO_VERSION}")
set(SDL_DYLIB_CURRENT_VERSION_MINOR "${PROJECT_VERSION_PATCH}")
else()
math(EXPR SDL_DYLIB_COMPAT_VERSION_MAJOR "100 * ${SDL_MINOR_VERSION} + ${SDL_MICRO_VERSION} + 1")
math(EXPR SDL_DYLIB_COMPAT_VERSION_MAJOR "100 * ${PROJECT_VERSION_MINOR} + ${PROJECT_VERSION_PATCH} + 1")
set(SDL_DYLIB_COMPAT_VERSION_MINOR "0")
math(EXPR SDL_DYLIB_CURRENT_VERSION_MAJOR "${SDL_DYLIB_COMPAT_VERSION_MAJOR}")
set(SDL_DYLIB_CURRENT_VERSION_MINOR "0")
endif()
set(SDL_DYLIB_COMPAT_VERSION_MICRO "0")
set(SDL_DYLIB_CURRENT_VERSION_MICRO "0")
set(SDL_DYLIB_COMPAT_VERSION_PATCH "0")
set(SDL_DYLIB_COMPAT_VERSION_PATCH "0")
set(SDL_DYLIB_CURRENT_VERSION "${SDL_DYLIB_CURRENT_VERSION_MAJOR}.${SDL_DYLIB_CURRENT_VERSION_MINOR}.${SDL_DYLIB_CURRENT_VERSION_MICRO}")
set(SDL_DYLIB_COMPAT_VERSION "${SDL_DYLIB_COMPAT_VERSION_MAJOR}.${SDL_DYLIB_COMPAT_VERSION_MINOR}.${SDL_DYLIB_COMPAT_VERSION_MICRO}")
set(SDL_DYLIB_CURRENT_VERSION "${SDL_DYLIB_CURRENT_VERSION_MAJOR}.${SDL_DYLIB_CURRENT_VERSION_MINOR}.${SDL_DYLIB_COMPAT_VERSION_PATCH}")
set(SDL_DYLIB_COMPAT_VERSION "${SDL_DYLIB_COMPAT_VERSION_MAJOR}.${SDL_DYLIB_COMPAT_VERSION_MINOR}.${SDL_DYLIB_COMPAT_VERSION_PATCH}")
#message("SDL_SO_VERSION=${SDL_SO_VERSION} SDL_DYLIB_CURRENT_VERSION=${SDL_DYLIB_CURRENT_VERSION} SDL_DYLIB_COMPAT_VERSION=${SDL_DYLIB_COMPAT_VERSION}")
check_cpu_architecture(x86 SDL_CPU_X86)
check_cpu_architecture(x64 SDL_CPU_X64)
check_cpu_architecture(arm32 SDL_CPU_ARM32)
check_cpu_architecture(arm64 SDL_CPU_ARM64)
check_cpu_architecture(loongarch64 SDL_CPU_LOONGARCH64)
set(SDL_FRAMEWORK_VERSION "A")
SDL_DetectCPUArchitecture()
# Check for 64 or 32 bit
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@ -282,7 +275,7 @@ endif()
if(CYGWIN)
# We build SDL on cygwin without the UNIX emulation layer
target_include_directories(sdl-build-options INTERFACE "/usr/include/mingw")
target_include_directories(sdl-build-options SYSTEM INTERFACE "/usr/include/mingw")
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mno-cygwin")
check_c_source_compiles("int main(int argc, char **argv) { return 0; }"
@ -310,7 +303,7 @@ if(USE_GCC OR (USE_CLANG AND NOT MSVC_CLANG))
target_compile_options(sdl-global-options INTERFACE "SHELL:-idirafter \"${SDL3_SOURCE_DIR}/src/video/khronos\"")
endif()
else()
target_include_directories(sdl-global-options INTERFACE "${SDL3_SOURCE_DIR}/src/video/khronos")
target_include_directories(sdl-global-options SYSTEM INTERFACE "${SDL3_SOURCE_DIR}/src/video/khronos")
endif()
# All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so
@ -372,8 +365,9 @@ foreach(_SUB ${SDL_SUBSYSTEMS})
endforeach()
# Allow some projects to be built conditionally.
set_option(SDL3_DISABLE_INSTALL "Disable installation of SDL3" ${SDL3_SUBPROJECT})
set_option(SDL3_DISABLE_UNINSTALL "Disable uninstallation of SDL3" OFF)
set_option(SDL_DISABLE_INSTALL "Disable installation of SDL3" ${SDL3_SUBPROJECT})
cmake_dependent_option(SDL_DISABLE_INSTALL_CPACK "Create binary SDL3 archive using CPack" ${SDL3_SUBPROJECT} "NOT SDL_DISABLE_INSTALL" OFF)
set_option(SDL_DISABLE_UNINSTALL "Disable uninstallation of SDL3" OFF)
option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
#set_option(SDL_DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON)
@ -452,6 +446,7 @@ set_option(SDL_LIBUDEV "Enable libudev support" ON)
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
option_string(SDL_VENDOR_INFO "Vendor name and/or version to add to SDL_REVISION" "")
set_option(SDL_CCACHE "Use Ccache to speed up build" ON)
set_option(SDL_CLANG_TIDY "Run clang-tidy static analysis" OFF)
option(SDL_WERROR "Enable -Werror" OFF)
@ -459,9 +454,12 @@ option(SDL_SHARED "Build a shared version of the library" ${SDL_SHARED_ENABLED_B
option(SDL_STATIC "Build a static version of the library" ${SDL_STATIC_ENABLED_BY_DEFAULT})
option(SDL_TEST "Build the SDL3_test library" ${SDL_TEST_ENABLED_BY_DEFAULT})
# Apple Frameworks NEED a (shared) SDL3.framework for `#include <SDL3/xxx.h>` to work
cmake_dependent_option(SDL_FRAMEWORK "Build SDL libraries as Apple Framework" OFF "SDL_SHARED;APPLE" OFF)
dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" "${CMAKE_POSITION_INDEPENDENT_CODE}" "SDL_STATIC" OFF)
dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST OFF)
set_option(SDL_INSTALL_TESTS "Install test-cases" OFF)
dep_option(SDL_INSTALL_TESTS "Install test-cases" OFF "NOT SDL_DISABLE_INSTALL;NOT SDL_FRAMEWORK" OFF)
set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}")
@ -599,6 +597,16 @@ if(USE_GCC OR USE_CLANG)
target_compile_options(sdl-global-options INTERFACE "-Wdocumentation-unknown-command")
endif()
check_c_compiler_flag(-fcomment-block-commands=threadsafety HAVE_GCC_COMMENT_BLOCK_COMMANDS)
if(HAVE_GCC_COMMENT_BLOCK_COMMANDS)
target_compile_options(sdl-global-options INTERFACE "-fcomment-block-commands=threadsafety")
else()
check_c_compiler_flag(/clang:-fcomment-block-commands=threadsafety HAVE_CLANG_COMMENT_BLOCK_COMMANDS)
if(HAVE_CLANG_COMMENT_BLOCK_COMMANDS)
target_compile_options(sdl-global-options INTERFACE "/clang:-fcomment-block-commands=threadsafety")
endif()
endif()
if(DEPENDENCY_TRACKING)
check_c_source_compiles("
#if !defined(__GNUC__) || __GNUC__ < 3
@ -626,6 +634,19 @@ if(USE_GCC OR USE_CLANG)
endif()
endif()
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fvisibility=hidden -Werror")
check_c_source_compiles("
#if !defined(__GNUC__) || __GNUC__ < 4
#error SDL only uses visibility attributes in GCC 4 or newer
#endif
__attribute__((visibility(\"default\"))) int foo(void);
__attribute__((visibility(\"hidden\"))) int bar(void);
int foo(void) { return 0; }
int bar(void) { return 1; }
int main(void) { return 0; }" HAVE_GCC_FVISIBILITY)
cmake_pop_check_state()
check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW)
if(HAVE_GCC_WSHADOW)
target_compile_options(sdl-global-options INTERFACE "-Wshadow")
@ -1495,7 +1516,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
pkg_search_module(DBUS dbus-1 dbus)
if(DBUS_FOUND)
set(HAVE_DBUS_DBUS_H TRUE)
target_include_directories(sdl-build-options INTERFACE ${DBUS_INCLUDE_DIRS})
target_include_directories(sdl-build-options SYSTEM INTERFACE ${DBUS_INCLUDE_DIRS})
# Fcitx need only dbus.
set(HAVE_FCITX TRUE)
set(HAVE_DBUS TRUE)
@ -1507,7 +1528,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
find_path(HAVE_SYS_INOTIFY_H NAMES sys/inotify.h)
if(IBUS_FOUND AND HAVE_SYS_INOTIFY_H)
set(HAVE_IBUS_IBUS_H TRUE)
target_include_directories(sdl-build-options INTERFACE ${IBUS_INCLUDE_DIRS})
target_include_directories(sdl-build-options SYSTEM INTERFACE ${IBUS_INCLUDE_DIRS})
set(HAVE_IBUS TRUE)
endif()
endif()
@ -1520,7 +1541,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
pkg_search_module(INOTIFY libinotify)
if(INOTIFY_FOUND)
set(HAVE_INOTIFY 1)
target_include_directories(sdl-build-options INTERFACE ${INOTIFY_INCLUDE_DIRS})
target_include_directories(sdl-build-options SYSTEM INTERFACE ${INOTIFY_INCLUDE_DIRS})
list(APPEND SDL_EXTRA_LIBS ${INOTIFY_LIBRARIES})
endif()
endif()
@ -2438,6 +2459,9 @@ elseif(VITA)
set(SDL_VIDEO_OPENGL_ES2 1)
list(APPEND SDL_EXTRA_LIBS
pib
libScePiglet_stub_weak
taihen_stub_weak
SceShaccCg_stub_weak
)
set(HAVE_VIDEO_VITA_PIB ON)
set(SDL_VIDEO_VITA_PIB 1)
@ -2450,7 +2474,6 @@ elseif(VITA)
check_include_file(gpu_es4/psp2_pvr_hint.h HAVE_PVR_H)
if(HAVE_PVR_H)
target_compile_definitions(sdl-build-options INTERFACE "__psp2__")
check_include_file(gl4esinit.h HAVE_GL4ES_H)
set(SDL_VIDEO_OPENGL_EGL 1)
set(HAVE_OPENGLES TRUE)
set(SDL_VIDEO_OPENGL_ES 1)
@ -2460,17 +2483,21 @@ elseif(VITA)
list(APPEND SDL_EXTRA_LIBS
libgpu_es4_ext_stub_weak
libIMGEGL_stub_weak
SceIme_stub
)
set(HAVE_VIDEO_VITA_PVR ON)
set(SDL_VIDEO_VITA_PVR 1)
if(HAVE_GL4ES_H)
set(HAVE_OPENGL TRUE)
set(SDL_VIDEO_OPENGL 1)
set(SDL_VIDEO_RENDER_OGL 1)
list(APPEND SDL_EXTRA_LIBS libGL_stub)
set(SDL_VIDEO_VITA_PVR_OGL 1)
if(SDL_OPENGL)
check_include_file(gl4esinit.h HAVE_GL4ES_H)
if(HAVE_GL4ES_H)
set(HAVE_OPENGL TRUE)
set(SDL_VIDEO_OPENGL 1)
set(SDL_VIDEO_RENDER_OGL 1)
list(APPEND SDL_EXTRA_LIBS libGL_stub)
set(SDL_VIDEO_VITA_PVR_OGL 1)
endif()
endif()
else()
@ -2500,19 +2527,6 @@ elseif(VITA)
SceProcessmgr_stub
m
)
if(HAVE_VITA_PIB)
list(PREPEND SDL_EXTRA_LIBS
pib
libScePiglet_stub
SceShaccCg_stub
taihen_stub
)
endif()
if(HAVE_VITA_PVR)
list(PREPEND SDL_EXTRA_LIBS
SceIme_stub
)
endif()
endif()
set(HAVE_ARMSIMD TRUE)
@ -2721,6 +2735,13 @@ elseif(N3DS)
else()
message_error("SDL_FILE must be enabled to build on N3DS")
endif()
foreach(lib ${CMAKE_C_STANDARD_LIBRARIES})
if(lib MATCHES "^-l")
string(SUBSTRING "${lib}" 2 -1 lib)
endif()
list(APPEND SDL_EXTRA_LIBS ${lib})
endforeach()
endif()
if(HAVE_VULKAN AND NOT SDL_LOADSO)
@ -2869,53 +2890,29 @@ else()
# If VERSION does not exist, use git to calculate a version
git_describe(SDL_REVISION_CENTER)
if(NOT SDL_REVISION_CENTER)
set(SDL_REVISION_CENTER "${SDL_VERSION}-no-vcs")
set(SDL_REVISION_CENTER "${SDL3_VERSION}-no-vcs")
endif()
endif()
set(SDL_REVISION "SDL-${SDL_REVISION_CENTER}${SDL_REVISION_SUFFIX}")
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${SDL3_BINARY_DIR}/include/SDL3")
configure_file("${SDL3_SOURCE_DIR}/include/build_config/SDL_revision.h.cmake"
"${SDL3_BINARY_DIR}/include/SDL3/SDL_revision.h")
configure_file(include/build_config/SDL_revision.h.cmake include/SDL3/SDL_revision.h @ONLY)
list(APPEND SDL3_INCLUDE_FILES "${SDL3_BINARY_DIR}/include/SDL3/SDL_revision.h")
if(CMAKE_STATIC_LIBRARY_PREFIX STREQUAL "" AND CMAKE_STATIC_LIBRARY_SUFFIX STREQUAL ".lib")
# Avoid conflict between the dll import library and the static library
if(SDL_FRAMEWORK)
# With Apple frameworks, headers in the PUBLIC_HEADER property also need to be added as sources
list(APPEND SDL3_INCLUDE_FILES ${SDL3_TEST_INCLUDE_FILES})
list(APPEND SOURCE_FILES ${SDL3_INCLUDE_FILES})
endif()
if((CMAKE_STATIC_LIBRARY_PREFIX STREQUAL "" AND CMAKE_STATIC_LIBRARY_SUFFIX STREQUAL ".lib") OR SDL_FRAMEWORK)
# - Avoid conflict between the dll import library and the static library
# - Create SDL3-static Apple Framework
set(sdl_static_libname "SDL3-static")
else()
set(sdl_static_libname "SDL3")
endif()
# Clean up variables for sdl3.pc
if(SDL_SHARED)
set(PKGCONFIG_LIBS_PRIV "\nLibs.private:")
else()
set(PKGCONFIG_LIBS_PRIV "")
endif()
# Clean up the different lists
listtostr(SDL_EXTRA_LIBS EXTRA_LIBS_L "-l")
set(SDL_PC_STATIC_LIBS ${SDL_EXTRA_LDFLAGS} ${EXTRA_LIBS_L})
list(REMOVE_DUPLICATES SDL_PC_STATIC_LIBS)
listtostr(SDL_PC_STATIC_LIBS SDL_PC_STATIC_LIBS)
listtostr(SDL_PC_LIBS SDL_PC_LIBS)
listtostr(SDL_PC_CFLAGS SDL_PC_CFLAGS)
listtostr(SDL_PC_PRIVATE_REQUIRES SDL_PC_PRIVATE_REQUIRES)
string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_PC_STATIC_LIBS "${SDL_PC_STATIC_LIBS}")
if(NOT SDL_SHARED)
string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_PC_LIBS "${SDL_PC_LIBS}")
endif()
if(SDL_STATIC AND SDL_SHARED AND NOT sdl_static_libname STREQUAL "SDL3")
message(STATUS "\"pkg-config --static --libs sdl3\" will return invalid information")
endif()
# message(STATUS "SDL_PC_CFLAGS: ${SDL_PC_CFLAGS}")
# message(STATUS "SDL_PC_LIBS: ${SDL_PC_LIBS}")
# message(STATUS "SDL_PC_STATIC_LIBS: ${SDL_PC_STATIC_LIBS}")
configure_file(cmake/sdl3.pc.in sdl3.pc @ONLY)
macro(check_add_debug_flag FLAG SUFFIX)
check_c_compiler_flag(${FLAG} HAS_C_FLAG_${SUFFIX})
if (HAS_C_FLAG_${SUFFIX})
@ -2995,6 +2992,28 @@ else()
set(HAVE_CCACHE OFF)
endif()
if(SDL_CLANG_TIDY)
cmake_minimum_required(VERSION 3.6)
find_program(CLANG_TIDY_BINARY clang-tidy)
if(CLANG_TIDY_BINARY)
set(HAVE_CLANG_TIDY ON)
get_clang_tidy_ignored_files(CLANG_TIDY_IGNORED_FILES)
set(CLANG_TIDY_COMMAND "${CLANG_TIDY_BINARY}" "-extra-arg=-Wno-unknown-warning-option" "--line-filter=[${CLANG_TIDY_IGNORED_FILES}]")
if(SDL_WERROR)
list(APPEND CLANG_TIDY_COMMAND "--warnings-as-errors=*")
endif()
set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_COMMAND})
set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_COMMAND})
set(CMAKE_OBJC_CLANG_TIDY ${CLANG_TIDY_COMMAND})
set_source_files_properties(${SOURCE_FILES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
file(GLOB STDLIB_SOURCES "${SDL3_SOURCE_DIR}/src/stdlib/*.c")
set_property(SOURCE ${STDLIB_SOURCES} APPEND PROPERTY COMPILE_DEFINITIONS "SDL_DISABLE_ANALYZE_MACROS")
else()
set(HAVE_CLANG_TIDY OFF)
endif()
endif()
if(SDL_TESTS)
set(HAVE_TESTS ON)
endif()
@ -3022,6 +3041,7 @@ list(REMOVE_DUPLICATES INFO_SHARED_LDFLAGS)
listtostr(INFO_SHARED_LDFLAGS INFO_SHARED_LDFLAGS)
listtostr(SDL_EXTRA_LIBS INFO_EXTRA_LIBS)
listtostr(SDL_CMAKE_DEPENDS INFO_CMAKE_DEPENDS)
##### Info output #####
message(STATUS "")
@ -3057,12 +3077,15 @@ message(STATUS " EXTRA DEFS: ${INFO_DEFS}")
message(STATUS " EXTRA CFLAGS: ${INFO_CFLAGS} ${INFO_CHECKS}")
message(STATUS " EXTRA INCDIRS: ${INFO_INCDIRS}")
message(STATUS " EXTRA LDFLAGS: ${INFO_SHARED_LDFLAGS} ${INFO_EXTRA_LDFLAGS}")
message(STATUS " EXTRA LIBS: ${INFO_EXTRA_LIBS}")
message(STATUS " EXTRA LIBS: ${INFO_EXTRA_LIBS} ${INFO_CMAKE_DEPENDS}")
message(STATUS "")
message(STATUS " Build Shared Library: ${SDL_SHARED}")
message(STATUS " Build Static Library: ${SDL_STATIC}")
if(SDL_STATIC)
message(STATUS " Build Static Library with Position Independent Code: ${SDL_STATIC_PIC}")
message(STATUS " Build Static Library with Position Independent Code: ${SDL_STATIC_PIC}")
endif()
if(APPLE)
message(STATUS " Build libraries as Apple Framework: ${SDL_FRAMEWORK}")
endif()
message(STATUS "")
if(UNIX)
@ -3091,7 +3114,7 @@ if(WARN_ABOUT_ARM_NEON_ASM_MIT)
endif()
if(ANDROID)
target_include_directories(sdl-build-options INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures")
target_include_directories(sdl-build-options SYSTEM INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures")
endif()
if(APPLE)
@ -3114,18 +3137,53 @@ endif()
# Disable precompiled headers on SDL_dynapi.c to avoid applying dynapi overrides
set_source_files_properties(src/dynapi/SDL_dynapi.c PROPERTIES SKIP_PRECOMPILE_HEADERS 1)
set(SDL_FRAMEWORK_RESOURCES
Xcode/SDL/pkg-support/resources/ReadMe.txt
LICENSE.txt
)
if(SDL_FRAMEWORK)
list(APPEND SOURCE_FILES ${SDL_FRAMEWORK_RESOURCES})
endif()
add_library(SDL3_Headers INTERFACE)
add_library(SDL3::Headers ALIAS SDL3_Headers)
set_target_properties(SDL3_Headers PROPERTIES
EXPORT_NAME "Headers"
)
target_include_directories(SDL3_Headers
INTERFACE
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include/SDL3>"
)
if(SDL_FRAMEWORK)
target_include_directories(SDL3_Headers
INTERFACE
"$<INSTALL_INTERFACE:SDL3.framework/Headers>"
)
else()
target_include_directories(SDL3_Headers
INTERFACE
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL3>"
)
endif()
if(SDL_SHARED)
add_library(SDL3 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
# alias target for in-tree builds
add_library(SDL3::SDL3 ALIAS SDL3)
set_target_properties(SDL3 PROPERTIES
C_VISIBILITY_PRESET "hidden"
CXX_VISIBILITY_PRESET "hidden"
OBJC_VISIBILITY_PRESET "hidden"
POSITION_INDEPENDENT_CODE TRUE
LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/dynapi/SDL_dynapi.sym"
INTERFACE_LINK_DEPENDS "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/dynapi/SDL_dynapi.sym>"
)
if(HAVE_GCC_FVISIBILITY)
set_target_properties(SDL3 PROPERTIES
C_VISIBILITY_PRESET "hidden"
CXX_VISIBILITY_PRESET "hidden"
OBJC_VISIBILITY_PRESET "hidden"
)
endif()
if(NOT SDL_LIBC)
if(MSVC AND SDL_CPU_X86)
# FIXME: should be added for all architectures (missing symbols for ARM)
@ -3134,8 +3192,17 @@ if(SDL_SHARED)
endif()
if(APPLE)
set_target_properties(SDL3 PROPERTIES
MACOSX_RPATH 1
MACOSX_RPATH TRUE
FRAMEWORK "${SDL_FRAMEWORK}"
)
if(SDL_FRAMEWORK)
set_target_properties(SDL3 PROPERTIES
PUBLIC_HEADER "${SDL3_INCLUDE_FILES}"
FRAMEWORK_VERSION "${SDL_FRAMEWORK_VERSION}"
MACOSX_FRAMEWORK_IDENTIFIER "org.libsdl.SDL3"
RESOURCE "${SDL_FRAMEWORK_RESOURCES}"
)
endif()
if(NOT CMAKE_VERSION VERSION_LESS "3.6")
set_target_properties(SDL3 PROPERTIES
SOVERSION "${SDL_DYLIB_COMPAT_VERSION}" # SOVERSION corresponds to compatibility version
@ -3167,17 +3234,12 @@ if(SDL_SHARED)
PRIVATE
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/src>"
PUBLIC
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include/SDL3>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL3>"
)
target_link_libraries(SDL3 PUBLIC $<TARGET_NAME:SDL3::Headers>)
# This picks up all the compiler options and such we've accumulated up to here.
target_link_libraries(SDL3 PRIVATE $<BUILD_INTERFACE:sdl-build-options>)
target_link_libraries(SDL3 PRIVATE $<BUILD_INTERFACE:sdl-shared-build-options>)
target_link_libraries(SDL3 PRIVATE $<BUILD_INTERFACE:sdl-global-options>)
target_link_libraries(SDL3 PRIVATE $<${build_local_interface}:sdl-build-options>)
target_link_libraries(SDL3 PRIVATE $<${build_local_interface}:sdl-shared-build-options>)
target_link_libraries(SDL3 PRIVATE $<${build_local_interface}:sdl-global-options>)
if(MINGW OR CYGWIN)
if(NOT CMAKE_VERSION VERSION_LESS "3.13")
target_link_options(SDL3 PRIVATE -static-libgcc)
@ -3193,28 +3255,34 @@ endif()
if(SDL_STATIC)
add_library(SDL3-static STATIC ${SOURCE_FILES})
# alias target for in-tree builds
add_library(SDL3::SDL3-static ALIAS SDL3-static)
set_target_properties(SDL3-static PROPERTIES
OUTPUT_NAME "${sdl_static_libname}"
POSITION_INDEPENDENT_CODE "${SDL_STATIC_PIC}"
)
if(APPLE)
set_target_properties(SDL3-static PROPERTIES
FRAMEWORK "${SDL_FRAMEWORK}"
)
if(SDL_FRAMEWORK)
set_target_properties(SDL3-static PROPERTIES
FRAMEWORK_VERSION "${SDL_FRAMEWORK_VERSION}"
MACOSX_FRAMEWORK_IDENTIFIER "org.libsdl.SDL3-static"
RESOURCE "${SDL_FRAMEWORK_RESOURCES}"
)
endif()
endif()
target_compile_definitions(SDL3-static PRIVATE SDL_STATIC_LIB)
target_link_libraries(SDL3-static PRIVATE ${SDL_EXTRA_LIBS} ${SDL_EXTRA_LDFLAGS} ${SDL_CMAKE_DEPENDS})
target_include_directories(SDL3-static
PRIVATE
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/src>"
PUBLIC
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include/SDL3>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL3>"
)
target_link_libraries(SDL3-static PUBLIC $<TARGET_NAME:SDL3::Headers>)
# This picks up all the compiler options and such we've accumulated up to here.
target_link_libraries(SDL3-static PRIVATE $<BUILD_INTERFACE:sdl-build-options>)
target_link_libraries(SDL3-static PRIVATE $<BUILD_INTERFACE:sdl-global-options>)
target_link_libraries(SDL3-static PRIVATE $<${build_local_interface}:sdl-build-options>)
target_link_libraries(SDL3-static PRIVATE $<${build_local_interface}:sdl-global-options>)
# Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library
set_property(TARGET SDL3-static PROPERTY INTERFACE_SDL3_SHARED FALSE)
set_property(TARGET SDL3-static APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL3_SHARED)
@ -3224,9 +3292,9 @@ if(SDL_STATIC)
endif()
target_compile_definitions(sdl-build-options INTERFACE
"SDL_BUILD_MAJOR_VERSION=${SDL_MAJOR_VERSION}"
"SDL_BUILD_MINOR_VERSION=${SDL_MINOR_VERSION}"
"SDL_BUILD_MICRO_VERSION=${SDL_MICRO_VERSION}"
"SDL_BUILD_MAJOR_VERSION=${PROJECT_VERSION_MAJOR}"
"SDL_BUILD_MINOR_VERSION=${PROJECT_VERSION_MINOR}"
"SDL_BUILD_MICRO_VERSION=${PROJECT_VERSION_PATCH}"
)
##### Tests #####
@ -3235,147 +3303,262 @@ if(SDL_TEST)
file(GLOB TEST_SOURCES ${SDL3_SOURCE_DIR}/src/test/*.c)
add_library(SDL3_test STATIC ${TEST_SOURCES})
add_library(SDL3::SDL3_test ALIAS SDL3_test)
target_link_libraries(SDL3_test PRIVATE $<BUILD_INTERFACE:sdl-global-options>)
target_link_libraries(SDL3_test PRIVATE $<${build_local_interface}:sdl-global-options>)
set_target_properties(SDL3_test PROPERTIES
EXPORT_NAME SDL3_test)
if(APPLE)
set_target_properties(SDL3_test PROPERTIES
FRAMEWORK "${SDL_FRAMEWORK}"
)
if(SDL_FRAMEWORK)
set_target_properties(SDL3_test PROPERTIES
FRAMEWORK_VERSION "${SDL_FRAMEWORK_VERSION}"
MACOSX_FRAMEWORK_IDENTIFIER "org.libsdl.SDL3_test"
RESOURCE "${SDL_FRAMEWORK_RESOURCES}"
)
endif()
endif()
target_include_directories(SDL3_test
PRIVATE
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
PUBLIC
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include/SDL3>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL3>"
)
target_link_libraries(SDL3_test PUBLIC $<TARGET_NAME:SDL3::Headers>)
target_link_libraries(SDL3_test PRIVATE ${EXTRA_TEST_LIBS})
endif()
if(NOT SDL3_DISABLE_INSTALL)
##### Configure installation folders #####
##### Configure installation folders #####
if(WINDOWS AND NOT MINGW)
set(SDL_INSTALL_CMAKEDIR_ROOT_DEFAULT "cmake")
else()
set(SDL_INSTALL_CMAKEDIR_ROOT_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake")
endif()
set(SDL_INSTALL_CMAKEDIR_ROOT "${SDL_INSTALL_CMAKEDIR_ROOT_DEFAULT}" CACHE STRING "Root folder where to install SDL3Config.cmake related files (SDL3 subfolder for MSVC projects)")
if(WINDOWS AND NOT MINGW)
set(SDL_INSTALL_CMAKEDIR_ROOT_DEFAULT "cmake")
else()
set(SDL_INSTALL_CMAKEDIR_ROOT_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake")
if(FREEBSD)
# FreeBSD uses ${PREFIX}/libdata/pkgconfig
set(SDL_PKGCONFIG_INSTALLDIR "libdata/pkgconfig")
else()
set(SDL_PKGCONFIG_INSTALLDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endif()
if(WINDOWS AND NOT MINGW)
set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_ROOT}")
set(SDL_INSTALL_LICENSEDIR "licenses/SDL3")
set(SDL_INSTALL_HEADERSDIR "${CMAKE_INSTALL_INCLUDEDIR}/SDL3")
elseif(SDL_FRAMEWORK)
set(SDL_INSTALL_CMAKEDIR "SDL3.framework/Versions/${SDL_FRAMEWORK_VERSION}/Resources/CMake")
set(SDL_INSTALL_LICENSEDIR "Resources")
set(SDL_INSTALL_HEADERSDIR "Headers")
else()
set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_ROOT}/SDL3")
set(SDL_INSTALL_LICENSEDIR "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}")
set(SDL_INSTALL_HEADERSDIR "${CMAKE_INSTALL_INCLUDEDIR}/SDL3")
endif()
if(SDL_FRAMEWORK)
set(SDL_SDL_INSTALL_RESOURCEDIR "SDL3.framework/Resources")
set(SDL_SDL_INSTALL_CMAKEDIR "${SDL_SDL_INSTALL_RESOURCEDIR}/CMake")
set(SDL_SDL_INSTALL_REAL_RESOURCEDIR "SDL3.framework/Versions/${SDL_FRAMEWORK_VERSION}/Resources")
set(SDL_SDL_INSTALL_REAL_CMAKEDIR "${SDL_SDL_INSTALL_REAL_RESOURCEDIR}/CMake")
# - Install other SDL3*Config.cmake files in SDL3*.framework/Resources/CMake
# - The *_RELATIVE_CMAKEDIR variables are the symlinked folders visible from outside
set(SDL_SDLstatic_INSTALL_RESOURCEDIR "SDL3-static.framework/Resources")
set(SDL_SDLstatic_INSTALL_CMAKEDIR "${SDL_SDLstatic_INSTALL_RESOURCEDIR}/CMake")
set(SDL_SDLstatic_INSTALL_CMAKEFILENAME "SDL3-staticConfig.cmake")
set(SDL_SDLtest_INSTALL_RESOURCEDIR "SDL3_test.framework/Resources")
set(SDL_SDLtest_INSTALL_CMAKEDIR "${SDL_SDLtest_INSTALL_RESOURCEDIR}/CMake")
set(SDL_SDLtest_INSTALL_CMAKEFILENAME "SDL3_testConfig.cmake")
else()
set(SDL_SDL_INSTALL_RESOURCEDIR ".")
set(SDL_SDL_INSTALL_CMAKEDIR ${SDL_INSTALL_CMAKEDIR})
set(SDL_SDL_INSTALL_REAL_CMAKEDIR ${SDL_INSTALL_CMAKEDIR})
# Install SDL3*Targets.cmake files in lib/cmake/SDL3
set(SDL_SDLstatic_INSTALL_RESOURCEDIR ".")
set(SDL_SDLstatic_INSTALL_CMAKEDIR "${SDL_SDL_INSTALL_CMAKEDIR}")
set(SDL_SDLstatic_INSTALL_CMAKEFILENAME "SDL3staticTargets.cmake")
set(SDL_SDLtest_INSTALL_RESOURCEDIR ".")
set(SDL_SDLtest_INSTALL_CMAKEDIR "${SDL_SDL_INSTALL_CMAKEDIR}")
set(SDL_SDLtest_INSTALL_CMAKEFILENAME "SDL3testTargets.cmake")
endif()
set(SDL_INSTALL_CMAKEDIR_ROOT "${SDL_INSTALL_CMAKEDIR_ROOT_DEFAULT}" CACHE STRING "Root folder where to install SDL3Config.cmake related files (SDL3 subfolder for MSVC projects)")
if(WINDOWS AND NOT MINGW)
set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_ROOT}")
set(LICENSES_PREFIX "licenses/SDL3")
if(CMAKE_VERSION VERSION_LESS "3.26")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/SDL3Targets.cmake" [[message(FATAL_ERROR "find_package(SDL3) using the SDL3 build directory not supported for CMake versions older then 3.26.")]])
else()
export(TARGETS SDL3_Headers NAMESPACE "SDL3::" FILE "SDL3headersTargets.cmake")
if(SDL_SHARED)
export(TARGETS SDL3 NAMESPACE "SDL3::" FILE "SDL3Targets.cmake")
endif()
if(SDL_STATIC)
export(TARGETS SDL3-static NAMESPACE "SDL3::" FILE "SDL3staticTargets.cmake")
endif()
if(SDL_TEST)
export(TARGETS SDL3_test NAMESPACE "SDL3::" FILE "SDL3testTargets.cmake")
endif()
endif()
configure_file("cmake/sdlfind.cmake" "sdlfind.cmake" COPYONLY)
include(CMakePackageConfigHelpers)
configure_package_config_file(cmake/SDL3Config.cmake.in SDL3Config.cmake
PATH_VARS CMAKE_INSTALL_PREFIX
INSTALL_DESTINATION "${SDL_SDL_INSTALL_CMAKEDIR}"
)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion
)
if(NOT SDL_DISABLE_INSTALL)
##### sdl3.pc #####
# Clean up variables for sdl3.pc
if(SDL_SHARED)
set(PKGCONFIG_LIBS_PRIV "\nLibs.private:")
else()
set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_ROOT}/SDL3")
set(LICENSES_PREFIX "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}")
endif ()
set(PKGCONFIG_LIBS_PRIV "")
endif()
##### Installation targets #####
# Clean up the different lists
listtostr(SDL_EXTRA_LIBS EXTRA_LIBS_L "-l")
set(SDL_PC_STATIC_LIBS ${SDL_EXTRA_LDFLAGS} ${EXTRA_LIBS_L})
list(REMOVE_DUPLICATES SDL_PC_STATIC_LIBS)
listtostr(SDL_PC_STATIC_LIBS SDL_PC_STATIC_LIBS)
listtostr(SDL_PC_LIBS SDL_PC_LIBS)
listtostr(SDL_PC_CFLAGS SDL_PC_CFLAGS)
listtostr(SDL_PC_PRIVATE_REQUIRES SDL_PC_PRIVATE_REQUIRES)
string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_PC_STATIC_LIBS "${SDL_PC_STATIC_LIBS}")
if(NOT SDL_SHARED)
string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_PC_LIBS "${SDL_PC_LIBS}")
endif()
if(SDL_STATIC AND SDL_SHARED AND NOT sdl_static_libname STREQUAL "SDL3")
message(STATUS "\"pkg-config --static --libs sdl3\" will return invalid information")
endif()
file(RELATIVE_PATH SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${CMAKE_INSTALL_PREFIX}/${SDL_PKGCONFIG_INSTALLDIR}" "${CMAKE_INSTALL_PREFIX}")
string(REGEX REPLACE "[/]+$" "" SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}")
set(SDL_PKGCONFIG_PREFIX "\${pcfiledir}/${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}")
# message(STATUS "SDL_PC_CFLAGS: ${SDL_PC_CFLAGS}")
# message(STATUS "SDL_PC_LIBS: ${SDL_PC_LIBS}")
# message(STATUS "SDL_PC_STATIC_LIBS: ${SDL_PC_STATIC_LIBS}")
configure_file(cmake/sdl3.pc.in sdl3.pc @ONLY)
if(NOT SDL_FRAMEWORK)
install(FILES ${SDL3_BINARY_DIR}/sdl3.pc DESTINATION "${SDL_PKGCONFIG_INSTALLDIR}")
endif()
##### Installation targets #####()
install(TARGETS SDL3_Headers EXPORT SDL3headersTargets)
if(SDL_SHARED)
install(TARGETS SDL3 EXPORT SDL3Targets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${SDL_INSTALL_HEADERSDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
FRAMEWORK DESTINATION "."
RESOURCE DESTINATION "${SDL_SDL_INSTALL_RESOURCEDIR}"
)
endif()
if(SDL_STATIC)
install(TARGETS SDL3-static EXPORT SDL3staticTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
FRAMEWORK DESTINATION "."
RESOURCE DESTINATION "${SDL_SDLstatic_INSTALL_RESOURCEDIR}"
)
endif()
if(SDL_TEST)
install(TARGETS SDL3_test EXPORT SDL3testTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
FRAMEWORK DESTINATION "."
RESOURCE DESTINATION "${SDL_SDLtest_INSTALL_RESOURCEDIR}"
)
endif()
##### Export files #####
##### Install CMake Targets #####
include(CMakePackageConfigHelpers)
configure_package_config_file(cmake/SDL3Config.cmake.in SDL3Config.cmake
PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR
INSTALL_DESTINATION "${SDL_INSTALL_CMAKEDIR}"
)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake"
VERSION ${SDL_VERSION}
COMPATIBILITY AnyNewerVersion
install(EXPORT SDL3headersTargets
FILE "SDL3headersTargets.cmake"
NAMESPACE SDL3::
DESTINATION "${SDL_SDL_INSTALL_CMAKEDIR}"
)
if(SDL_SHARED)
install(EXPORT SDL3Targets
FILE SDL3Targets.cmake
FILE "SDL3Targets.cmake"
NAMESPACE SDL3::
DESTINATION "${SDL_INSTALL_CMAKEDIR}"
DESTINATION "${SDL_SDL_INSTALL_CMAKEDIR}"
)
if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7)
install(EXPORT_ANDROID_MK SDL3Targets
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3")
endif()
endif()
if(SDL_STATIC)
install(EXPORT SDL3staticTargets
FILE SDL3staticTargets.cmake
FILE "${SDL_SDLstatic_INSTALL_CMAKEFILENAME}"
NAMESPACE SDL3::
DESTINATION "${SDL_INSTALL_CMAKEDIR}"
DESTINATION "${SDL_SDLstatic_INSTALL_CMAKEDIR}"
)
if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7)
install(EXPORT_ANDROID_MK SDL3staticTargets
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3-static")
endif()
endif()
if(SDL_TEST)
install(EXPORT SDL3testTargets
FILE SDL3testTargets.cmake
FILE "${SDL_SDLtest_INSTALL_CMAKEFILENAME}"
NAMESPACE SDL3::
DESTINATION "${SDL_INSTALL_CMAKEDIR}"
DESTINATION "${SDL_SDLtest_INSTALL_CMAKEDIR}"
)
if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7)
install(EXPORT_ANDROID_MK SDL3testTargets
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3_test")
endif()
endif()
install(
FILES
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/SDL3Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake
${SDL3_SOURCE_DIR}/cmake/sdlfind.cmake
DESTINATION "${SDL_INSTALL_CMAKEDIR}"
COMPONENT Devel
DESTINATION "${SDL_SDL_INSTALL_REAL_CMAKEDIR}"
)
install(
FILES
${SDL3_INCLUDE_FILES}
"${SDL3_BINARY_DIR}/include/SDL3/SDL_revision.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL3
)
if(SDL_TEST)
install(
FILES ${SDL3_TEST_INCLUDE_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL3
if(NOT SDL_FRAMEWORK)
install(FILES ${SDL3_INCLUDE_FILES}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3"
)
if(SDL_TEST)
install(FILES ${SDL3_TEST_INCLUDE_FILES}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3"
)
endif()
install(FILES "LICENSE.txt" DESTINATION "${SDL_INSTALL_LICENSEDIR}")
endif()
install(FILES "LICENSE.txt" DESTINATION "${LICENSES_PREFIX}")
if(FREEBSD)
# FreeBSD uses ${PREFIX}/libdata/pkgconfig
install(FILES ${SDL3_BINARY_DIR}/sdl3.pc DESTINATION "libdata/pkgconfig")
else()
install(FILES ${SDL3_BINARY_DIR}/sdl3.pc
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
if(NOT SDL_DISABLE_INSTALL_CPACK)
if(SDL_FRAMEWORK)
set(CPACK_GENERATOR "DragNDrop")
elseif(MSVC)
set(CPACK_GENERATOR "ZIP")
else()
set(CPACK_GENERATOR "TGZ")
endif()
configure_file(cmake/CPackProjectConfig.cmake.in CPackProjectConfig.cmake @ONLY)
set(CPACK_PROJECT_CONFIG_FILE "${SDL3_BINARY_DIR}/CPackProjectConfig.cmake")
# CPACK_SOURCE_PACKAGE_FILE_NAME must end with "-src" (so we can block creating a source archive)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "SDL${PROJECT_VERSION_MAJOR}-${PROJECT_VERSION}-src")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/dist")
include(CPack)
endif()
endif()
##### Uninstall target #####
if(NOT SDL3_DISABLE_UNINSTALL)
if(NOT SDL_DISABLE_UNINSTALL)
if(NOT TARGET uninstall)
configure_file(cmake/cmake_uninstall.cmake.in cmake_uninstall.cmake IMMEDIATE @ONLY)

View file

@ -354,7 +354,6 @@
<ClInclude Include="..\..\include\SDL3\SDL_test_font.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_fuzzer.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_harness.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_images.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_log.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_md5.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_memory.h" />

View file

@ -366,9 +366,6 @@
<ClInclude Include="..\..\include\SDL3\SDL_test_harness.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_test_images.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_test_log.h">
<Filter>API Headers</Filter>
</ClInclude>

View file

@ -198,11 +198,6 @@
<ClCompile Include="..\..\src\test\SDL_test_font.c" />
<ClCompile Include="..\..\src\test\SDL_test_fuzzer.c" />
<ClCompile Include="..\..\src\test\SDL_test_harness.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageBlit.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageBlitBlend.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageFace.c" />
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c" />
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c" />
<ClCompile Include="..\..\src\test\SDL_test_log.c" />
<ClCompile Include="..\..\src\test\SDL_test_md5.c" />
<ClCompile Include="..\..\src\test\SDL_test_memory.c" />

View file

@ -291,11 +291,6 @@
<ClCompile Include="..\..\src\test\SDL_test_font.c" />
<ClCompile Include="..\..\src\test\SDL_test_fuzzer.c" />
<ClCompile Include="..\..\src\test\SDL_test_harness.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageBlit.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageBlitBlend.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageFace.c" />
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c" />
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c" />
<ClCompile Include="..\..\src\test\SDL_test_log.c" />
<ClCompile Include="..\..\src\test\SDL_test_md5.c" />
<ClCompile Include="..\..\src\test\SDL_test_memory.c" />
@ -333,4 +328,4 @@
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.targets" />
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.targets" />
</ImportGroup>
</Project>
</Project>

View file

@ -66,21 +66,6 @@
<ClCompile Include="..\..\src\test\SDL_test_harness.c">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\src\test\SDL_test_imageBlit.c">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\src\test\SDL_test_imageBlitBlend.c">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\src\test\SDL_test_imageFace.c">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\src\test\SDL_test_log.c">
<Filter>Common</Filter>
</ClCompile>
@ -100,4 +85,4 @@
<ItemGroup>
<ResourceCompile Include="..\..\src\main\winrt\SDL3-WinRTResources.rc" />
</ItemGroup>
</Project>
</Project>

View file

@ -86,16 +86,16 @@
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)/../src;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)/../../src;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)/../src;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)/../../src;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(SolutionDir)/../src;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)/../../src;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(SolutionDir)/../src;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)/../../src;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
@ -300,7 +300,6 @@
<ClInclude Include="..\..\include\SDL3\SDL_test_font.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_fuzzer.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_harness.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_images.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_log.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_md5.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_memory.h" />

View file

@ -363,9 +363,6 @@
<ClInclude Include="..\..\include\SDL3\SDL_test_harness.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_test_images.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_test_log.h">
<Filter>API Headers</Filter>
</ClInclude>

View file

@ -160,11 +160,6 @@
<ClCompile Include="..\..\src\test\SDL_test_font.c" />
<ClCompile Include="..\..\src\test\SDL_test_fuzzer.c" />
<ClCompile Include="..\..\src\test\SDL_test_harness.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageBlit.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageBlitBlend.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageFace.c" />
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c" />
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c" />
<ClCompile Include="..\..\src\test\SDL_test_log.c" />
<ClCompile Include="..\..\src\test\SDL_test_md5.c" />
<ClCompile Include="..\..\src\test\SDL_test_memory.c" />

View file

@ -39,14 +39,9 @@ else()
return()
endif()
# For compatibility with autotools sdl3-config.cmake, provide SDL3_* variables.
set_and_check(SDL3_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..")
set_and_check(SDL3_EXEC_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..")
set_and_check(SDL3_INCLUDE_DIR "${SDL3_PREFIX}/include")
set(SDL3_INCLUDE_DIRS "${SDL3_INCLUDE_DIR};${SDL3_INCLUDE_DIR}/SDL3")
set_and_check(SDL3_BINDIR "${SDL3_PREFIX}/lib/${_sdl_arch_subdir}")
set_and_check(SDL3_LIBDIR "${SDL3_PREFIX}/lib/${_sdl_arch_subdir}")
set_and_check(_sdl3_prefix "${CMAKE_CURRENT_LIST_DIR}/..")
set(_sdl3_include_dirs "${_sdl3_prefix}/include;${_sdl3_prefix}/include/SDL3")
unset(_sdl3_prefix)
set(SDL3_LIBRARIES SDL3::SDL3)
set(SDL3TEST_LIBRARY SDL3::SDL3_test)
@ -55,6 +50,16 @@ set(SDL3TEST_LIBRARY SDL3::SDL3_test)
# All targets are created, even when some might not be requested though COMPONENTS.
# This is done for compatibility with CMake generated SDL3-target.cmake files.
if(NOT TARGET SDL3::Headers)
add_library(SDL3::Headers INTERFACE IMPORTED)
set_target_properties(SDL3::SDL3
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_include_dirs}"
)
endif()
set(SDL3_Headers_FOUND TRUE)
unset(_sdl3_include_dirs)
set(_sdl3_library "${SDL3_LIBDIR}/SDL3.lib")
set(_sdl3_dll_library "${SDL3_BINDIR}/SDL3.dll")
if(EXISTS "${_sdl3_library}" AND EXISTS "${_sdl3_dll_library}")
@ -62,7 +67,7 @@ if(EXISTS "${_sdl3_library}" AND EXISTS "${_sdl3_dll_library}")
add_library(SDL3::SDL3 SHARED IMPORTED)
set_target_properties(SDL3::SDL3
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "SDL3::Headers"
IMPORTED_IMPLIB "${_sdl3_library}"
IMPORTED_LOCATION "${_sdl3_dll_library}"
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
@ -82,7 +87,7 @@ if(EXISTS "${_sdl3test_library}")
add_library(SDL3::SDL3_test STATIC IMPORTED)
set_target_properties(SDL3::SDL3_test
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "SDL3::Headers"
IMPORTED_LOCATION "${_sdl3test_library}"
)
endif()

View file

@ -202,6 +202,7 @@
<ClCompile Include="..\..\..\test\testautomation_events.c" />
<ClCompile Include="..\..\..\test\testautomation_guid.c" />
<ClCompile Include="..\..\..\test\testautomation_hints.c" />
<ClCompile Include="..\..\..\test\testautomation_images.c" />
<ClCompile Include="..\..\..\test\testautomation_joystick.c" />
<ClCompile Include="..\..\..\test\testautomation_keyboard.c" />
<ClCompile Include="..\..\..\test\testautomation_main.c" />
@ -225,4 +226,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View file

@ -24,3 +24,4 @@ General:
* Added SDL_aligned_alloc() and SDL_aligned_free() to allocate and free memory with a given alignment
* Added SDL_GetRenderVSync() to get vsync of the given renderer
* Added SDL_PlayAudioDevice() to start audio playback
* Added SDL_ConvertAudioSamples() to convert audio samples from one format to another

View file

@ -31,34 +31,45 @@ endmacro()
set(SDL3_FOUND TRUE)
string(REGEX REPLACE "SDL3\\.framework.*" "SDL3.framework" SDL3_FRAMEWORK_PATH "${CMAKE_CURRENT_LIST_DIR}")
string(REGEX REPLACE "SDL3\\.framework.*" "" SDL3_FRAMEWORK_PARENT_PATH "${CMAKE_CURRENT_LIST_DIR}")
# Compute the installation prefix relative to this file.
get_filename_component(_sdl3_framework_path "${CMAKE_CURRENT_LIST_FILE}" PATH) # /SDL3.framework/Resources/CMake/
get_filename_component(_sdl3_framework_path "${_IMPORT_PREFIX}" PATH) # /SDL3.framework/Resources/
get_filename_component(_sdl3_framework_path "${_IMPORT_PREFIX}" PATH) # /SDL3.framework/
get_filename_component(_sdl3_framework_parent_path "${_sdl3_framework_path}" PATH) # /
# For compatibility with autotools sdl3-config.cmake, provide SDL3_* variables.
set_and_check(SDL3_PREFIX "${SDL3_FRAMEWORK_PATH}")
set_and_check(SDL3_EXEC_PREFIX "${SDL3_FRAMEWORK_PATH}")
set_and_check(SDL3_INCLUDE_DIR "${SDL3_FRAMEWORK_PATH}/Headers")
set(SDL3_INCLUDE_DIRS "${SDL3_INCLUDE_DIR}")
set_and_check(SDL3_BINDIR "${SDL3_FRAMEWORK_PATH}")
set_and_check(SDL3_LIBDIR "${SDL3_FRAMEWORK_PATH}")
set_and_check(_sdl3_include_dirs "${_sdl3_framework_path}/Headers")
set(SDL3_LIBRARIES "SDL3::SDL3")
# All targets are created, even when some might not be requested though COMPONENTS.
# This is done for compatibility with CMake generated SDL3-target.cmake files.
if(NOT TARGET SDL3::Headers)
add_library(SDL3::Headers INTERFACE IMPORTED)
set_target_properties(SDL3::Headers
PROPERTIES
INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${_sdl3_framework_parent_path}\""
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_include_dirs}"
)
endif()
set(SDL3_Headers_FOUND TRUE)
unset(_sdl3_include_dirs)
if(NOT TARGET SDL3::SDL3)
add_library(SDL3::SDL3 INTERFACE IMPORTED)
add_library(SDL3::SDL3 SHARED IMPORTED)
set_target_properties(SDL3::SDL3
PROPERTIES
INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${SDL3_FRAMEWORK_PARENT_PATH}\""
INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIRS}"
INTERFACE_LINK_OPTIONS "SHELL:-F \"${SDL3_FRAMEWORK_PARENT_PATH}\";SHELL:-framework SDL3"
FRAMEWORK "TRUE"
INTERFACE_LINK_LIBRARIES "SDL3::Headers"
IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3"
IMPORTED_SONAME "${_sdl3_framework_path}/SDL3"
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
INTERFACE_SDL3_SHARED "ON"
)
endif()
set(SDL3_SDL3_FOUND TRUE)
unset(_sdl3_framework_parent_path)
unset(_sdl3_framework_path)
check_required_components(SDL3)

View file

@ -13,6 +13,7 @@
buildPhases = (
);
dependencies = (
F35E56E72983133F00A43A5F /* PBXTargetDependency */,
DB0F490517CA5249008798C5 /* PBXTargetDependency */,
DB0F490717CA5249008798C5 /* PBXTargetDependency */,
DB166E9816A1D7CF00A1396C /* PBXTargetDependency */,
@ -108,11 +109,6 @@
DB166D9716A1D1A500A1396C /* SDL_test_font.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8816A1D1A500A1396C /* SDL_test_font.c */; };
DB166D9816A1D1A500A1396C /* SDL_test_fuzzer.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */; };
DB166D9916A1D1A500A1396C /* SDL_test_harness.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */; };
DB166D9A16A1D1A500A1396C /* SDL_test_imageBlit.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */; };
DB166D9B16A1D1A500A1396C /* SDL_test_imageBlitBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */; };
DB166D9C16A1D1A500A1396C /* SDL_test_imageFace.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */; };
DB166D9D16A1D1A500A1396C /* SDL_test_imagePrimitives.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */; };
DB166D9E16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */; };
DB166D9F16A1D1A500A1396C /* SDL_test_log.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D9016A1D1A500A1396C /* SDL_test_log.c */; };
DB166DA016A1D1A500A1396C /* SDL_test_md5.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D9116A1D1A500A1396C /* SDL_test_md5.c */; };
DB166DA116A1D1A500A1396C /* SDL_test_random.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D9216A1D1A500A1396C /* SDL_test_random.c */; };
@ -153,6 +149,30 @@
DBEC54ED1A1A828A005B1EAB /* axis.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D61A1A8145005B1EAB /* axis.bmp */; };
DBEC54EE1A1A828D005B1EAB /* button.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D71A1A8145005B1EAB /* button.bmp */; };
DBEC54EF1A1A828F005B1EAB /* gamepadmap.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D81A1A8145005B1EAB /* gamepadmap.bmp */; };
F35E56A6298312CB00A43A5F /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; };
F35E56CF2983130F00A43A5F /* testautomation_main.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56B62983130A00A43A5F /* testautomation_main.c */; };
F35E56D02983130F00A43A5F /* testautomation_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56B72983130A00A43A5F /* testautomation_hints.c */; };
F35E56D12983130F00A43A5F /* testautomation_render.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56B82983130A00A43A5F /* testautomation_render.c */; };
F35E56D22983130F00A43A5F /* testautomation_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56B92983130B00A43A5F /* testautomation_rwops.c */; };
F35E56D32983130F00A43A5F /* testautomation_math.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56BA2983130B00A43A5F /* testautomation_math.c */; };
F35E56D42983130F00A43A5F /* testautomation_events.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56BB2983130B00A43A5F /* testautomation_events.c */; };
F35E56D52983130F00A43A5F /* testautomation_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56BC2983130B00A43A5F /* testautomation_clipboard.c */; };
F35E56D62983130F00A43A5F /* testautomation_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56BD2983130B00A43A5F /* testautomation_timer.c */; };
F35E56D72983130F00A43A5F /* testautomation_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56BE2983130C00A43A5F /* testautomation_stdlib.c */; };
F35E56D82983130F00A43A5F /* testautomation_images.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56BF2983130C00A43A5F /* testautomation_images.c */; };
F35E56D92983130F00A43A5F /* testautomation_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56C02983130C00A43A5F /* testautomation_pixels.c */; };
F35E56DA2983130F00A43A5F /* testautomation_video.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56C12983130C00A43A5F /* testautomation_video.c */; };
F35E56DB2983130F00A43A5F /* testautomation_platform.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56C32983130D00A43A5F /* testautomation_platform.c */; };
F35E56DC2983130F00A43A5F /* testautomation_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56C42983130D00A43A5F /* testautomation_audio.c */; };
F35E56DD2983130F00A43A5F /* testautomation_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56C52983130D00A43A5F /* testautomation_rect.c */; };
F35E56DE2983130F00A43A5F /* testautomation_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56C62983130D00A43A5F /* testautomation_joystick.c */; };
F35E56DF2983130F00A43A5F /* testautomation_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56C72983130E00A43A5F /* testautomation_keyboard.c */; };
F35E56E02983130F00A43A5F /* testautomation_sdltest.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56C82983130E00A43A5F /* testautomation_sdltest.c */; };
F35E56E12983130F00A43A5F /* testautomation_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56C92983130E00A43A5F /* testautomation_guid.c */; };
F35E56E22983130F00A43A5F /* testautomation_syswm.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56CA2983130E00A43A5F /* testautomation_syswm.c */; };
F35E56E32983130F00A43A5F /* testautomation_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56CB2983130F00A43A5F /* testautomation_surface.c */; };
F35E56E42983130F00A43A5F /* testautomation.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56CC2983130F00A43A5F /* testautomation.c */; };
F35E56E52983130F00A43A5F /* testautomation_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = F35E56CD2983130F00A43A5F /* testautomation_mouse.c */; };
F3C17C6B28E4022A00E1A26D /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; };
F3C17C7428E40AF000E1A26D /* testutils.c in Sources */ = {isa = PBXBuildFile; fileRef = F3C17C7328E40ADE00E1A26D /* testutils.c */; };
F3C17C7628E40BA200E1A26D /* gamepadmap_back.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = F3C17C7528E40B6B00E1A26D /* gamepadmap_back.bmp */; };
@ -503,6 +523,13 @@
remoteGlobalIDString = DB31407717554B71006C0E22;
remoteInfo = "Shared Library";
};
F35E56E62983133F00A43A5F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = F35E56A2298312CB00A43A5F;
remoteInfo = testautomation;
};
F3C17C5C28E3FB2900E1A26D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */;
@ -517,13 +544,6 @@
remoteGlobalIDString = A7D88D1523E24BED00DCD162;
remoteInfo = "Framework-tvOS";
};
F3C17C6028E3FB2900E1A26D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = E2D187CF28A5673500D2B4F1;
remoteInfo = "xcFramework-iOS";
};
F3C17C6228E3FB2900E1A26D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */;
@ -770,11 +790,6 @@
DB166D8816A1D1A500A1396C /* SDL_test_font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_font.c; sourceTree = "<group>"; };
DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_fuzzer.c; sourceTree = "<group>"; };
DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_harness.c; sourceTree = "<group>"; };
DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageBlit.c; sourceTree = "<group>"; };
DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageBlitBlend.c; sourceTree = "<group>"; };
DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageFace.c; sourceTree = "<group>"; };
DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imagePrimitives.c; sourceTree = "<group>"; };
DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imagePrimitivesBlend.c; sourceTree = "<group>"; };
DB166D9016A1D1A500A1396C /* SDL_test_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_log.c; sourceTree = "<group>"; };
DB166D9116A1D1A500A1396C /* SDL_test_md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_md5.c; sourceTree = "<group>"; };
DB166D9216A1D1A500A1396C /* SDL_test_random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_random.c; sourceTree = "<group>"; };
@ -798,6 +813,30 @@
DBEC54D71A1A8145005B1EAB /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = button.bmp; sourceTree = "<group>"; };
DBEC54D81A1A8145005B1EAB /* gamepadmap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = gamepadmap.bmp; sourceTree = "<group>"; };
DBEC54EA1A1A81C3005B1EAB /* gamepadmap */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = gamepadmap; path = gamepadmap.app; sourceTree = BUILT_PRODUCTS_DIR; };
F35E56AA298312CB00A43A5F /* testautomation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testautomation.app; sourceTree = BUILT_PRODUCTS_DIR; };
F35E56B62983130A00A43A5F /* testautomation_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_main.c; sourceTree = "<group>"; };
F35E56B72983130A00A43A5F /* testautomation_hints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_hints.c; sourceTree = "<group>"; };
F35E56B82983130A00A43A5F /* testautomation_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_render.c; sourceTree = "<group>"; };
F35E56B92983130B00A43A5F /* testautomation_rwops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_rwops.c; sourceTree = "<group>"; };
F35E56BA2983130B00A43A5F /* testautomation_math.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_math.c; sourceTree = "<group>"; };
F35E56BB2983130B00A43A5F /* testautomation_events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_events.c; sourceTree = "<group>"; };
F35E56BC2983130B00A43A5F /* testautomation_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_clipboard.c; sourceTree = "<group>"; };
F35E56BD2983130B00A43A5F /* testautomation_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_timer.c; sourceTree = "<group>"; };
F35E56BE2983130C00A43A5F /* testautomation_stdlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_stdlib.c; sourceTree = "<group>"; };
F35E56BF2983130C00A43A5F /* testautomation_images.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_images.c; sourceTree = "<group>"; };
F35E56C02983130C00A43A5F /* testautomation_pixels.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_pixels.c; sourceTree = "<group>"; };
F35E56C12983130C00A43A5F /* testautomation_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_video.c; sourceTree = "<group>"; };
F35E56C32983130D00A43A5F /* testautomation_platform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_platform.c; sourceTree = "<group>"; };
F35E56C42983130D00A43A5F /* testautomation_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_audio.c; sourceTree = "<group>"; };
F35E56C52983130D00A43A5F /* testautomation_rect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_rect.c; sourceTree = "<group>"; };
F35E56C62983130D00A43A5F /* testautomation_joystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_joystick.c; sourceTree = "<group>"; };
F35E56C72983130E00A43A5F /* testautomation_keyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_keyboard.c; sourceTree = "<group>"; };
F35E56C82983130E00A43A5F /* testautomation_sdltest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_sdltest.c; sourceTree = "<group>"; };
F35E56C92983130E00A43A5F /* testautomation_guid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_guid.c; sourceTree = "<group>"; };
F35E56CA2983130E00A43A5F /* testautomation_syswm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_syswm.c; sourceTree = "<group>"; };
F35E56CB2983130F00A43A5F /* testautomation_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_surface.c; sourceTree = "<group>"; };
F35E56CC2983130F00A43A5F /* testautomation.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation.c; sourceTree = "<group>"; };
F35E56CD2983130F00A43A5F /* testautomation_mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_mouse.c; sourceTree = "<group>"; };
F3C17C6A28E3FD4400E1A26D /* config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = config.xcconfig; sourceTree = "<group>"; };
F3C17C7328E40ADE00E1A26D /* testutils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testutils.c; sourceTree = "<group>"; };
F3C17C7528E40B6B00E1A26D /* gamepadmap_back.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = gamepadmap_back.bmp; sourceTree = "<group>"; };
@ -1141,6 +1180,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F35E56A5298312CB00A43A5F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F35E56A6298312CB00A43A5F /* libSDL_test.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F3C17CD928E416CF00E1A26D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@ -1158,7 +1205,6 @@
003FA643093FFD41000C53B3 /* SDL3.framework */,
F3C17C5D28E3FB2900E1A26D /* SDL3.framework */,
F3C17C5F28E3FB2900E1A26D /* SDL3.framework */,
F3C17C6128E3FB2900E1A26D /* SDL3.framework */,
003FA645093FFD41000C53B3 /* libSDL3.a */,
F3C17C6328E3FB2900E1A26D /* libSDL3.a */,
F3C17C6528E3FB2900E1A26D /* libSDL3.a */,
@ -1212,6 +1258,29 @@
083E4872006D84C97F000001 /* loopwave.c */,
0017958F1074216E00F5D044 /* testatomic.c */,
001795B01074222D00F5D044 /* testaudioinfo.c */,
F35E56C42983130D00A43A5F /* testautomation_audio.c */,
F35E56BC2983130B00A43A5F /* testautomation_clipboard.c */,
F35E56BB2983130B00A43A5F /* testautomation_events.c */,
F35E56C92983130E00A43A5F /* testautomation_guid.c */,
F35E56B72983130A00A43A5F /* testautomation_hints.c */,
F35E56BF2983130C00A43A5F /* testautomation_images.c */,
F35E56C62983130D00A43A5F /* testautomation_joystick.c */,
F35E56C72983130E00A43A5F /* testautomation_keyboard.c */,
F35E56B62983130A00A43A5F /* testautomation_main.c */,
F35E56BA2983130B00A43A5F /* testautomation_math.c */,
F35E56CD2983130F00A43A5F /* testautomation_mouse.c */,
F35E56C02983130C00A43A5F /* testautomation_pixels.c */,
F35E56C32983130D00A43A5F /* testautomation_platform.c */,
F35E56C52983130D00A43A5F /* testautomation_rect.c */,
F35E56B82983130A00A43A5F /* testautomation_render.c */,
F35E56B92983130B00A43A5F /* testautomation_rwops.c */,
F35E56C82983130E00A43A5F /* testautomation_sdltest.c */,
F35E56BE2983130C00A43A5F /* testautomation_stdlib.c */,
F35E56CB2983130F00A43A5F /* testautomation_surface.c */,
F35E56CA2983130E00A43A5F /* testautomation_syswm.c */,
F35E56BD2983130B00A43A5F /* testautomation_timer.c */,
F35E56C12983130C00A43A5F /* testautomation_video.c */,
F35E56CC2983130F00A43A5F /* testautomation.c */,
001797711074320D00F5D044 /* testdraw.c */,
DB0F48D717CA51D2008798C5 /* testdrawchessboard.c */,
DB445EFA18184BB600B306B0 /* testdropfile.c */,
@ -1314,6 +1383,7 @@
DB445EF818184B7000B306B0 /* testdropfile.app */,
DBEC54EA1A1A81C3005B1EAB /* gamepadmap */,
F3C17CDC28E416CF00E1A26D /* testgeometry.app */,
F35E56AA298312CB00A43A5F /* testautomation.app */,
);
name = Products;
sourceTree = "<group>";
@ -1328,11 +1398,6 @@
DB166D8816A1D1A500A1396C /* SDL_test_font.c */,
DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */,
DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */,
DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */,
DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */,
DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */,
DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */,
DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */,
DB166D9016A1D1A500A1396C /* SDL_test_log.c */,
DB166D9116A1D1A500A1396C /* SDL_test_md5.c */,
AAF02FF41F90089800B9A9FB /* SDL_test_memory.c */,
@ -2106,6 +2171,22 @@
productReference = DBEC54EA1A1A81C3005B1EAB /* gamepadmap */;
productType = "com.apple.product-type.application";
};
F35E56A2298312CB00A43A5F /* testautomation */ = {
isa = PBXNativeTarget;
buildConfigurationList = F35E56A7298312CB00A43A5F /* Build configuration list for PBXNativeTarget "testautomation" */;
buildPhases = (
F35E56A3298312CB00A43A5F /* Sources */,
F35E56A5298312CB00A43A5F /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = testautomation;
productName = testalpha;
productReference = F35E56AA298312CB00A43A5F /* testautomation.app */;
productType = "com.apple.product-type.application";
};
F3C17CDB28E416CF00E1A26D /* testgeometry */ = {
isa = PBXNativeTarget;
buildConfigurationList = F3C17CE828E416D000E1A26D /* Build configuration list for PBXNativeTarget "testgeometry" */;
@ -2165,6 +2246,7 @@
BEC566C50761D90300A33029 /* loopwave */,
0017957410741F7900F5D044 /* testatomic */,
00179595107421BF00F5D044 /* testaudioinfo */,
F35E56A2298312CB00A43A5F /* testautomation */,
00179756107431B300F5D044 /* testdraw */,
DB0F48D917CA51E5008798C5 /* testdrawchessboard */,
DB445EE618184B7000B306B0 /* testdropfile */,
@ -2253,13 +2335,6 @@
remoteRef = F3C17C5E28E3FB2900E1A26D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
F3C17C6128E3FB2900E1A26D /* SDL3.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = SDL3.framework;
remoteRef = F3C17C6028E3FB2900E1A26D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
F3C17C6328E3FB2900E1A26D /* libSDL3.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -2606,11 +2681,6 @@
DB166D9716A1D1A500A1396C /* SDL_test_font.c in Sources */,
DB166D9816A1D1A500A1396C /* SDL_test_fuzzer.c in Sources */,
DB166D9916A1D1A500A1396C /* SDL_test_harness.c in Sources */,
DB166D9A16A1D1A500A1396C /* SDL_test_imageBlit.c in Sources */,
DB166D9B16A1D1A500A1396C /* SDL_test_imageBlitBlend.c in Sources */,
DB166D9C16A1D1A500A1396C /* SDL_test_imageFace.c in Sources */,
DB166D9D16A1D1A500A1396C /* SDL_test_imagePrimitives.c in Sources */,
DB166D9E16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c in Sources */,
DB166D9F16A1D1A500A1396C /* SDL_test_log.c in Sources */,
DB166DA016A1D1A500A1396C /* SDL_test_md5.c in Sources */,
AAF02FFA1F90092700B9A9FB /* SDL_test_memory.c in Sources */,
@ -2720,6 +2790,36 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F35E56A3298312CB00A43A5F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F35E56D12983130F00A43A5F /* testautomation_render.c in Sources */,
F35E56E22983130F00A43A5F /* testautomation_syswm.c in Sources */,
F35E56D22983130F00A43A5F /* testautomation_rwops.c in Sources */,
F35E56E32983130F00A43A5F /* testautomation_surface.c in Sources */,
F35E56DB2983130F00A43A5F /* testautomation_platform.c in Sources */,
F35E56DD2983130F00A43A5F /* testautomation_rect.c in Sources */,
F35E56D52983130F00A43A5F /* testautomation_clipboard.c in Sources */,
F35E56E52983130F00A43A5F /* testautomation_mouse.c in Sources */,
F35E56D72983130F00A43A5F /* testautomation_stdlib.c in Sources */,
F35E56D92983130F00A43A5F /* testautomation_pixels.c in Sources */,
F35E56E42983130F00A43A5F /* testautomation.c in Sources */,
F35E56CF2983130F00A43A5F /* testautomation_main.c in Sources */,
F35E56DE2983130F00A43A5F /* testautomation_joystick.c in Sources */,
F35E56D82983130F00A43A5F /* testautomation_images.c in Sources */,
F35E56DC2983130F00A43A5F /* testautomation_audio.c in Sources */,
F35E56D32983130F00A43A5F /* testautomation_math.c in Sources */,
F35E56E02983130F00A43A5F /* testautomation_sdltest.c in Sources */,
F35E56D42983130F00A43A5F /* testautomation_events.c in Sources */,
F35E56E12983130F00A43A5F /* testautomation_guid.c in Sources */,
F35E56D62983130F00A43A5F /* testautomation_timer.c in Sources */,
F35E56DA2983130F00A43A5F /* testautomation_video.c in Sources */,
F35E56D02983130F00A43A5F /* testautomation_hints.c in Sources */,
F35E56DF2983130F00A43A5F /* testautomation_keyboard.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F3C17CD828E416CF00E1A26D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@ -2942,6 +3042,11 @@
target = DB166E8016A1D78C00A1396C /* teststreaming */;
targetProxy = DB166E9716A1D7CF00A1396C /* PBXContainerItemProxy */;
};
F35E56E72983133F00A43A5F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F35E56A2298312CB00A43A5F /* testautomation */;
targetProxy = F35E56E62983133F00A43A5F /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
@ -3672,6 +3777,20 @@
};
name = Release;
};
F35E56A8298312CB00A43A5F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
F35E56A9298312CB00A43A5F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
F3C17CE928E416D000E1A26D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -4121,6 +4240,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
F35E56A7298312CB00A43A5F /* Build configuration list for PBXNativeTarget "testautomation" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F35E56A8298312CB00A43A5F /* Debug */,
F35E56A9298312CB00A43A5F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
F3C17CE828E416D000E1A26D /* Build configuration list for PBXNativeTarget "testgeometry" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View file

@ -170,7 +170,7 @@ public class HIDDeviceManager {
Log.i(TAG," Interface protocol: " + mUsbInterface.getInterfaceProtocol());
Log.i(TAG," Endpoint count: " + mUsbInterface.getEndpointCount());
// Get endpoint details
// Get endpoint details
for (int epi = 0; epi < mUsbInterface.getEndpointCount(); epi++)
{
UsbEndpoint mEndpoint = mUsbInterface.getEndpoint(epi);
@ -277,6 +277,7 @@ public class HIDDeviceManager {
0x0738, // Mad Catz
0x0e6f, // PDP
0x0f0d, // Hori
0x10f5, // Turtle Beach
0x1532, // Razer Wildcat
0x20d6, // PowerA
0x24c6, // PowerA
@ -526,7 +527,7 @@ public class HIDDeviceManager {
for (HIDDevice device : mDevicesById.values()) {
device.setFrozen(frozen);
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -311,7 +311,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
mNextNativeState = NativeState.INIT;
mCurrentNativeState = NativeState.INIT;
}
protected SDLSurface createSDLSurface(Context context) {
return new SDLSurface(context);
}
@ -909,7 +909,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
public static native void nativeResume();
public static native void nativeFocusChanged(boolean hasFocus);
public static native void onNativeDropFile(String filename);
public static native void nativeSetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, float rate);
public static native void nativeSetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, float density, float rate);
public static native void onNativeResize();
public static native void onNativeKeyDown(int keycode);
public static native void onNativeKeyUp(int keycode);
@ -1198,13 +1198,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
}
/**
* This method is called by SDL using JNI.
*/
public static DisplayMetrics getDisplayDPI() {
return getContext().getResources().getDisplayMetrics();
}
/**
* This method is called by SDL using JNI.
*/

View file

@ -114,6 +114,7 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
mHeight = height;
int nDeviceWidth = width;
int nDeviceHeight = height;
float density = 1.0f;
try
{
if (Build.VERSION.SDK_INT >= 17) {
@ -121,6 +122,8 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
mDisplay.getRealMetrics( realMetrics );
nDeviceWidth = realMetrics.widthPixels;
nDeviceHeight = realMetrics.heightPixels;
// Use densityDpi instead of density to more closely match what the UI scale is
density = (float)realMetrics.densityDpi / 160.0f;
}
} catch(Exception ignored) {
}
@ -132,7 +135,7 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
Log.v("SDL", "Window size: " + width + "x" + height);
Log.v("SDL", "Device size: " + nDeviceWidth + "x" + nDeviceHeight);
SDLActivity.nativeSetScreenResolution(width, height, nDeviceWidth, nDeviceHeight, mDisplay.getRefreshRate());
SDLActivity.nativeSetScreenResolution(width, height, nDeviceWidth, nDeviceHeight, density, mDisplay.getRefreshRate());
SDLActivity.onNativeResize();
// Prevent a screen distortion glitch,

View file

@ -203,11 +203,6 @@ expression e;
- SDL_HINT_VIDEODRIVER
+ SDL_HINT_VIDEO_DRIVER
@@
@@
- M_PI
+ SDL_PI_D
// SDL_GetRevisionNumber() has been removed from the API, it always returned 0 in SDL 2.0.
@@
@@
@ -294,9 +289,12 @@ expression e1, e2, e3;
@@
typedef PFN_vkGetInstanceProcAddr;
@@
(
(PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr()
|
+ (PFN_vkGetInstanceProcAddr)
SDL_Vulkan_GetVkGetInstanceProcAddr()
)
// SDL_PauseAudioDevice / SDL_PlayAudioDevice
@@
@ -716,13 +714,21 @@ expression e1, e2, e3, e4, e5, e6, e7, e8, e9;
@@
// SDL_CreateRenderer:
// 2nd argument changed from int (default=-1) to const char* (default=NULL)
expression e1, e2;
expression e1, e3;
int e2;
@@
SDL_CreateRenderer(e1,
- -1
+ NULL
, e2)
(
-SDL_CreateRenderer(e1, -1, e3)
+SDL_CreateRenderer(e1, NULL, e3)
|
-SDL_CreateRenderer(e1, e2, e3)
+SDL_CreateRenderer(e1, SDL_GetRenderDriver(e2), e3)
)
// Renaming of SDL_oldnames.h
@ -769,43 +775,43 @@ SDL_CreateRenderer(e1,
@@
@@
- SDL_CONTROLLERAXISMOTION
+ SDL_GAMEPADAXISMOTION
+ SDL_EVENT_GAMEPAD_AXIS_MOTION
@@
@@
- SDL_CONTROLLERBUTTONDOWN
+ SDL_GAMEPADBUTTONDOWN
+ SDL_EVENT_GAMEPAD_BUTTON_DOWN
@@
@@
- SDL_CONTROLLERBUTTONUP
+ SDL_GAMEPADBUTTONUP
+ SDL_EVENT_GAMEPAD_BUTTON_UP
@@
@@
- SDL_CONTROLLERDEVICEADDED
+ SDL_GAMEPADADDED
+ SDL_EVENT_GAMEPAD_ADDED
@@
@@
- SDL_CONTROLLERDEVICEREMAPPED
+ SDL_GAMEPADREMAPPED
+ SDL_EVENT_GAMEPAD_REMAPPED
@@
@@
- SDL_CONTROLLERDEVICEREMOVED
+ SDL_GAMEPADREMOVED
+ SDL_EVENT_GAMEPAD_REMOVED
@@
@@
- SDL_CONTROLLERSENSORUPDATE
+ SDL_GAMEPADSENSORUPDATE
+ SDL_EVENT_GAMEPAD_SENSOR_UPDATE
@@
@@
- SDL_CONTROLLERTOUCHPADDOWN
+ SDL_GAMEPADTOUCHPADDOWN
+ SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
@@
@@
- SDL_CONTROLLERTOUCHPADMOTION
+ SDL_GAMEPADTOUCHPADMOTION
+ SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
@@
@@
- SDL_CONTROLLERTOUCHPADUP
+ SDL_GAMEPADTOUCHPADUP
+ SDL_EVENT_GAMEPAD_TOUCHPAD_UP
@@
typedef SDL_ControllerAxisEvent, SDL_GamepadAxisEvent;
@@
@ -1316,6 +1322,10 @@ typedef SDL_GameControllerButtonBind, SDL_GamepadBinding;
@@
- SDL_INIT_GAMECONTROLLER
+ SDL_INIT_GAMEPAD
@ rule_init_noparachute @
@@
- SDL_INIT_NOPARACHUTE
+ 0
@@
@@
- SDL_JOYSTICK_TYPE_GAMECONTROLLER
@ -1763,15 +1773,12 @@ typedef SDL_GameControllerButtonBind, SDL_GamepadBinding;
+ SDL_GetRenderClipRect
(...)
@@
SDL_Renderer *renderer;
int *e1;
int *e2;
@@
- SDL_RenderGetIntegerScale
+ SDL_GetRenderIntegerScale
(...)
@@
@@
- SDL_RenderGetLogicalSize
+ SDL_GetRenderLogicalSize
(...)
- SDL_RenderGetLogicalSize(renderer, e1, e2)
+ SDL_GetRenderLogicalPresentation(renderer, e1, e2, NULL, NULL)
@@
@@
- SDL_RenderGetMetalCommandEncoder
@ -1808,15 +1815,17 @@ typedef SDL_GameControllerButtonBind, SDL_GamepadBinding;
+ SDL_SetRenderClipRect
(...)
@@
SDL_Renderer *renderer;
expression e1;
expression e2;
@@
- SDL_RenderSetIntegerScale
+ SDL_SetRenderIntegerScale
(...)
@@
@@
- SDL_RenderSetLogicalSize
+ SDL_SetRenderLogicalSize
(...)
(
- SDL_RenderSetLogicalSize(renderer, 0, 0)
+ SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_ScaleModeNearest)
|
- SDL_RenderSetLogicalSize(renderer, e1, e2)
+ SDL_SetRenderLogicalPresentation(renderer, e1, e2, SDL_LOGICAL_PRESENTATION_LETTERBOX, SDL_ScaleModeLinear)
)
@@
@@
- SDL_RenderSetScale
@ -1982,10 +1991,499 @@ typedef SDL_GameControllerButtonBind, SDL_GamepadBinding;
@@
@@
- SDL_GetPointDisplayIndex
+ SDL_GetDisplayIndexForPoint
+ SDL_GetDisplayForPoint
(...)
@@
@@
- SDL_GetRectDisplayIndex
+ SDL_GetDisplayIndexForRect
+ SDL_GetDisplayForRect
(...)
@ depends on rule_init_noparachute @
expression e;
@@
- e | 0
+ e
@@
@@
- SDL_FIRSTEVENT
+ SDL_EVENT_FIRST
@@
@@
- SDL_QUIT
+ SDL_EVENT_QUIT
@@
@@
- SDL_APP_TERMINATING
+ SDL_EVENT_TERMINATING
@@
@@
- SDL_APP_LOWMEMORY
+ SDL_EVENT_LOW_MEMORY
@@
@@
- SDL_APP_WILLENTERBACKGROUND
+ SDL_EVENT_WILL_ENTER_BACKGROUND
@@
@@
- SDL_APP_DIDENTERBACKGROUND
+ SDL_EVENT_DID_ENTER_BACKGROUND
@@
@@
- SDL_APP_WILLENTERFOREGROUND
+ SDL_EVENT_WILL_ENTER_FOREGROUND
@@
@@
- SDL_APP_DIDENTERFOREGROUND
+ SDL_EVENT_DID_ENTER_FOREGROUND
@@
@@
- SDL_LOCALECHANGED
+ SDL_EVENT_LOCALE_CHANGED
@@
@@
- SDL_DISPLAYEVENT_ORIENTATION
+ SDL_EVENT_DISPLAY_ORIENTATION
@@
@@
- SDL_DISPLAYEVENT_CONNECTED
+ SDL_EVENT_DISPLAY_CONNECTED
@@
@@
- SDL_DISPLAYEVENT_DISCONNECTED
+ SDL_EVENT_DISPLAY_DISCONNECTED
@@
@@
- SDL_DISPLAYEVENT_MOVED
+ SDL_EVENT_DISPLAY_MOVED
@@
@@
- SDL_DISPLAYEVENT_FIRST
+ SDL_EVENT_DISPLAY_FIRST
@@
@@
- SDL_DISPLAYEVENT_LAST
+ SDL_EVENT_DISPLAY_LAST
@@
@@
- SDL_SYSWMEVENT
+ SDL_EVENT_SYSWM
@@
@@
- SDL_WINDOWEVENT_SHOWN
+ SDL_EVENT_WINDOW_SHOWN
@@
@@
- SDL_WINDOWEVENT_HIDDEN
+ SDL_EVENT_WINDOW_HIDDEN
@@
@@
- SDL_WINDOWEVENT_EXPOSED
+ SDL_EVENT_WINDOW_EXPOSED
@@
@@
- SDL_WINDOWEVENT_MOVED
+ SDL_EVENT_WINDOW_MOVED
@@
@@
- SDL_WINDOWEVENT_RESIZED
+ SDL_EVENT_WINDOW_RESIZED
@@
@@
- SDL_WINDOWEVENT_SIZE_CHANGED
+ SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED
@@
@@
- SDL_WINDOWEVENT_MINIMIZED
+ SDL_EVENT_WINDOW_MINIMIZED
@@
@@
- SDL_WINDOWEVENT_MAXIMIZED
+ SDL_EVENT_WINDOW_MAXIMIZED
@@
@@
- SDL_WINDOWEVENT_RESTORED
+ SDL_EVENT_WINDOW_RESTORED
@@
@@
- SDL_WINDOWEVENT_ENTER
+ SDL_EVENT_WINDOW_MOUSE_ENTER
@@
@@
- SDL_WINDOWEVENT_LEAVE
+ SDL_EVENT_WINDOW_MOUSE_LEAVE
@@
@@
- SDL_WINDOWEVENT_FOCUS_GAINED
+ SDL_EVENT_WINDOW_FOCUS_GAINED
@@
@@
- SDL_WINDOWEVENT_FOCUS_LOST
+ SDL_EVENT_WINDOW_FOCUS_LOST
@@
@@
- SDL_WINDOWEVENT_CLOSE
+ SDL_EVENT_WINDOW_CLOSE_REQUESTED
@@
@@
- SDL_WINDOWEVENT_TAKE_FOCUS
+ SDL_EVENT_WINDOW_TAKE_FOCUS
@@
@@
- SDL_WINDOWEVENT_HIT_TEST
+ SDL_EVENT_WINDOW_HIT_TEST
@@
@@
- SDL_WINDOWEVENT_ICCPROF_CHANGED
+ SDL_EVENT_WINDOW_ICCPROF_CHANGED
@@
@@
- SDL_WINDOWEVENT_DISPLAY_CHANGED
+ SDL_EVENT_WINDOW_DISPLAY_CHANGED
@@
@@
- SDL_WINDOWEVENT_FIRST
+ SDL_EVENT_WINDOW_FIRST
@@
@@
- SDL_WINDOWEVENT_LAST
+ SDL_EVENT_WINDOW_LAST
@@
@@
- SDL_KEYDOWN
+ SDL_EVENT_KEY_DOWN
@@
@@
- SDL_KEYUP
+ SDL_EVENT_KEY_UP
@@
@@
- SDL_TEXTEDITING
+ SDL_EVENT_TEXT_EDITING
@@
@@
- SDL_TEXTINPUT
+ SDL_EVENT_TEXT_INPUT
@@
@@
- SDL_KEYMAPCHANGED
+ SDL_EVENT_KEYMAP_CHANGED
@@
@@
- SDL_TEXTEDITING_EXT
+ SDL_EVENT_TEXT_EDITING_EXT
@@
@@
- SDL_MOUSEMOTION
+ SDL_EVENT_MOUSE_MOTION
@@
@@
- SDL_MOUSEBUTTONDOWN
+ SDL_EVENT_MOUSE_BUTTON_DOWN
@@
@@
- SDL_MOUSEBUTTONUP
+ SDL_EVENT_MOUSE_BUTTON_UP
@@
@@
- SDL_MOUSEWHEEL
+ SDL_EVENT_MOUSE_WHEEL
@@
@@
- SDL_JOYAXISMOTION
+ SDL_EVENT_JOYSTICK_AXIS_MOTION
@@
@@
- SDL_JOYHATMOTION
+ SDL_EVENT_JOYSTICK_HAT_MOTION
@@
@@
- SDL_JOYBUTTONDOWN
+ SDL_EVENT_JOYSTICK_BUTTON_DOWN
@@
@@
- SDL_JOYBUTTONUP
+ SDL_EVENT_JOYSTICK_BUTTON_UP
@@
@@
- SDL_JOYDEVICEADDED
+ SDL_EVENT_JOYSTICK_ADDED
@@
@@
- SDL_JOYDEVICEREMOVED
+ SDL_EVENT_JOYSTICK_REMOVED
@@
@@
- SDL_JOYBATTERYUPDATED
+ SDL_EVENT_JOYSTICK_BATTERY_UPDATED
@@
@@
- SDL_GAMEPADAXISMOTION
+ SDL_EVENT_GAMEPAD_AXIS_MOTION
@@
@@
- SDL_GAMEPADBUTTONDOWN
+ SDL_EVENT_GAMEPAD_BUTTON_DOWN
@@
@@
- SDL_GAMEPADBUTTONUP
+ SDL_EVENT_GAMEPAD_BUTTON_UP
@@
@@
- SDL_GAMEPADADDED
+ SDL_EVENT_GAMEPAD_ADDED
@@
@@
- SDL_GAMEPADREMOVED
+ SDL_EVENT_GAMEPAD_REMOVED
@@
@@
- SDL_GAMEPADREMAPPED
+ SDL_EVENT_GAMEPAD_REMAPPED
@@
@@
- SDL_GAMEPADTOUCHPADDOWN
+ SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
@@
@@
- SDL_GAMEPADTOUCHPADMOTION
+ SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
@@
@@
- SDL_GAMEPADTOUCHPADUP
+ SDL_EVENT_GAMEPAD_TOUCHPAD_UP
@@
@@
- SDL_GAMEPADSENSORUPDATE
+ SDL_EVENT_GAMEPAD_SENSOR_UPDATE
@@
@@
- SDL_FINGERDOWN
+ SDL_EVENT_FINGER_DOWN
@@
@@
- SDL_FINGERUP
+ SDL_EVENT_FINGER_UP
@@
@@
- SDL_FINGERMOTION
+ SDL_EVENT_FINGER_MOTION
@@
@@
- SDL_CLIPBOARDUPDATE
+ SDL_EVENT_CLIPBOARD_UPDATE
@@
@@
- SDL_DROPFILE
+ SDL_EVENT_DROP_FILE
@@
@@
- SDL_DROPTEXT
+ SDL_EVENT_DROP_TEXT
@@
@@
- SDL_DROPBEGIN
+ SDL_EVENT_DROP_BEGIN
@@
@@
- SDL_DROPCOMPLETE
+ SDL_EVENT_DROP_COMPLETE
@@
@@
- SDL_AUDIODEVICEADDED
+ SDL_EVENT_AUDIO_DEVICE_ADDED
@@
@@
- SDL_AUDIODEVICEREMOVED
+ SDL_EVENT_AUDIO_DEVICE_REMOVED
@@
@@
- SDL_SENSORUPDATE
+ SDL_EVENT_SENSOR_UPDATE
@@
@@
- SDL_RENDER_TARGETS_RESET
+ SDL_EVENT_RENDER_TARGETS_RESET
@@
@@
- SDL_RENDER_DEVICE_RESET
+ SDL_EVENT_RENDER_DEVICE_RESET
@@
@@
- SDL_POLLSENTINEL
+ SDL_EVENT_POLL_SENTINEL
@@
@@
- SDL_USEREVENT
+ SDL_EVENT_USER
@@
@@
- SDL_LASTEVENT
+ SDL_EVENT_LAST
@@
@@
- SDL_WINDOW_INPUT_GRABBED
+ SDL_WINDOW_MOUSE_GRABBED
@@
SDL_DisplayMode *e;
@@
(
- e->w
+ e->screen_w
|
- e->h
+ e->screen_h
)
@@
SDL_DisplayMode e;
@@
(
- e.w
+ e.screen_w
|
- e.h
+ e.screen_h
)
@@
@@
- SDL_GetWindowDisplayIndex
+ SDL_GetDisplayForWindow
(...)
@@
@@
- SDL_SetWindowDisplayMode
+ SDL_SetWindowFullscreenMode
(...)
@@
@@
- SDL_GetWindowDisplayMode
+ SDL_GetWindowFullscreenMode
(...)
@@
@@
- SDL_GetClosestDisplayMode
+ SDL_GetClosestFullscreenDisplayMode
(...)
@@
@@
- SDL_GetRendererOutputSize
+ SDL_GetCurrentRenderOutputSize
(...)
@@
@@
- SDL_RenderWindowToLogical
+ SDL_RenderCoordinatesFromWindow
(...)
@@
@@
- SDL_RenderLogicalToWindow
+ SDL_RenderCoordinatesToWindow
(...)
@@
symbol SDL_ScaleModeNearest;
@@
- SDL_ScaleModeNearest
+ SDL_SCALEMODE_NEAREST
@@
symbol SDL_ScaleModeLinear;
@@
- SDL_ScaleModeLinear
+ SDL_SCALEMODE_LINEAR
@@
symbol SDL_ScaleModeBest;
@@
- SDL_ScaleModeBest
+ SDL_SCALEMODE_BEST
@@
@@
- SDL_RenderCopy
+ SDL_RenderTexture
(...)
@@
@@
- SDL_RenderCopyEx
+ SDL_RenderTextureRotated
(...)
@@
SDL_Renderer *renderer;
constant c1;
constant c2;
constant c3;
constant c4;
expression e1;
expression e2;
expression e3;
expression e4;
@@
- SDL_RenderDrawLine(renderer,
+ SDL_RenderLine(renderer,
(
c1
|
- e1
+ (float)e1
)
,
(
c2
|
- e2
+ (float)e2
)
,
(
c3
|
- e3
+ (float)e3
)
,
(
c4
|
- e4
+ (float)e4
)
)
@@
@@
- SDL_RenderDrawLines
+ SDL_RenderLines
(...)
@@
SDL_Renderer *renderer;
constant c1;
constant c2;
expression e1;
expression e2;
@@
- SDL_RenderDrawPoint(renderer,
+ SDL_RenderPoint(renderer,
(
c1
|
- e1
+ (float)e1
)
,
(
c2
|
- e2
+ (float)e2
)
)
@@
@@
- SDL_RenderDrawPoints
+ SDL_RenderPoints
(...)
@@
@@
- SDL_RenderDrawRect
+ SDL_RenderRect
(...)
@@
@@
- SDL_RenderDrawRects
+ SDL_RenderRects
(...)

View file

@ -61,7 +61,7 @@ build_cmake_projects() {
-DSDL_STATIC=ON \
-DSDL_STATIC_PIC=ON \
-DSDL_TEST=ON \
-DSDL3_DISABLE_INSTALL=OFF \
-DSDL_DISABLE_INSTALL=OFF \
-DCMAKE_INSTALL_PREFIX="${build_root}/build_${android_abi}/prefix" \
-DCMAKE_INSTALL_INCLUDEDIR=include \
-DCMAKE_INSTALL_LIBDIR=lib \

View file

@ -76,5 +76,3 @@ while (<STDIN>) {
print("\n") if $reported;
exit(0); # Let the push go forward.
# vi: set ts=4 sw=4 expandtab:

View file

@ -25,10 +25,7 @@ not_ok () {
failed=1
}
major=$(sed -ne 's/^set(SDL_MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
minor=$(sed -ne 's/^set(SDL_MINOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
micro=$(sed -ne 's/^set(SDL_MICRO_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
version="${major}.${minor}.${micro}"
version=$(sed -Ene 's/^project\(SDL[0-9]+ LANGUAGES C CXX VERSION "([0-9.]*)"\)$/\1/p' CMakeLists.txt)
if [ "$ref_version" = "$version" ]; then
ok "CMakeLists.txt $version"

View file

@ -1,7 +1,15 @@
#!/bin/sh
if [ "$SED" = "" ]; then
if type gsed >/dev/null; then
SED=gsed
else
SED=sed
fi
fi
find . -type f \
| grep -v \.git \
| while read file; do \
LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \
LC_ALL=C $SED -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \
done

View file

@ -54,9 +54,7 @@ if [ "x$PATCH" != "x0" ]; then
fi
fi
perl -w -pi -e 's/\A(set\(SDL_MAJOR_VERSION\s+)\d+/${1}'$MAJOR'/;' CMakeLists.txt
perl -w -pi -e 's/\A(set\(SDL_MINOR_VERSION\s+)\d+/${1}'$MINOR'/;' CMakeLists.txt
perl -w -pi -e 's/\A(set\(SDL_MICRO_VERSION\s+)\d+/${1}'$PATCH'/;' CMakeLists.txt
perl -w -pi -e 's/\A(project\(SDL[0-9]+ LANGUAGES C CXX VERSION ")[0-9.]+/${1}'$NEWVERSION'/;' CMakeLists.txt
perl -w -pi -e 's/\A(.* SDL_MAJOR_VERSION = )\d+/${1}'$MAJOR'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
perl -w -pi -e 's/\A(.* SDL_MINOR_VERSION = )\d+/${1}'$MINOR'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java

View file

@ -415,6 +415,7 @@ my @standard_wiki_sections = (
'Function Parameters',
'Return Value',
'Remarks',
'Thread Safety',
'Version',
'Code Examples',
'Related Functions'
@ -729,6 +730,7 @@ if ($copy_direction == 1) { # --copy-to-headers
my $remarks = %$sectionsref{'Remarks'};
my $params = %$sectionsref{'Function Parameters'};
my $returns = %$sectionsref{'Return Value'};
my $threadsafety = %$sectionsref{'Thread Safety'};
my $version = %$sectionsref{'Version'};
my $related = %$sectionsref{'Related Functions'};
my $deprecated = %$sectionsref{'Deprecated'};
@ -821,6 +823,21 @@ if ($copy_direction == 1) { # --copy-to-headers
}
}
if (defined $threadsafety) {
# !!! FIXME: lots of code duplication in all of these.
$str .= "\n" if $addblank; $addblank = 1;
my $v = dewikify($wikitype, $threadsafety);
my $whitespacelen = length("\\threadsafety") + 1;
my $whitespace = ' ' x $whitespacelen;
$v = wordwrap($v, -$whitespacelen);
my @desclines = split /\n/, $v;
my $firstline = shift @desclines;
$str .= "\\threadsafety $firstline\n";
foreach (@desclines) {
$str .= "${whitespace}$_\n";
}
}
if (defined $version) {
# !!! FIXME: lots of code duplication in all of these.
$str .= "\n" if $addblank; $addblank = 1;
@ -1047,6 +1064,21 @@ if ($copy_direction == 1) { # --copy-to-headers
}
$desc =~ s/[\s\n]+\Z//ms;
$sections{'Version'} = wordwrap(wikify($wikitype, $desc)) . "\n";
} elsif ($l =~ /\A\\threadsafety\s+(.*)\Z/) {
my $desc = $1;
while (@doxygenlines) {
my $subline = $doxygenlines[0];
$subline =~ s/\A\s*//;
last if $subline =~ /\A\\/; # some sort of doxygen command, assume we're past this thing.
shift @doxygenlines; # dump this line from the array; we're using it.
if ($subline eq '') { # empty line, make sure it keeps the newline char.
$desc .= "\n";
} else {
$desc .= " $subline";
}
}
$desc =~ s/[\s\n]+\Z//ms;
$sections{'Thread Safety'} = wordwrap(wikify($wikitype, $desc)) . "\n";
} elsif ($l =~ /\A\\sa\s+(.*)\Z/) {
my $sa = $1;
$sa =~ s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func"
@ -1137,10 +1169,11 @@ if ($copy_direction == 1) { # --copy-to-headers
$$sectionsref{'[footer]'} = $footer;
if (defined $wikipreamble) {
my $wikified_preamble = wikify($wikitype, $wikipreamble);
if ($wikitype eq 'mediawiki') {
print FH "====== $wikipreamble ======\n";
print FH "====== $wikified_preamble ======\n";
} elsif ($wikitype eq 'md') {
print FH "###### $wikipreamble\n";
print FH "###### $wikified_preamble\n";
} else { die("Unexpected wikitype '$wikitype'\n"); }
}
@ -1239,6 +1272,7 @@ if ($copy_direction == 1) { # --copy-to-headers
my $params = %$sectionsref{'Function Parameters'};
my $returns = %$sectionsref{'Return Value'};
my $version = %$sectionsref{'Version'};
my $threadsafety = %$sectionsref{'Thread Safety'};
my $related = %$sectionsref{'Related Functions'};
my $examples = %$sectionsref{'Code Examples'};
my $deprecated = %$sectionsref{'Deprecated'};
@ -1346,6 +1380,11 @@ if ($copy_direction == 1) { # --copy-to-headers
$dewikify_manpage_code_indent = 1;
}
if (defined $threadsafety) {
$str .= ".SH THREAD SAFETY\n";
$str .= dewikify($wikitype, $threadsafety) . "\n";
}
if (defined $version) {
$str .= ".SH AVAILABILITY\n";
$str .= dewikify($wikitype, $version) . "\n";

120
cmake/3rdparty.cmake Normal file
View file

@ -0,0 +1,120 @@
include_guard()
function(get_clang_tidy_ignored_files OUTVAR)
set(3RD_PARTY_SOURCES
# Public GL headers
"SDL_egl.h"
"SDL_hidapi.h"
"SDL_opengl.h"
"SDL_opengl_glext.h"
"SDL_opengles2_gl2.h"
"SDL_opengles2_gl2ext.h"
"SDL_opengles2_gl2platform.h"
"SDL_opengles2_khrplatform.h"
# stdlib
"SDL_malloc.c"
"SDL_qsort.c"
"SDL_strtokr.c"
# edid
"edid-parse.c"
"edid.h"
# imKStoUCS
"imKStoUCS.c"
"imKStoUCS.h"
# Joystick controller type
"controller_type.h"
"controller_type.c"
# HIDAPI Steam controller
"controller_constants.h"
"controller_structs.h"
# Nokia Pixman
"pixman-arm-asm.h"
"pixman-arm-neon-asm.h"
"pixman-arm-simd-asm.h"
# YUV2RGB
"yuv_rgb.c"
"yuv_rgb_lsx_func.h"
"yuv_rgb_sse_func.h"
"yuv_rgb_std_func.h"
# LIBM
"e_atan2.c"
"e_exp.c"
"e_fmod.c"
"e_log10.c"
"e_log.c"
"e_pow.c"
"e_rem_pio2.c"
"e_sqrt.c"
"k_cos.c"
"k_rem_pio2.c"
"k_sin.c"
"k_tan.c"
"s_atan.c"
"s_copysign.c"
"s_cos.c"
"s_fabs.c"
"s_floor.c"
"s_scalbn.c"
"s_sin.c"
"s_tan.c"
"math_private.h"
"math_libm.h"
# EGL
"egl.h"
"eglext.h"
"eglplatform.h"
# GLES2
"gl2.h"
"gl2ext.h"
"gl2platform.h"
# KHR
"khrplatform.h"
# Vulkan
"vk_icd.h"
"vk_layer.h"
"vk_platform.h"
"vk_sdk_platform.h"
"vulkan_android.h"
"vulkan_beta.h"
"vulkan_core.h"
"vulkan_directfb.h"
"vulkan_fuchsia.h"
"vulkan_ggp.h"
"vulkan_ios.h"
"vulkan_macos.h"
"vulkan_metal.h"
"vulkan_screen.h"
"vulkan_vi.h"
"vulkan_wayland.h"
"vulkan_win32.h"
"vulkan_xcb.h"
"vulkan_xlib_xrandr.h"
"vulkan_xlib.h"
"vulkan.h"
"vulkan_enums.hpp"
"vulkan_format_traits.hpp"
"vulkan_funcs.hpp"
"vulkan_handles.hpp"
"vulkan_hash.hpp"
"vulkan_raii.hpp"
"vulkan_static_assertions.hpp"
"vulkan_structs.hpp"
"vulkan_to_string.hpp"
"vulkan.hpp"
# HIDAPI
"hid.c"
"hid.cpp"
"hid.m"
"hidraw.cpp"
"hidusb.cpp"
"hidapi.h")
foreach(SOURCE_FILE ${3RD_PARTY_SOURCES})
list(APPEND IGNORED_LIST "{\"name\":\"${SOURCE_FILE}\",\"lines\":[[1,1]]}")
endforeach()
string(REPLACE ";" "," IGNORED_FILES "${IGNORED_LIST}")
set(${OUTVAR}
"${IGNORED_FILES}"
PARENT_SCOPE)
endfunction()

View file

@ -0,0 +1,36 @@
if(CPACK_PACKAGE_FILE_NAME MATCHES ".*-src$")
message(FATAL_ERROR "Creating source archives for SDL @PROJECT_VERSION@ is not supported.")
endif()
set(PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@")
set(SDL_CMAKE_PLATFORM "@SDL_CMAKE_PLATFORM@")
set(SDL_CPU_NAMES "@SDL_CPU_NAMES@")
list(SORT SDL_CPU_NAMES)
string(REPLACE ";" "-" SDL_CPU_NAMES_WITH_DASHES "${SDL_CPU_NAMES}")
if(SDL_CPU_NAMES_WITH_DASHES)
set(SDL_CPU_NAMES_WITH_DASHES "-${SDL_CPU_NAMES_WITH_DASHES}")
endif()
string(TOLOWER "${SDL_CMAKE_PLATFORM}" lower_sdl_cmake_platform)
string(TOLOWER "${SDL_CPU_NAMES}" lower_sdl_cpu_names)
if(lower_sdl_cmake_platform STREQUAL lower_sdl_cpu_names)
set(SDL_CPU_NAMES_WITH_DASHES)
endif()
set(MSVC @MSVC@)
set(MINGW @MINGW@)
if(MSVC)
set(SDL_CMAKE_PLATFORM "${SDL_CMAKE_PLATFORM}-VC")
elseif(MINGW)
set(SDL_CMAKE_PLATFORM "${SDL_CMAKE_PLATFORM}-mingw")
endif()
set(CPACK_PACKAGE_FILE_NAME "SDL@PROJECT_VERSION_MAJOR@-@PROJECT_VERSION@-${SDL_CMAKE_PLATFORM}${SDL_CPU_NAMES_WITH_DASHES}")
if(CPACK_GENERATOR STREQUAL "DragNDrop")
set(CPACK_DMG_VOLUME_NAME "SDL@PROJECT_VERSION_MAJOR@ @PROJECT_VERSION@")
# FIXME: use pre-built/create .DS_Store through AppleScript (CPACK_DMG_DS_STORE/CPACK_DMG_DS_STORE_SETUP_SCRIPT)
set(CPACK_DMG_DS_STORE "${PROJECT_SOURCE_DIR}/Xcode/SDL/pkg-support/resources/SDL_DS_Store")
endif()

View file

@ -34,6 +34,8 @@ function(check_cpu_architecture ARCH VARIABLE)
_internal_check_cpu_architecture("defined(__aarch64__) || defined(_M_ARM64)" arm64 ${VARIABLE})
elseif(ARCH STREQUAL "loongarch64")
_internal_check_cpu_architecture("defined(__loongarch64)" loongarch64 ${VARIABLE})
elseif(ARCH STREQUAL "emscripten")
_internal_check_cpu_architecture("defined(__EMSCRIPTEN__)" emscripten ${VARIABLE})
else()
message(WARNING "Unknown CPU architectures (${ARCH}).")
set(${VARIABLE} FALSE)

View file

@ -9,21 +9,52 @@ set_package_properties(SDL3 PROPERTIES
@PACKAGE_INIT@
set(SDL3_FOUND TRUE)
set(_sdl3_framework @SDL_FRAMEWORK@)
# Find SDL3::Headers
if(NOT TARGET SDL3::Headers)
include("${CMAKE_CURRENT_LIST_DIR}/SDL3headersTargets.cmake")
# Manually add `-F <parent folder of SDL3.framework>` to make sure `#include "SDL3/..."` works.
if(_sdl3_framework)
set_property(TARGET SDL3::Headers APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "SHELL:-F \"@PACKAGE_CMAKE_INSTALL_PREFIX@\"")
endif()
endif()
set(SDL3_Headers_FOUND TRUE)
# Find SDL3::SDL3
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake")
set(SDL3_SDL3_FOUND TRUE)
endif()
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake")
if(ANDROID OR HAIKU)
enable_language(CXX)
# Find SDL3::SDL3-static
if(_sdl3_framework)
find_package(SDL3-static CONFIG)
if(SDL3-static_FOUND)
set(SDL3_SDL3-static_FOUND TRUE)
endif()
else()
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake")
if(ANDROID OR HAIKU)
enable_language(CXX)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake")
set(SDL3_SDL3-static_FOUND TRUE)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake")
set(SDL3_SDL3-static_FOUND TRUE)
endif()
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake")
set(SDL3_SDL3_test_FOUND TRUE)
# Find SDL3::SDL3_test
if(_sdl3_framework)
find_package(SDL3_test CONFIG)
if(SDL3_test_FOUND)
enable_language(OBJC)
set(SDL3_SDL3_test_FOUND TRUE)
endif()
else()
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake")
set(SDL3_SDL3_test_FOUND TRUE)
endif()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/sdlfind.cmake")
@ -49,14 +80,6 @@ if(TARGET SDL3::SDL3-static AND NOT TARGET SDL3::SDL3)
endif()
endif()
# For compatibility with autotools sdl3-config.cmake, provide SDL3_* variables.
set(SDL3_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set(SDL3_EXEC_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set(SDL3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
set(SDL3_INCLUDE_DIRS "${SDL3_INCLUDE_DIR}")
set(SDL3_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@")
set(SDL3_LIBDIR "@PACKAGE_CMAKE_INSTALL_FULL_LIBDIR@")
set(SDL3_LIBRARIES SDL3::SDL3)
set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static)
set(SDL3_STATIC_PRIVATE_LIBS)

View file

@ -1,13 +1,13 @@
# sdl pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
prefix=@SDL_PKGCONFIG_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: sdl3
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
Version: @SDL_VERSION@
Version: @PROJECT_VERSION@
Requires.private: @SDL_PC_PRIVATE_REQUIRES@
Conflicts:
Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_PC_LIBS@ @PKGCONFIG_LIBS_PRIV@ @SDL_PC_STATIC_LIBS@

View file

@ -1,6 +1,3 @@
include(CMakeParseArguments)
include(${SDL3_SOURCE_DIR}/cmake/sdlfind.cmake)
macro(FindLibraryAndSONAME _LIB)
cmake_parse_arguments(FLAS "" "" "LIBDIRS" ${ARGN})
@ -140,7 +137,7 @@ macro(CheckPipewire)
file(GLOB PIPEWIRE_SOURCES ${SDL3_SOURCE_DIR}/src/audio/pipewire/*.c)
list(APPEND SOURCE_FILES ${PIPEWIRE_SOURCES})
set(SDL_AUDIO_DRIVER_PIPEWIRE 1)
target_compile_options(sdl-build-options INTERFACE ${PKG_PIPEWIRE_CFLAGS})
target_include_directories(sdl-build-options SYSTEM INTERFACE ${PKG_PIPEWIRE_INCLUDE_DIRS})
if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic Pipewire loading")
endif()
@ -169,7 +166,7 @@ macro(CheckPulseAudio)
file(GLOB PULSEAUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/pulseaudio/*.c)
list(APPEND SOURCE_FILES ${PULSEAUDIO_SOURCES})
set(SDL_AUDIO_DRIVER_PULSEAUDIO 1)
target_compile_options(sdl-build-options INTERFACE ${PKG_PULSEAUDIO_CFLAGS})
target_include_directories(sdl-build-options SYSTEM INTERFACE ${PKG_PULSEAUDIO_INCLUDE_DIRS})
if(SDL_PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading")
endif()
@ -198,7 +195,7 @@ macro(CheckJACK)
file(GLOB JACK_SOURCES ${SDL3_SOURCE_DIR}/src/audio/jack/*.c)
list(APPEND SOURCE_FILES ${JACK_SOURCES})
set(SDL_AUDIO_DRIVER_JACK 1)
target_compile_options(sdl-build-options INTERFACE ${PKG_JACK_CFLAGS})
target_include_directories(sdl-build-options SYSTEM INTERFACE ${PKG_JACK_INCLUDE_DIRS})
if(SDL_JACK_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading")
endif()
@ -227,7 +224,7 @@ macro(CheckSNDIO)
file(GLOB SNDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/sndio/*.c)
list(APPEND SOURCE_FILES ${SNDIO_SOURCES})
set(SDL_AUDIO_DRIVER_SNDIO 1)
target_compile_options(sdl-build-options INTERFACE ${PKG_SNDIO_CFLAGS})
target_include_directories(sdl-build-options INTERFACE ${PKG_SNDIO_INCLUDE_DIRS})
if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
endif()
@ -573,7 +570,7 @@ macro(CheckWayland)
# We have to generate some protocol interface code for some unstable Wayland features.
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols")
target_include_directories(sdl-build-options INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols")
target_include_directories(sdl-build-options SYSTEM INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols")
file(GLOB WAYLAND_PROTOCOLS_XML RELATIVE "${SDL3_SOURCE_DIR}/wayland-protocols/" "${SDL3_SOURCE_DIR}/wayland-protocols/*.xml")
foreach(_XML ${WAYLAND_PROTOCOLS_XML})
@ -609,7 +606,7 @@ macro(CheckWayland)
set(HAVE_WAYLAND_LIBDECOR TRUE)
set(HAVE_LIBDECOR_H 1)
target_link_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_LIBRARY_DIRS}")
target_include_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_INCLUDE_DIRS}")
target_include_directories(sdl-build-options SYSTEM INTERFACE "${PKG_LIBDECOR_INCLUDE_DIRS}")
if(SDL_WAYLAND_LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading")
endif()
@ -620,6 +617,17 @@ macro(CheckWayland)
else()
list(APPEND SDL_EXTRA_LIBS ${PKG_LIBDECOR_LIBRARIES})
endif()
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_FLAGS ${PKG_LIBDECOR_CFLAGS})
list(APPEND CMAKE_REQUIRED_INCLUDES ${PKG_LIBDECOR_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${PKG_LIBDECOR_LINK_LIBRARIES})
check_symbol_exists(libdecor_frame_get_max_content_size "libdecor.h" HAVE_LIBDECOR_FRAME_GET_MAX_CONTENT_SIZE)
check_symbol_exists(libdecor_frame_get_min_content_size "libdecor.h" HAVE_LIBDECOR_FRAME_GET_MIN_CONTENT_SIZE)
if(HAVE_LIBDECOR_FRAME_GET_MAX_CONTENT_SIZE AND HAVE_LIBDECOR_FRAME_GET_MIN_CONTENT_SIZE)
set(SDL_HAVE_LIBDECOR_GET_MIN_MAX 1)
endif()
cmake_pop_check_state()
endif()
endif()
@ -1042,7 +1050,7 @@ macro(CheckHIDAPI)
check_include_file(libusb.h HAVE_LIBUSB_H ${PKG_LIBUSB_CFLAGS})
if(HAVE_LIBUSB_H)
set(HAVE_LIBUSB TRUE)
target_compile_options(sdl-build-options INTERFACE ${PKG_LIBUSB_CFLAGS})
target_include_directories(sdl-build-options SYSTEM INTERFACE ${PKG_LIBUSB_INCLUDE_DIRS})
if(HIDAPI_ONLY_LIBUSB)
list(APPEND SDL_EXTRA_LIBS ${PKG_LIBUSB_LIBRARIES})
else()
@ -1158,7 +1166,7 @@ macro(CheckKMSDRM)
file(GLOB KMSDRM_SOURCES ${SDL3_SOURCE_DIR}/src/video/kmsdrm/*.c)
list(APPEND SOURCE_FILES ${KMSDRM_SOURCES})
target_compile_options(sdl-build-options INTERFACE ${PKG_KMSDRM_CFLAGS})
target_include_directories(sdl-build-options SYSTEM INTERFACE ${PKG_KMSDRM_INCLUDE_DIRS})
set(SDL_VIDEO_DRIVER_KMSDRM 1)

View file

@ -1,9 +1,8 @@
macro(sdlFindALSA)
find_package(ALSA MODULE)
if(ALSA_FOUND AND (NOT TARGET ALSA::ALSA) )
if(ALSA_FOUND AND NOT TARGET ALSA::ALSA)
add_Library(ALSA::ALSA UNKNOWN IMPORTED)
set_property(TARGET ALSA::ALSA PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS})
set_property(TARGET ALSA::ALSA APPEND PROPERTY IMPORTED_LOCATION ${ALSA_LIBRARY})
set_property(TARGET ALSA::ALSA PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${ALSA_INCLUDE_DIRS}")
set_property(TARGET ALSA::ALSA APPEND PROPERTY IMPORTED_LOCATION "${ALSA_LIBRARY}")
endif()
endmacro()
endmacro()

View file

@ -2,54 +2,106 @@ macro(SDL_DetectCMakePlatform)
set(SDL_CMAKE_PLATFORM )
# Get the platform
if(WIN32)
set(SDL_CMAKE_PLATFORM WINDOWS)
elseif(UNIX AND NOT APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(SDL_CMAKE_PLATFORM LINUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
set(SDL_CMAKE_PLATFORM FREEBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
set(SDL_CMAKE_PLATFORM NETBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
set(SDL_CMAKE_PLATFORM OPENBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
set(SDL_CMAKE_PLATFORM GNU)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
set(SDL_CMAKE_PLATFORM BSDI)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
set(SDL_CMAKE_PLATFORM FREEBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
set(SDL_CMAKE_PLATFORM SYSV5)
elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*")
set(SDL_CMAKE_PLATFORM SOLARIS)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
set(SDL_CMAKE_PLATFORM HPUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
set(SDL_CMAKE_PLATFORM AIX)
elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
set(SDL_CMAKE_PLATFORM MINIX)
endif()
set(SDL_CMAKE_PLATFORM Windows)
elseif(PSP)
set(SDL_CMAKE_PLATFORM psp)
elseif(APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
set(SDL_CMAKE_PLATFORM DARWIN)
set(SDL_CMAKE_PLATFORM Darwin)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
set(SDL_CMAKE_PLATFORM MACOSX)
set(SDL_CMAKE_PLATFORM MacosX)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
set(SDL_CMAKE_PLATFORM TVOS)
set(SDL_CMAKE_PLATFORM tvOS)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*")
# !!! FIXME: remove the version check when we start requiring >= 3.14.0
if(CMAKE_VERSION VERSION_LESS 3.14)
set(SDL_CMAKE_PLATFORM IOS)
set(SDL_CMAKE_PLATFORM iOS)
endif()
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
set(SDL_CMAKE_PLATFORM Haiku)
elseif(NINTENDO_3DS)
set(SDL_CMAKE_PLATFORM n3ds)
elseif(PS2)
set(SDL_CMAKE_PLATFORM ps2)
elseif(VITA)
set(SDL_CMAKE_PLATFORM Vita)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(SDL_CMAKE_PLATFORM Linux)
elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
set(SDL_CMAKE_PLATFORM FreeBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
set(SDL_CMAKE_PLATFORM NetBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
set(SDL_CMAKE_PLATFORM OpenBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
set(SDL_CMAKE_PLATFORM GNU)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
set(SDL_CMAKE_PLATFORM BSDi)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
set(SDL_CMAKE_PLATFORM FreeBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
set(SDL_CMAKE_PLATFORM SYSV5)
elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*")
set(SDL_CMAKE_PLATFORM Solaris)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
set(SDL_CMAKE_PLATFORM HPUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
set(SDL_CMAKE_PLATFORM AIX)
elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
set(SDL_CMAKE_PLATFORM Minix)
elseif(CMAKE_SYSTEM_NAME MATCHES "Android.*")
set(SDL_CMAKE_PLATFORM Android)
elseif(CMAKE_SYSTEM_NAME MATCHES "Emscripten.*")
set(SDL_CMAKE_PLATFORM Emscripten)
elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
message_error("BeOS support has been removed as of SDL 2.0.2.")
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
set(SDL_CMAKE_PLATFORM HAIKU)
elseif(NINTENDO_3DS)
set(SDL_CMAKE_PLATFORM N3DS)
endif()
if(SDL_CMAKE_PLATFORM)
set(${SDL_CMAKE_PLATFORM} TRUE)
string(TOUPPER "${SDL_CMAKE_PLATFORM}" _upper_platform)
set(${_upper_platform} TRUE)
else()
set(SDL_CMAKE_PLATFORM} "unknown")
endif()
endmacro()
function(SDL_DetectCPUArchitecture)
set(sdl_cpu_names)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
if(osx_arch STREQUAL "x86_64")
list(APPEND sdl_cpu_names "x64")
elseif(osx_arch STREQUAL "arm64")
list(APPEND sdl_cpu_names "arm64")
endif()
endforeach()
endif()
set(sdl_known_archs x86 x64 arm32 arm64 loongarch64 emscripten)
if(NOT sdl_cpu_names)
set(found FALSE)
foreach(sdl_known_arch ${sdl_known_archs})
if(NOT found)
string(TOUPPER "${sdl_known_arch}" sdl_known_arch_upper)
set(var_name "SDL_CPU_${sdl_known_arch_upper}")
check_cpu_architecture(${sdl_known_arch} ${var_name})
if(${var_name})
list(APPEND sdl_cpu_names ${sdl_known_arch})
set(found TRUE)
endif()
endif()
endforeach()
endif()
foreach(sdl_known_arch ${sdl_known_archs})
string(TOUPPER "${sdl_known_arch}" sdl_known_arch_upper)
set(var_name "SDL_CPU_${sdl_known_arch_upper}")
if(sdl_cpu_names MATCHES "(^|;)${sdl_known_arch}($|;)") # FIXME: use if(IN_LIST)
set(${var_name} 1 PARENT_SCOPE)
else()
set(${var_name} 0 PARENT_SCOPE)
endif()
endforeach()
set(SDL_CPU_NAMES ${sdl_cpu_names} PARENT_SCOPE)
endfunction()

View file

@ -27,6 +27,13 @@ add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library")
option(TEST_STATIC "Test linking to static SDL3 library" ON)
add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library")
option(TEST_TEST "Test linking to SDL3_test library" ON)
add_feature_info("TEST_TEST" TEST_STATIC "Test linking to SDL test library")
find_package(SDL3 REQUIRED CONFIG COMPONENTS Headers)
add_library(headers_test OBJECT inc_sdl_slash.c inc_sdl_noslash.c)
target_link_libraries(headers_test PRIVATE SDL3::Headers)
if(TEST_SHARED)
find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
add_executable(gui-shared WIN32 main_gui.c)
@ -43,10 +50,6 @@ if(TEST_SHARED)
target_compile_definitions(sharedlib-shared PRIVATE "EXPORT_HEADER=\"${CMAKE_CURRENT_BINARY_DIR}/sharedlib-shared_export.h\"")
set_target_properties(sharedlib-shared PROPERTIES C_VISIBILITY_PRESET "hidden")
add_executable(gui-shared-vars WIN32 main_gui.c)
target_link_libraries(gui-shared-vars PRIVATE ${SDL3_LIBRARIES})
target_include_directories(gui-shared-vars PRIVATE ${SDL3_INCLUDE_DIRS})
add_executable(cli-shared main_cli.c)
target_link_libraries(cli-shared PRIVATE SDL3::SDL3)
if(WIN32)
@ -55,16 +58,10 @@ if(TEST_SHARED)
)
endif()
add_executable(cli-shared-vars main_cli.c)
target_link_libraries(cli-shared-vars PRIVATE ${SDL3_LIBRARIES})
target_include_directories(cli-shared-vars PRIVATE ${SDL3_INCLUDE_DIRS})
add_library(sharedlib-shared-vars SHARED main_lib.c)
target_link_libraries(sharedlib-shared-vars PRIVATE ${SDL3_LIBRARIES})
target_include_directories(sharedlib-shared-vars PRIVATE ${SDL3_INCLUDE_DIRS})
generate_export_header(sharedlib-shared-vars EXPORT_MACRO_NAME MYLIBRARY_EXPORT)
target_compile_definitions(sharedlib-shared-vars PRIVATE "EXPORT_HEADER=\"${CMAKE_CURRENT_BINARY_DIR}/sharedlib-shared-vars_export.h\"")
set_target_properties(sharedlib-shared-vars PROPERTIES C_VISIBILITY_PRESET "hidden")
if(TEST_TEST)
add_executable(sdltest-shared sdltest.c)
target_link_libraries(sdltest-shared PRIVATE SDL3::SDL3_test SDL3::SDL3)
endif()
endif()
if(TEST_STATIC)
@ -81,24 +78,10 @@ if(TEST_STATIC)
set_target_properties(sharedlib-static PROPERTIES C_VISIBILITY_PRESET "hidden")
endif()
add_executable(gui-static-vars WIN32 main_gui.c)
target_link_libraries(gui-static-vars PRIVATE ${SDL3_STATIC_LIBRARIES})
target_include_directories(gui-static-vars PRIVATE ${SDL3_INCLUDE_DIRS})
add_executable(cli-static main_cli.c)
target_link_libraries(cli-static PRIVATE SDL3::SDL3-static)
add_executable(cli-static-vars main_cli.c)
target_link_libraries(cli-static-vars PRIVATE ${SDL3_STATIC_LIBRARIES})
target_include_directories(cli-static-vars PRIVATE ${SDL3_INCLUDE_DIRS})
if(TEST_TEST)
add_executable(sdltest-static sdltest.c)
target_link_libraries(sdltest-static PRIVATE SDL3::SDL3_test SDL3::SDL3-static)
endif()
endif()
message(STATUS "SDL3_PREFIX: ${SDL3_PREFIX}")
message(STATUS "SDL3_INCLUDE_DIR: ${SDL3_INCLUDE_DIR}")
message(STATUS "SDL3_INCLUDE_DIRS: ${SDL3_INCLUDE_DIRS}")
message(STATUS "SDL3_LIBRARIES: ${SDL3_LIBRARIES}")
message(STATUS "SDL3_STATIC_LIBRARIES: ${SDL3_STATIC_LIBRARIES}")
message(STATUS "SDL3TEST_LIBRARY: ${SDL3TEST_LIBRARY}")
feature_summary(WHAT ALL)

View file

@ -0,0 +1,8 @@
#include "SDL.h"
#include "SDL_main.h"
void inc_sdl_noslash(void) {
SDL_SetMainReady();
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Quit();
}

View file

@ -0,0 +1,8 @@
#include "SDL3/SDL.h"
#include "SDL3/SDL_main.h"
void inc_sdl_slash(void) {
SDL_SetMainReady();
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Quit();
}

View file

@ -1,10 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := main_gui_androidmk
LOCAL_SRC_FILES := ../main_gui.c
LOCAL_SHARED_LIBRARIES += SDL3
include $(BUILD_SHARED_LIBRARY)
$(call import-module,SDL3)

9
cmake/test/sdltest.c Normal file
View file

@ -0,0 +1,9 @@
#include <SDL3/SDL.h>
#include <SDL3/SDL_test.h>
int main(int argc, char *argv[]) {
SDLTest_CommonState state;
SDLTest_CommonDefaultArgs(&state, argc, argv);
return 0;
}

View file

@ -13,7 +13,7 @@ case "$machine" in
*android* )
EXEPREFIX="lib"
EXESUFFIX=".so"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared"
LDFLAGS="$EXTRA_LDFLAGS -shared"
;;
* )
EXEPREFIX=""
@ -25,20 +25,20 @@ set -e
# Get the canonical path of the folder containing this script
testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
CFLAGS="$( pkg-config sdl3 --cflags )"
LDFLAGS="$( pkg-config sdl3 --libs )"
STATIC_LDFLAGS="$( pkg-config sdl3 --libs --static )"
SDL_CFLAGS="$( pkg-config sdl3 --cflags )"
SDL_LDFLAGS="$( pkg-config sdl3 --libs )"
SDL_STATIC_LDFLAGS="$( pkg-config sdl3 --libs --static )"
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $CFLAGS $EXTRA_CFLAGS"
link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS"
static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $STATIC_LDFLAGS $EXTRA_LDFLAGS"
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $SDL_CFLAGS $CFLAGS"
link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $SDL_LDFLAGS $LDFLAGS"
static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $SDL_STATIC_LDFLAGS $LDFLAGS"
echo "-- CC: $CC"
echo "-- CFLAGS: $CFLAGS"
echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS"
echo "-- LDFLASG: $LDFLAGS"
echo "-- STATIC_LDFLAGS: $STATIC_LDFLAGS"
echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
echo "-- CC: $CC"
echo "-- CFLAGS: $CFLAGS"
echo "-- LDFLASG: $LDFLAGS"
echo "-- SDL_CFLAGS: $SDL_CFLAGS"
echo "-- SDL_LDFLAGS: $SDL_LDFLAGS"
echo "-- SDL_STATIC_LDFLAGS: $SDL_STATIC_LDFLAGS"
echo "-- COMPILE: $compile_cmd"
echo "-- LINK: $link_cmd"

View file

@ -195,20 +195,20 @@ 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
a specific message (SDL_EVENT_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:
- SDL_EVENT_WILL_ENTER_BACKGROUND:
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:
- SDL_EVENT_DID_ENTER_FOREGROUND:
GL context is restored, and the SDL renderer API is available (unless you
receive SDL_RENDER_DEVICE_RESET).
receive SDL_EVENT_RENDER_DEVICE_RESET).
Mouse / Touch events
================================================================================
@ -456,12 +456,12 @@ Two legitimate ways:
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
(see Activity life cycle). Your application will receive an SDL_EVENT_QUIT 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
NB: "Back button" can be handled as a SDL_EVENT_KEY_DOWN/UP events, with Keycode
SDLK_AC_BACK, for any purpose.
Known issues

View file

@ -41,16 +41,15 @@ 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.
SDL_GetWindowSize() and mouse coordinates are in screen coordinates rather
than pixels, but the window will have a much greater pixel density when the
device supports it, and the SDL_GetWindowSizeInPixels() can be called to
determine the size in pixels of the drawable screen framebuffer.
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.
The SDL 2D rendering API will automatically handle this for you, by default
providing a rendering area in screen coordinates, and you can call
SDL_SetRenderLogicalPresentation() to gain access to the higher density
resolution.
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
@ -73,34 +72,34 @@ e.g.
{
switch (event->type)
{
case SDL_APP_TERMINATING:
case SDL_EVENT_TERMINATING:
/* Terminate the app.
Shut everything down before returning from this function.
*/
return 0;
case SDL_APP_LOWMEMORY:
case SDL_EVENT_LOW_MEMORY:
/* 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:
case SDL_EVENT_WILL_ENTER_BACKGROUND:
/* 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:
case SDL_EVENT_DID_ENTER_BACKGROUND:
/* 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.
If the user got a phone call and canceled it, you'll instead get an SDL_EVENT_DID_ENTER_FOREGROUND 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:
case SDL_EVENT_WILL_ENTER_FOREGROUND:
/* This call happens when your app is coming back to the foreground.
Restore all your state here.
*/
return 0;
case SDL_APP_DIDENTERFOREGROUND:
case SDL_EVENT_DID_ENTER_FOREGROUND:
/* Restart your loops here.
Your app is interactive and getting CPU again.
*/

View file

@ -44,7 +44,7 @@ use the traditional autoconf/automake/make method, or use Xcode.
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
normal app, and it will not send a SDL_EVENT_DROP_FILE when you request to open a
file with the app. To solve these issues, put the following code in your
NSApplicationDelegate implementation:
@ -52,9 +52,9 @@ NSApplicationDelegate implementation:
```objc
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
if (SDL_GetEventState(SDL_EVENT_QUIT) == SDL_ENABLE) {
SDL_Event event;
event.type = SDL_QUIT;
event.type = SDL_EVENT_QUIT;
SDL_PushEvent(&event);
}
@ -63,9 +63,9 @@ NSApplicationDelegate implementation:
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
if (SDL_GetEventState(SDL_EVENT_DROP_FILE) == SDL_ENABLE) {
SDL_Event event;
event.type = SDL_DROPFILE;
event.type = SDL_EVENT_DROP_FILE;
event.drop.file = SDL_strdup([filename UTF8String]);
return (SDL_PushEvent(&event) > 0);
}

View file

@ -54,6 +54,31 @@ SDL_PauseAudioDevice() is only used to pause audio playback. Use SDL_PlayAudioDe
SDL_FreeWAV has been removed and calls can be replaced with SDL_free.
SDL_AudioCVT interface is removed, SDL_AudioStream interface or SDL_ConvertAudioSamples() helper function can be used.
Code that used to look like this:
```c
SDL_AudioCVT cvt;
SDL_BuildAudioCVT(&cvt, src_format, src_channels, src_rate, dst_format, dst_channels, dst_rate);
cvt.len = src_len;
cvt.buf = (Uint8 *) SDL_malloc(src_len * cvt.len_mult);
SDL_memcpy(cvt.buf, src_data, src_len);
SDL_ConvertAudio(&cvt);
do_something(cvt.buf, cvt.len_cvt);
```
should be changed to:
```c
Uint8 *dst_data = NULL;
int dst_len = 0;
if (SDL_ConvertAudioSamples(src_format, src_channels, src_rate, src_data, src_len
dst_format, dst_channels, dst_rate, &dst_data, &dst_len) < 0) {
/* error */
}
do_something(dst_data, dst_len);
SDL_free(dst_data);
```
The following functions have been renamed:
* SDL_AudioStreamAvailable() => SDL_GetAudioStreamAvailable()
* SDL_AudioStreamClear() => SDL_ClearAudioStream()
@ -65,6 +90,8 @@ The following functions have been renamed:
The following functions have been removed:
* SDL_ConvertAudio()
* SDL_BuildAudioCVT()
* SDL_OpenAudio()
* SDL_CloseAudio()
* SDL_PauseAudio()
@ -93,23 +120,70 @@ You should set the event.common.timestamp field before passing an event to SDL_P
Mouse events use floating point values for mouse coordinates and relative motion values. You can get sub-pixel motion depending on the platform and display scaling.
The SDL_DISPLAYEVENT_* events have been moved to top level events, and SDL_DISPLAYEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_DISPLAYEVENT and then checking for display events. You can compare the event >= SDL_DISPLAYEVENT_FIRST and <= SDL_DISPLAYEVENT_LAST if you need to see whether it's a display event.
The SDL_DISPLAYEVENT_* events have been moved to top level events, and SDL_DISPLAYEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_DISPLAYEVENT and then checking for display events. You can compare the event >= SDL_EVENT_DISPLAY_FIRST and <= SDL_EVENT_DISPLAY_LAST if you need to see whether it's a display event.
The SDL_WINDOWEVENT_* events have been moved to top level events, and SDL_WINDOWEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_WINDOWEVENT and then checking for window events. You can compare the event >= SDL_WINDOWEVENT_FIRST and <= SDL_WINDOWEVENT_LAST if you need to see whether it's a window event.
The SDL_WINDOWEVENT_* events have been moved to top level events, and SDL_WINDOWEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_WINDOWEVENT and then checking for window events. You can compare the event >= SDL_EVENT_WINDOW_FIRST and <= SDL_EVENT_WINDOW_LAST if you need to see whether it's a window event.
The SDL_EVENT_WINDOW_RESIZED event is always sent, even in response to SDL_SetWindowSize().
The SDL_EVENT_WINDOW_SIZE_CHANGED event has been removed, and you can use SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED to detect window backbuffer size changes.
SDL_QUERY, SDL_IGNORE, SDL_ENABLE, and SDL_DISABLE have been removed. You can use the functions SDL_SetEventEnabled() and SDL_EventEnabled() to set and query event processing state.
The following symbols have been renamed:
* SDL_CONTROLLERAXISMOTION => SDL_GAMEPADAXISMOTION
* SDL_CONTROLLERBUTTONDOWN => SDL_GAMEPADBUTTONDOWN
* SDL_CONTROLLERBUTTONUP => SDL_GAMEPADBUTTONUP
* SDL_CONTROLLERDEVICEADDED => SDL_GAMEPADADDED
* SDL_CONTROLLERDEVICEREMAPPED => SDL_GAMEPADREMAPPED
* SDL_CONTROLLERDEVICEREMOVED => SDL_GAMEPADREMOVED
* SDL_CONTROLLERSENSORUPDATE => SDL_GAMEPADSENSORUPDATE
* SDL_CONTROLLERTOUCHPADDOWN => SDL_GAMEPADTOUCHPADDOWN
* SDL_CONTROLLERTOUCHPADMOTION => SDL_GAMEPADTOUCHPADMOTION
* SDL_CONTROLLERTOUCHPADUP => SDL_GAMEPADTOUCHPADUP
* SDL_APP_DIDENTERBACKGROUND => SDL_EVENT_DID_ENTER_BACKGROUND
* SDL_APP_DIDENTERFOREGROUND => SDL_EVENT_DID_ENTER_FOREGROUND
* SDL_APP_LOWMEMORY => SDL_EVENT_LOW_MEMORY
* SDL_APP_TERMINATING => SDL_EVENT_TERMINATING
* SDL_APP_WILLENTERBACKGROUND => SDL_EVENT_WILL_ENTER_BACKGROUND
* SDL_APP_WILLENTERFOREGROUND => SDL_EVENT_WILL_ENTER_FOREGROUND
* SDL_AUDIODEVICEADDED => SDL_EVENT_AUDIO_DEVICE_ADDED
* SDL_AUDIODEVICEREMOVED => SDL_EVENT_AUDIO_DEVICE_REMOVED
* SDL_CLIPBOARDUPDATE => SDL_EVENT_CLIPBOARD_UPDATE
* SDL_CONTROLLERAXISMOTION => SDL_EVENT_GAMEPAD_AXIS_MOTION
* SDL_CONTROLLERBUTTONDOWN => SDL_EVENT_GAMEPAD_BUTTON_DOWN
* SDL_CONTROLLERBUTTONUP => SDL_EVENT_GAMEPAD_BUTTON_UP
* SDL_CONTROLLERDEVICEADDED => SDL_EVENT_GAMEPAD_ADDED
* SDL_CONTROLLERDEVICEREMAPPED => SDL_EVENT_GAMEPAD_REMAPPED
* SDL_CONTROLLERDEVICEREMOVED => SDL_EVENT_GAMEPAD_REMOVED
* SDL_CONTROLLERSENSORUPDATE => SDL_EVENT_GAMEPAD_SENSOR_UPDATE
* SDL_CONTROLLERTOUCHPADDOWN => SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
* SDL_CONTROLLERTOUCHPADMOTION => SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
* SDL_CONTROLLERTOUCHPADUP => SDL_EVENT_GAMEPAD_TOUCHPAD_UP
* SDL_DROPBEGIN => SDL_EVENT_DROP_BEGIN
* SDL_DROPCOMPLETE => SDL_EVENT_DROP_COMPLETE
* SDL_DROPFILE => SDL_EVENT_DROP_FILE
* SDL_DROPTEXT => SDL_EVENT_DROP_TEXT
* SDL_FINGERDOWN => SDL_EVENT_FINGER_DOWN
* SDL_FINGERMOTION => SDL_EVENT_FINGER_MOTION
* SDL_FINGERUP => SDL_EVENT_FINGER_UP
* SDL_FIRSTEVENT => SDL_EVENT_FIRST
* SDL_JOYAXISMOTION => SDL_EVENT_JOYSTICK_AXIS_MOTION
* SDL_JOYBATTERYUPDATED => SDL_EVENT_JOYSTICK_BATTERY_UPDATED
* SDL_JOYBUTTONDOWN => SDL_EVENT_JOYSTICK_BUTTON_DOWN
* SDL_JOYBUTTONUP => SDL_EVENT_JOYSTICK_BUTTON_UP
* SDL_JOYDEVICEADDED => SDL_EVENT_JOYSTICK_ADDED
* SDL_JOYDEVICEREMOVED => SDL_EVENT_JOYSTICK_REMOVED
* SDL_JOYHATMOTION => SDL_EVENT_JOYSTICK_HAT_MOTION
* SDL_KEYDOWN => SDL_EVENT_KEY_DOWN
* SDL_KEYMAPCHANGED => SDL_EVENT_KEYMAP_CHANGED
* SDL_KEYUP => SDL_EVENT_KEY_UP
* SDL_LASTEVENT => SDL_EVENT_LAST
* SDL_LOCALECHANGED => SDL_EVENT_LOCALE_CHANGED
* SDL_MOUSEBUTTONDOWN => SDL_EVENT_MOUSE_BUTTON_DOWN
* SDL_MOUSEBUTTONUP => SDL_EVENT_MOUSE_BUTTON_UP
* SDL_MOUSEMOTION => SDL_EVENT_MOUSE_MOTION
* SDL_MOUSEWHEEL => SDL_EVENT_MOUSE_WHEEL
* SDL_POLLSENTINEL => SDL_EVENT_POLL_SENTINEL
* SDL_QUIT => SDL_EVENT_QUIT
* SDL_RENDER_DEVICE_RESET => SDL_EVENT_RENDER_DEVICE_RESET
* SDL_RENDER_TARGETS_RESET => SDL_EVENT_RENDER_TARGETS_RESET
* SDL_SENSORUPDATE => SDL_EVENT_SENSOR_UPDATE
* SDL_SYSWMEVENT => SDL_EVENT_SYSWM
* SDL_TEXTEDITING => SDL_EVENT_TEXT_EDITING
* SDL_TEXTEDITING_EXT => SDL_EVENT_TEXT_EDITING_EXT
* SDL_TEXTINPUT => SDL_EVENT_TEXT_INPUT
* SDL_USEREVENT => SDL_EVENT_USER
The following structures have been renamed:
* SDL_ControllerAxisEvent => SDL_GamepadAxisEvent
@ -126,11 +200,11 @@ The following functions have been removed:
SDL_gamecontroller.h has been renamed SDL_gamepad.h, and all APIs have been renamed to match.
The SDL_GAMEPADADDED event now provides the joystick instance ID in the which member of the cdevice event structure.
The SDL_EVENT_GAMEPAD_ADDED event now provides the joystick instance ID in the which member of the cdevice event structure.
The functions SDL_GetGamepads(), SDL_GetGamepadInstanceName(), SDL_GetGamepadInstancePath(), SDL_GetGamepadInstancePlayerIndex(), SDL_GetGamepadInstanceGUID(), SDL_GetGamepadInstanceVendor(), SDL_GetGamepadInstanceProduct(), SDL_GetGamepadInstanceProductVersion(), and SDL_GetGamepadInstanceType() have been added to directly query the list of available gamepads.
SDL_GameControllerGetSensorDataWithTimestamp() has been removed. If you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_GAMEPADSENSORUPDATE events.
SDL_GameControllerGetSensorDataWithTimestamp() has been removed. If you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_EVENT_GAMEPAD_SENSOR_UPDATE events.
The following enums have been renamed:
* SDL_GameControllerAxis => SDL_GamepadAxis
@ -160,8 +234,8 @@ The following functions have been renamed:
* SDL_GameControllerGetButtonFromString() => SDL_GetGamepadButtonFromString()
* SDL_GameControllerGetFirmwareVersion() => SDL_GetGamepadFirmwareVersion()
* SDL_GameControllerGetJoystick() => SDL_GetGamepadJoystick()
* SDL_GameControllerGetNumTouchpadFingers() => SDL_GetGamepadNumTouchpadFingers()
* SDL_GameControllerGetNumTouchpads() => SDL_GetGamepadNumTouchpads()
* SDL_GameControllerGetNumTouchpadFingers() => SDL_GetNumGamepadTouchpadFingers()
* SDL_GameControllerGetNumTouchpads() => SDL_GetNumGamepadTouchpads()
* SDL_GameControllerGetPlayerIndex() => SDL_GetGamepadPlayerIndex()
* SDL_GameControllerGetProduct() => SDL_GetGamepadProduct()
* SDL_GameControllerGetProductVersion() => SDL_GetGamepadProductVersion()
@ -267,10 +341,12 @@ functionality to your app and aid migration. That is located in the
SDL_AddHintCallback() now returns a standard int result instead of void, returning 0 if the function succeeds or a negative error code if there was an error.
The following hints have been removed:
* SDL_HINT_IDLE_TIMER_DISABLED (use SDL_DisableScreenSaver instead)
* SDL_HINT_VIDEO_X11_FORCE_EGL (use SDL_HINT_VIDEO_FORCE_EGL instead)
* SDL_HINT_VIDEO_X11_XINERAMA (Xinerama no longer supported by the X11 backend)
* SDL_HINT_VIDEO_X11_XVIDMODE (Xvidmode no longer supported by the X11 backend)
* SDL_HINT_IDLE_TIMER_DISABLED - use SDL_DisableScreenSaver instead
* SDL_HINT_MOUSE_RELATIVE_SCALING - mouse coordinates are no longer automatically scaled by the SDL renderer
* SDL_HINT_RENDER_LOGICAL_SIZE_MODE - the logical size mode is explicitly set with SDL_SetRenderLogicalPresentation()
* SDL_HINT_VIDEO_X11_FORCE_EGL - use SDL_HINT_VIDEO_FORCE_EGL instead
* SDL_HINT_VIDEO_X11_XINERAMA - Xinerama no longer supported by the X11 backend
* SDL_HINT_VIDEO_X11_XVIDMODE - Xvidmode no longer supported by the X11 backend
* Renamed hints SDL_HINT_VIDEODRIVER and SDL_HINT_AUDIODRIVER to SDL_HINT_VIDEO_DRIVER and SDL_HINT_AUDIO_DRIVER
* Renamed environment variables SDL_VIDEODRIVER and SDL_AUDIODRIVER to SDL_VIDEO_DRIVER and SDL_AUDIO_DRIVER
@ -280,6 +356,9 @@ The following hints have been removed:
The following symbols have been renamed:
* SDL_INIT_GAMECONTROLLER => SDL_INIT_GAMEPAD
The following symbols have been removed:
* SDL_INIT_NOPARACHUTE
## SDL_joystick.h
SDL_JoystickID has changed from Sint32 to Uint32, with an invalid ID being 0.
@ -306,7 +385,7 @@ Rather than iterating over joysticks using device index, there is a new function
}
```
The SDL_JOYDEVICEADDED event now provides the joystick instance ID in the `which` member of the jdevice event structure.
The SDL_EVENT_JOYSTICK_ADDED event now provides the joystick instance ID in the `which` member of the jdevice event structure.
The functions SDL_GetJoysticks(), SDL_GetJoystickInstanceName(), SDL_GetJoystickInstancePath(), SDL_GetJoystickInstancePlayerIndex(), SDL_GetJoystickInstanceGUID(), SDL_GetJoystickInstanceVendor(), SDL_GetJoystickInstanceProduct(), SDL_GetJoystickInstanceProductVersion(), and SDL_GetJoystickInstanceType() have been added to directly query the list of available joysticks.
@ -367,7 +446,7 @@ The following functions have been removed:
* SDL_JoystickGetDeviceVendor() - replaced with SDL_GetJoystickInstanceVendor()
* SDL_JoystickNameForIndex() - replaced with SDL_GetJoystickInstanceName()
* SDL_JoystickPathForIndex() - replaced with SDL_GetJoystickInstancePath()
* SDL_NumJoysticks - replaced with SDL_GetJoysticks()
* SDL_NumJoysticks() - replaced with SDL_GetJoysticks()
## SDL_keyboard.h
@ -431,6 +510,10 @@ Furthermore, the different SDL_*RunApp() functions (SDL_WinRtRunApp, SDL_GDKRunA
have been unified into just `int SDL_RunApp(int argc, char* argv[], void * reserved)` (which is also
used by additional platforms that didn't have a SDL_RunApp-like function before).
## SDL_metal.h
SDL_Metal_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place.
## SDL_mouse.h
SDL_ShowCursor() has been split into three functions: SDL_ShowCursor(), SDL_HideCursor(), and SDL_CursorVisible()
@ -452,6 +535,30 @@ The following functions have been renamed:
* SDL_MasksToPixelFormatEnum() => SDL_GetPixelFormatEnumForMasks()
* SDL_PixelFormatEnumToMasks() => SDL_GetMasksForPixelFormatEnum()
The following symbols have been renamed:
* SDL_DISPLAYEVENT_DISCONNECTED => SDL_EVENT_DISPLAY_DISCONNECTED
* SDL_DISPLAYEVENT_MOVED => SDL_EVENT_DISPLAY_MOVED
* SDL_DISPLAYEVENT_ORIENTATION => SDL_EVENT_DISPLAY_ORIENTATION
* SDL_WINDOWEVENT_CLOSE => SDL_EVENT_WINDOW_CLOSE_REQUESTED
* SDL_WINDOWEVENT_DISPLAY_CHANGED => SDL_EVENT_WINDOW_DISPLAY_CHANGED
* SDL_WINDOWEVENT_ENTER => SDL_EVENT_WINDOW_ENTER
* SDL_WINDOWEVENT_EXPOSED => SDL_EVENT_WINDOW_EXPOSED
* SDL_WINDOWEVENT_FOCUS_GAINED => SDL_EVENT_WINDOW_FOCUS_GAINED
* SDL_WINDOWEVENT_FOCUS_LOST => SDL_EVENT_WINDOW_FOCUS_LOST
* SDL_WINDOWEVENT_HIDDEN => SDL_EVENT_WINDOW_HIDDEN
* SDL_WINDOWEVENT_HIT_TEST => SDL_EVENT_WINDOW_HIT_TEST
* SDL_WINDOWEVENT_ICCPROF_CHANGED => SDL_EVENT_WINDOW_ICCPROF_CHANGED
* SDL_WINDOWEVENT_LEAVE => SDL_EVENT_WINDOW_LEAVE
* SDL_WINDOWEVENT_MAXIMIZED => SDL_EVENT_WINDOW_MAXIMIZED
* SDL_WINDOWEVENT_MINIMIZED => SDL_EVENT_WINDOW_MINIMIZED
* SDL_WINDOWEVENT_MOVED => SDL_EVENT_WINDOW_MOVED
* SDL_WINDOWEVENT_RESIZED => SDL_EVENT_WINDOW_RESIZED
* SDL_WINDOWEVENT_RESTORED => SDL_EVENT_WINDOW_RESTORED
* SDL_WINDOWEVENT_SHOWN => SDL_EVENT_WINDOW_SHOWN
* SDL_WINDOWEVENT_SIZE_CHANGED => SDL_EVENT_WINDOW_SIZE_CHANGED
* SDL_WINDOWEVENT_TAKE_FOCUS => SDL_EVENT_WINDOW_TAKE_FOCUS
## SDL_platform.h
The preprocessor symbol `__MACOSX__` has been renamed `__MACOS__`, and `__IPHONEOS__` has been renamed `__IOS__`
@ -489,46 +596,68 @@ which index is the "opengl" or whatnot driver, you can just pass that string dir
here, now. Passing NULL is the same as passing -1 here in SDL2, to signify you want SDL
to decide for you.
SDL_RenderWindowToLogical() and SDL_RenderLogicalToWindow() take floating point coordinates in both directions.
When a renderer is created, it will automatically set the logical size to the size of
the window in screen coordinates. For high DPI displays, this will set up scaling from
window coordinates to pixels. You can disable this scaling with:
```c
SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_SCALEMODE_NEAREST);
```
Mouse and touch events are no longer filtered to change their coordinates, instead you
can call SDL_ConvertEventToRenderCoordinates() to explicitly map event coordinates into
the rendering viewport.
SDL_RenderWindowToLogical() and SDL_RenderLogicalToWindow() have been renamed SDL_RenderCoordinatesFromWindow() and SDL_RenderCoordinatesToWindow() and take floating point coordinates in both directions.
The viewport, clipping state, and scale for render targets are now persistent and will remain set whenever they are active.
The following functions have been renamed:
* SDL_GetRendererOutputSize() => SDL_GetCurrentRenderOutputSize()
* SDL_RenderCopy() => SDL_RenderTexture()
* SDL_RenderCopyEx() => SDL_RenderTextureRotated()
* SDL_RenderCopyExF() => SDL_RenderTextureRotated()
* SDL_RenderCopyF() => SDL_RenderTexture()
* SDL_RenderDrawLine() => SDL_RenderLine()
* SDL_RenderDrawLineF() => SDL_RenderLine()
* SDL_RenderDrawLines() => SDL_RenderLines()
* SDL_RenderDrawLinesF() => SDL_RenderLines()
* SDL_RenderDrawPoint() => SDL_RenderPoint()
* SDL_RenderDrawPointF() => SDL_RenderPoint()
* SDL_RenderDrawPoints() => SDL_RenderPoints()
* SDL_RenderDrawPointsF() => SDL_RenderPoints()
* SDL_RenderDrawRect() => SDL_RenderRect()
* SDL_RenderDrawRectF() => SDL_RenderRect()
* SDL_RenderDrawRects() => SDL_RenderRects()
* SDL_RenderDrawRectsF() => SDL_RenderRects()
* SDL_RenderFillRectF() => SDL_RenderFillRect()
* SDL_RenderFillRectsF() => SDL_RenderFillRects()
* SDL_RenderGetClipRect() => SDL_GetRenderClipRect()
* SDL_RenderGetIntegerScale() => SDL_GetRenderIntegerScale()
* SDL_RenderGetLogicalSize() => SDL_GetRenderLogicalSize()
* SDL_RenderGetLogicalSize() => SDL_GetRenderLogicalPresentation()
* SDL_RenderGetMetalCommandEncoder() => SDL_GetRenderMetalCommandEncoder()
* SDL_RenderGetMetalLayer() => SDL_GetRenderMetalLayer()
* SDL_RenderGetScale() => SDL_GetRenderScale()
* SDL_RenderGetViewport() => SDL_GetRenderViewport()
* SDL_RenderGetWindow() => SDL_GetRenderWindow()
* SDL_RenderIsClipEnabled() => SDL_RenderClipEnabled()
* SDL_RenderLogicalToWindow() => SDL_RenderCoordinatesToWindow()
* SDL_RenderSetClipRect() => SDL_SetRenderClipRect()
* SDL_RenderSetIntegerScale() => SDL_SetRenderIntegerScale()
* SDL_RenderSetLogicalSize() => SDL_SetRenderLogicalSize()
* SDL_RenderSetLogicalSize() => SDL_SetRenderLogicalPresentation()
* SDL_RenderSetScale() => SDL_SetRenderScale()
* SDL_RenderSetVSync() => SDL_SetRenderVSync()
* SDL_RenderSetViewport() => SDL_SetRenderViewport()
* SDL_RenderWindowToLogical() => SDL_RenderCoordinatesFromWindow()
The following functions have been removed:
* SDL_RenderCopy()
* SDL_RenderCopyEx()
* SDL_RenderDrawLine()
* SDL_RenderDrawLines()
* SDL_RenderDrawPoint()
* SDL_RenderDrawPoints()
* SDL_RenderDrawRect()
* SDL_RenderDrawRects()
* SDL_RenderFillRect()
* SDL_RenderFillRects()
* SDL_RenderGetIntegerScale()
* SDL_RenderSetIntegerScale() - this is now explicit with SDL_LOGICAL_PRESENTATION_INTEGER_SCALE
* SDL_RenderTargetSupported() - render targets are always supported
The following symbols have been renamed:
* SDL_ScaleModeBest => SDL_SCALEMODE_BEST
* SDL_ScaleModeLinear => SDL_SCALEMODE_LINEAR
* SDL_ScaleModeNearest => SDL_SCALEMODE_NEAREST
## SDL_rwops.h
@ -717,7 +846,7 @@ Rather than iterating over sensors using device index, there is a new function S
}
```
Removed SDL_SensorGetDataWithTimestamp(), if you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_SENSORUPDATE events.
Removed SDL_SensorGetDataWithTimestamp(), if you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_EVENT_SENSOR_UPDATE events.
The following functions have been renamed:
@ -807,6 +936,8 @@ The following functions have been renamed:
## SDL_system.h
SDL_AndroidGetExternalStorageState() takes the state as an output parameter and returns 0 if the function succeeds or a negative error code if there was an error.
The following functions have been renamed:
* SDL_RenderGetD3D11Device() => SDL_GetRenderD3D11Device()
* SDL_RenderGetD3D9Device() => SDL_GetRenderD3D9Device()
@ -844,6 +975,10 @@ If you were using this macro for other things besides SDL ticks values, you can
#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
```
## SDL_touch.h
SDL_GetNumTouchFingers() returns a negative error code if there was an error.
## SDL_version.h
SDL_GetRevisionNumber() has been removed from the API, it always returned 0 in SDL 2.0.
@ -851,12 +986,61 @@ SDL_GetRevisionNumber() has been removed from the API, it always returned 0 in S
## SDL_video.h
SDL_VideoInit() and SDL_VideoQuit() have been removed. Instead you can call SDL_InitSubSytem() and SDL_QuitSubSytem() with SDL_INIT_VIDEO, which will properly refcount the subsystems. You can choose a specific audio driver using SDL_VIDEO_DRIVER hint.
SDL_VideoInit() and SDL_VideoQuit() have been removed. Instead you can call SDL_InitSubSytem() and SDL_QuitSubSytem() with SDL_INIT_VIDEO, which will properly refcount the subsystems. You can choose a specific video driver using SDL_VIDEO_DRIVER hint.
'SDL_WINDOW_SHOW' flag has been removed. Windows are shown by default and can be created hidden by using the SDL_WINDOW_HIDDEN flag.
Rather than iterating over displays using display index, there is a new function SDL_GetDisplays() to get the current list of displays, and functions which used to take a display index now take SDL_DisplayID, with an invalid ID being 0.
```c
{
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == 0) {
int i, num_displays = 0;
SDL_DisplayID *displays = SDL_GetDisplays(&num_displays);
if (displays) {
for (i = 0; i < num_displays; ++i) {
SDL_DisplayID instance_id = displays[i];
const char *name = SDL_GetDisplayName(instance_id);
SDL_Log("Display %" SDL_PRIu32 ": %s\n", instance_id, name ? name : "Unknown");
}
SDL_free(displays);
}
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
}
```
The SDL_WINDOWPOS_UNDEFINED_DISPLAY() and SDL_WINDOWPOS_CENTERED_DISPLAY() macros take a display ID instead of display index. The display ID 0 has a special meaning in this case, and is used to indicate the primary display.
The SDL_WINDOW_SHOWN flag has been removed. Windows are shown by default and can be created hidden by using the SDL_WINDOW_HIDDEN flag.
The SDL_WINDOW_ALLOW_HIGHDPI flag has been removed. Windows are automatically high DPI aware and their coordinates are in screen space, which may differ from physical pixels on displays using display scaling.
SDL_DisplayMode now includes the pixel size, the screen size and the relationship between the two. For example, a 4K display at 200% scale could have a pixel size of 3840x2160, a screen size of 1920x1080, and a display scale of 2.0.
The refresh rate in SDL_DisplayMode is now a float.
Rather than iterating over display modes using an index, there is a new function SDL_GetFullscreenDisplayModes() to get the list of available fullscreen modes on a display.
```c
{
SDL_DisplayID display = SDL_GetPrimaryDisplay();
int num_modes = 0;
SDL_DisplayMode **modes = SDL_GetFullscreenDisplayModes(display, &num_modes);
if (modes) {
for (i = 0; i < num_modes; ++i) {
SDL_DisplayMode *mode = modes[i];
SDL_Log("Display %" SDL_PRIu32 " mode %d: %dx%d@%gHz, %d%% scale\n",
display, i, mode->pixel_w, mode->pixel_h, mode->refresh_rate, (int)(mode->display_scale * 100.0f));
}
SDL_free(modes);
}
}
```
SDL_GetDesktopDisplayMode() and SDL_GetCurrentDisplayMode() return pointers to display modes rather than filling in application memory.
Windows now have an explicit fullscreen mode that is set, using SDL_SetWindowFullscreenMode(). The fullscreen mode for a window can be queried with SDL_GetWindowFullscreenMode(), which returns a pointer to the mode, or NULL if the window will be fullscreen desktop. SDL_SetWindowFullscreen() just takes a boolean value, setting the correct fullscreen state based on the selected mode.
SDL_WINDOW_FULLSCREEN_DESKTOP has been removed, and you can call SDL_GetWindowFullscreenMode() to see whether an exclusive fullscreen mode will be used or the fullscreen desktop mode will be used when the window is fullscreen.
SDL_SetWindowBrightness and SDL_SetWindowGammaRamp have been removed from the API, because they interact poorly with modern operating systems and aren't able to limit their effects to the SDL window.
Programs which have access to shaders can implement more robust versions of those functions using custom shader code rendered as a post-process effect.
@ -869,12 +1053,27 @@ SDL_GL_SwapWindow() returns 0 if the function succeeds or a negative error code
SDL_GL_GetSwapInterval() takes the interval as an output parameter and returns 0 if the function succeeds or a negative error code if there was an error.
SDL_GL_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place.
The following functions have been renamed:
* SDL_GetPointDisplayIndex() => SDL_GetDisplayIndexForPoint()
* SDL_GetRectDisplayIndex() => SDL_GetDisplayIndexForRect()
* SDL_GetClosestDisplayMode() => SDL_GetClosestFullscreenDisplayMode()
* SDL_GetPointDisplayIndex() => SDL_GetDisplayForPoint()
* SDL_GetRectDisplayIndex() => SDL_GetDisplayForRect()
* SDL_GetWindowDisplayIndex() => SDL_GetDisplayForWindow()
* SDL_GetWindowDisplayMode() => SDL_GetWindowFullscreenMode()
* SDL_SetWindowDisplayMode() => SDL_SetWindowFullscreenMode()
The following functions have been removed:
* SDL_GetClosestFullscreenDisplayMode()
* SDL_GetDisplayDPI() - not reliable across platforms, approximately replaced by multiplying `display_scale` in the structure returned by SDL_GetDesktopDisplayMode() times 160 on iPhone and Android, and 96 on other platforms.
* SDL_GetDisplayMode()
* SDL_GetNumDisplayModes() - replaced with SDL_GetFullscreenDisplayModes()
* SDL_GetNumVideoDisplays() - replaced with SDL_GetDisplays()
SDL_Window id type is named SDL_WindowID
The following symbols have been renamed:
* SDL_WINDOW_INPUT_GRABBED => SDL_WINDOW_MOUSE_GRABBED
## SDL_vulkan.h
@ -882,3 +1081,5 @@ SDL_Vulkan_GetInstanceExtensions() no longer takes a window parameter.
SDL_Vulkan_GetVkGetInstanceProcAddr() now returns `SDL_FunctionPointer` instead of `void *`, and should be cast to PFN_vkGetInstanceProcAddr.
SDL_Vulkan_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place.

View file

@ -127,7 +127,7 @@ 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
If you notice there's no SDL_EVENT_TEXT_INPUT message being emitted, double check that
your app has read access to one of the following:
* /proc/self/fd/0

View file

@ -17,7 +17,7 @@ Unfortunately there is no windows support as of yet. Support for Windows 7 is pl
===========================================================================
Events
===========================================================================
SDL_FINGERDOWN:
SDL_EVENT_FINGER_DOWN:
Sent when a finger (or stylus) is placed on a touch device.
Fields:
* event.tfinger.touchId - the Id of the touch device.
@ -26,17 +26,17 @@ Fields:
* event.tfinger.y - the y coordinate of the touch (0..1)
* event.tfinger.pressure - the pressure of the touch (0..1)
SDL_FINGERMOTION:
SDL_EVENT_FINGER_MOTION:
Sent when a finger (or stylus) is moved on the touch device.
Fields:
Same as SDL_FINGERDOWN but with additional:
Same as SDL_EVENT_FINGER_DOWN 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:
SDL_EVENT_FINGER_UP:
Sent when a finger (or stylus) is lifted from the touch device.
Fields:
Same as SDL_FINGERDOWN.
Same as SDL_EVENT_FINGER_DOWN.
===========================================================================
@ -66,7 +66,7 @@ The most common reason to access SDL_Finger is to query the fingers outside the
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.
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_EVENT_FINGER_UP event is _added_ to the event queue, and thus _before_ the SDL_EVENT_FINGER_UP event is polled.
As a result, be very careful to check for NULL return values.
A SDL_Finger has the following fields:

View file

@ -333,23 +333,20 @@ your project, and open the file in Visual C++'s text editor.
int main(int argc, char **argv)
{
SDL_DisplayMode mode;
SDL_Window * window = NULL;
SDL_Renderer * renderer = NULL;
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) {
} else if (SDL_CreateWindowAndRenderer(0, 0, 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)) {
if ((evt.type == SDL_EVENT_KEY_DOWN) && (evt.key.keysym.sym == SDLK_ESCAPE)) {
keep_going = SDL_FALSE;
}
}

View file

@ -51,6 +51,9 @@ assert can have unique static variables associated with it.
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
#elif defined(ANDROID)
#include <assert.h>
#define SDL_TriggerBreakpoint() assert(0)
#elif SDL_HAS_BUILTIN(__builtin_debugtrap)
#define SDL_TriggerBreakpoint() __builtin_debugtrap()
#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
@ -127,19 +130,30 @@ typedef struct SDL_AssertData
#if (SDL_ASSERT_LEVEL > 0)
/* Never call this directly. Use the SDL_assert* macros. */
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
const char *,
const char *, int)
/**
* Never call this directly. Use the SDL_assert* macros.
*
* \param data assert data structure
* \param func function name
* \param file file name
* \param line line number
* \returns assert state
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data,
const char *func,
const char *file, int line)
#if defined(__clang__)
#if __has_feature(attribute_analyzer_noreturn)
/* this tells Clang's static analysis that we're a custom assert function,
and that the analyzer should assume the condition was always true past this
SDL_assert test. */
__attribute__((analyzer_noreturn))
#endif
#endif
;
/* Previous 'analyzer_noreturn' attribute tells Clang's static analysis that we're a custom assert function,
and that the analyzer should assume the condition was always true past this
SDL_assert test. */
/* the do {} while(0) avoids dangling else problems:
if (x) SDL_assert(y); else blah();

View file

@ -186,6 +186,10 @@ extern __inline void SDL_CompilerBarrier(void);
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
/*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
@ -244,14 +248,15 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory")
#elif (defined(__powerpc__) || defined(__powerpc64__))
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27");
#elif (defined(__riscv) && __riscv_xlen == 64)
#define SDL_CPUPauseInstruction() __asm__ __volatile__(".insn i 0x0F, 0, x0, x0, 0x010");
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
#define SDL_CPUPauseInstruction() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
#define SDL_CPUPauseInstruction() __yield()
#elif defined(__WATCOMC__) && defined(__386__)
/* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes. */
extern __inline void SDL_CPUPauseInstruction(void);
#pragma aux SDL_CPUPauseInstruction = "db 0f3h,90h"
#pragma aux SDL_CPUPauseInstruction = ".686p" ".xmm2" "pause"
#else
#define SDL_CPUPauseInstruction()
#endif

View file

@ -191,59 +191,6 @@ typedef struct SDL_AudioSpec
} SDL_AudioSpec;
struct SDL_AudioCVT;
typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
SDL_AudioFormat format);
/**
* \brief 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.
*/
#define SDL_AUDIOCVT_MAX_FILTERS 9
/**
* \struct SDL_AudioCVT
* \brief A structure to hold a set of audio conversion filters and buffers.
*
* Note that various parts of the conversion pipeline can take advantage
* of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
* you to pass it aligned data, but can possibly run much faster if you
* set both its (buf) field to a pointer that is aligned to 16 bytes, and its
* (len) field to something that's a multiple of 16, if possible.
*/
#if defined(__GNUC__) && !defined(__CHERI_PURE_CAPABILITY__)
/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
pad it out to 88 bytes to guarantee ABI compatibility between compilers.
This is not a concern on CHERI architectures, where pointers must be stored
at aligned locations otherwise they will become invalid, and thus structs
containing pointers cannot be packed without giving a warning or error.
vvv
The next time we rev the ABI, make sure to size the ints and add padding.
*/
#define SDL_AUDIOCVT_PACKED __attribute__((packed))
#else
#define SDL_AUDIOCVT_PACKED
#endif
/* */
typedef struct SDL_AudioCVT
{
int needed; /**< Set to 1 if conversion possible */
SDL_AudioFormat src_format; /**< Source audio format */
SDL_AudioFormat dst_format; /**< Target audio format */
double rate_incr; /**< Rate conversion increment */
Uint8 *buf; /**< Buffer to hold entire audio data */
int len; /**< Length of original audio buffer */
int len_cvt; /**< Length of converted audio buffer */
int len_mult; /**< buffer must be len*len_mult big */
double len_ratio; /**< Given len, final size is len*len_ratio */
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
int filter_index; /**< Current audio conversion function */
} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
/* Function prototypes */
/**
@ -409,7 +356,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
* \param iscapture non-zero to query the list of recording devices, zero to
* query the list of output devices.
* \param spec The SDL_AudioSpec to be initialized by this function.
* \returns 0 on success, nonzero on error
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -443,7 +391,8 @@ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
* \param spec The SDL_AudioSpec to be initialized by this function.
* \param iscapture non-zero to query the default recording device, zero to
* query the default output device.
* \returns 0 on success, nonzero on error
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -460,8 +409,8 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name,
* Open a specific audio device.
*
* Passing in a `device` name of NULL requests the most reasonable default.
* The `device` name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
* some drivers allow arbitrary and driver-specific strings, such as a
* The `device` name is a UTF-8 string reported by SDL_GetAudioDeviceName(),
* but some drivers allow arbitrary and driver-specific strings, such as a
* hostname/IP address for a remote audio server, or a filename in the
* diskaudio driver.
*
@ -598,46 +547,49 @@ extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDevice
/**
* Use this function to play audio on a specified device.
*
* Newly-opened audio devices start in the paused state, so you must
* call this function after opening the specified audio
* device to start playing sound. This allows you to safely initialize data
* for your callback function after opening the audio device. Silence will be
* written to the audio device while paused, and the audio callback is
* guaranteed to not be called. Pausing one device does not prevent other
* unpaused devices from running their callbacks.
* Newly-opened audio devices start in the paused state, so you must call this
* function after opening the specified audio device to start playing sound.
* This allows you to safely initialize data for your callback function after
* opening the audio device. Silence will be written to the audio device while
* paused, and the audio callback is guaranteed to not be called. Pausing one
* device does not prevent other unpaused devices from running their
* callbacks.
*
* \param dev a device opened by SDL_OpenAudioDevice()
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_LockAudioDevice
* \sa SDL_PauseAudioDevice
*/
extern DECLSPEC void SDLCALL SDL_PlayAudioDevice(SDL_AudioDeviceID dev);
extern DECLSPEC int SDLCALL SDL_PlayAudioDevice(SDL_AudioDeviceID dev);
/**
* Use this function to pause audio playback on a specified device.
*
* This function pauses the audio callback processing for a given
* device. Silence will be written to the audio device while paused, and
* the audio callback is guaranteed to not be called.
* Pausing one device does not prevent other unpaused devices from running
* their callbacks.
* This function pauses the audio callback processing for a given device.
* Silence will be written to the audio device while paused, and the audio
* callback is guaranteed to not be called. Pausing one device does not
* prevent other unpaused devices from running their callbacks.
*
* If you just need to protect a few variables from race conditions vs your
* callback, you shouldn't pause the audio device, as it will lead to dropouts
* in the audio playback. Instead, you should use SDL_LockAudioDevice().
*
* \param dev a device opened by SDL_OpenAudioDevice()
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_LockAudioDevice
* \sa SDL_PlayAudioDevice
*/
extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
extern DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
/**
@ -734,85 +686,6 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
/**
* Initialize an SDL_AudioCVT structure for conversion.
*
* Before an SDL_AudioCVT structure can be used to convert audio data it must
* be initialized with source and destination information.
*
* This function will zero out every field of the SDL_AudioCVT, so it must be
* called before the application fills in the final buffer information.
*
* Once this function has returned successfully, and reported that a
* conversion is necessary, the application fills in the rest of the fields in
* SDL_AudioCVT, now that it knows how large a buffer it needs to allocate,
* and then can call SDL_ConvertAudio() to complete the conversion.
*
* \param cvt an SDL_AudioCVT structure filled in with audio conversion
* information
* \param src_format the source format of the audio data; for more info see
* SDL_AudioFormat
* \param src_channels the number of channels in the source
* \param src_rate the frequency (sample-frames-per-second) of the source
* \param dst_format the destination format of the audio data; for more info
* see SDL_AudioFormat
* \param dst_channels the number of channels in the destination
* \param dst_rate the frequency (sample-frames-per-second) of the destination
* \returns 1 if the audio filter is prepared, 0 if no conversion is needed,
* or a negative error code on failure; call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_ConvertAudio
*/
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
SDL_AudioFormat src_format,
Uint8 src_channels,
int src_rate,
SDL_AudioFormat dst_format,
Uint8 dst_channels,
int dst_rate);
/**
* Convert audio data to a desired audio format.
*
* This function does the actual audio data conversion, after the application
* has called SDL_BuildAudioCVT() to prepare the conversion information and
* then filled in the buffer details.
*
* Once the application has initialized the `cvt` structure using
* SDL_BuildAudioCVT(), allocated an audio buffer and filled it with audio
* data in the source format, this function will convert the buffer, in-place,
* to the desired format.
*
* The data conversion may go through several passes; any given pass may
* possibly temporarily increase the size of the data. For example, SDL might
* expand 16-bit data to 32 bits before resampling to a lower frequency,
* shrinking the data size after having grown it briefly. Since the supplied
* buffer will be both the source and destination, converting as necessary
* in-place, the application must allocate a buffer that will fully contain
* the data during its largest conversion pass. After SDL_BuildAudioCVT()
* returns, the application should set the `cvt->len` field to the size, in
* bytes, of the source data, and allocate a buffer that is `cvt->len *
* cvt->len_mult` bytes long for the `buf` field.
*
* The source data should be copied into this buffer before the call to
* SDL_ConvertAudio(). Upon successful return, this buffer will contain the
* converted audio, and `cvt->len_cvt` will be the size of the converted data,
* in bytes. Any bytes in the buffer past `cvt->len_cvt` are undefined once
* this function returns.
*
* \param cvt an SDL_AudioCVT structure that was previously set up by
* SDL_BuildAudioCVT().
* \returns 0 if the conversion was completed successfully or a negative error
* code on failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_BuildAudioCVT
*/
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
/* SDL_AudioStream is a new audio conversion interface.
The benefits vs SDL_AudioCVT:
@ -858,7 +731,8 @@ extern DECLSPEC SDL_AudioStream *SDLCALL SDL_CreateAudioStream(SDL_AudioFormat s
* \param stream The stream the audio data is being added to
* \param buf A pointer to the audio data to add
* \param len The number of bytes to write to the stream
* \returns 0 on success, or -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -897,6 +771,9 @@ extern DECLSPEC int SDLCALL SDL_GetAudioStreamData(SDL_AudioStream *stream, void
* resample correctly, so this number might be lower than what you expect, or
* even be zero. Add more data or flush the stream if you need the data now.
*
* \param stream The audio stream to query
* \returns the number of converted/resampled bytes available.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_CreateAudioStream
@ -916,6 +793,10 @@ extern DECLSPEC int SDLCALL SDL_GetAudioStreamAvailable(SDL_AudioStream *stream)
* audio gaps in the output. Generally this is intended to signal the end of
* input, so the complete output becomes available.
*
* \param stream The audio stream to flush
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_CreateAudioStream
@ -930,6 +811,10 @@ extern DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
/**
* Clear any pending data in the stream without converting it
*
* \param stream The audio stream to clear
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_CreateAudioStream
@ -939,11 +824,12 @@ extern DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
* \sa SDL_FlushAudioStream
* \sa SDL_DestroyAudioStream
*/
extern DECLSPEC void SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
extern DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
/**
* Free an audio stream
*
* \param stream The audio stream to free
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_CreateAudioStream
@ -984,10 +870,12 @@ extern DECLSPEC void SDLCALL SDL_DestroyAudioStream(SDL_AudioStream *stream);
* \param len the length of the audio buffer in bytes
* \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
* for full audio volume
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
extern DECLSPEC int SDLCALL SDL_MixAudioFormat(Uint8 * dst,
const Uint8 * src,
SDL_AudioFormat format,
Uint32 len, int volume);
@ -1147,6 +1035,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
* This function always succeeds and thus returns void.
*
* \param dev the device ID of which to clear the audio queue
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1154,7 +1044,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
* \sa SDL_QueueAudio
* \sa SDL_DequeueAudio
*/
extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
extern DECLSPEC int SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
/**
@ -1199,12 +1089,14 @@ extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
* thread.
*
* \param dev the ID of the device to be locked
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_UnlockAudioDevice
*/
extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
extern DECLSPEC int SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
/**
* Use this function to unlock the audio callback function for a specified
@ -1245,6 +1137,38 @@ extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
*/
extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
/**
* Convert some audio data of one format to another format.
*
* \param src_format The format of the source audio
* \param src_channels The number of channels of the source audio
* \param src_rate The sampling rate of the source audio
* \param src_data The audio data to be converted
* \param src_len The len of src_data
* \param dst_format The format of the desired audio output
* \param dst_channels The number of channels of the desired audio output
* \param dst_rate The sampling rate of the desired audio output
* \param dst_data Will be filled with a pointer to converted audio data,
* which should be freed with SDL_free(). On error, it will be NULL.
* \param dst_len Will be filled with the len of dst_data
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_CreateAudioStream
*/
extern DECLSPEC int SDLCALL SDL_ConvertAudioSamples(SDL_AudioFormat src_format,
Uint8 src_channels,
int src_rate,
const Uint8 *src_data,
int src_len,
SDL_AudioFormat dst_format,
Uint8 dst_channels,
int dst_rate,
Uint8 **dst_data,
int *dst_len);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}

View file

@ -170,12 +170,12 @@
#endif /* SDL_FALLTHROUGH not defined */
#ifndef SDL_MALLOC
#if defined(__GNUC__)
#if defined(__GNUC__) && (__GNUC__ >= 3)
#define SDL_MALLOC __attribute__((malloc))
/* FIXME
/** FIXME
#elif defined(_MSC_VER)
#define SDL_MALLOC __declspec(allocator) __desclspec(restrict)
*/
**/
#else
#define SDL_MALLOC
#endif

View file

@ -27,6 +27,8 @@
#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#if defined(__vita__) || defined(__psp2__)
#include <psp2/display.h>
#include <psp2/gxm.h>
#include <psp2/types.h>
#endif

View file

@ -148,7 +148,14 @@ typedef enum
SDL_UNSUPPORTED,
SDL_LASTERROR
} SDL_errorcode;
/* SDL_Error() unconditionally returns -1. */
/**
* SDL_Error()
*
* \param code Error code
* \returns unconditionally -1.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
/* @} *//* Internal error functions */

View file

@ -54,153 +54,147 @@ extern "C" {
*/
typedef enum
{
SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
SDL_EVENT_FIRST = 0, /**< Unused (do not remove) */
/* Application events */
SDL_QUIT = 0x100, /**< User-requested quit */
SDL_EVENT_QUIT = 0x100, /**< User-requested quit */
/* These application events have special meaning on iOS, see README-ios.md for details */
SDL_APP_TERMINATING, /**< The application is being terminated by the OS
SDL_EVENT_TERMINATING, /**< The application is being terminated by the OS
Called on iOS in applicationWillTerminate()
Called on Android in onDestroy()
*/
SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
SDL_EVENT_LOW_MEMORY, /**< The application is low on memory, free memory if possible.
Called on iOS in applicationDidReceiveMemoryWarning()
Called on Android in onLowMemory()
*/
SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
SDL_EVENT_WILL_ENTER_BACKGROUND, /**< The application is about to enter the background
Called on iOS in applicationWillResignActive()
Called on Android in onPause()
*/
SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
SDL_EVENT_DID_ENTER_BACKGROUND, /**< The application did enter the background and may not get CPU for some time
Called on iOS in applicationDidEnterBackground()
Called on Android in onPause()
*/
SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
SDL_EVENT_WILL_ENTER_FOREGROUND, /**< The application is about to enter the foreground
Called on iOS in applicationWillEnterForeground()
Called on Android in onResume()
*/
SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
SDL_EVENT_DID_ENTER_FOREGROUND, /**< The application is now interactive
Called on iOS in applicationDidBecomeActive()
Called on Android in onResume()
*/
SDL_LOCALECHANGED, /**< The user's locale preferences have changed. */
SDL_EVENT_LOCALE_CHANGED, /**< The user's locale preferences have changed. */
/* Display events */
/* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
SDL_DISPLAYEVENT_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
SDL_DISPLAYEVENT_CONNECTED, /**< Display has been added to the system */
SDL_DISPLAYEVENT_DISCONNECTED, /**< Display has been removed from the system */
SDL_DISPLAYEVENT_MOVED, /**< Display has changed position */
SDL_DISPLAYEVENT_FIRST = SDL_DISPLAYEVENT_ORIENTATION,
SDL_DISPLAYEVENT_LAST = SDL_DISPLAYEVENT_DISCONNECTED,
SDL_EVENT_DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
SDL_EVENT_DISPLAY_CONNECTED, /**< Display has been added to the system */
SDL_EVENT_DISPLAY_DISCONNECTED, /**< Display has been removed from the system */
SDL_EVENT_DISPLAY_MOVED, /**< Display has changed position */
SDL_EVENT_DISPLAY_FIRST = SDL_EVENT_DISPLAY_ORIENTATION,
SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_DISCONNECTED,
/* Window events */
/* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
SDL_SYSWMEVENT = 0x201, /**< System specific event */
SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
redrawn */
SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
*/
SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */
SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as
a result of an API call or through the
system or user changing the window size. */
SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
and position */
SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */
SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
SDL_WINDOWEVENT_HIT_TEST, /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
SDL_WINDOWEVENT_ICCPROF_CHANGED,/**< The ICC profile of the window's display has changed. */
SDL_WINDOWEVENT_DISPLAY_CHANGED,/**< Window has been moved to display data1. */
SDL_WINDOWEVENT_FIRST = SDL_WINDOWEVENT_SHOWN,
SDL_WINDOWEVENT_LAST = SDL_WINDOWEVENT_DISPLAY_CHANGED,
SDL_EVENT_SYSWM = 0x201, /**< System specific event */
SDL_EVENT_WINDOW_SHOWN, /**< Window has been shown */
SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn */
SDL_EVENT_WINDOW_MOVED, /**< Window has been moved to data1, data2 */
SDL_EVENT_WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */
SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED,/**< The pixel size of the window has changed to data1xdata2 */
SDL_EVENT_WINDOW_MINIMIZED, /**< Window has been minimized */
SDL_EVENT_WINDOW_MAXIMIZED, /**< Window has been maximized */
SDL_EVENT_WINDOW_RESTORED, /**< Window has been restored to normal size and position */
SDL_EVENT_WINDOW_MOUSE_ENTER, /**< Window has gained mouse focus */
SDL_EVENT_WINDOW_MOUSE_LEAVE, /**< Window has lost mouse focus */
SDL_EVENT_WINDOW_FOCUS_GAINED, /**< Window has gained keyboard focus */
SDL_EVENT_WINDOW_FOCUS_LOST, /**< Window has lost keyboard focus */
SDL_EVENT_WINDOW_CLOSE_REQUESTED, /**< The window manager requests that the window be closed */
SDL_EVENT_WINDOW_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
SDL_EVENT_WINDOW_HIT_TEST, /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL */
SDL_EVENT_WINDOW_ICCPROF_CHANGED, /**< The ICC profile of the window's display has changed */
SDL_EVENT_WINDOW_DISPLAY_CHANGED, /**< Window has been moved to display data1 */
SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN,
SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_DISPLAY_CHANGED,
/* Keyboard events */
SDL_KEYDOWN = 0x300, /**< Key pressed */
SDL_KEYUP, /**< Key released */
SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
SDL_TEXTINPUT, /**< Keyboard text input */
SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
input language or keyboard layout change.
*/
SDL_TEXTEDITING_EXT, /**< Extended keyboard text editing (composition) */
SDL_EVENT_KEY_DOWN = 0x300, /**< Key pressed */
SDL_EVENT_KEY_UP, /**< Key released */
SDL_EVENT_TEXT_EDITING, /**< Keyboard text editing (composition) */
SDL_EVENT_TEXT_INPUT, /**< Keyboard text input */
SDL_EVENT_KEYMAP_CHANGED, /**< Keymap changed due to a system event such as an
input language or keyboard layout change. */
SDL_EVENT_TEXT_EDITING_EXT, /**< Extended keyboard text editing (composition) */
/* Mouse events */
SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
SDL_MOUSEBUTTONUP, /**< Mouse button released */
SDL_MOUSEWHEEL, /**< Mouse wheel motion */
SDL_EVENT_MOUSE_MOTION = 0x400, /**< Mouse moved */
SDL_EVENT_MOUSE_BUTTON_DOWN, /**< Mouse button pressed */
SDL_EVENT_MOUSE_BUTTON_UP, /**< Mouse button released */
SDL_EVENT_MOUSE_WHEEL, /**< Mouse wheel motion */
/* Joystick events */
SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
SDL_JOYHATMOTION = 0x602, /**< Joystick hat position change */
SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
SDL_JOYBUTTONUP, /**< Joystick button released */
SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
SDL_JOYBATTERYUPDATED, /**< Joystick battery level change */
SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600, /**< Joystick axis motion */
SDL_EVENT_JOYSTICK_HAT_MOTION = 0x602, /**< Joystick hat position change */
SDL_EVENT_JOYSTICK_BUTTON_DOWN, /**< Joystick button pressed */
SDL_EVENT_JOYSTICK_BUTTON_UP, /**< Joystick button released */
SDL_EVENT_JOYSTICK_ADDED, /**< A new joystick has been inserted into the system */
SDL_EVENT_JOYSTICK_REMOVED, /**< An opened joystick has been removed */
SDL_EVENT_JOYSTICK_BATTERY_UPDATED, /**< Joystick battery level change */
/* Gamepad events */
SDL_GAMEPADAXISMOTION = 0x650, /**< Gamepad axis motion */
SDL_GAMEPADBUTTONDOWN, /**< Gamepad button pressed */
SDL_GAMEPADBUTTONUP, /**< Gamepad button released */
SDL_GAMEPADADDED, /**< A new gamepad has been inserted into the system */
SDL_GAMEPADREMOVED, /**< An opened gamepad has been removed */
SDL_GAMEPADREMAPPED, /**< The gamepad mapping was updated */
SDL_GAMEPADTOUCHPADDOWN, /**< Gamepad touchpad was touched */
SDL_GAMEPADTOUCHPADMOTION, /**< Gamepad touchpad finger was moved */
SDL_GAMEPADTOUCHPADUP, /**< Gamepad touchpad finger was lifted */
SDL_GAMEPADSENSORUPDATE, /**< Gamepad sensor was updated */
SDL_EVENT_GAMEPAD_AXIS_MOTION = 0x650, /**< Gamepad axis motion */
SDL_EVENT_GAMEPAD_BUTTON_DOWN, /**< Gamepad button pressed */
SDL_EVENT_GAMEPAD_BUTTON_UP, /**< Gamepad button released */
SDL_EVENT_GAMEPAD_ADDED, /**< A new gamepad has been inserted into the system */
SDL_EVENT_GAMEPAD_REMOVED, /**< An opened gamepad has been removed */
SDL_EVENT_GAMEPAD_REMAPPED, /**< The gamepad mapping was updated */
SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN, /**< Gamepad touchpad was touched */
SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION, /**< Gamepad touchpad finger was moved */
SDL_EVENT_GAMEPAD_TOUCHPAD_UP, /**< Gamepad touchpad finger was lifted */
SDL_EVENT_GAMEPAD_SENSOR_UPDATE, /**< Gamepad sensor was updated */
/* Touch events */
SDL_FINGERDOWN = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,
SDL_EVENT_FINGER_DOWN = 0x700,
SDL_EVENT_FINGER_UP,
SDL_EVENT_FINGER_MOTION,
/* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
/* Clipboard events */
SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard or primary selection changed */
SDL_EVENT_CLIPBOARD_UPDATE = 0x900, /**< The clipboard or primary selection changed */
/* Drag and drop events */
SDL_DROPFILE = 0x1000, /**< The system requests a file open */
SDL_DROPTEXT, /**< text/plain drag-and-drop event */
SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */
SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */
SDL_EVENT_DROP_FILE = 0x1000, /**< The system requests a file open */
SDL_EVENT_DROP_TEXT, /**< text/plain drag-and-drop event */
SDL_EVENT_DROP_BEGIN, /**< A new set of drops is beginning (NULL filename) */
SDL_EVENT_DROP_COMPLETE, /**< Current set of drops is now complete (NULL filename) */
/* Audio hotplug events */
SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
SDL_EVENT_AUDIO_DEVICE_ADDED = 0x1100, /**< A new audio device is available */
SDL_EVENT_AUDIO_DEVICE_REMOVED, /**< An audio device has been removed. */
/* Sensor events */
SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */
SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
/* Render events */
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
SDL_EVENT_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_EVENT_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
/* Internal events */
SDL_POLLSENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
SDL_EVENT_POLL_SENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
/** Events ::SDL_EVENT_USER through ::SDL_EVENT_LAST are for your use,
* and should be allocated with SDL_RegisterEvents()
*/
SDL_USEREVENT = 0x8000,
SDL_EVENT_USER = 0x8000,
/**
* This last event is only for bounding internal arrays
*/
SDL_LASTEVENT = 0xFFFF
SDL_EVENT_LAST = 0xFFFF
} SDL_EventType;
/**
@ -219,7 +213,7 @@ typedef struct SDL_DisplayEvent
{
Uint32 type; /**< ::SDL_DISPLAYEVENT_* */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
Uint32 display; /**< The associated display index */
SDL_DisplayID displayID;/**< The associated display */
Sint32 data1; /**< event dependent data */
} SDL_DisplayEvent;
@ -240,7 +234,7 @@ typedef struct SDL_WindowEvent
*/
typedef struct SDL_KeyboardEvent
{
Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
Uint32 type; /**< ::SDL_EVENT_KEY_DOWN or ::SDL_EVENT_KEY_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID;/**< The window with keyboard focus, if any */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
@ -256,7 +250,7 @@ typedef struct SDL_KeyboardEvent
*/
typedef struct SDL_TextEditingEvent
{
Uint32 type; /**< ::SDL_TEXTEDITING */
Uint32 type; /**< ::SDL_EVENT_TEXT_EDITING */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
@ -270,7 +264,7 @@ typedef struct SDL_TextEditingEvent
*/
typedef struct SDL_TextEditingExtEvent
{
Uint32 type; /**< ::SDL_TEXTEDITING_EXT */
Uint32 type; /**< ::SDL_EVENT_TEXT_EDITING_EXT */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID 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 */
@ -284,7 +278,7 @@ typedef struct SDL_TextEditingExtEvent
*/
typedef struct SDL_TextInputEvent
{
Uint32 type; /**< ::SDL_TEXTINPUT */
Uint32 type; /**< ::SDL_EVENT_TEXT_INPUT */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
@ -295,7 +289,7 @@ typedef struct SDL_TextInputEvent
*/
typedef struct SDL_MouseMotionEvent
{
Uint32 type; /**< ::SDL_MOUSEMOTION */
Uint32 type; /**< ::SDL_EVENT_MOUSE_MOTION */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID;/**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@ -311,7 +305,7 @@ typedef struct SDL_MouseMotionEvent
*/
typedef struct SDL_MouseButtonEvent
{
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
Uint32 type; /**< ::SDL_EVENT_MOUSE_BUTTON_DOWN or ::SDL_EVENT_MOUSE_BUTTON_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID;/**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@ -328,7 +322,7 @@ typedef struct SDL_MouseButtonEvent
*/
typedef struct SDL_MouseWheelEvent
{
Uint32 type; /**< ::SDL_MOUSEWHEEL */
Uint32 type; /**< ::SDL_EVENT_MOUSE_WHEEL */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID;/**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@ -344,7 +338,7 @@ typedef struct SDL_MouseWheelEvent
*/
typedef struct SDL_JoyAxisEvent
{
Uint32 type; /**< ::SDL_JOYAXISMOTION */
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_AXIS_MOTION */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */
@ -360,7 +354,7 @@ typedef struct SDL_JoyAxisEvent
*/
typedef struct SDL_JoyHatEvent
{
Uint32 type; /**< ::SDL_JOYHATMOTION */
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_HAT_MOTION */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */
@ -380,7 +374,7 @@ typedef struct SDL_JoyHatEvent
*/
typedef struct SDL_JoyButtonEvent
{
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_BUTTON_DOWN or ::SDL_EVENT_JOYSTICK_BUTTON_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */
@ -394,7 +388,7 @@ typedef struct SDL_JoyButtonEvent
*/
typedef struct SDL_JoyDeviceEvent
{
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_ADDED or ::SDL_EVENT_JOYSTICK_REMOVED */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
} SDL_JoyDeviceEvent;
@ -404,7 +398,7 @@ typedef struct SDL_JoyDeviceEvent
*/
typedef struct SDL_JoyBatteryEvent
{
Uint32 type; /**< ::SDL_JOYBATTERYUPDATED */
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_BATTERY_UPDATED */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
SDL_JoystickPowerLevel level; /**< The joystick battery level */
@ -415,7 +409,7 @@ typedef struct SDL_JoyBatteryEvent
*/
typedef struct SDL_GamepadAxisEvent
{
Uint32 type; /**< ::SDL_GAMEPADAXISMOTION */
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_AXIS_MOTION */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The gamepad axis (SDL_GamepadAxis) */
@ -432,7 +426,7 @@ typedef struct SDL_GamepadAxisEvent
*/
typedef struct SDL_GamepadButtonEvent
{
Uint32 type; /**< ::SDL_GAMEPADBUTTONDOWN or ::SDL_GAMEPADBUTTONUP */
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_BUTTON_DOWN or ::SDL_EVENT_GAMEPAD_BUTTON_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The gamepad button (SDL_GamepadButton) */
@ -447,7 +441,7 @@ typedef struct SDL_GamepadButtonEvent
*/
typedef struct SDL_GamepadDeviceEvent
{
Uint32 type; /**< ::SDL_GAMEPADADDED, ::SDL_GAMEPADREMOVED, or ::SDL_GAMEPADREMAPPED */
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_ADDED, ::SDL_EVENT_GAMEPAD_REMOVED, or ::SDL_EVENT_GAMEPAD_REMAPPED */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
} SDL_GamepadDeviceEvent;
@ -457,7 +451,7 @@ typedef struct SDL_GamepadDeviceEvent
*/
typedef struct SDL_GamepadTouchpadEvent
{
Uint32 type; /**< ::SDL_GAMEPADTOUCHPADDOWN or ::SDL_GAMEPADTOUCHPADMOTION or ::SDL_GAMEPADTOUCHPADUP */
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN or ::SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION or ::SDL_EVENT_GAMEPAD_TOUCHPAD_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Sint32 touchpad; /**< The index of the touchpad */
@ -472,7 +466,7 @@ typedef struct SDL_GamepadTouchpadEvent
*/
typedef struct SDL_GamepadSensorEvent
{
Uint32 type; /**< ::SDL_GAMEPADSENSORUPDATE */
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_SENSOR_UPDATE */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */
@ -485,7 +479,7 @@ typedef struct SDL_GamepadSensorEvent
*/
typedef struct SDL_AudioDeviceEvent
{
Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
Uint32 type; /**< ::SDL_EVENT_AUDIO_DEVICE_ADDED, or ::SDL_EVENT_AUDIO_DEVICE_REMOVED */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_AudioDeviceID 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. */
@ -500,7 +494,7 @@ typedef struct SDL_AudioDeviceEvent
*/
typedef struct SDL_TouchFingerEvent
{
Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
Uint32 type; /**< ::SDL_EVENT_FINGER_MOTION or ::SDL_EVENT_FINGER_DOWN or ::SDL_EVENT_FINGER_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId;
@ -520,7 +514,7 @@ typedef struct SDL_TouchFingerEvent
*/
typedef struct SDL_DropEvent
{
Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
Uint32 type; /**< ::SDL_EVENT_DROP_BEGIN or ::SDL_EVENT_DROP_FILE or ::SDL_EVENT_DROP_TEXT or ::SDL_EVENT_DROP_COMPLETE */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
SDL_WindowID windowID;/**< The window that was dropped on, if any */
@ -532,7 +526,7 @@ typedef struct SDL_DropEvent
*/
typedef struct SDL_SensorEvent
{
Uint32 type; /**< ::SDL_SENSORUPDATE */
Uint32 type; /**< ::SDL_EVENT_SENSOR_UPDATE */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_SensorID which; /**< The instance ID of the sensor */
float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData() */
@ -544,7 +538,7 @@ typedef struct SDL_SensorEvent
*/
typedef struct SDL_QuitEvent
{
Uint32 type; /**< ::SDL_QUIT */
Uint32 type; /**< ::SDL_EVENT_QUIT */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
} SDL_QuitEvent;
@ -553,7 +547,7 @@ typedef struct SDL_QuitEvent
*/
typedef struct SDL_OSEvent
{
Uint32 type; /**< ::SDL_QUIT */
Uint32 type; /**< ::SDL_EVENT_QUIT */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
} SDL_OSEvent;
@ -562,7 +556,7 @@ typedef struct SDL_OSEvent
*/
typedef struct SDL_UserEvent
{
Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
Uint32 type; /**< ::SDL_EVENT_USER through ::SDL_EVENT_LAST-1 */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID;/**< The associated window if any */
Sint32 code; /**< User defined event code */
@ -582,7 +576,7 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg;
*/
typedef struct SDL_SysWMEvent
{
Uint32 type; /**< ::SDL_SYSWMEVENT */
Uint32 type; /**< ::SDL_EVENT_SYSWM */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
} SDL_SysWMEvent;
@ -701,9 +695,9 @@ typedef enum
* SDL_GETEVENT, the maximum number of events to retrieve
* \param action action to take; see [[#action|Remarks]] for details
* \param minType minimum value of the event type to be considered;
* SDL_FIRSTEVENT is a safe choice
* SDL_EVENT_FIRST is a safe choice
* \param maxType maximum value of the event type to be considered;
* SDL_LASTEVENT is a safe choice
* SDL_EVENT_LAST is a safe choice
* \returns the number of events actually stored or a negative error code on
* failure; call SDL_GetError() for more information.
*
@ -879,8 +873,8 @@ extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
* As this function may implicitly call SDL_PumpEvents(), you can only call
* this function in the thread that initialized the video subsystem.
*
* The timeout is not guaranteed, the actual wait time could be longer
* due to system scheduling.
* The timeout is not guaranteed, the actual wait time could be longer due to
* system scheduling.
*
* \param event the SDL_Event structure to be filled in with the next event
* from the queue, or NULL

View file

@ -160,11 +160,11 @@ typedef struct SDL_GamepadBinding
*
* The mapping string has the format "GUID,name,mapping", where GUID is the
* string value from SDL_GetJoystickGUIDString(), name is the human readable
* string for the device and mappings are gamepad mappings to joystick
* ones. Under Windows there is a reserved GUID of "xinput" that covers all
* XInput devices. The mapping format for joystick is: {| |bX |a joystick
* button, index X |- |hX.Y |hat X with value Y |- |aX |axis X of the joystick
* |} Buttons can be used as a gamepad axes and vice versa.
* string for the device and mappings are gamepad mappings to joystick ones.
* Under Windows there is a reserved GUID of "xinput" that covers all XInput
* devices. The mapping format for joystick is: {| |bX |a joystick button,
* index X |- |hX.Y |hat X with value Y |- |aX |axis X of the joystick |}
* Buttons can be used as a gamepad axes and vice versa.
*
* This string shows an example of a valid mapping for a gamepad:
*
@ -232,6 +232,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumGamepadMappings(void);
/**
* Get the mapping at a particular index.
*
* \param mapping_index mapping index
* \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
* the index is out of range.
*
@ -262,10 +263,9 @@ extern DECLSPEC char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_JoystickGUID gui
*
* Details about mappings are discussed with SDL_AddGamepadMapping().
*
* \param gamepad the gamepad you want to get the current
* mapping for
* \returns a string that has the gamepad's mapping or NULL if no mapping
* is available; call SDL_GetError() for more information.
* \param gamepad the gamepad you want to get the current mapping for
* \returns a string that has the gamepad's mapping or NULL if no mapping is
* available; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -278,7 +278,9 @@ extern DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad);
* Get a list of currently connected gamepads.
*
* \param count a pointer filled in with the number of gamepads returned
* \returns a 0 terminated array of joystick instance IDs which should be freed with SDL_free(), or NULL on error; call SDL_GetError() for more details.
* \returns a 0 terminated array of joystick instance IDs which should be
* freed with SDL_free(), or NULL on error; call SDL_GetError() for
* more details.
*
* \since This function is available since SDL 3.0.0.
*
@ -370,8 +372,8 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_GetGamepadInstanceGUID(SDL_Joystick
* available this function returns 0.
*
* \param instance_id the joystick instance ID
* \returns the USB vendor ID of the selected gamepad. If called on an
* invalid index, this function returns zero
* \returns the USB vendor ID of the selected gamepad. If called on an invalid
* index, this function returns zero
*
* \since This function is available since SDL 3.0.0.
*/
@ -446,11 +448,12 @@ extern DECLSPEC char *SDLCALL SDL_GetGamepadInstanceMapping(SDL_JoystickID insta
extern DECLSPEC SDL_Gamepad *SDLCALL SDL_OpenGamepad(SDL_JoystickID instance_id);
/**
* Get the SDL_Gamepad associated with a joystick instance ID.
* Get the SDL_Gamepad associated with a joystick instance ID, if it has been
* opened.
*
* \param instance_id the joystick instance ID of the gamepad
* \returns an SDL_Gamepad on success or NULL on failure; call
* SDL_GetError() for more information.
* \returns an SDL_Gamepad on success or NULL on failure or if it hasn't been
* opened yet; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -472,13 +475,13 @@ extern DECLSPEC SDL_Gamepad *SDLCALL SDL_GetGamepadFromPlayerIndex(int player_in
/**
* Get the implementation-dependent name for an opened gamepad.
*
* This is the same name as returned by SDL_GetGamepadNameForIndex(), but
* it takes a gamepad identifier instead of the (unstable) device index.
* This is the same name as returned by SDL_GetGamepadNameForIndex(), but it
* takes a gamepad identifier instead of the (unstable) device index.
*
* \param gamepad a gamepad identifier previously returned by
* SDL_OpenGamepad()
* \returns the implementation dependent name for the gamepad, or NULL
* if there is no name or the identifier passed is invalid.
* SDL_OpenGamepad()
* \returns the implementation dependent name for the gamepad, or NULL if
* there is no name or the identifier passed is invalid.
*
* \since This function is available since SDL 3.0.0.
*
@ -490,13 +493,13 @@ extern DECLSPEC const char *SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad);
/**
* Get the implementation-dependent path for an opened gamepad.
*
* This is the same path as returned by SDL_GetGamepadNameForIndex(), but
* it takes a gamepad identifier instead of the (unstable) device index.
* This is the same path as returned by SDL_GetGamepadNameForIndex(), but it
* takes a gamepad identifier instead of the (unstable) device index.
*
* \param gamepad a gamepad identifier previously returned by
* SDL_OpenGamepad()
* \returns the implementation dependent path for the gamepad, or NULL
* if there is no path or the identifier passed is invalid.
* SDL_OpenGamepad()
* \returns the implementation dependent path for the gamepad, or NULL if
* there is no path or the identifier passed is invalid.
*
* \since This function is available since SDL 3.0.0.
*
@ -507,8 +510,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetGamepadPath(SDL_Gamepad *gamepad);
/**
* Get the type of this currently opened gamepad
*
* This is the same name as returned by SDL_GetGamepadInstanceType(), but
* it takes a gamepad identifier instead of the (unstable) device index.
* This is the same name as returned by SDL_GetGamepadInstanceType(), but it
* takes a gamepad identifier instead of the (unstable) device index.
*
* \param gamepad the gamepad object to query.
* \returns the gamepad type.
@ -533,12 +536,14 @@ extern DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad);
* Set the player index of an opened gamepad.
*
* \param gamepad the gamepad object to adjust.
* \param player_index Player index to assign to this gamepad, or -1 to
* clear the player index and turn off player LEDs.
* \param player_index Player index to assign to this gamepad, or -1 to clear
* the player index and turn off player LEDs.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
extern DECLSPEC int SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
/**
* Get the USB vendor ID of an opened gamepad, if available.
@ -546,7 +551,7 @@ extern DECLSPEC void SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int
* If the vendor ID isn't available this function returns 0.
*
* \param gamepad the gamepad object to query.
* \return the USB vendor ID, or zero if unavailable.
* \returns the USB vendor ID, or zero if unavailable.
*
* \since This function is available since SDL 3.0.0.
*/
@ -558,7 +563,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadVendor(SDL_Gamepad *gamepad);
* If the product ID isn't available this function returns 0.
*
* \param gamepad the gamepad object to query.
* \return the USB product ID, or zero if unavailable.
* \returns the USB product ID, or zero if unavailable.
*
* \since This function is available since SDL 3.0.0.
*/
@ -570,7 +575,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadProduct(SDL_Gamepad *gamepad);
* If the product version isn't available this function returns 0.
*
* \param gamepad the gamepad object to query.
* \return the USB product version, or zero if unavailable.
* \returns the USB product version, or zero if unavailable.
*
* \since This function is available since SDL 3.0.0.
*/
@ -582,7 +587,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadProductVersion(SDL_Gamepad *gamepad
* If the firmware version isn't available this function returns 0.
*
* \param gamepad the gamepad object to query.
* \return the gamepad firmware version, or zero if unavailable.
* \returns the gamepad firmware version, or zero if unavailable.
*
* \since This function is available since SDL 3.0.0.
*/
@ -591,11 +596,10 @@ extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadFirmwareVersion(SDL_Gamepad *gamepa
/**
* Get the serial number of an opened gamepad, if available.
*
* Returns the serial number of the gamepad, or NULL if it is not
* available.
* Returns the serial number of the gamepad, or NULL if it is not available.
*
* \param gamepad the gamepad object to query.
* \return the serial number, or NULL if unavailable.
* \returns the serial number, or NULL if unavailable.
*
* \since This function is available since SDL 3.0.0.
*/
@ -605,7 +609,7 @@ extern DECLSPEC const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamepad);
* Check if a gamepad has been opened and is currently connected.
*
* \param gamepad a gamepad identifier previously returned by
* SDL_OpenGamepad()
* SDL_OpenGamepad()
* \returns SDL_TRUE if the gamepad has been opened and is currently
* connected, or SDL_FALSE if not.
*
@ -620,17 +624,15 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GamepadConnected(SDL_Gamepad *gamepad);
* Get the underlying joystick from a gamepad
*
* This function will give you a SDL_Joystick object, which allows you to use
* the SDL_Joystick functions with a SDL_Gamepad object. This would be
* useful for getting a joystick's position at any given time, even if it
* hasn't moved (moving it would produce an event, which would have the axis'
* value).
* the SDL_Joystick functions with a SDL_Gamepad object. This would be useful
* for getting a joystick's position at any given time, even if it hasn't
* moved (moving it would produce an event, which would have the axis' value).
*
* The pointer returned is owned by the SDL_Gamepad. You should not
* call SDL_CloseJoystick() on it, for example, since doing so will likely
* cause SDL to crash.
* The pointer returned is owned by the SDL_Gamepad. You should not call
* SDL_CloseJoystick() on it, for example, since doing so will likely cause
* SDL to crash.
*
* \param gamepad the gamepad object that you want to get a
* joystick from
* \param gamepad the gamepad object that you want to get a joystick from
* \returns an SDL_Joystick object; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
@ -640,9 +642,8 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GetGamepadJoystick(SDL_Gamepad *gamepa
/**
* Set the state of gamepad event processing.
*
* If gamepad events are disabled, you must call SDL_UpdateGamepads()
* yourself and check the state of the gamepad when you want gamepad
* information.
* If gamepad events are disabled, you must call SDL_UpdateGamepads() yourself
* and check the state of the gamepad when you want gamepad information.
*
* \param enabled whether to process gamepad events or not
*
@ -655,11 +656,11 @@ extern DECLSPEC void SDLCALL SDL_SetGamepadEventsEnabled(SDL_bool enabled);
/**
* Query the state of gamepad event processing.
*
* If gamepad events are disabled, you must call SDL_UpdateGamepads()
* yourself and check the state of the gamepad when you want gamepad
* information.
* If gamepad events are disabled, you must call SDL_UpdateGamepads() yourself
* and check the state of the gamepad when you want gamepad information.
*
* \returns SDL_TRUE if gamepad events are being processed, SDL_FALSE otherwise.
* \returns SDL_TRUE if gamepad events are being processed, SDL_FALSE
* otherwise.
*
* \since This function is available since SDL 3.0.0.
*
@ -682,18 +683,18 @@ extern DECLSPEC void SDLCALL SDL_UpdateGamepads(void);
/**
* Convert a string into SDL_GamepadAxis enum.
*
* This function is called internally to translate SDL_Gamepad mapping
* strings for the underlying joystick device into the consistent
* SDL_Gamepad mapping. You do not normally need to call this function
* unless you are parsing SDL_Gamepad mappings in your own code.
* This function is called internally to translate SDL_Gamepad mapping strings
* for the underlying joystick device into the consistent SDL_Gamepad mapping.
* You do not normally need to call this function unless you are parsing
* SDL_Gamepad mappings in your own code.
*
* Note specially that "righttrigger" and "lefttrigger" map to
* `SDL_GAMEPAD_AXIS_RIGHT_TRIGGER` and `SDL_GAMEPAD_AXIS_LEFT_TRIGGER`,
* respectively.
*
* \param str string representing a SDL_Gamepad axis
* \returns the SDL_GamepadAxis enum corresponding to the input string,
* or `SDL_GAMEPAD_AXIS_INVALID` if no match was found.
* \returns the SDL_GamepadAxis enum corresponding to the input string, or
* `SDL_GAMEPAD_AXIS_INVALID` if no match was found.
*
* \since This function is available since SDL 3.0.0.
*
@ -722,8 +723,8 @@ extern DECLSPEC const char* SDLCALL SDL_GetGamepadStringForAxis(SDL_GamepadAxis
*
* \param gamepad a gamepad
* \param axis an axis enum value (one of the SDL_GamepadAxis values)
* \returns a SDL_GamepadBinding describing the bind. On failure
* (like the given Controller axis doesn't exist on the device), its
* \returns a SDL_GamepadBinding describing the bind. On failure (like the
* given Controller axis doesn't exist on the device), its
* `.bindType` will be `SDL_GAMEPAD_BINDTYPE_NONE`.
*
* \since This function is available since SDL 3.0.0.
@ -768,14 +769,14 @@ extern DECLSPEC Sint16 SDLCALL SDL_GetGamepadAxis(SDL_Gamepad *gamepad, SDL_Game
/**
* Convert a string into an SDL_GamepadButton enum.
*
* This function is called internally to translate SDL_Gamepad mapping
* strings for the underlying joystick device into the consistent
* SDL_Gamepad mapping. You do not normally need to call this function
* unless you are parsing SDL_Gamepad mappings in your own code.
* This function is called internally to translate SDL_Gamepad mapping strings
* for the underlying joystick device into the consistent SDL_Gamepad mapping.
* You do not normally need to call this function unless you are parsing
* SDL_Gamepad mappings in your own code.
*
* \param str string representing a SDL_Gamepad axis
* \returns the SDL_GamepadButton enum corresponding to the input
* string, or `SDL_GAMEPAD_AXIS_INVALID` if no match was found.
* \returns the SDL_GamepadButton enum corresponding to the input string, or
* `SDL_GAMEPAD_AXIS_INVALID` if no match was found.
*
* \since This function is available since SDL 3.0.0.
*/
@ -802,9 +803,9 @@ extern DECLSPEC const char* SDLCALL SDL_GetGamepadStringForButton(SDL_GamepadBut
*
* \param gamepad a gamepad
* \param button an button enum value (an SDL_GamepadButton value)
* \returns a SDL_GamepadBinding describing the bind. On failure
* (like the given Controller button doesn't exist on the device),
* its `.bindType` will be `SDL_GAMEPAD_BINDTYPE_NONE`.
* \returns a SDL_GamepadBinding describing the bind. On failure (like the
* given Controller button doesn't exist on the device), its
* `.bindType` will be `SDL_GAMEPAD_BINDTYPE_NONE`.
*
* \since This function is available since SDL 3.0.0.
*
@ -815,8 +816,8 @@ extern DECLSPEC SDL_GamepadBinding SDLCALL SDL_GetGamepadBindForButton(SDL_Gamep
/**
* Query whether a gamepad has a given button.
*
* This merely reports whether the gamepad's mapping defined this button,
* as that is all the information SDL has about the physical device.
* This merely reports whether the gamepad's mapping defined this button, as
* that is all the information SDL has about the physical device.
*
* \param gamepad a gamepad
* \param button a button enum value (an SDL_GamepadButton value)
@ -843,21 +844,38 @@ extern DECLSPEC Uint8 SDLCALL SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_Gam
/**
* Get the number of touchpads on a gamepad.
*
* \param gamepad a gamepad
* \returns number of touchpads
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_GetGamepadNumTouchpads(SDL_Gamepad *gamepad);
extern DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpads(SDL_Gamepad *gamepad);
/**
* Get the number of supported simultaneous fingers on a touchpad on a game
* gamepad.
*
* \param gamepad a gamepad
* \param touchpad a touchpad
* \returns number of supported simultaneous fingers
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_GetGamepadNumTouchpadFingers(SDL_Gamepad *gamepad, int touchpad);
extern DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpadFingers(SDL_Gamepad *gamepad, int touchpad);
/**
* Get the current state of a finger on a touchpad on a gamepad.
*
* \param gamepad a gamepad
* \param touchpad a touchpad
* \param finger a finger
* \param state filled with state
* \param x filled with x position
* \param y filled with y position
* \param pressure filled with pressure value
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
@ -879,7 +897,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasSensor(SDL_Gamepad *gamepad, SDL_
* \param gamepad The gamepad to update
* \param type The type of sensor to enable/disable
* \param enabled Whether data reporting should be enabled
* \returns 0 or -1 if an error occurred.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -897,12 +916,11 @@ extern DECLSPEC int SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SD
extern DECLSPEC SDL_bool SDLCALL SDL_GamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type);
/**
* Get the data rate (number of events per second) of a gamepad
* sensor.
* Get the data rate (number of events per second) of a gamepad sensor.
*
* \param gamepad The gamepad to query
* \param type The type of sensor to query
* \return the data rate, or 0.0f if the data rate is not available.
* \returns the data rate, or 0.0f if the data rate is not available.
*
* \since This function is available since SDL 3.0.0.
*/
@ -918,7 +936,8 @@ extern DECLSPEC float SDLCALL SDL_GetGamepadSensorDataRate(SDL_Gamepad *gamepad,
* \param type The type of sensor to query
* \param data A pointer filled with the current sensor state
* \param num_values The number of values to write to data
* \return 0 or -1 if an error occurred.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -950,10 +969,9 @@ extern DECLSPEC int SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_f
* Each call to this function cancels any previous trigger rumble effect, and
* calling it with 0 intensity stops any rumbling.
*
* Note that this is rumbling of the _triggers_ and not the gamepad as
* a whole. This is currently only supported on Xbox One gamepads. If you
* want the (more common) whole-gamepad rumble, use
* SDL_RumbleGamepad() instead.
* Note that this is rumbling of the _triggers_ and not the gamepad as a
* whole. This is currently only supported on Xbox One gamepads. If you want
* the (more common) whole-gamepad rumble, use SDL_RumbleGamepad() instead.
*
* \param gamepad The gamepad to vibrate
* \param left_rumble The intensity of the left trigger rumble motor, from 0
@ -961,7 +979,8 @@ extern DECLSPEC int SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_f
* \param right_rumble The intensity of the right trigger rumble motor, from 0
* to 0xFFFF
* \param duration_ms The duration of the rumble effect, in milliseconds
* \returns 0, or -1 if trigger rumble isn't supported on this gamepad
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -973,8 +992,8 @@ extern DECLSPEC int SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint
* Query whether a gamepad has an LED.
*
* \param gamepad The gamepad to query
* \returns SDL_TRUE, or SDL_FALSE if this gamepad does not have a
* modifiable LED
* \returns SDL_TRUE, or SDL_FALSE if this gamepad does not have a modifiable
* LED
*
* \since This function is available since SDL 3.0.0.
*/
@ -1013,7 +1032,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasRumbleTriggers(SDL_Gamepad *gamep
* \param red The intensity of the red LED
* \param green The intensity of the green LED
* \param blue The intensity of the blue LED
* \returns 0, or -1 if this gamepad does not have a modifiable LED
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -1025,8 +1045,8 @@ extern DECLSPEC int SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, U
* \param gamepad The gamepad to affect
* \param data The data to send to the gamepad
* \param size The size of the data to send to the gamepad
* \returns 0, or -1 if this gamepad or driver doesn't support effect
* packets
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -1035,7 +1055,8 @@ extern DECLSPEC int SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const vo
/**
* Close a gamepad previously opened with SDL_OpenGamepad().
*
* \param gamepad a gamepad identifier previously returned by SDL_OpenGamepad()
* \param gamepad a gamepad identifier previously returned by
* SDL_OpenGamepad()
*
* \since This function is available since SDL 3.0.0.
*
@ -1058,8 +1079,7 @@ extern DECLSPEC void SDLCALL SDL_CloseGamepad(SDL_Gamepad *gamepad);
extern DECLSPEC const char* SDLCALL SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);
/**
* Return the sfSymbolsName for a given axis on a gamepad on Apple
* platforms.
* Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
*
* \param gamepad the gamepad to query
* \param axis an axis on the gamepad

View file

@ -66,12 +66,14 @@ typedef struct {
* \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
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GUIDFromString
*/
extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
extern DECLSPEC int SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
/**
* Convert a GUID string into a ::SDL_GUID structure.

View file

@ -133,7 +133,8 @@ typedef struct SDL_hid_device_info
*
* Each call to this function should have a matching call to SDL_hid_exit()
*
* \returns 0 on success and -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -147,7 +148,8 @@ extern DECLSPEC int SDLCALL SDL_hid_init(void);
* This function frees all of the static data associated with HIDAPI. It
* should be called at the end of execution to avoid memory leaks.
*
* \returns 0 on success and -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -235,6 +237,7 @@ extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id,
* platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
*
* \param path The path name of the device to open
* \param bExclusive Open device in exclusive mode (Windows only)
* \returns a pointer to a SDL_hid_device object on success or NULL on
* failure.
*
@ -321,7 +324,8 @@ extern DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *dat
* \param dev A device handle returned from SDL_hid_open().
* \param nonblock enable or not the nonblocking reads - 1 to enable
* nonblocking - 0 to disable nonblocking.
* \returns 0 on success and -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -377,10 +381,12 @@ extern DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsi
* Close a HID device.
*
* \param dev A device handle returned from SDL_hid_open().
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev);
extern DECLSPEC int SDLCALL SDL_hid_close(SDL_hid_device *dev);
/**
* Get The Manufacturer String from a HID device.
@ -388,7 +394,8 @@ extern DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev);
* \param dev A device handle returned from SDL_hid_open().
* \param string A wide string buffer to put the data into.
* \param maxlen The length of the buffer in multiples of wchar_t.
* \returns 0 on success and -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -400,7 +407,8 @@ extern DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev,
* \param dev A device handle returned from SDL_hid_open().
* \param string A wide string buffer to put the data into.
* \param maxlen The length of the buffer in multiples of wchar_t.
* \returns 0 on success and -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -412,7 +420,8 @@ extern DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wcha
* \param dev A device handle returned from SDL_hid_open().
* \param string A wide string buffer to put the data into.
* \param maxlen The length of the buffer in multiples of wchar_t.
* \returns 0 on success and -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -425,7 +434,8 @@ extern DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev
* \param string_index The index of the string to get.
* \param string A wide string buffer to put the data into.
* \param maxlen The length of the buffer in multiples of wchar_t.
* \returns 0 on success and -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/

View file

@ -92,7 +92,7 @@ extern "C" {
* By default this hint is not set and the APK expansion files are not searched.
*/
#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
/**
* \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc.
*
@ -132,13 +132,13 @@ extern "C" {
* \brief A variable to control whether we trap the Android back button to handle it manually.
* This is necessary for the right mouse button to work on some Android devices, or
* to be able to trap the back button for use in your code reliably. If set to true,
* the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of
* the back button will show up as an SDL_EVENT_KEY_DOWN / SDL_EVENT_KEY_UP pair with a keycode of
* SDL_SCANCODE_AC_BACK.
*
* The variable can be set to the following values:
* "0" - Back button will be handled as usual for system. (default)
* "1" - Back button will be trapped, allowing you to handle the key press
* manually. (This will also let right mouse click work on systems
* manually. (This will also let right mouse click work on systems
* where the right mouse button functions as back.)
*
* The value of this hint is used at runtime, so it can be changed at any time.
@ -147,7 +147,7 @@ extern "C" {
/**
* \brief Specify an application name.
*
*
* This hint lets you specify the application name sent to the OS when
* required. For example, this will often appear in volume control applets for
* audio streams, and in lists of applications which are inhibiting the
@ -516,7 +516,7 @@ extern "C" {
/**
* \brief If set, game controller face buttons report their values according to their labels instead of their positional layout.
*
*
* For example, on Nintendo Switch controllers, normally you'd get:
*
* (Y)
@ -557,13 +557,13 @@ extern "C" {
#define SDL_HINT_HIDAPI_IGNORE_DEVICES "SDL_HIDAPI_IGNORE_DEVICES"
/**
* \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events.
* \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_EVENT_TEXT_EDITING events.
*
* The variable can be set to the following values:
* "0" - SDL_TEXTEDITING events are sent, and it is the application's
* responsibility to render the text from these events and
* "0" - SDL_EVENT_TEXT_EDITING events are sent, and it is the application's
* responsibility to render the text from these events and
* differentiate it somehow from committed text. (default)
* "1" - If supported by the IME then SDL_TEXTEDITING events are not sent,
* "1" - If supported by the IME then SDL_EVENT_TEXT_EDITING events are not sent,
* and text that is being composed will be rendered in its own UI.
*/
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
@ -1143,17 +1143,6 @@ extern "C" {
*/
#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP"
/**
* \brief A variable controlling whether relative mouse motion is affected by renderer scaling
*
* This variable can be set to the following values:
* "0" - Relative motion is unaffected by DPI or renderer's logical size
* "1" - Relative motion is scaled according to DPI scaling and logical size
*
* By default relative mouse deltas are affected by DPI and renderer scaling
*/
#define SDL_HINT_MOUSE_RELATIVE_SCALING "SDL_MOUSE_RELATIVE_SCALING"
/**
* \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
*/
@ -1211,7 +1200,7 @@ extern "C" {
*
* The variable can be set to the following values:
* "0" - SDL will install a SIGINT and SIGTERM handler, and when it
* catches a signal, convert it into an SDL_QUIT event.
* catches a signal, convert it into an SDL_EVENT_QUIT event.
* "1" - SDL will not install a signal handler at all.
*/
#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS"
@ -1279,7 +1268,7 @@ extern "C" {
*
* If set, this will be favored over anything the OS might report for the
* user's preferred locales. Changing this hint at runtime will not generate
* a SDL_LOCALECHANGED event (but if you can change the hint, you can push
* a SDL_EVENT_LOCALE_CHANGED event (but if you can change the hint, you can push
* your own event, if you want).
*
* The format of this hint is a comma-separated list of language and locale,
@ -1399,17 +1388,6 @@ extern "C" {
*/
#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER"
/**
* \brief A variable controlling the scaling policy for SDL_SetRenderLogicalSize.
*
* This variable can be set to the following values:
* "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen
* "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
*
* By default letterbox is used
*/
#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE"
/**
* \brief A variable controlling whether the OpenGL render driver uses shaders if they are available.
*
@ -1487,7 +1465,7 @@ extern "C" {
* disabled. You should use a string that describes what your program is doing
* (and, therefore, why the screensaver is disabled). For example, "Playing a
* game" or "Watching a video".
*
*
* Setting this to "" or leaving it unset will have SDL use a reasonable
* default: "Playing a game" or something similar.
*
@ -1501,13 +1479,13 @@ extern "C" {
* On some platforms, like Linux, a realtime priority thread may be subject to restrictions
* that require special handling by the application. This hint exists to let SDL know that
* the app is prepared to handle said restrictions.
*
*
* On Linux, SDL will apply the following configuration to any thread that becomes realtime:
* * The SCHED_RESET_ON_FORK bit will be set on the scheduling policy,
* * An RLIMIT_RTTIME budget will be configured to the rtkit specified limit.
* * Exceeding this limit will result in the kernel sending SIGKILL to the app,
* * Refer to the man pages for more information.
*
*
* This variable can be set to the following values:
* "0" - default platform specific behaviour
* "1" - Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling policy
@ -1595,7 +1573,7 @@ extern "C" {
#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK"
/**
* \brief A variable controlling whether the screensaver is enabled.
* \brief A variable controlling whether the screensaver is enabled.
*
* This variable can be set to the following values:
* "0" - Disable screensaver
@ -1608,7 +1586,7 @@ extern "C" {
/**
* \brief Tell the video driver that we only want a double buffer.
*
* By default, most lowlevel 2D APIs will use a triple buffer scheme that
* By default, most lowlevel 2D APIs will use a triple buffer scheme that
* wastes no CPU time on waiting for vsync after issuing a flip, but
* introduces a frame of latency. On the other hand, using a double buffer
* scheme instead is recommended for cases where low latency is an important
@ -1662,11 +1640,6 @@ extern "C" {
*/
#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT"
/**
* \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
*/
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED"
/**
* \brief A variable that dictates policy for fullscreen Spaces on macOS.
*
@ -1751,9 +1724,9 @@ extern "C" {
/**
* \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").
*
*
* If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has
* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly
* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly
* created SDL_Window:
*
* 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is
@ -1820,13 +1793,13 @@ extern "C" {
/**
* \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
*
*
* This variable can be set to the following values:
* "0" - Disable _NET_WM_BYPASS_COMPOSITOR
* "1" - Enable _NET_WM_BYPASS_COMPOSITOR
*
*
* By default SDL will use _NET_WM_BYPASS_COMPOSITOR
*
*
*/
#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
@ -1964,7 +1937,7 @@ extern "C" {
#define SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS "SDL_WINDOWS_ENABLE_MENU_MNEMONICS"
/**
* \brief A variable controlling whether the windows message loop is processed by SDL
* \brief A variable controlling whether the windows message loop is processed by SDL
*
* This variable can be set to the following values:
* "0" - The window message loop is not run
@ -2005,7 +1978,7 @@ extern "C" {
#define SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL "SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL"
/**
* \brief A variable to specify custom icon resource id from RC file on Windows platform
* \brief A variable to specify custom icon resource id from RC file on Windows platform
*/
#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON"
#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
@ -2040,58 +2013,7 @@ extern "C" {
#define SDL_HINT_WINDOWS_USE_D3D9EX "SDL_WINDOWS_USE_D3D9EX"
/**
* \brief Controls whether SDL will declare the process to be DPI aware.
*
* This hint must be set before initializing the video subsystem.
*
* The main purpose of declaring DPI awareness is to disable OS bitmap scaling of SDL windows on monitors with
* a DPI scale factor.
*
* This hint is equivalent to requesting DPI awareness via external means (e.g. calling SetProcessDpiAwarenessContext)
* and does not cause SDL to use a virtualized coordinate system, so it will generally give you 1 SDL coordinate = 1 pixel
* even on high-DPI displays.
*
* For more information, see:
* https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows
*
* This variable can be set to the following values:
* "" - Do not change the DPI awareness (default).
* "unaware" - Declare the process as DPI unaware. (Windows 8.1 and later).
* "system" - Request system DPI awareness. (Vista and later).
* "permonitor" - Request per-monitor DPI awareness. (Windows 8.1 and later).
* "permonitorv2" - Request per-monitor V2 DPI awareness. (Windows 10, version 1607 and later).
* The most visible difference from "permonitor" is that window title bar will be scaled
* to the visually correct size when dragging between monitors with different scale factors.
* This is the preferred DPI awareness level.
*
* If the requested DPI awareness is not available on the currently running OS, SDL will try to request the best
* available match.
*/
#define SDL_HINT_WINDOWS_DPI_AWARENESS "SDL_WINDOWS_DPI_AWARENESS"
/**
* \brief Uses DPI-scaled points as the SDL coordinate system on Windows.
*
* This changes the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere.
* This means windows will be appropriately sized, even when created on high-DPI displays with scaling.
*
* e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings,
* will create a window with an 800x600 client area (in pixels).
*
* Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary),
* and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows.
*
* This variable can be set to the following values:
* "0" - SDL coordinates equal Windows coordinates. No automatic window resizing when dragging
* between monitors with different scale factors (unless this is performed by
* Windows itself, which is the case when the process is DPI unaware).
* "1" - SDL coordinates are in DPI-scaled points. Automatically resize windows as needed on
* displays with non-100% scale factors.
*/
#define SDL_HINT_WINDOWS_DPI_SCALING "SDL_WINDOWS_DPI_SCALING"
/**
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
*
* This variable can be set to the following values:
* "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc)
@ -2102,7 +2024,7 @@ extern "C" {
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
/**
* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called
* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called
*
* This variable can be set to the following values:
* "0" - The window is activated when the SDL_ShowWindow function is called
@ -2138,8 +2060,8 @@ extern "C" {
* the app).
*
* SDL registers its own back-button-press callback with the Windows Phone
* OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN
* and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
* OS. This callback will emit a pair of SDL key-press events (SDL_EVENT_KEY_DOWN
* and SDL_EVENT_KEY_UP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
* it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON.
* If the hint's value is set to "1", the back button event's Handled
* property will get set to 'true'. If the hint's value is set to something
@ -2152,8 +2074,8 @@ extern "C" {
*
* In order to get notified when a back button is pressed, SDL apps should
* register a callback function with SDL_AddEventWatch(), and have it listen
* for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
* (Alternatively, SDL_KEYUP events can be listened-for. Listening for
* for SDL_EVENT_KEY_DOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
* (Alternatively, SDL_EVENT_KEY_UP events can be listened-for. Listening for
* either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON
* set by such a callback, will be applied to the OS' current
* back-button-press event.
@ -2290,26 +2212,26 @@ extern "C" {
#define SDL_HINT_X11_WINDOW_TYPE "SDL_X11_WINDOW_TYPE"
/**
* \brief A variable that decides whether to send SDL_QUIT when closing the final window.
* \brief A variable that decides whether to send SDL_EVENT_QUIT when closing the final window.
*
* By default, SDL sends an SDL_QUIT event when there is only one window
* and it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most
* By default, SDL sends an SDL_EVENT_QUIT event when there is only one window
* and it receives an SDL_EVENT_WINDOW_CLOSE_REQUESTED event, under the assumption most
* apps would also take the loss of this window as a signal to terminate the
* program.
*
* However, it's not unreasonable in some cases to have the program continue
* to live on, perhaps to create new windows later.
*
* Changing this hint to "0" will cause SDL to not send an SDL_QUIT event
* Changing this hint to "0" will cause SDL to not send an SDL_EVENT_QUIT event
* when the final window is requesting to close. Note that in this case,
* there are still other legitimate reasons one might get an SDL_QUIT
* there are still other legitimate reasons one might get an SDL_EVENT_QUIT
* event: choosing "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c)
* on Unix, etc.
*
* The default value is "1". This hint can be changed at any time.
*
* This hint is available since SDL 2.0.22. Before then, you always get
* an SDL_QUIT event when closing the final window.
* an SDL_EVENT_QUIT event when closing the final window.
*/
#define SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE "SDL_QUIT_ON_LAST_WINDOW_CLOSE"

View file

@ -39,26 +39,32 @@ extern "C" {
/* As of version 0.5, SDL is loaded dynamically into the application */
/**
* \name SDL_INIT_*
* \brief Initialization flags for SDL_Init and/or SDL_InitSubSystem
*
* These are the flags which may be passed to SDL_Init(). You should
* specify the subsystems which you will be using in your application.
* These are the flags which may be passed to SDL_Init(). You should
* specify the subsystems which you will be using in your application.
*
* \sa SDL_Init
* \sa SDL_Quit
* \sa SDL_InitSubSystem
* \sa SDL_QuitSubSystem
* \sa SDL_WasInit
*/
/* @{ */
#define SDL_INIT_TIMER 0x00000001u
#define SDL_INIT_AUDIO 0x00000010u
#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
#define SDL_INIT_HAPTIC 0x00001000u
#define SDL_INIT_GAMEPAD 0x00002000u /**< SDL_INIT_GAMEPAD implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000u
#define SDL_INIT_SENSOR 0x00008000u
#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
typedef enum
{
SDL_INIT_TIMER = 0x00000001,
SDL_INIT_AUDIO = 0x00000010,
SDL_INIT_VIDEO = 0x00000020, /**< `SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS` */
SDL_INIT_JOYSTICK = 0x00000200, /**< `SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS` */
SDL_INIT_HAPTIC = 0x00001000,
SDL_INIT_GAMEPAD = 0x00002000, /**< `SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK` */
SDL_INIT_EVENTS = 0x00004000,
SDL_INIT_SENSOR = 0x00008000
} SDL_InitFlags;
#define SDL_INIT_EVERYTHING ( \
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMEPAD | SDL_INIT_SENSOR \
)
/* @} */
/**
* Initialize the SDL library.
@ -85,11 +91,10 @@ extern "C" {
* - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the
* events subsystem
* - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem
* - `SDL_INIT_GAMEPAD`: gamepad subsystem; automatically
* initializes the joystick subsystem
* - `SDL_INIT_GAMEPAD`: gamepad subsystem; automatically initializes the
* joystick subsystem
* - `SDL_INIT_EVENTS`: events subsystem
* - `SDL_INIT_EVERYTHING`: all of the above subsystems
* - `SDL_INIT_NOPARACHUTE`: compatibility; this flag is ignored
*
* Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem()
* for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or
@ -148,8 +153,6 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
* \returns a mask of all initialized subsystems if `flags` is 0, otherwise it
* returns the initialization status of the specified subsystems.
*
* The return value does not include SDL_INIT_NOPARACHUTE.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_Init

View file

@ -121,9 +121,9 @@ typedef enum
/**
* Locking for atomic access to the joystick API
*
* The SDL joystick functions are thread-safe, however you can lock the joysticks
* while processing to guarantee that the joystick list won't change and joystick
* and gamepad events will not be delivered.
* The SDL joystick functions are thread-safe, however you can lock the
* joysticks while processing to guarantee that the joystick list won't change
* and joystick and gamepad events will not be delivered.
*
* \since This function is available since SDL 3.0.0.
*/
@ -140,7 +140,9 @@ extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void) SDL_RELEASE(SDL_joystick_
* Get a list of currently connected joysticks.
*
* \param count a pointer filled in with the number of joysticks returned
* \returns a 0 terminated array of joystick instance IDs which should be freed with SDL_free(), or NULL on error; call SDL_GetError() for more details.
* \returns a 0 terminated array of joystick instance IDs which should be
* freed with SDL_free(), or NULL on error; call SDL_GetError() for
* more details.
*
* \since This function is available since SDL 3.0.0.
*
@ -283,11 +285,11 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_GetJoystickInstanceType(SDL_Joystic
extern DECLSPEC SDL_Joystick *SDLCALL SDL_OpenJoystick(SDL_JoystickID instance_id);
/**
* Get the SDL_Joystick associated with an instance ID.
* Get the SDL_Joystick associated with an instance ID, if it has been opened.
*
* \param instance_id the instance ID to get the SDL_Joystick for
* \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError()
* for more information.
* \returns an SDL_Joystick on success or NULL on failure or if it hasn't been
* opened yet; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -307,7 +309,12 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GetJoystickFromPlayerIndex(int player_
/**
* Attach a new virtual joystick.
*
* \returns the joystick instance ID, or 0 if an error occurred; call SDL_GetError() for more information.
* \param type type of joystick
* \param naxes number of axes
* \param nbuttons number of buttons
* \param nhats number of hats
* \returns the joystick instance ID, or 0 if an error occurred; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -358,7 +365,9 @@ typedef struct SDL_VirtualJoystickDesc
/**
* Attach a new virtual joystick with extended properties.
*
* \returns the joystick instance ID, or 0 if an error occurred; call SDL_GetError() for more information.
* \param desc Joystick description
* \returns the joystick instance ID, or 0 if an error occurred; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -367,8 +376,10 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystickEx(const SDL_Vir
/**
* Detach a virtual joystick.
*
* \param instance_id the joystick instance ID, previously returned from SDL_AttachVirtualJoystick()
* \returns 0 on success, or -1 if an error occurred.
* \param instance_id the joystick instance ID, previously returned from
* SDL_AttachVirtualJoystick()
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -400,7 +411,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsJoystickVirtual(SDL_JoystickID instance_i
* \param joystick the virtual joystick on which to set state.
* \param axis the specific axis on the virtual joystick to set.
* \param value the new value for the specified axis.
* \returns 0 on success, -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -418,7 +430,8 @@ extern DECLSPEC int SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, i
* \param joystick the virtual joystick on which to set state.
* \param button the specific button on the virtual joystick to set.
* \param value the new value for the specified button.
* \returns 0 on success, -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -436,7 +449,8 @@ extern DECLSPEC int SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick,
* \param joystick the virtual joystick on which to set state.
* \param hat the specific hat on the virtual joystick to set.
* \param value the new value for the specified hat.
* \returns 0 on success, -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -488,10 +502,12 @@ extern DECLSPEC int SDLCALL SDL_GetJoystickPlayerIndex(SDL_Joystick *joystick);
* \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
* \param player_index Player index to assign to this joystick, or -1 to clear
* the player index and turn off player LEDs.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index);
extern DECLSPEC int SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index);
/**
* Get the implementation-dependent GUID for the joystick.
@ -590,6 +606,8 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_GetJoystickType(SDL_Joystick *joyst
* \param guid the SDL_JoystickGUID you wish to convert to string
* \param pszGUID buffer in which to write the ASCII string
* \param cbGUID the size of pszGUID
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -597,7 +615,7 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_GetJoystickType(SDL_Joystick *joyst
* \sa SDL_GetJoystickGUID
* \sa SDL_GetJoystickGUIDFromString
*/
extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
extern DECLSPEC int SDLCALL SDL_GetJoystickGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
/**
* Convert a GUID string into a SDL_JoystickGUID structure.
@ -730,7 +748,8 @@ extern DECLSPEC void SDLCALL SDL_SetJoystickEventsEnabled(SDL_bool enabled);
* yourself and check the state of the joystick when you want joystick
* information.
*
* \returns SDL_TRUE if joystick events are being processed, SDL_FALSE otherwise.
* \returns SDL_TRUE if joystick events are being processed, SDL_FALSE
* otherwise.
*
* \since This function is available since SDL 3.0.0.
*
@ -783,7 +802,7 @@ extern DECLSPEC Sint16 SDLCALL SDL_GetJoystickAxis(SDL_Joystick *joystick,
* \param joystick an SDL_Joystick structure containing joystick information
* \param axis the axis to query; the axis indices start at index 0
* \param state Upon return, the initial value is supplied here.
* \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
* \returns SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
*
* \since This function is available since SDL 3.0.0.
*/
@ -883,7 +902,8 @@ extern DECLSPEC int SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 lo
* \param right_rumble The intensity of the right trigger rumble motor, from 0
* to 0xFFFF
* \param duration_ms The duration of the rumble effect, in milliseconds
* \returns 0, or -1 if trigger rumble isn't supported on this joystick
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -898,7 +918,7 @@ extern DECLSPEC int SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, U
* DualShock 4 controller.
*
* \param joystick The joystick to query
* \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise.
* \returns SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise.
*
* \since This function is available since SDL 3.0.0.
*/
@ -908,7 +928,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick);
* Query whether a joystick has rumble support.
*
* \param joystick The joystick to query
* \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise.
* \returns SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise.
*
* \since This function is available since SDL 3.0.0.
*
@ -920,7 +940,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumble(SDL_Joystick *joystick);
* Query whether a joystick has rumble support on triggers.
*
* \param joystick The joystick to query
* \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise.
* \returns SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise.
*
* \since This function is available since SDL 3.0.0.
*
@ -938,7 +958,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumbleTriggers(SDL_Joystick *joy
* \param red The intensity of the red LED
* \param green The intensity of the green LED
* \param blue The intensity of the blue LED
* \returns 0 on success, -1 if this joystick does not have a modifiable LED
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -950,7 +971,8 @@ extern DECLSPEC int SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red
* \param joystick The joystick to affect
* \param data The data to send to the joystick
* \param size The size of the data to send to the joystick
* \returns 0, or -1 if this joystick or driver doesn't support effect packets
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/

View file

@ -42,7 +42,7 @@ extern "C" {
/**
* \brief The SDL keysym structure, used in key events.
*
* \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
* \note If you are looking for translated character input, see the ::SDL_EVENT_TEXT_INPUT event.
*/
typedef struct SDL_Keysym
{
@ -247,9 +247,9 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
* Start accepting Unicode text input events.
*
* This function will start accepting Unicode text input events in the focused
* SDL window, and start emitting SDL_TextInputEvent (SDL_TEXTINPUT) and
* SDL_TextEditingEvent (SDL_TEXTEDITING) events. Please use this function in
* pair with SDL_StopTextInput().
* SDL window, and start emitting SDL_TextInputEvent (SDL_EVENT_TEXT_INPUT)
* and SDL_TextEditingEvent (SDL_EVENT_TEXT_EDITING) events. Please use this
* function in pair with SDL_StopTextInput().
*
* On some platforms using this function activates the screen keyboard.
*
@ -293,6 +293,8 @@ extern DECLSPEC void SDLCALL SDL_ClearComposition(void);
/**
* Returns if an IME Composite or Candidate window is currently shown.
*
* \returns SDL_TRUE if shown, else SDL_FALSE
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_TextInputShown(void);
@ -310,12 +312,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_TextInputShown(void);
*
* \param rect the SDL_Rect structure representing the rectangle to receive
* text (ignored if NULL)
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_StartTextInput
*/
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(const SDL_Rect *rect);
extern DECLSPEC int SDLCALL SDL_SetTextInputRect(const SDL_Rect *rect);
/**
* Check whether the platform has screen keyboard support.

View file

@ -89,8 +89,7 @@ extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
* \sa SDL_LoadObject
* \sa SDL_UnloadObject
*/
extern DECLSPEC SDL_FunctionPointer SDL_LoadFunction(void *handle,
const char *name);
extern DECLSPEC SDL_FunctionPointer SDLCALL SDL_LoadFunction(void *handle, const char *name);
/**
* Unload a shared object from memory.

View file

@ -79,11 +79,11 @@ typedef struct SDL_Locale
* This might be a "slow" call that has to query the operating system. It's
* best to ask for this once and save the results. However, this list can
* change, usually because the user has changed a system preference outside of
* your program; SDL will send an SDL_LOCALECHANGED event in this case, if
* possible, and you can call this function again to get an updated copy of
* your program; SDL will send an SDL_EVENT_LOCALE_CHANGED event in this case,
* if possible, and you can call this function again to get an updated copy of
* preferred locales.
*
* \return array of locales, terminated with a locale with a NULL language
* \returns array of locales, terminated with a locale with a NULL language
* field. Will return NULL on error.
*
* \since This function is available since SDL 3.0.0.

View file

@ -173,23 +173,25 @@ extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
/**
* Initializes and launches an SDL application, by doing platform-specific
* initialization before calling your mainFunction and cleanups after it returns,
* if that is needed for a specific platform, otherwise it just calls mainFunction.
* You can use this if you want to use your own main() implementation
* without using SDL_main (like when using SDL_MAIN_HANDLED).
* When using this, you do *not* need SDL_SetMainReady().
* initialization before calling your mainFunction and cleanups after it
* returns, if that is needed for a specific platform, otherwise it just calls
* mainFunction.
*
* \param argc The argc parameter from the application's main() function,
* or 0 if the platform's main-equivalent has no argc
* \param argv The argv parameter from the application's main() function,
* or NULL if the platform's main-equivalent has no argv
* \param mainFunction Your SDL app's C-style main(), an SDL_main_func.
* NOT the function you're calling this from!
* Its name doesn't matter, but its signature must be
* like int my_main(int argc, char* argv[])
* \param reserved should be NULL (reserved for future use, will probably
* be platform-specific then)
* \return the return value from mainFunction: 0 on success, -1 on failure;
* You can use this if you want to use your own main() implementation without
* using SDL_main (like when using SDL_MAIN_HANDLED). When using this, you do
* *not* need SDL_SetMainReady().
*
* \param argc The argc parameter from the application's main() function, or 0
* if the platform's main-equivalent has no argc
* \param argv The argv parameter from the application's main() function, or
* NULL if the platform's main-equivalent has no argv
* \param mainFunction Your SDL app's C-style main(), an SDL_main_func. NOT
* the function you're calling this from! Its name doesn't
* matter, but its signature must be like int my_main(int
* argc, char* argv[])
* \param reserved should be NULL (reserved for future use, will probably be
* platform-specific then)
* \returns the return value from mainFunction: 0 on success, -1 on failure;
* SDL_GetError() might have more information on the failure
*
* \since This function is available since SDL 3.0.0.
@ -217,7 +219,8 @@ extern DECLSPEC int SDLCALL SDL_RunApp(int argc, char* argv[], SDL_main_func mai
* what is specified here.
* \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL
* will use `GetModuleHandle(NULL)` instead.
* \returns 0 on success, -1 on error. SDL_GetError() may have details.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -265,7 +268,7 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
/**
* Callback from the application to let the suspend continue.
*
* \since This function is available since SDL 2.28.0.
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);

View file

@ -58,6 +58,9 @@ typedef void *SDL_MetalView;
* The returned handle can be casted directly to a NSView or UIView. To access
* the backing CAMetalLayer, call SDL_Metal_GetLayer().
*
* \param window the window
* \returns handle NSView or UIView
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_Metal_DestroyView
@ -71,6 +74,8 @@ extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
* called after SDL_CreateWindow.
*
* \param view the SDL_MetalView object
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_Metal_CreateView
@ -80,28 +85,15 @@ extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
/**
* Get a pointer to the backing CAMetalLayer for the given view.
*
* \param view the SDL_MetalView object
* \returns a pointer
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_Metal_CreateView
*/
extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
/**
* Get the size of a window's underlying drawable in pixels (for use with
* setting viewport, scissor & etc).
*
* \param window SDL_Window from which the drawable size should be queried
* \param w Pointer to variable for storing the width in pixels, may be NULL
* \param h Pointer to variable for storing the height in pixels, may be NULL
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetWindowSize
* \sa SDL_CreateWindow
*/
extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
int *h);
/* @} *//* Metal support functions */
/* Ends C function definitions when using C++ */

View file

@ -61,8 +61,8 @@ extern "C" {
*
* \param url A valid URL/URI to open. Use `file:///full/path/to/file` for
* local files, if supported.
* \returns 0 on success, or -1 on error; call SDL_GetError() for more
* information.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/

View file

@ -214,8 +214,6 @@ extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(float x, float y);
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* If relative mode is not supported, this returns -1.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetRelativeMouseMode
@ -259,8 +257,8 @@ extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
* `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero.
*
* \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable.
* \returns 0 on success or -1 if not supported; call SDL_GetError() for more
* information.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -364,13 +362,15 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
* this is desired for any reason.
*
* \param cursor a cursor to make active
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_CreateCursor
* \sa SDL_GetCursor
*/
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
extern DECLSPEC int SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
/**
* Get the active cursor.
@ -389,8 +389,8 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
/**
* Get the default cursor.
*
* You do not have to call SDL_DestroyCursor() on the return value,
* but it is safe to do so.
* You do not have to call SDL_DestroyCursor() on the return value, but it is
* safe to do so.
*
* \returns the default cursor on success or NULL on failure.
*

View file

@ -166,7 +166,8 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
* other threads in the system (this is known as a "recursive mutex").
*
* \param mutex the mutex to lock
* \return 0, or -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -208,7 +209,8 @@ extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex) SDL_TRY_ACQUIRE(
* It is also an error to unlock a mutex that isn't locked at all.
*
* \param mutex the mutex to unlock.
* \returns 0, or -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -481,9 +483,9 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
* `cond`. Once the condition variable is signaled, the mutex is re-locked and
* the function returns.
*
* The mutex must be locked before calling this function. Locking the
* mutex recursively (more than once) is not supported and leads to
* undefined behavior.
* The mutex must be locked before calling this function. Locking the mutex
* recursively (more than once) is not supported and leads to undefined
* behavior.
*
* This function is the equivalent of calling SDL_CondWaitTimeout() with a
* time length of `SDL_MUTEX_MAXWAIT`.
@ -512,14 +514,14 @@ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex);
* signaled or the time elapsed, the mutex is re-locked and the function
* returns.
*
* The mutex must be locked before calling this function. Locking the
* mutex recursively (more than once) is not supported and leads to
* undefined behavior.
* The mutex must be locked before calling this function. Locking the mutex
* recursively (more than once) is not supported and leads to undefined
* behavior.
*
* \param cond the condition variable to wait on
* \param mutex the mutex used to coordinate thread access
* \param timeoutMS the maximum time to wait, in milliseconds, or `SDL_MUTEX_MAXWAIT`
* to wait indefinitely
* \param timeoutMS the maximum time to wait, in milliseconds, or
* `SDL_MUTEX_MAXWAIT` to wait indefinitely
* \returns 0 if the condition variable is signaled, `SDL_MUTEX_TIMEDOUT` if
* the condition is not signaled in the allotted time, or a negative
* error code on failure; call SDL_GetError() for more information.

View file

@ -50,21 +50,86 @@
#define SDL_NewAudioStream SDL_CreateAudioStream
/* ##SDL_events.h */
#define SDL_CONTROLLERAXISMOTION SDL_GAMEPADAXISMOTION
#define SDL_CONTROLLERBUTTONDOWN SDL_GAMEPADBUTTONDOWN
#define SDL_CONTROLLERBUTTONUP SDL_GAMEPADBUTTONUP
#define SDL_CONTROLLERDEVICEADDED SDL_GAMEPADADDED
#define SDL_CONTROLLERDEVICEREMAPPED SDL_GAMEPADREMAPPED
#define SDL_CONTROLLERDEVICEREMOVED SDL_GAMEPADREMOVED
#define SDL_CONTROLLERSENSORUPDATE SDL_GAMEPADSENSORUPDATE
#define SDL_CONTROLLERTOUCHPADDOWN SDL_GAMEPADTOUCHPADDOWN
#define SDL_CONTROLLERTOUCHPADMOTION SDL_GAMEPADTOUCHPADMOTION
#define SDL_CONTROLLERTOUCHPADUP SDL_GAMEPADTOUCHPADUP
#define SDL_APP_DIDENTERBACKGROUND SDL_EVENT_DID_ENTER_BACKGROUND
#define SDL_APP_DIDENTERFOREGROUND SDL_EVENT_DID_ENTER_FOREGROUND
#define SDL_APP_LOWMEMORY SDL_EVENT_LOW_MEMORY
#define SDL_APP_TERMINATING SDL_EVENT_TERMINATING
#define SDL_APP_WILLENTERBACKGROUND SDL_EVENT_WILL_ENTER_BACKGROUND
#define SDL_APP_WILLENTERFOREGROUND SDL_EVENT_WILL_ENTER_FOREGROUND
#define SDL_AUDIODEVICEADDED SDL_EVENT_AUDIO_DEVICE_ADDED
#define SDL_AUDIODEVICEREMOVED SDL_EVENT_AUDIO_DEVICE_REMOVED
#define SDL_CLIPBOARDUPDATE SDL_EVENT_CLIPBOARD_UPDATE
#define SDL_CONTROLLERAXISMOTION SDL_EVENT_GAMEPAD_AXIS_MOTION
#define SDL_CONTROLLERBUTTONDOWN SDL_EVENT_GAMEPAD_BUTTON_DOWN
#define SDL_CONTROLLERBUTTONUP SDL_EVENT_GAMEPAD_BUTTON_UP
#define SDL_CONTROLLERDEVICEADDED SDL_EVENT_GAMEPAD_ADDED
#define SDL_CONTROLLERDEVICEREMAPPED SDL_EVENT_GAMEPAD_REMAPPED
#define SDL_CONTROLLERDEVICEREMOVED SDL_EVENT_GAMEPAD_REMOVED
#define SDL_CONTROLLERSENSORUPDATE SDL_EVENT_GAMEPAD_SENSOR_UPDATE
#define SDL_CONTROLLERTOUCHPADDOWN SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
#define SDL_CONTROLLERTOUCHPADMOTION SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
#define SDL_CONTROLLERTOUCHPADUP SDL_EVENT_GAMEPAD_TOUCHPAD_UP
#define SDL_ControllerAxisEvent SDL_GamepadAxisEvent
#define SDL_ControllerButtonEvent SDL_GamepadButtonEvent
#define SDL_ControllerDeviceEvent SDL_GamepadDeviceEvent
#define SDL_ControllerSensorEvent SDL_GamepadSensorEvent
#define SDL_ControllerTouchpadEvent SDL_GamepadTouchpadEvent
#define SDL_DISPLAYEVENT_CONNECTED SDL_EVENT_DISPLAY_CONNECTED
#define SDL_DISPLAYEVENT_DISCONNECTED SDL_EVENT_DISPLAY_DISCONNECTED
#define SDL_DISPLAYEVENT_MOVED SDL_EVENT_DISPLAY_MOVED
#define SDL_DISPLAYEVENT_ORIENTATION SDL_EVENT_DISPLAY_ORIENTATION
#define SDL_DROPBEGIN SDL_EVENT_DROP_BEGIN
#define SDL_DROPCOMPLETE SDL_EVENT_DROP_COMPLETE
#define SDL_DROPFILE SDL_EVENT_DROP_FILE
#define SDL_DROPTEXT SDL_EVENT_DROP_TEXT
#define SDL_FINGERDOWN SDL_EVENT_FINGER_DOWN
#define SDL_FINGERMOTION SDL_EVENT_FINGER_MOTION
#define SDL_FINGERUP SDL_EVENT_FINGER_UP
#define SDL_FIRSTEVENT SDL_EVENT_FIRST
#define SDL_JOYAXISMOTION SDL_EVENT_JOYSTICK_AXIS_MOTION
#define SDL_JOYBATTERYUPDATED SDL_EVENT_JOYSTICK_BATTERY_UPDATED
#define SDL_JOYBUTTONDOWN SDL_EVENT_JOYSTICK_BUTTON_DOWN
#define SDL_JOYBUTTONUP SDL_EVENT_JOYSTICK_BUTTON_UP
#define SDL_JOYDEVICEADDED SDL_EVENT_JOYSTICK_ADDED
#define SDL_JOYDEVICEREMOVED SDL_EVENT_JOYSTICK_REMOVED
#define SDL_JOYHATMOTION SDL_EVENT_JOYSTICK_HAT_MOTION
#define SDL_KEYDOWN SDL_EVENT_KEY_DOWN
#define SDL_KEYMAPCHANGED SDL_EVENT_KEYMAP_CHANGED
#define SDL_KEYUP SDL_EVENT_KEY_UP
#define SDL_LASTEVENT SDL_EVENT_LAST
#define SDL_LOCALECHANGED SDL_EVENT_LOCALE_CHANGED
#define SDL_MOUSEBUTTONDOWN SDL_EVENT_MOUSE_BUTTON_DOWN
#define SDL_MOUSEBUTTONUP SDL_EVENT_MOUSE_BUTTON_UP
#define SDL_MOUSEMOTION SDL_EVENT_MOUSE_MOTION
#define SDL_MOUSEWHEEL SDL_EVENT_MOUSE_WHEEL
#define SDL_POLLSENTINEL SDL_EVENT_POLL_SENTINEL
#define SDL_QUIT SDL_EVENT_QUIT
#define SDL_RENDER_DEVICE_RESET SDL_EVENT_RENDER_DEVICE_RESET
#define SDL_RENDER_TARGETS_RESET SDL_EVENT_RENDER_TARGETS_RESET
#define SDL_SENSORUPDATE SDL_EVENT_SENSOR_UPDATE
#define SDL_SYSWMEVENT SDL_EVENT_SYSWM
#define SDL_TEXTEDITING SDL_EVENT_TEXT_EDITING
#define SDL_TEXTEDITING_EXT SDL_EVENT_TEXT_EDITING_EXT
#define SDL_TEXTINPUT SDL_EVENT_TEXT_INPUT
#define SDL_USEREVENT SDL_EVENT_USER
#define SDL_WINDOWEVENT_CLOSE SDL_EVENT_WINDOW_CLOSE_REQUESTED
#define SDL_WINDOWEVENT_DISPLAY_CHANGED SDL_EVENT_WINDOW_DISPLAY_CHANGED
#define SDL_WINDOWEVENT_ENTER SDL_EVENT_WINDOW_MOUSE_ENTER
#define SDL_WINDOWEVENT_EXPOSED SDL_EVENT_WINDOW_EXPOSED
#define SDL_WINDOWEVENT_FOCUS_GAINED SDL_EVENT_WINDOW_FOCUS_GAINED
#define SDL_WINDOWEVENT_FOCUS_LOST SDL_EVENT_WINDOW_FOCUS_LOST
#define SDL_WINDOWEVENT_HIDDEN SDL_EVENT_WINDOW_HIDDEN
#define SDL_WINDOWEVENT_HIT_TEST SDL_EVENT_WINDOW_HIT_TEST
#define SDL_WINDOWEVENT_ICCPROF_CHANGED SDL_EVENT_WINDOW_ICCPROF_CHANGED
#define SDL_WINDOWEVENT_LEAVE SDL_EVENT_WINDOW_MOUSE_LEAVE
#define SDL_WINDOWEVENT_MAXIMIZED SDL_EVENT_WINDOW_MAXIMIZED
#define SDL_WINDOWEVENT_MINIMIZED SDL_EVENT_WINDOW_MINIMIZED
#define SDL_WINDOWEVENT_MOVED SDL_EVENT_WINDOW_MOVED
#define SDL_WINDOWEVENT_RESIZED SDL_EVENT_WINDOW_RESIZED
#define SDL_WINDOWEVENT_RESTORED SDL_EVENT_WINDOW_RESTORED
#define SDL_WINDOWEVENT_SHOWN SDL_EVENT_WINDOW_SHOWN
#define SDL_WINDOWEVENT_SIZE_CHANGED SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED
#define SDL_WINDOWEVENT_TAKE_FOCUS SDL_EVENT_WINDOW_TAKE_FOCUS
/* ##SDL_gamepad.h */
#define SDL_CONTROLLER_AXIS_INVALID SDL_GAMEPAD_AXIS_INVALID
@ -138,8 +203,8 @@
#define SDL_GameControllerGetButtonFromString SDL_GetGamepadButtonFromString
#define SDL_GameControllerGetFirmwareVersion SDL_GetGamepadFirmwareVersion
#define SDL_GameControllerGetJoystick SDL_GetGamepadJoystick
#define SDL_GameControllerGetNumTouchpadFingers SDL_GetGamepadNumTouchpadFingers
#define SDL_GameControllerGetNumTouchpads SDL_GetGamepadNumTouchpads
#define SDL_GameControllerGetNumTouchpadFingers SDL_GetNumGamepadTouchpadFingers
#define SDL_GameControllerGetNumTouchpads SDL_GetNumGamepadTouchpads
#define SDL_GameControllerGetPlayerIndex SDL_GetGamepadPlayerIndex
#define SDL_GameControllerGetProduct SDL_GetGamepadProduct
#define SDL_GameControllerGetProductVersion SDL_GetGamepadProductVersion
@ -280,31 +345,43 @@
#define SDL_UnionRect SDL_GetRectUnion
/* ##SDL_render.h */
#define SDL_GetRendererOutputSize SDL_GetCurrentRenderOutputSize
#define SDL_RenderCopy SDL_RenderTexture
#define SDL_RenderCopyEx SDL_RenderTextureRotated
#define SDL_RenderCopyExF SDL_RenderTextureRotated
#define SDL_RenderCopyF SDL_RenderTexture
#define SDL_RenderDrawLine SDL_RenderLine
#define SDL_RenderDrawLineF SDL_RenderLine
#define SDL_RenderDrawLines SDL_RenderLines
#define SDL_RenderDrawLinesF SDL_RenderLines
#define SDL_RenderDrawPoint SDL_RenderPoint
#define SDL_RenderDrawPointF SDL_RenderPoint
#define SDL_RenderDrawPoints SDL_RenderPoints
#define SDL_RenderDrawPointsF SDL_RenderPoints
#define SDL_RenderDrawRect SDL_RenderRect
#define SDL_RenderDrawRectF SDL_RenderRect
#define SDL_RenderDrawRects SDL_RenderRects
#define SDL_RenderDrawRectsF SDL_RenderRects
#define SDL_RenderFillRectF SDL_RenderFillRect
#define SDL_RenderFillRectsF SDL_RenderFillRects
#define SDL_RenderGetClipRect SDL_GetRenderClipRect
#define SDL_RenderGetIntegerScale SDL_GetRenderIntegerScale
#define SDL_RenderGetLogicalSize SDL_GetRenderLogicalSize
#define SDL_RenderGetLogicalSize SDL_GetRenderLogicalPresentation
#define SDL_RenderGetMetalCommandEncoder SDL_GetRenderMetalCommandEncoder
#define SDL_RenderGetMetalLayer SDL_GetRenderMetalLayer
#define SDL_RenderGetScale SDL_GetRenderScale
#define SDL_RenderGetViewport SDL_GetRenderViewport
#define SDL_RenderGetWindow SDL_GetRenderWindow
#define SDL_RenderIsClipEnabled SDL_RenderClipEnabled
#define SDL_RenderLogicalToWindow SDL_RenderCoordinatesToWindow
#define SDL_RenderSetClipRect SDL_SetRenderClipRect
#define SDL_RenderSetIntegerScale SDL_SetRenderIntegerScale
#define SDL_RenderSetLogicalSize SDL_SetRenderLogicalSize
#define SDL_RenderSetLogicalSize SDL_SetRenderLogicalPresentation
#define SDL_RenderSetScale SDL_SetRenderScale
#define SDL_RenderSetVSync SDL_SetRenderVSync
#define SDL_RenderSetViewport SDL_SetRenderViewport
#define SDL_RenderWindowToLogical SDL_RenderCoordinatesFromWindow
#define SDL_ScaleModeBest SDL_SCALEMODE_BEST
#define SDL_ScaleModeLinear SDL_SCALEMODE_LINEAR
#define SDL_ScaleModeNearest SDL_SCALEMODE_NEAREST
/* ##SDL_rwops.h */
#define RW_SEEK_CUR SDL_RW_SEEK_CUR
@ -347,8 +424,13 @@
#define SDL_GetTicks64 SDL_GetTicks
/* ##SDL_video.h */
#define SDL_GetPointDisplayIndex SDL_GetDisplayIndexForPoint
#define SDL_GetRectDisplayIndex SDL_GetDisplayIndexForRect
#define SDL_GetClosestDisplayMode SDL_GetClosestFullscreenDisplayMode
#define SDL_GetPointDisplayIndex SDL_GetDisplayForPoint
#define SDL_GetRectDisplayIndex SDL_GetDisplayForRect
#define SDL_GetWindowDisplayIndex SDL_GetDisplayForWindow
#define SDL_GetWindowDisplayMode SDL_GetWindowFullscreenMode
#define SDL_SetWindowDisplayMode SDL_SetWindowFullscreenMode
#define SDL_WINDOW_INPUT_GRABBED SDL_WINDOW_MOUSE_GRABBED
#elif !defined(SDL_DISABLE_OLD_NAMES)
@ -363,6 +445,15 @@
#define SDL_NewAudioStream SDL_NewAudioStream_renamed_SDL_CreateAudioStream
/* ##SDL_events.h */
#define SDL_APP_DIDENTERBACKGROUND SDL_APP_DIDENTERBACKGROUND_renamed_SDL_EVENT_DID_ENTER_BACKGROUND
#define SDL_APP_DIDENTERFOREGROUND SDL_APP_DIDENTERFOREGROUND_renamed_SDL_EVENT_DID_ENTER_FOREGROUND
#define SDL_APP_LOWMEMORY SDL_APP_LOWMEMORY_renamed_SDL_EVENT_LOW_MEMORY
#define SDL_APP_TERMINATING SDL_APP_TERMINATING_renamed_SDL_EVENT_TERMINATING
#define SDL_APP_WILLENTERBACKGROUND SDL_APP_WILLENTERBACKGROUND_renamed_SDL_EVENT_WILL_ENTER_BACKGROUND
#define SDL_APP_WILLENTERFOREGROUND SDL_APP_WILLENTERFOREGROUND_renamed_SDL_EVENT_WILL_ENTER_FOREGROUND
#define SDL_AUDIODEVICEADDED SDL_AUDIODEVICEADDED_renamed_SDL_EVENT_AUDIO_DEVICE_ADDED
#define SDL_AUDIODEVICEREMOVED SDL_AUDIODEVICEREMOVED_renamed_SDL_EVENT_AUDIO_DEVICE_REMOVED
#define SDL_CLIPBOARDUPDATE SDL_CLIPBOARDUPDATE_renamed_SDL_EVENT_CLIPBOARD_UPDATE
#define SDL_CONTROLLERAXISMOTION SDL_CONTROLLERAXISMOTION_renamed_SDL_GAMEPADAXISMOTION
#define SDL_CONTROLLERBUTTONDOWN SDL_CONTROLLERBUTTONDOWN_renamed_SDL_GAMEPADBUTTONDOWN
#define SDL_CONTROLLERBUTTONUP SDL_CONTROLLERBUTTONUP_renamed_SDL_GAMEPADBUTTONUP
@ -378,6 +469,62 @@
#define SDL_ControllerDeviceEvent SDL_ControllerDeviceEvent_renamed_SDL_GamepadDeviceEvent
#define SDL_ControllerSensorEvent SDL_ControllerSensorEvent_renamed_SDL_GamepadSensorEvent
#define SDL_ControllerTouchpadEvent SDL_ControllerTouchpadEvent_renamed_SDL_GamepadTouchpadEvent
#define SDL_DISPLAYEVENT_CONNECTED SDL_DISPLAYEVENT_CONNECTED_renamed_SDL_EVENT_DISPLAY_CONNECTED
#define SDL_DISPLAYEVENT_DISCONNECTED SDL_DISPLAYEVENT_DISCONNECTED_renamed_SDL_EVENT_DISPLAY_DISCONNECTED
#define SDL_DISPLAYEVENT_MOVED SDL_DISPLAYEVENT_MOVED_renamed_SDL_EVENT_DISPLAY_MOVED
#define SDL_DISPLAYEVENT_ORIENTATION SDL_DISPLAYEVENT_ORIENTATION_renamed_SDL_EVENT_DISPLAY_ORIENTATION
#define SDL_DROPBEGIN SDL_DROPBEGIN_renamed_SDL_EVENT_DROP_BEGIN
#define SDL_DROPCOMPLETE SDL_DROPCOMPLETE_renamed_SDL_EVENT_DROP_COMPLETE
#define SDL_DROPFILE SDL_DROPFILE_renamed_SDL_EVENT_DROP_FILE
#define SDL_DROPTEXT SDL_DROPTEXT_renamed_SDL_EVENT_DROP_TEXT
#define SDL_FINGERDOWN SDL_FINGERDOWN_renamed_SDL_EVENT_FINGER_DOWN
#define SDL_FINGERMOTION SDL_FINGERMOTION_renamed_SDL_EVENT_FINGER_MOTION
#define SDL_FINGERUP SDL_FINGERUP_renamed_SDL_EVENT_FINGER_UP
#define SDL_FIRSTEVENT SDL_FIRSTEVENT_renamed_SDL_EVENT_FIRST
#define SDL_JOYAXISMOTION SDL_JOYAXISMOTION_renamed_SDL_EVENT_JOYSTICK_AXIS_MOTION
#define SDL_JOYBATTERYUPDATED SDL_JOYBATTERYUPDATED_renamed_SDL_EVENT_JOYSTICK_BATTERY_UPDATED
#define SDL_JOYBUTTONDOWN SDL_JOYBUTTONDOWN_renamed_SDL_EVENT_JOYSTICK_BUTTON_DOWN
#define SDL_JOYBUTTONUP SDL_JOYBUTTONUP_renamed_SDL_EVENT_JOYSTICK_BUTTON_UP
#define SDL_JOYDEVICEADDED SDL_JOYDEVICEADDED_renamed_SDL_EVENT_JOYSTICK_ADDED
#define SDL_JOYDEVICEREMOVED SDL_JOYDEVICEREMOVED_renamed_SDL_EVENT_JOYSTICK_REMOVED
#define SDL_JOYHATMOTION SDL_JOYHATMOTION_renamed_SDL_EVENT_JOYSTICK_HAT_MOTION
#define SDL_KEYDOWN SDL_KEYDOWN_renamed_SDL_EVENT_KEY_DOWN
#define SDL_KEYMAPCHANGED SDL_KEYMAPCHANGED_renamed_SDL_EVENT_KEYMAP_CHANGED
#define SDL_KEYUP SDL_KEYUP_renamed_SDL_EVENT_KEY_UP
#define SDL_LASTEVENT SDL_LASTEVENT_renamed_SDL_EVENT_LAST
#define SDL_LOCALECHANGED SDL_LOCALECHANGED_renamed_SDL_EVENT_LOCALE_CHANGED
#define SDL_MOUSEBUTTONDOWN SDL_MOUSEBUTTONDOWN_renamed_SDL_EVENT_MOUSE_BUTTON_DOWN
#define SDL_MOUSEBUTTONUP SDL_MOUSEBUTTONUP_renamed_SDL_EVENT_MOUSE_BUTTON_UP
#define SDL_MOUSEMOTION SDL_MOUSEMOTION_renamed_SDL_EVENT_MOUSE_MOTION
#define SDL_MOUSEWHEEL SDL_MOUSEWHEEL_renamed_SDL_EVENT_MOUSE_WHEEL
#define SDL_POLLSENTINEL SDL_POLLSENTINEL_renamed_SDL_EVENT_POLL_SENTINEL
#define SDL_QUIT SDL_QUIT_renamed_SDL_EVENT_QUIT
#define SDL_RENDER_DEVICE_RESET SDL_RENDER_DEVICE_RESET_renamed_SDL_EVENT_RENDER_DEVICE_RESET
#define SDL_RENDER_TARGETS_RESET SDL_RENDER_TARGETS_RESET_renamed_SDL_EVENT_RENDER_TARGETS_RESET
#define SDL_SENSORUPDATE SDL_SENSORUPDATE_renamed_SDL_EVENT_SENSOR_UPDATE
#define SDL_SYSWMEVENT SDL_SYSWMEVENT_renamed_SDL_EVENT_SYSWM
#define SDL_TEXTEDITING SDL_TEXTEDITING_renamed_SDL_EVENT_TEXT_EDITING
#define SDL_TEXTEDITING_EXT SDL_TEXTEDITING_EXT_renamed_SDL_EVENT_TEXT_EDITING_EXT
#define SDL_TEXTINPUT SDL_TEXTINPUT_renamed_SDL_EVENT_TEXT_INPUT
#define SDL_USEREVENT SDL_USEREVENT_renamed_SDL_EVENT_USER
#define SDL_WINDOWEVENT_CLOSE SDL_WINDOWEVENT_CLOSE_renamed_SDL_EVENT_WINDOW_CLOSE_REQUESTED
#define SDL_WINDOWEVENT_DISPLAY_CHANGED SDL_WINDOWEVENT_DISPLAY_CHANGED_renamed_SDL_EVENT_WINDOW_DISPLAY_CHANGED
#define SDL_WINDOWEVENT_ENTER SDL_WINDOWEVENT_ENTER_renamed_SDL_EVENT_WINDOW_ENTER
#define SDL_WINDOWEVENT_EXPOSED SDL_WINDOWEVENT_EXPOSED_renamed_SDL_EVENT_WINDOW_EXPOSED
#define SDL_WINDOWEVENT_FOCUS_GAINED SDL_WINDOWEVENT_FOCUS_GAINED_renamed_SDL_EVENT_WINDOW_FOCUS_GAINED
#define SDL_WINDOWEVENT_FOCUS_LOST SDL_WINDOWEVENT_FOCUS_LOST_renamed_SDL_EVENT_WINDOW_FOCUS_LOST
#define SDL_WINDOWEVENT_HIDDEN SDL_WINDOWEVENT_HIDDEN_renamed_SDL_EVENT_WINDOW_HIDDEN
#define SDL_WINDOWEVENT_HIT_TEST SDL_WINDOWEVENT_HIT_TEST_renamed_SDL_EVENT_WINDOW_HIT_TEST
#define SDL_WINDOWEVENT_ICCPROF_CHANGED SDL_WINDOWEVENT_ICCPROF_CHANGED_renamed_SDL_EVENT_WINDOW_ICCPROF_CHANGED
#define SDL_WINDOWEVENT_LEAVE SDL_WINDOWEVENT_LEAVE_renamed_SDL_EVENT_WINDOW_LEAVE
#define SDL_WINDOWEVENT_MAXIMIZED SDL_WINDOWEVENT_MAXIMIZED_renamed_SDL_EVENT_WINDOW_MAXIMIZED
#define SDL_WINDOWEVENT_MINIMIZED SDL_WINDOWEVENT_MINIMIZED_renamed_SDL_EVENT_WINDOW_MINIMIZED
#define SDL_WINDOWEVENT_MOVED SDL_WINDOWEVENT_MOVED_renamed_SDL_EVENT_WINDOW_MOVED
#define SDL_WINDOWEVENT_RESIZED SDL_WINDOWEVENT_RESIZED_renamed_SDL_EVENT_WINDOW_RESIZED
#define SDL_WINDOWEVENT_RESTORED SDL_WINDOWEVENT_RESTORED_renamed_SDL_EVENT_WINDOW_RESTORED
#define SDL_WINDOWEVENT_SHOWN SDL_WINDOWEVENT_SHOWN_renamed_SDL_EVENT_WINDOW_SHOWN
#define SDL_WINDOWEVENT_SIZE_CHANGED SDL_WINDOWEVENT_SIZE_CHANGED_renamed_SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED
#define SDL_WINDOWEVENT_TAKE_FOCUS SDL_WINDOWEVENT_TAKE_FOCUS_renamed_SDL_EVENT_WINDOW_TAKE_FOCUS
/* ##SDL_gamepad.h */
#define SDL_CONTROLLER_AXIS_INVALID SDL_CONTROLLER_AXIS_INVALID_renamed_SDL_GAMEPAD_AXIS_INVALID
@ -451,8 +598,8 @@
#define SDL_GameControllerGetButtonFromString SDL_GameControllerGetButtonFromString_renamed_SDL_GetGamepadButtonFromString
#define SDL_GameControllerGetFirmwareVersion SDL_GameControllerGetFirmwareVersion_renamed_SDL_GetGamepadFirmwareVersion
#define SDL_GameControllerGetJoystick SDL_GameControllerGetJoystick_renamed_SDL_GetGamepadJoystick
#define SDL_GameControllerGetNumTouchpadFingers SDL_GameControllerGetNumTouchpadFingers_renamed_SDL_GetGamepadNumTouchpadFingers
#define SDL_GameControllerGetNumTouchpads SDL_GameControllerGetNumTouchpads_renamed_SDL_GetGamepadNumTouchpads
#define SDL_GameControllerGetNumTouchpadFingers SDL_GameControllerGetNumTouchpadFingers_renamed_SDL_GetNumGamepadTouchpadFingers
#define SDL_GameControllerGetNumTouchpads SDL_GameControllerGetNumTouchpads_renamed_SDL_GetNumGamepadTouchpads
#define SDL_GameControllerGetPlayerIndex SDL_GameControllerGetPlayerIndex_renamed_SDL_GetGamepadPlayerIndex
#define SDL_GameControllerGetProduct SDL_GameControllerGetProduct_renamed_SDL_GetGamepadProduct
#define SDL_GameControllerGetProductVersion SDL_GameControllerGetProductVersion_renamed_SDL_GetGamepadProductVersion
@ -594,31 +741,43 @@
#define SDL_UnionRect SDL_UnionRect_renamed_SDL_GetRectUnion
/* ##SDL_render.h */
#define SDL_GetRendererOutputSize SDL_GetRendererOutputSize_renamed_SDL_GetCurrentRenderOutputSize
#define SDL_RenderCopy SDL_RenderCopy_renamed_SDL_RenderTexture
#define SDL_RenderCopyEx SDL_RenderCopyEx_renamed_SDL_RenderTextureRotated
#define SDL_RenderCopyExF SDL_RenderCopyExF_renamed_SDL_RenderTextureRotated
#define SDL_RenderCopyF SDL_RenderCopyF_renamed_SDL_RenderTexture
#define SDL_RenderDrawLine SDL_RenderDrawLine_renamed_SDL_RenderLine
#define SDL_RenderDrawLineF SDL_RenderDrawLineF_renamed_SDL_RenderLine
#define SDL_RenderDrawLines SDL_RenderDrawLines_renamed_SDL_RenderLines
#define SDL_RenderDrawLinesF SDL_RenderDrawLinesF_renamed_SDL_RenderLines
#define SDL_RenderDrawPoint SDL_RenderDrawPoint_renamed_SDL_RenderPoint
#define SDL_RenderDrawPointF SDL_RenderDrawPointF_renamed_SDL_RenderPoint
#define SDL_RenderDrawPoints SDL_RenderDrawPoints_renamed_SDL_RenderPoints
#define SDL_RenderDrawPointsF SDL_RenderDrawPointsF_renamed_SDL_RenderPoints
#define SDL_RenderDrawRect SDL_RenderDrawRect_renamed_SDL_RenderRect
#define SDL_RenderDrawRectF SDL_RenderDrawRectF_renamed_SDL_RenderRect
#define SDL_RenderDrawRects SDL_RenderDrawRects_renamed_SDL_RenderRects
#define SDL_RenderDrawRectsF SDL_RenderDrawRectsF_renamed_SDL_RenderRects
#define SDL_RenderFillRectF SDL_RenderFillRectF_renamed_SDL_RenderFillRect
#define SDL_RenderFillRectsF SDL_RenderFillRectsF_renamed_SDL_RenderFillRects
#define SDL_RenderGetClipRect SDL_RenderGetClipRect_renamed_SDL_GetRenderClipRect
#define SDL_RenderGetIntegerScale SDL_RenderGetIntegerScale_renamed_SDL_GetRenderIntegerScale
#define SDL_RenderGetLogicalSize SDL_RenderGetLogicalSize_renamed_SDL_GetRenderLogicalSize
#define SDL_RenderGetLogicalSize SDL_RenderGetLogicalSize_renamed_SDL_GetRenderLogicalPresentation
#define SDL_RenderGetMetalCommandEncoder SDL_RenderGetMetalCommandEncoder_renamed_SDL_GetRenderMetalCommandEncoder
#define SDL_RenderGetMetalLayer SDL_RenderGetMetalLayer_renamed_SDL_GetRenderMetalLayer
#define SDL_RenderGetScale SDL_RenderGetScale_renamed_SDL_GetRenderScale
#define SDL_RenderGetViewport SDL_RenderGetViewport_renamed_SDL_GetRenderViewport
#define SDL_RenderGetWindow SDL_RenderGetWindow_renamed_SDL_GetRenderWindow
#define SDL_RenderIsClipEnabled SDL_RenderIsClipEnabled_renamed_SDL_RenderClipEnabled
#define SDL_RenderLogicalToWindow SDL_RenderLogicalToWindow_renamed_SDL_RenderCoordinatesToWindow
#define SDL_RenderSetClipRect SDL_RenderSetClipRect_renamed_SDL_SetRenderClipRect
#define SDL_RenderSetIntegerScale SDL_RenderSetIntegerScale_renamed_SDL_SetRenderIntegerScale
#define SDL_RenderSetLogicalSize SDL_RenderSetLogicalSize_renamed_SDL_SetRenderLogicalSize
#define SDL_RenderSetLogicalSize SDL_RenderSetLogicalSize_renamed_SDL_SetRenderLogicalPresentation
#define SDL_RenderSetScale SDL_RenderSetScale_renamed_SDL_SetRenderScale
#define SDL_RenderSetVSync SDL_RenderSetVSync_renamed_SDL_SetRenderVSync
#define SDL_RenderSetViewport SDL_RenderSetViewport_renamed_SDL_SetRenderViewport
#define SDL_RenderWindowToLogical SDL_RenderWindowToLogical_renamed_SDL_RenderCoordinatesFromWindow
#define SDL_ScaleModeBest SDL_ScaleModeBest_renamed_SDL_SCALEMODE_BEST
#define SDL_ScaleModeLinear SDL_ScaleModeLinear_renamed_SDL_SCALEMODE_LINEAR
#define SDL_ScaleModeNearest SDL_ScaleModeNearest_renamed_SDL_SCALEMODE_NEAREST
/* ##SDL_rwops.h */
#define RW_SEEK_CUR RW_SEEK_CUR_renamed_SDL_RW_SEEK_CUR
@ -661,8 +820,13 @@
#define SDL_GetTicks64 SDL_GetTicks64_renamed_SDL_GetTicks
/* ##SDL_video.h */
#define SDL_GetPointDisplayIndex SDL_GetPointDisplayIndex_renamed_SDL_GetDisplayIndexForPoint
#define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_renamed_SDL_GetDisplayIndexForRect
#define SDL_GetClosestDisplayMode SDL_GetClosestDisplayMode_renamed_SDL_GetClosestFullscreenDisplayMode
#define SDL_GetPointDisplayIndex SDL_GetPointDisplayIndex_renamed_SDL_GetDisplayForPoint
#define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_renamed_SDL_GetDisplayForRect
#define SDL_GetWindowDisplayIndex SDL_GetWindowDisplayIndex_renamed_SDL_GetDisplayForWindow
#define SDL_GetWindowDisplayMode SDL_GetWindowDisplayMode_renamed_SDL_GetWindowFullscreenMode
#define SDL_SetWindowDisplayMode SDL_SetWindowDisplayMode_renamed_SDL_SetWindowFullscreenMode
#define SDL_WINDOW_INPUT_GRABBED SDL_WINDOW_INPUT_GRABBED_renamed_SDL_WINDOW_MOUSE_GRABBED
#endif /* SDL_ENABLE_OLD_NAMES */

View file

@ -1,4 +1,8 @@
#ifndef __gl_glext_h_
/* SDL modified the include guard to be compatible with Mesa and Apple include guards:
* - Mesa uses: __gl_glext_h_
* - Apple uses: __glext_h_ */
#if !defined(__glext_h_) && !defined(__gl_glext_h_)
#define __glext_h_ 1
#define __gl_glext_h_ 1
#ifdef __cplusplus

View file

@ -462,8 +462,8 @@ extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
* \param colors an array of SDL_Color structures to copy into the palette
* \param firstcolor the index of the first palette entry to modify
* \param ncolors the number of entries to modify
* \returns 0 on success or a negative error code if not all of the colors
* could be set; call SDL_GetError() for more information.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*

View file

@ -64,12 +64,12 @@ typedef enum
* It's possible a platform can only report battery percentage or time left
* but not both.
*
* \param seconds seconds of battery life left, you can pass a NULL here if you
* don't care, will return -1 if we can't determine a value, or
* we're not running on a battery
* \param percent percentage of battery life left, between 0 and 100, you can pass
* a NULL here if you don't care, will return -1 if we can't
* determine a value, or we're not running on a battery
* \param seconds seconds of battery life left, you can pass a NULL here if
* you don't care, will return -1 if we can't determine a
* value, or we're not running on a battery
* \param percent percentage of battery life left, between 0 and 100, you can
* pass a NULL here if you don't care, will return -1 if we
* can't determine a value, or we're not running on a battery
* \returns an SDL_PowerState enum representing the current battery state.
*
* \since This function is available since SDL 3.0.0.

View file

@ -34,16 +34,16 @@
/**
* \file SDL_quit.h
*
* 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.
* ::SDL_EVENT_QUIT 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
* is allowed to close. When the window is closed, screen updates will
* complete, but have no effect.
*
* 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_EVENT_QUIT as well. There is no way
* to determine the cause of an ::SDL_EVENT_QUIT, but setting a signal
* handler in your application will override the default generation of
* quit events for that signal.
*
@ -53,6 +53,6 @@
/* There are no functions directly affecting the quit event */
#define SDL_QuitRequested() \
(SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
(SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_EVENT_QUIT,SDL_EVENT_QUIT) > 0))
#endif /* SDL_quit_h_ */

View file

@ -172,10 +172,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect * A,
* \param B an SDL_Rect structure representing the second rectangle
* \param result an SDL_Rect structure filled in with the union of rectangles
* `A` and `B`
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_GetRectUnion(const SDL_Rect * A,
extern DECLSPEC int SDLCALL SDL_GetRectUnion(const SDL_Rect * A,
const SDL_Rect * B,
SDL_Rect * result);
@ -238,6 +240,8 @@ SDL_FORCE_INLINE SDL_bool SDL_PointInRectFloat(const SDL_FPoint *p, const SDL_FR
/**
* Returns true if the rectangle has no area.
*
* \since This function is available since SDL 3.0.0.
*/
SDL_FORCE_INLINE SDL_bool SDL_RectEmptyFloat(const SDL_FRect *r)
{
@ -247,7 +251,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEmptyFloat(const SDL_FRect *r)
/**
* Returns true if the two rectangles are equal, within some given epsilon.
*
* \since This function is available since SDL 2.0.22.
* \since This function is available since SDL 3.0.0.
*/
SDL_FORCE_INLINE SDL_bool SDL_RectsEqualEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon)
{
@ -262,7 +266,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectsEqualEpsilon(const SDL_FRect *a, const SDL_FR
/**
* Returns true if the two rectangles are equal, using a default epsilon.
*
* \since This function is available since SDL 2.0.22.
* \since This function is available since SDL 3.0.0.
*/
SDL_FORCE_INLINE SDL_bool SDL_RectsEqualFloat(const SDL_FRect *a, const SDL_FRect *b)
{
@ -311,10 +315,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRect *
* \param B an SDL_FRect structure representing the second rectangle
* \param result an SDL_FRect structure filled in with the union of rectangles
* `A` and `B`
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_GetRectUnionFloat(const SDL_FRect * A,
extern DECLSPEC int SDLCALL SDL_GetRectUnionFloat(const SDL_FRect * A,
const SDL_FRect * B,
SDL_FRect * result);

View file

@ -68,8 +68,6 @@ typedef enum
acceleration */
SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
with the refresh rate */
SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports
rendering to texture */
} SDL_RendererFlags;
/**
@ -100,9 +98,9 @@ typedef struct SDL_Vertex
*/
typedef enum
{
SDL_ScaleModeNearest, /**< nearest pixel sampling */
SDL_ScaleModeLinear, /**< linear filtering */
SDL_ScaleModeBest /**< anisotropic filtering */
SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */
SDL_SCALEMODE_LINEAR, /**< linear filtering */
SDL_SCALEMODE_BEST /**< anisotropic filtering */
} SDL_ScaleMode;
/**
@ -135,6 +133,19 @@ typedef enum
SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */
} SDL_RendererFlip;
/**
* How the logical size is mapped to the output
*/
typedef enum
{
SDL_LOGICAL_PRESENTATION_DISABLED, /**< There is no logical size in effect */
SDL_LOGICAL_PRESENTATION_MATCH, /**< The rendered content matches the window size in screen coordinates */
SDL_LOGICAL_PRESENTATION_STRETCH, /**< The rendered content is stretched to the output resolution */
SDL_LOGICAL_PRESENTATION_LETTERBOX, /**< The rendered content is fit to the largest dimension and the other dimension is letterboxed with black bars */
SDL_LOGICAL_PRESENTATION_OVERSCAN, /**< The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds */
SDL_LOGICAL_PRESENTATION_INTEGER_SCALE, /**< The rendered content is scaled up by integer multiples to fit the output resolution */
} SDL_RendererLogicalPresentation;
/**
* A structure representing rendering state
*/
@ -203,8 +214,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetRenderDriver(int index);
* SDL_CreateWindow())
* \param window a pointer filled with the window, or NULL on error
* \param renderer a pointer filled with the renderer, or NULL on error
* \returns 0 on success, or -1 on error; call SDL_GetError() for more
* information.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -217,12 +228,15 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, U
/**
* Create a 2D rendering context for a window.
*
* If you want a specific renderer, you can specify its name here. A list
* of available renderers can be obtained by calling SDL_GetRenderDriver
* multiple times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If
* you don't need a specific renderer, specify NULL and SDL will attempt
* to chooes the best option for you, based on what is available on the
* user's system.
* If you want a specific renderer, you can specify its name here. A list of
* available renderers can be obtained by calling SDL_GetRenderDriver multiple
* times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If you don't
* need a specific renderer, specify NULL and SDL will attempt to chooes the
* best option for you, based on what is available on the user's system.
*
* By default the rendering size matches the window size in screen coordinates,
* but you can call SDL_SetRenderLogicalPresentation() to enable high DPI
* rendering or change the content size and scaling options.
*
* \param window the window where rendering is displayed
* \param name the name of the rendering driver to initialize, or NULL to
@ -302,15 +316,14 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer);
extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info);
/**
* Get the output size in pixels of a rendering context.
* Get the output size in screen coordinates of a rendering context.
*
* Due to high-dpi displays, you might end up with a rendering context that
* has more pixels than the window that contains it, so use this instead of
* SDL_GetWindowSize() to decide how much drawing area you have.
* This returns the true output size in screen coordinates, ignoring any
* render targets or logical size and presentation.
*
* \param renderer the rendering context
* \param w an int filled with the width
* \param h an int filled with the height
* \param w a pointer filled in with the width in screen coordinates
* \param h a pointer filled in with the height in screen coordinates
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
@ -318,7 +331,46 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_Rend
*
* \sa SDL_GetRenderer
*/
extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer *renderer, int *w, int *h);
extern DECLSPEC int SDLCALL SDL_GetRenderWindowSize(SDL_Renderer *renderer, int *w, int *h);
/**
* Get the output size in pixels of a rendering context.
*
* This returns the true output size in pixels, ignoring any render targets
* or logical size and presentation.
*
* \param renderer the rendering context
* \param w a pointer filled in with the width in pixels
* \param h a pointer filled in with the height in pixels
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetRenderer
*/
extern DECLSPEC int SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
/**
* Get the current output size in pixels of a rendering context.
*
* If a rendering target is active, this will return the size of the
* rendering target in pixels, otherwise if a logical size is set, it will
* return the logical size, otherwise it will return the value of
* SDL_GetRenderOutputSize().
*
* \param renderer the rendering context
* \param w a pointer filled in with the current width
* \param h a pointer filled in with the current height
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetRenderOutputSize
* \sa SDL_GetRenderer
*/
extern DECLSPEC int SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
/**
* Create a texture for a rendering context.
@ -515,7 +567,8 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_Bl
*
* \param texture The texture to update.
* \param scaleMode the SDL_ScaleMode to use for texture scaling.
* \returns 0 on success, or -1 if the texture is not valid.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -528,7 +581,8 @@ extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_Sc
*
* \param texture the texture to query.
* \param scaleMode a pointer filled in with the current scale mode.
* \return 0 on success, or -1 if the texture is not valid.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -541,7 +595,8 @@ extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_Sc
*
* \param texture the texture to update.
* \param userdata the pointer to associate with the texture.
* \returns 0 on success, or -1 if the texture is not valid.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -553,7 +608,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureUserData(SDL_Texture *texture, void *u
* Get the user-specified pointer associated with a texture
*
* \param texture the texture to query.
* \return the pointer associated with the texture, or NULL if the texture is
* \returns the pointer associated with the texture, or NULL if the texture is
* not valid.
*
* \since This function is available since SDL 3.0.0.
@ -613,7 +668,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Re
* \param Vplane the raw pixel data for the V plane
* \param Vpitch the number of bytes between rows of pixel data for the V
* plane
* \returns 0 on success or -1 if the texture is not valid; call
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
@ -642,7 +697,8 @@ extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture,
* \param UVplane the raw pixel data for the UV plane.
* \param UVpitch the number of bytes between rows of pixel data for the UV
* plane.
* \return 0 on success, or -1 if the texture is not valid.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -700,14 +756,14 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture *texture,
* The returned surface is freed internally after calling SDL_UnlockTexture()
* or SDL_DestroyTexture(). The caller should not free it.
*
* \param texture the texture to lock for access, which was created with
* \param texture the texture to lock for access, which must be created with
* `SDL_TEXTUREACCESS_STREAMING`
* \param rect a pointer to the rectangle to lock for access. If the rect is
* NULL, the entire texture will be locked
* \param surface this is filled in with an SDL surface representing the
* locked area
* \returns 0 on success, or -1 if the texture is not valid or was not created
* with `SDL_TEXTUREACCESS_STREAMING`
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -737,18 +793,6 @@ extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
*/
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
/**
* Determine whether a renderer supports the use of render targets.
*
* \param renderer the renderer that will be checked
* \returns SDL_TRUE if supported or SDL_FALSE if not.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetRenderTarget
*/
extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer);
/**
* Set a texture as the current rendering target.
*
@ -789,92 +833,116 @@ extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Text
extern DECLSPEC SDL_Texture *SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
/**
* Set a device independent resolution for rendering.
* Set a device independent resolution and presentation mode for rendering.
*
* This function uses the viewport and scaling functionality to allow a fixed
* logical resolution for rendering, regardless of the actual output
* resolution. If the actual output resolution doesn't have the same aspect
* ratio the output rendering will be centered within the output display.
* This function sets the width and height of the logical rendering output.
* A render target is created at the specified size and used for rendering
* and then copied to the output during presentation.
*
* If the output display is a window, mouse and touch events in the window
* will be filtered and scaled so they seem to arrive within the logical
* resolution. The SDL_HINT_MOUSE_RELATIVE_SCALING hint controls whether
* relative motion events are also scaled.
* When a renderer is created, the logical size is set to match the window
* size in screen coordinates. The actual output size may be higher pixel
* density, and can be queried with SDL_GetRenderOutputSize().
*
* If this function results in scaling or subpixel drawing by the rendering
* backend, it will be handled using the appropriate quality hints.
* You can disable logical coordinates by setting the mode to
* SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full
* resolution of the output window.
*
* \param renderer the renderer for which resolution should be set
* You can convert coordinates in an event into rendering coordinates using
* SDL_ConvertEventToRenderCoordinates().
*
* \param renderer the rendering context
* \param w the width of the logical resolution
* \param h the height of the logical resolution
* \param mode the presentation mode used
* \param scale_mode the scale mode used
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetRenderLogicalSize
* \sa SDL_ConvertEventToRenderCoordinates
* \sa SDL_GetRenderLogicalPresentation
*/
extern DECLSPEC int SDLCALL SDL_SetRenderLogicalSize(SDL_Renderer *renderer, int w, int h);
extern DECLSPEC int SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode);
/**
* Get device independent resolution for rendering.
* Get device independent resolution and presentation mode for rendering.
*
* When using the main rendering target (eg no target texture is set): this
* may return 0 for `w` and `h` if the SDL_Renderer has never had its logical
* size set by SDL_SetRenderLogicalSize(). Otherwise it returns the logical
* width and height.
* This function gets the width and height of the logical rendering output,
* or the output size in pixels if a logical resolution is not enabled.
*
* When using a target texture: Never return 0 for `w` and `h` at first. Then
* it returns the logical width and height that are set.
*
* \param renderer a rendering context
* \param renderer the rendering context
* \param w an int to be filled with the width
* \param h an int to be filled with the height
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetRenderLogicalSize
*/
extern DECLSPEC void SDLCALL SDL_GetRenderLogicalSize(SDL_Renderer *renderer, int *w, int *h);
/**
* Set whether to force integer scales for resolution-independent rendering.
*
* This function restricts the logical viewport to integer values - that is,
* when a resolution is between two multiples of a logical size, the viewport
* size is rounded down to the lower multiple.
*
* \param renderer the renderer for which integer scaling should be set
* \param enable enable or disable the integer scaling for rendering
* \param mode a pointer filled in with the presentation mode
* \param scale_mode a pointer filled in with the scale mode
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetRenderIntegerScale
* \sa SDL_SetRenderLogicalSize
* \sa SDL_SetRenderLogicalPresentation
*/
extern DECLSPEC int SDLCALL SDL_SetRenderIntegerScale(SDL_Renderer *renderer, SDL_bool enable);
extern DECLSPEC int SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode);
/**
* Get whether integer scales are forced for resolution-independent rendering.
* Get a point in render coordinates when given a point in window coordinates.
*
* \param renderer the renderer from which integer scaling should be queried
* \returns SDL_TRUE if integer scales are forced or SDL_FALSE if not and on
* failure; call SDL_GetError() for more information.
* \param renderer the rendering context
* \param window_x the x coordinate in window coordinates
* \param window_y the y coordinate in window coordinates
* \param x a pointer filled with the x coordinate in render coordinates
* \param y a pointer filled with the y coordinate in render coordinates
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetRenderIntegerScale
* \sa SDL_SetRenderLogicalPresentation
* \sa SDL_SetRenderScale
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetRenderIntegerScale(SDL_Renderer *renderer);
extern DECLSPEC int SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y);
/**
* Get a point in window coordinates when given a point in render coordinates.
*
* \param renderer the rendering context
* \param x the x coordinate in render coordinates
* \param y the y coordinate in render coordinates
* \param window_x a pointer filled with the x coordinate in window coordinates
* \param window_y a pointer filled with the y coordinate in window coordinates
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetRenderLogicalPresentation
* \sa SDL_SetRenderScale
*/
extern DECLSPEC int SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
/**
* Convert the coordinates in an event to render coordinates.
*
* Touch coordinates are converted from normalized coordinates in the window
* to non-normalized rendering coordinates.
*
* Once converted, the coordinates may be outside the rendering area.
*
* \param renderer the rendering context
* \param event the event to modify
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetRenderCoordinatesFromWindowCoordinates
*/
extern DECLSPEC int SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
/**
* Set the drawing area for rendering on the current target.
*
* When the window is resized, the viewport is reset to fill the entire new
* window size.
*
* \param renderer the rendering context
* \param rect the SDL_Rect structure representing the drawing area, or NULL
* to set the viewport to the entire target
@ -892,18 +960,19 @@ extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const
*
* \param renderer the rendering context
* \param rect an SDL_Rect structure filled in with the current drawing area
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetRenderViewport
*/
extern DECLSPEC void SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
extern DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
/**
* Set the clip rectangle for rendering on the specified target.
*
* \param renderer the rendering context for which clip rectangle should be
* set
* \param renderer the rendering context
* \param rect an SDL_Rect structure representing the clip area, relative to
* the viewport, or NULL to disable clipping
* \returns 0 on success or a negative error code on failure; call
@ -919,22 +988,23 @@ extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const
/**
* Get the clip rectangle for the current target.
*
* \param renderer the rendering context from which clip rectangle should be
* queried
* \param renderer the rendering context
* \param rect an SDL_Rect structure filled in with the current clipping area
* or an empty rectangle if clipping is disabled
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_RenderClipEnabled
* \sa SDL_SetRenderClipRect
*/
extern DECLSPEC void SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
extern DECLSPEC int SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
/**
* Get whether clipping is enabled on the given renderer.
*
* \param renderer the renderer from which clip state should be queried
* \param renderer the rendering context
* \returns SDL_TRUE if clipping is enabled or SDL_FALSE if not; call
* SDL_GetError() for more information.
*
@ -945,7 +1015,6 @@ extern DECLSPEC void SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_R
*/
extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
/**
* Set the drawing scale for rendering on the current target.
*
@ -957,7 +1026,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
* will be handled using the appropriate quality hints. For best results use
* integer scaling factors.
*
* \param renderer a rendering context
* \param renderer the rendering context
* \param scaleX the horizontal scaling factor
* \param scaleY the vertical scaling factor
* \returns 0 on success or a negative error code on failure; call
@ -966,73 +1035,23 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetRenderScale
* \sa SDL_SetRenderLogicalSize
*/
extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
/**
* Get the drawing scale for the current target.
*
* \param renderer the renderer from which drawing scale should be queried
* \param renderer the rendering context
* \param scaleX a pointer filled in with the horizontal scaling factor
* \param scaleY a pointer filled in with the vertical scaling factor
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetRenderScale
*/
extern DECLSPEC void SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
/**
* Get logical coordinates of point in renderer when given real coordinates of
* point in window.
*
* Logical coordinates will differ from real coordinates when render is scaled
* and logical renderer size set
*
* \param renderer the renderer from which the logical coordinates should be
* calculated
* \param windowX the real X coordinate in the window
* \param windowY the real Y coordinate in the window
* \param logicalX the pointer filled with the logical x coordinate
* \param logicalY the pointer filled with the logical y coordinate
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetRenderScale
* \sa SDL_SetRenderScale
* \sa SDL_GetRenderLogicalSize
* \sa SDL_SetRenderLogicalSize
*/
extern DECLSPEC void SDLCALL SDL_RenderWindowToLogical(SDL_Renderer *renderer,
float windowX, float windowY,
float *logicalX, float *logicalY);
/**
* Get real coordinates of point in window when given logical coordinates of
* point in renderer.
*
* Logical coordinates will differ from real coordinates when render is scaled
* and logical renderer size set
*
* \param renderer the renderer from which the window coordinates should be
* calculated
* \param logicalX the logical x coordinate
* \param logicalY the logical y coordinate
* \param windowX the pointer filled with the real X coordinate in the window
* \param windowY the pointer filled with the real Y coordinate in the window
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetRenderScale
* \sa SDL_SetRenderScale
* \sa SDL_GetRenderLogicalSize
* \sa SDL_SetRenderLogicalSize
*/
extern DECLSPEC void SDLCALL SDL_RenderLogicalToWindow(SDL_Renderer *renderer,
float logicalX, float logicalY,
float *windowX, float *windowY);
extern DECLSPEC int SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
/**
* Set the color used for drawing operations (Rect, Line and Clear).
@ -1146,7 +1165,7 @@ extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
* \param renderer The renderer which should draw a point.
* \param x The x coordinate of the point.
* \param y The y coordinate of the point.
* \return 0 on success, or -1 on error
* \returns 0 on success, or -1 on error
*
* \since This function is available since SDL 3.0.0.
*/
@ -1158,7 +1177,8 @@ extern DECLSPEC int SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, flo
* \param renderer The renderer which should draw multiple points.
* \param points The points to draw
* \param count The number of points to draw
* \return 0 on success, or -1 on error
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -1172,7 +1192,7 @@ extern DECLSPEC int SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_F
* \param y1 The y coordinate of the start point.
* \param x2 The x coordinate of the end point.
* \param y2 The y coordinate of the end point.
* \return 0 on success, or -1 on error
* \returns 0 on success, or -1 on error
*
* \since This function is available since SDL 3.0.0.
*/
@ -1185,7 +1205,8 @@ extern DECLSPEC int SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, flo
* \param renderer The renderer which should draw multiple lines.
* \param points The points along the lines
* \param count The number of points, drawing count-1 lines
* \return 0 on success, or -1 on error
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -1197,7 +1218,7 @@ extern DECLSPEC int SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FP
* \param renderer The renderer which should draw a rectangle.
* \param rect A pointer to the destination rectangle, or NULL to outline the
* entire rendering target.
* \return 0 on success, or -1 on error
* \returns 0 on success, or -1 on error
*
* \since This function is available since SDL 3.0.0.
*/
@ -1210,7 +1231,8 @@ extern DECLSPEC int SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRe
* \param renderer The renderer which should draw multiple rectangles.
* \param rects A pointer to an array of destination rectangles.
* \param count The number of rectangles.
* \return 0 on success, or -1 on error
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -1223,7 +1245,7 @@ extern DECLSPEC int SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FR
* \param renderer The renderer which should fill a rectangle.
* \param rect A pointer to the destination rectangle, or NULL for the entire
* rendering target.
* \return 0 on success, or -1 on error
* \returns 0 on success, or -1 on error
*
* \since This function is available since SDL 3.0.0.
*/
@ -1236,7 +1258,8 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL
* \param renderer The renderer which should fill multiple rectangles.
* \param rects A pointer to an array of destination rectangles.
* \param count The number of rectangles.
* \return 0 on success, or -1 on error
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -1252,7 +1275,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SD
* texture.
* \param dstrect A pointer to the destination rectangle, or NULL for the
* entire rendering target.
* \return 0 on success, or -1 on error
* \returns 0 on success, or -1 on error
*
* \since This function is available since SDL 3.0.0.
*/
@ -1275,7 +1298,8 @@ extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Textur
* around dstrect.w/2, dstrect.h/2).
* \param flip An SDL_RendererFlip value stating which flipping actions should
* be performed on the texture
* \return 0 on success, or -1 on error
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -1297,7 +1321,7 @@ extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL
* array, if NULL all vertices will be rendered in sequential
* order.
* \param num_indices Number of indices.
* \return 0 on success, or -1 if the operation is not supported
* \returns 0 on success, or -1 if the operation is not supported
*
* \since This function is available since SDL 3.0.0.
*
@ -1327,7 +1351,8 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
* if NULL all vertices will be rendered in sequential order.
* \param num_indices Number of indices.
* \param size_indices Index size: 1 (byte), 2 (short), 4 (int)
* \return 0 on success, or -1 if the operation is not supported
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1357,8 +1382,8 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
* Bitmap data pads all rows to multiples of 4 bytes).
*
* \param renderer the rendering context
* \param rect an SDL_Rect structure representing the area to read, or NULL
* for the entire render target
* \param rect an SDL_Rect structure representing the area in pixels relative
* to the to current viewport, or NULL for the entire viewport
* \param format an SDL_PixelFormatEnum value of the desired format of the
* pixel data, or 0 to use the format of the rendering target
* \param pixels a pointer to the pixel data to copy into
@ -1377,9 +1402,9 @@ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
* Update the screen with any rendering performed since the previous call.
*
* SDL's rendering functions operate on a backbuffer; that is, calling a
* rendering function such as SDL_RenderLine() does not directly put a
* line on the screen, but rather updates the backbuffer. As such, you compose
* your entire scene and *present* the composed backbuffer to the screen as a
* rendering function such as SDL_RenderLine() does not directly put a line on
* the screen, but rather updates the backbuffer. As such, you compose your
* entire scene and *present* the composed backbuffer to the screen as a
* complete picture.
*
* Therefore, when using SDL's rendering API, one does all drawing intended
@ -1393,6 +1418,10 @@ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
* pixel.
*
* \param renderer the rendering context
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \threadsafety You may only call this function on the main thread.
*
* \since This function is available since SDL 3.0.0.
*
@ -1408,7 +1437,7 @@ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
* \sa SDL_SetRenderDrawBlendMode
* \sa SDL_SetRenderDrawColor
*/
extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
extern DECLSPEC int SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
/**
* Destroy the specified texture.
@ -1498,7 +1527,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer *renderer);
* texture width or NULL if you don't need that value
* \param texh a pointer to a float value which will be filled with the
* texture height or NULL if you don't need that value
* \returns 0 on success, or -1 if the operation is not supported; call
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
@ -1514,7 +1543,8 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw
* See SDL_GL_BindTexture() for examples on how to use these functions
*
* \param texture the texture to unbind from the current OpenGL/ES/ES2 context
* \returns 0 on success, or -1 if the operation is not supported
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
@ -1565,7 +1595,8 @@ extern DECLSPEC void *SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *ren
*
* \param renderer The renderer to toggle
* \param vsync 1 for on, 0 for off. All other values are reserved
* \returns a 0 int on success, or non-zero on failure
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -1575,8 +1606,10 @@ extern DECLSPEC int SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync
* Get VSync of the given renderer.
*
* \param renderer The renderer to toggle
* \param vsync an int filled with 1 for on, 0 for off. All other values are reserved
* \returns a 0 int on success, or non-zero on failure
* \param vsync an int filled with 1 for on, 0 for off. All other values are
* reserved
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/

View file

@ -319,10 +319,11 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_CreateRW(void);
* call the **close** method on those SDL_RWops pointers when you are done
* with them.
*
* Only use SDL_DestroyRW() on pointers returned by SDL_CreateRW(). The pointer is
* invalid as soon as this function returns. Any extra memory allocated during
* creation of the SDL_RWops is not freed by SDL_DestroyRW(); the programmer must
* be responsible for managing that memory in their **close** method.
* Only use SDL_DestroyRW() on pointers returned by SDL_CreateRW(). The
* pointer is invalid as soon as this function returns. Any extra memory
* allocated during creation of the SDL_RWops is not freed by SDL_DestroyRW();
* the programmer must be responsible for managing that memory in their
* **close** method.
*
* \param area the SDL_RWops structure to be freed
*
@ -371,7 +372,8 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
* \param context a pointer to an SDL_RWops structure
* \param offset an offset in bytes, relative to **whence** location; can be
* negative
* \param whence any of `SDL_RW_SEEK_SET`, `SDL_RW_SEEK_CUR`, `SDL_RW_SEEK_END`
* \param whence any of `SDL_RW_SEEK_SET`, `SDL_RW_SEEK_CUR`,
* `SDL_RW_SEEK_END`
* \returns the final offset in the data stream after the seek or -1 on error.
*
* \since This function is available since SDL 3.0.0.
@ -417,24 +419,25 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context);
* Read from a data source.
*
* This function reads up `size` bytes from the data source to the area
* pointed at by `ptr`. This function may read less bytes than requested.
* It will return zero when the data stream is completely read, or
* -1 on error. For streams that support non-blocking
* operation, if nothing was read because it would require blocking,
* this function returns -2 to distinguish that this is not an error or
* end-of-file, and the caller can try again later.
* pointed at by `ptr`. This function may read less bytes than requested. It
* will return zero when the data stream is completely read, or -1 on error.
* For streams that support non-blocking operation, if nothing was read
* because it would require blocking, this function returns -2 to distinguish
* that this is not an error or end-of-file, and the caller can try again
* later.
*
* SDL_RWread() is actually a function wrapper that calls the SDL_RWops's
* `read` method appropriately, to simplify application development.
*
* It is an error to specify a negative `size`, but this parameter is
* signed so you definitely cannot overflow the return value on a
* successful run with enormous amounts of data.
* It is an error to specify a negative `size`, but this parameter is signed
* so you definitely cannot overflow the return value on a successful run with
* enormous amounts of data.
*
* \param context a pointer to an SDL_RWops structure
* \param ptr a pointer to a buffer to read data into
* \param size the number of bytes to read from the data source.
* \returns the number of bytes read, 0 at end of file, -1 on error, and -2 for data not ready with a non-blocking context.
* \returns the number of bytes read, 0 at end of file, -1 on error, and -2
* for data not ready with a non-blocking context.
*
* \since This function is available since SDL 3.0.0.
*
@ -450,25 +453,23 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWread(SDL_RWops *context, void *ptr, Sint64
/**
* Write to an SDL_RWops data stream.
*
* This function writes exactly `size` bytes from the area pointed at by
* `ptr` to the stream. If this fails for any reason, it'll return less
* than `size` to demonstrate how far the write progressed. On success,
* it returns `num`.
* This function writes exactly `size` bytes from the area pointed at by `ptr`
* to the stream. If this fails for any reason, it'll return less than `size`
* to demonstrate how far the write progressed. On success, it returns `num`.
*
* On error, this function still attempts to write as much as possible,
* so it might return a positive value less than the requested write
* size. If the function failed to write anything and there was an
* actual error, it will return -1. For streams that support non-blocking
* operation, if nothing was written because it would require blocking,
* this function returns -2 to distinguish that this is not an error and
* the caller can try again later.
* On error, this function still attempts to write as much as possible, so it
* might return a positive value less than the requested write size. If the
* function failed to write anything and there was an actual error, it will
* return -1. For streams that support non-blocking operation, if nothing was
* written because it would require blocking, this function returns -2 to
* distinguish that this is not an error and the caller can try again later.
*
* SDL_RWwrite is actually a function wrapper that calls the SDL_RWops's
* `write` method appropriately, to simplify application development.
*
* It is an error to specify a negative `size`, but this parameter is
* signed so you definitely cannot overflow the return value on a
* successful run with enormous amounts of data.
* It is an error to specify a negative `size`, but this parameter is signed
* so you definitely cannot overflow the return value on a successful run with
* enormous amounts of data.
*
* \param context a pointer to an SDL_RWops structure
* \param ptr a pointer to a buffer containing data to write

View file

@ -132,7 +132,9 @@ typedef enum
* Get a list of currently connected sensors.
*
* \param count a pointer filled in with the number of sensors returned
* \returns a 0 terminated array of sensor instance IDs which should be freed with SDL_free(), or NULL on error; call SDL_GetError() for more details.
* \returns a 0 terminated array of sensor instance IDs which should be freed
* with SDL_free(), or NULL on error; call SDL_GetError() for more
* details.
*
* \since This function is available since SDL 3.0.0.
*/
@ -152,7 +154,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetSensorInstanceName(SDL_SensorID insta
* Get the type of a sensor.
*
* \param instance_id the sensor instance ID
* \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `instance_id` is not valid
* \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `instance_id` is
* not valid
*
* \since This function is available since SDL 3.0.0.
*/
@ -162,7 +165,8 @@ extern DECLSPEC SDL_SensorType SDLCALL SDL_GetSensorInstanceType(SDL_SensorID in
* Get the platform dependent type of a sensor.
*
* \param instance_id the sensor instance ID
* \returns the sensor platform dependent type, or -1 if `instance_id` is not valid
* \returns the sensor platform dependent type, or -1 if `instance_id` is not
* valid
*
* \since This function is available since SDL 3.0.0.
*/
@ -237,7 +241,8 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_GetSensorInstanceID(SDL_Sensor *sensor)
* \param sensor The SDL_Sensor object to query
* \param data A pointer filled with the current sensor state
* \param num_values The number of values to write to data
* \returns 0 or -1 if an error occurred.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/

View file

@ -56,11 +56,11 @@ extern "C" {
* \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_MOUSE_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.
* \returns the window created, or NULL if window creation failed.
*
* \since This function is available since SDL 3.0.0.
*
@ -72,7 +72,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,un
* Return whether the given window is a shaped window.
*
* \param window The window to query for being shaped.
* \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if
* \returns SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if
* the window is unshaped or NULL.
*
* \since This function is available since SDL 3.0.0.
@ -116,7 +116,7 @@ typedef struct SDL_WindowShapeMode {
* \param window The shaped window whose parameters should be set.
* \param shape A surface encoding the desired shape for the window.
* \param shape_mode The parameters to set for the shaped window.
* \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape
* \returns 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape
* argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does
* not reference a valid shaped window.
*
@ -133,7 +133,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *s
* \param window The shaped window whose parameters should be retrieved.
* \param shape_mode An empty shape-mode structure to fill, or NULL to check
* whether the window has a shape.
* \return 0 if the window has a shape and, provided shape_mode was not NULL,
* \returns 0 if the window has a shape and, provided shape_mode was not NULL,
* shape_mode has been filled with the mode data,
* SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped
* window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a

View file

@ -394,6 +394,11 @@ typedef void (SDLCALL *SDL_free_func)(void *mem);
/**
* Get the original set of SDL memory functions
*
* \param malloc_func filled with malloc function
* \param calloc_func filled with calloc function
* \param realloc_func filled with realloc function
* \param free_func filled with free function
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_GetOriginalMemoryFunctions(SDL_malloc_func *malloc_func,
@ -404,6 +409,11 @@ extern DECLSPEC void SDLCALL SDL_GetOriginalMemoryFunctions(SDL_malloc_func *mal
/**
* Get the current set of SDL memory functions
*
* \param malloc_func filled with malloc function
* \param calloc_func filled with calloc function
* \param realloc_func filled with realloc function
* \param free_func filled with free function
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
@ -414,6 +424,13 @@ extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func
/**
* Replace SDL's memory allocation functions with a custom set
*
* \param malloc_func custom malloc function
* \param calloc_func custom calloc function
* \param realloc_func custom realloc function
* \param free_func custom free function
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
@ -424,9 +441,11 @@ extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
/**
* Allocate memory aligned to a specific value
*
* If `alignment` is less than the size of `void *`, then it will be increased to match that.
* If `alignment` is less than the size of `void *`, then it will be increased
* to match that.
*
* The returned memory address will be a multiple of the alignment value, and the amount of memory allocated will be a multiple of the alignment value.
* The returned memory address will be a multiple of the alignment value, and
* the amount of memory allocated will be a multiple of the alignment value.
*
* The memory returned by this function must be freed with SDL_aligned_free()
*
@ -452,6 +471,8 @@ extern DECLSPEC void SDLCALL SDL_aligned_free(void *mem);
/**
* Get the number of outstanding (unfreed) allocations
*
* \returns the number of allocations
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
@ -711,7 +732,7 @@ 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.
*
* \since This function is available since SDL 2.24.0.
* \since This function is available since SDL 3.0.0.
*/
SDL_FORCE_INLINE int SDL_size_mul_overflow (size_t a,
size_t b,
@ -741,7 +762,7 @@ SDL_FORCE_INLINE int SDL_size_mul_overflow_builtin (size_t a,
* 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.
* \since This function is available since SDL 3.0.0.
*/
SDL_FORCE_INLINE int SDL_size_add_overflow (size_t a,
size_t b,

View file

@ -137,6 +137,9 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurface
* No copy is made of the pixel data. Pixel data is not managed automatically;
* you must free the surface before you free the pixel data.
*
* You may pass NULL for pixels and 0 for pitch to create a surface that you
* will fill in with valid values later.
*
* \param pixels a pointer to existing pixel data
* \param width the width of the surface
* \param height the height of the surface
@ -221,8 +224,8 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
/**
* Load a BMP image from a seekable SDL data stream.
*
* The new surface should be freed with SDL_DestroySurface(). Not doing so will
* result in a memory leak.
* The new surface should be freed with SDL_DestroySurface(). Not doing so
* will result in a memory leak.
*
* src is an open SDL_RWops buffer, typically loaded with SDL_RWFromFile.
* Alternitavely, you might also use the macro SDL_LoadBMP to load a bitmap
@ -348,7 +351,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface,
* It is safe to pass a NULL `surface` here; it will return SDL_FALSE.
*
* \param surface the SDL_Surface structure to query
* \return SDL_TRUE if the surface has a color key, SDL_FALSE otherwise.
* \returns SDL_TRUE if the surface has a color key, SDL_FALSE otherwise.
*
* \since This function is available since SDL 3.0.0.
*
@ -526,13 +529,15 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface,
* clipped
* \param rect an SDL_Rect structure filled in with the clipping rectangle for
* the surface
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_BlitSurface
* \sa SDL_SetSurfaceClipRect
*/
extern DECLSPEC void SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface,
extern DECLSPEC int SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface,
SDL_Rect *rect);
/*
@ -543,6 +548,8 @@ extern DECLSPEC void SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface,
* \param surface the surface to duplicate.
* \returns a copy of the surface, or NULL on failure; call SDL_GetError() for
* more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface *surface);
@ -649,8 +656,8 @@ extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height,
* information, no blending takes place.
*
* If there is a clip rectangle set on the destination (set via
* SDL_SetSurfaceClipRect()), then this function will fill based on the intersection
* of the clip rectangle and `rect`.
* SDL_SetSurfaceClipRect()), then this function will fill based on the
* intersection of the clip rectangle and `rect`.
*
* \param dst the SDL_Surface structure that is the drawing target
* \param rect the SDL_Rect structure representing the rectangle to fill, or
@ -675,8 +682,8 @@ extern DECLSPEC int SDLCALL SDL_FillSurfaceRect
* information, no blending takes place.
*
* If there is a clip rectangle set on the destination (set via
* SDL_SetSurfaceClipRect()), then this function will fill based on the intersection
* of the clip rectangle and `rect`.
* SDL_SetSurfaceClipRect()), then this function will fill based on the
* intersection of the clip rectangle and `rect`.
*
* \param dst the SDL_Surface structure that is the drawing target
* \param rects an array of SDL_Rects representing the rectangles to fill.
@ -693,56 +700,57 @@ extern DECLSPEC int SDLCALL SDL_FillSurfaceRects
(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color);
/**
* Performs a fast blit from the source surface to the destination surface.
* 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.
* 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 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
* The blit semantics for surfaces with and without blending and colorkey are
* defined as follows:
*
* ```c
* 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.
* ```
*
* \param src the SDL_Surface structure to be copied from
* \param srcrect the SDL_Rect structure representing the rectangle to be
@ -789,6 +797,15 @@ extern DECLSPEC int SDLCALL SDL_BlitSurfaceUnchecked
* Perform a fast, low quality, stretch blit between two surfaces of the same
* format.
*
* \param src the SDL_Surface structure to be copied from
* \param srcrect the SDL_Rect structure representing the rectangle to be
* copied
* \param dst the SDL_Surface structure that is the blit target
* \param dstrect the SDL_Rect structure representing the rectangle that is
* copied into
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* Please use SDL_BlitScaled() instead.
*
* \since This function is available since SDL 3.0.0.
@ -801,6 +818,15 @@ extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src,
/**
* Perform bilinear scaling between two surfaces of the same format, 32BPP.
*
* \param src the SDL_Surface structure to be copied from
* \param srcrect the SDL_Rect structure representing the rectangle to be
* copied
* \param dst the SDL_Surface structure that is the blit target
* \param dstrect the SDL_Rect structure representing the rectangle that is
* copied into
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface *src,
@ -855,6 +881,8 @@ extern DECLSPEC int SDLCALL SDL_BlitSurfaceUncheckedScaled
/**
* Set the YUV conversion mode
*
* \param mode YUV conversion mode
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
@ -862,6 +890,8 @@ extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mo
/**
* Get the YUV conversion mode
*
* \returns YUV conversion mode
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
@ -870,6 +900,10 @@ extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
* Get the YUV conversion mode, returning the correct mode for the resolution
* when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
*
* \param width width
* \param height height
* \returns YUV conversion mode
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);

View file

@ -42,7 +42,7 @@ extern "C" {
/* Platform specific functions for Windows */
#if defined(__WIN32__) || defined(__GDK__)
typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam);
/**
@ -60,19 +60,18 @@ extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook ca
#if defined(__WIN32__) || defined(__WINGDK__)
/**
* Get the D3D9 adapter index that matches the specified display index.
* Get the D3D9 adapter index that matches the specified display.
*
* The returned adapter index can be passed to `IDirect3D9::CreateDevice` and
* controls on which monitor a full screen application will appear.
*
* \param displayIndex the display index for which to get the D3D9 adapter
* index
* \param displayID the instance of the display to query
* \returns the D3D9 adapter index on success or a negative error code on
* failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex );
extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID);
typedef struct IDirect3DDevice9 IDirect3DDevice9;
@ -131,16 +130,13 @@ extern DECLSPEC ID3D12Device* SDLCALL SDL_RenderGetD3D12Device(SDL_Renderer* ren
#if defined(__WIN32__) || defined(__WINGDK__)
/**
* Get the DXGI Adapter and Output indices for the specified display index.
* Get the DXGI Adapter and Output indices for the specified display.
*
* The DXGI Adapter and Output indices can be passed to `EnumAdapters` and
* `EnumOutputs` respectively to get the objects required to create a DX10 or
* DX11 device and swap chain.
*
* Before SDL 2.0.4 this function did not return a value. Since SDL 2.0.4 it
* returns an SDL_bool.
*
* \param displayIndex the display index for which to get both indices
* \param displayID the instance of the display to query
* \param adapterIndex a pointer to be filled in with the adapter index
* \param outputIndex a pointer to be filled in with the output index
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
@ -148,7 +144,7 @@ extern DECLSPEC ID3D12Device* SDLCALL SDL_RenderGetD3D12Device(SDL_Renderer* ren
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex );
extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex);
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
@ -177,14 +173,15 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int prio
* \param sdlPriority The new SDL_ThreadPriority value.
* \param schedPolicy The new scheduling policy (SCHED_FIFO, SCHED_RR,
* SCHED_OTHER, etc...)
* \returns 0 on success, or -1 on error.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
#endif /* __LINUX__ */
/* Platform specific functions for iOS */
#ifdef __IOS__
@ -388,14 +385,15 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
*
* If external storage is currently unavailable, this will return 0.
*
* \returns the current state of external storage on success or 0 on failure;
* call SDL_GetError() for more information.
* \param state filled with the current state of external storage. 0 if external storage is currently unavailable.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AndroidGetExternalStoragePath
*/
extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(Uint32 *state);
/**
* Get the path used for external storage for this application.
@ -446,7 +444,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permis
* \param gravity where the notification should appear on the screen.
* \param xoffset set this parameter only when gravity >=0
* \param yoffset set this parameter only when gravity >=0
* \returns 0 if success, -1 if any error occurs.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -459,6 +458,8 @@ extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int durati
*
* \param command user command that must be greater or equal to 0x8000
* \param param user parameter
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
@ -581,13 +582,41 @@ extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
/* Functions used by iOS application delegates to notify SDL about state changes */
/*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void);
/*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void);
/*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void);
/*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void);
/*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
/*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
#ifdef __IOS__
/*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
#endif
@ -604,7 +633,8 @@ typedef struct XTaskQueueObject * XTaskQueueHandle;
* leak.
*
* \param outTaskQueue a pointer to be filled in with task queue handle.
* \returns 0 if success, -1 if any error occurs.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/

View file

@ -36,7 +36,7 @@
/**
* \brief 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_EVENT_SYSWM,
* 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_SetEventEnabled().

View file

@ -38,7 +38,6 @@
#include <SDL3/SDL_test_font.h>
#include <SDL3/SDL_test_fuzzer.h>
#include <SDL3/SDL_test_harness.h>
#include <SDL3/SDL_test_images.h>
#include <SDL3/SDL_test_log.h>
#include <SDL3/SDL_test_md5.h>
#include <SDL3/SDL_test_memory.h>

View file

@ -61,7 +61,8 @@ typedef struct
/* Video info */
const char *videodriver;
int display;
int display_index;
SDL_DisplayID displayID;
const char *window_title;
const char *window_icon;
Uint32 window_flags;
@ -76,9 +77,13 @@ typedef struct
int window_maxH;
int logical_w;
int logical_h;
SDL_RendererLogicalPresentation logical_presentation;
SDL_ScaleMode logical_scale_mode;
float scale;
int depth;
float refresh_rate;
SDL_bool fullscreen_exclusive;
SDL_DisplayMode fullscreen_mode;
int num_windows;
SDL_Window **windows;

View file

@ -38,8 +38,6 @@
#include <SDL3/SDL.h>
#include <SDL3/SDL_test_images.h>
#include <SDL3/SDL_begin_code.h>
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus

View file

@ -88,7 +88,7 @@ typedef struct SDLTest_TextWindow
*
* \returns the new window, or NULL on failure.
*
* \since This function is available since SDL 2.24.0
* \since This function is available since SDL 3.0.0.
*/
SDLTest_TextWindow *SDLTest_TextWindowCreate(float x, float y, float w, float h);
@ -100,7 +100,7 @@ SDLTest_TextWindow *SDLTest_TextWindowCreate(float x, float y, float w, float h)
* \param textwin The text output window
* \param renderer The renderer to use for display
*
* \since This function is available since SDL 2.24.0
* \since This function is available since SDL 3.0.0.
*/
void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer);
@ -115,7 +115,7 @@ void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *render
* \param fmt A printf() style format string
* \param ... additional parameters matching % tokens in the `fmt` string, if any
*
* \since This function is available since SDL 2.24.0
* \since This function is available since SDL 3.0.0.
*/
void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
@ -130,7 +130,7 @@ void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_ST
* \param text The text to add to the window
* \param len The length, in bytes, of the text to add to the window
*
* \since This function is available since SDL 2.24.0
* \since This function is available since SDL 3.0.0.
*/
void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len);
@ -139,7 +139,7 @@ void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char
*
* \param textwin The text output window
*
* \since This function is available since SDL 2.24.0
* \since This function is available since SDL 3.0.0.
*/
void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin);
@ -148,7 +148,7 @@ void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin);
*
* \param textwin The text output window
*
* \since This function is available since SDL 2.24.0
* \since This function is available since SDL 3.0.0.
*/
void SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin);

Some files were not shown because too many files have changed in this diff Show more