diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc91c61..3a3372a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,25 +14,21 @@ jobs: fail-fast: false matrix: platform: - - { name: win-x64, os: windows-latest, flags: -A x64 } - - { name: win-x86, os: windows-latest, flags: -A Win32 } - - { name: win-arm64, os: windows-latest, flags: -A ARM64 } - - { name: linux-x64, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":amd64" } - - { name: linux-x86, os: ubuntu-20.04, flags: -GNinja -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32", target_apt_arch: ":i386" } - - { name: linux-arm64, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":arm64", container: arm64v8/ubuntu, docker_platform: linux/arm64/v8 } - - { name: linux-arm, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":armhf", container: arm32v7/ubuntu, docker_platform: linux/arm/v7 } - - { name: osx-x64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 } + - { name: win-x64, os: windows-latest, flags: -A x64 } + - { name: win-x86, os: windows-latest, flags: -A Win32 } + - { name: win-arm64, os: windows-latest, flags: -A ARM64 } + - { name: linux-x64, os: ubuntu-22.04, flags: -GNinja, target_apt_arch: ":amd64" } + - { name: linux-x86, os: ubuntu-22.04, flags: -GNinja -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32", target_apt_arch: ":i386" } + - { name: linux-arm64, os: ubuntu-22.04-arm, flags: -GNinja, target_apt_arch: ":arm64", container: "arm64v8/ubuntu:22.04" } + - { name: linux-arm, os: ubuntu-22.04-arm, flags: -GNinja, target_apt_arch: ":armhf", container: "arm32v7/ubuntu:22.04" } + - { name: osx-x64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 } # NOTE: macOS 11.0 is the first released supported by Apple Silicon. - - { name: osx-arm64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 } + - { name: osx-arm64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 } steps: - uses: actions/checkout@v4 with: submodules: true - - name: Set up QEMU - if: contains(matrix.platform.container, 'arm') - uses: docker/setup-qemu-action@v3 - - name: Build (Linux ARM) if: contains(matrix.platform.container, 'arm') uses: addnab/docker-run-action@v3 @@ -45,7 +41,6 @@ jobs: -e RUNNER_OS=${{ runner.os }} -e FLAGS=${{ matrix.platform.flags }} -e BUILD_TYPE=${{ env.BUILD_TYPE }} - --platform ${{ matrix.platform.docker_platform }} run: | cd /workspace ./External/build.sh @@ -117,7 +112,7 @@ jobs: build-android: name: android - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: NDK_VER: 23.1.7779620 PLATFORM_VER: android-34 @@ -157,7 +152,7 @@ jobs: run: | export JAVA_HOME=$JAVA_HOME_11_X64 export PATH=$JAVA_HOME_11_X64/bin:$PATH - export OUTPUT=$PWD/SDL3-CS.Android/Jars/ + export OUTPUT=$PWD/SDL3-CS/Jars/ rm -rf $OUTPUT && mkdir -p $OUTPUT # Build SDL3 Android Java part @@ -179,7 +174,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: android-jar - path: SDL3-CS.Android/Jars/SDL3AndroidBridge.jar + path: SDL3-CS/Jars/SDL3AndroidBridge.jar if-no-files-found: error make-pr: @@ -207,7 +202,7 @@ jobs: uses: actions/download-artifact@v4 with: name: android-jar - path: SDL3-CS.Android/Jars/ + path: SDL3-CS/Jars/ - name: Create pull request uses: peter-evans/create-pull-request@v6 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f875e85..3f6b211 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,7 +6,7 @@ on: - '*' jobs: - desktop: + pack: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -16,10 +16,19 @@ jobs: with: dotnet-version: 8.0.x - - name: Build - run: dotnet build SDL3-CS.Desktop.slnf -c Release + - name: Setup JDK 17 + uses: actions/setup-java@v4 + with: + distribution: microsoft + java-version: 17 - - name: Pack + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + - name: Install .NET workloads + run: dotnet workload restore SDL3-CS/SDL3-CS.csproj + + - name: Build & pack run: dotnet pack SDL3-CS/SDL3-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) - name: Upload artifact @@ -30,34 +39,3 @@ jobs: - name: Publish tagged release to nuget.org run: dotnet nuget push SDL3-CS/bin/Release/ppy.*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} - - android: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - - name: Install Android workload - # since windows image 20241113.3.0, not specifying a version here - # installs the .NET 7 version of android workload for very unknown reasons. - # revisit once we upgrade to .NET 9, it's probably fixed there. - run: dotnet workload install android --version (dotnet --version) - - - name: Build - run: dotnet build SDL3-CS.Android.slnf -c Release - - - name: Pack - run: dotnet pack SDL3-CS.Android\SDL3-CS.Android.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: SDL3-CS.Android - path: SDL3-CS.Android\bin\Release\ppy.*.nupkg - - - name: Publish tagged release to nuget.org - run: dotnet nuget push SDL3-CS.Android\bin\Release\ppy.*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} diff --git a/.idea/.idea.SDL3-CS.Android/.idea/.name b/.idea/.idea.SDL3-CS.Android/.idea/.name deleted file mode 100644 index 104344e..0000000 --- a/.idea/.idea.SDL3-CS.Android/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -SDL3-CS.Android \ No newline at end of file diff --git a/.idea/.idea.SDL3-CS.Android/.idea/projectSettingsUpdater.xml b/.idea/.idea.SDL3-CS.Android/.idea/projectSettingsUpdater.xml deleted file mode 100644 index 4bb9f4d..0000000 --- a/.idea/.idea.SDL3-CS.Android/.idea/projectSettingsUpdater.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 38286b4..ec76d73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,12 @@ RUN apt-get update && \ WORKDIR /tmp COPY .config/dotnet-tools.json .config/dotnet-tools.json COPY SDL3-CS/SDL3-CS.csproj SDL3-CS/SDL3-CS.csproj + +# .NET 8 installed using the distro package does not support the android workload. +# Since the project is only used for reference purposes, we'll retarget it to a single framework. +# See: https://github.com/dotnet/core/discussions/9258#discussioncomment-9548857 +RUN sed -i 's/net8.0<\/TargetFramework>/' SDL3-CS/SDL3-CS.csproj + RUN dotnet tool restore && \ dotnet restore --ucr SDL3-CS/SDL3-CS.csproj @@ -16,4 +22,4 @@ RUN echo '#!/bin/bash' >> entrypoint.sh && \ echo 'python3 SDL3-CS/generate_bindings.py "$@"' >> entrypoint.sh && \ chmod +x entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] diff --git a/External/.idea/encodings.xml b/External/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/External/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.SDL3-CS.Android/.idea/indexLayout.xml b/External/.idea/indexLayout.xml similarity index 100% rename from .idea/.idea.SDL3-CS.Android/.idea/indexLayout.xml rename to External/.idea/indexLayout.xml diff --git a/External/.idea/misc.xml b/External/.idea/misc.xml new file mode 100644 index 0000000..fc259db --- /dev/null +++ b/External/.idea/misc.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/External/.idea/projectSettingsUpdater.xml b/External/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..ef20cb0 --- /dev/null +++ b/External/.idea/projectSettingsUpdater.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/External/SDL b/External/SDL index e027b85..a40b2de 160000 --- a/External/SDL +++ b/External/SDL @@ -1 +1 @@ -Subproject commit e027b85cc457556071cbb2f3f1bcf8803c1bc001 +Subproject commit a40b2de9466c41426a5a24662c5a17374ea36f0d diff --git a/External/build.sh b/External/build.sh index 8ea5241..3fd6a8b 100755 --- a/External/build.sh +++ b/External/build.sh @@ -1,6 +1,8 @@ #!/bin/bash -pushd "$(dirname "$0")" >/dev/null +set -e + +pushd "$(dirname "$0")" # Check if environment variables are defined if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then @@ -8,7 +10,9 @@ if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then exit 1 fi -SUDO=$(which sudo) +SUDO=$(which sudo || exit 0) + +export DEBIAN_FRONTEND=noninteractive if [[ $RUNNER_OS == 'Linux' ]]; then # Setup Linux dependencies @@ -18,11 +22,6 @@ if [[ $RUNNER_OS == 'Linux' ]]; then $SUDO apt-get update -y -qq - if [[ $TARGET_APT_ARCH == :i386 ]]; then - # Workaround GitHub's ubuntu-20.04 image issue - $SUDO apt-get install -y --allow-downgrades libpcre2-8-0=10.34-7 - fi - if [[ $NAME != 'linux-x86' && $NAME != 'linux-x64' ]]; then GCC="gcc" GPP="g++" @@ -34,12 +33,12 @@ if [[ $RUNNER_OS == 'Linux' ]]; then $SUDO apt-get install -y \ $GCC \ $GPP \ - git \ + git \ cmake \ ninja-build \ wayland-scanner++ \ wayland-protocols \ - meson \ + meson \ pkg-config$TARGET_APT_ARCH \ libasound2-dev$TARGET_APT_ARCH \ libdbus-1-dev$TARGET_APT_ARCH \ @@ -47,9 +46,9 @@ if [[ $RUNNER_OS == 'Linux' ]]; then libgl1-mesa-dev$TARGET_APT_ARCH \ libgles2-mesa-dev$TARGET_APT_ARCH \ libglu1-mesa-dev$TARGET_APT_ARCH \ - libgtk-3-dev$TARGET_APT_ARCH \ + libgtk-3-dev$TARGET_APT_ARCH \ libibus-1.0-dev$TARGET_APT_ARCH \ - libpango1.0-dev$TARGET_APT_ARCH \ + libpango1.0-dev$TARGET_APT_ARCH \ libpulse-dev$TARGET_APT_ARCH \ libsndio-dev$TARGET_APT_ARCH \ libudev-dev$TARGET_APT_ARCH \ @@ -67,31 +66,24 @@ if [[ $RUNNER_OS == 'Linux' ]]; then libxxf86vm-dev$TARGET_APT_ARCH \ libdrm-dev$TARGET_APT_ARCH \ libgbm-dev$TARGET_APT_ARCH \ - libpulse-dev$TARGET_APT_ARCH - - if [[ $TARGET_APT_ARCH != :i386 ]]; then - # Build libdecor. - # This is required so that window decorations can work on wayland. - # The support will only be enabled in SDL, but we're not shipping the libdecor binaries - # because making them work from a c# app as everything else does (via runtimes) is too difficult. - # Also skip i386 because attempting to support this for i386 is a pain. - # Special shoutouts to gnome for refusing to support server-side decorations. - git clone https://gitlab.freedesktop.org/libdecor/libdecor.git - cd libdecor - git checkout 0.2.2 - meson build --buildtype release - $SUDO meson install -C build - cd .. - fi + libpulse-dev$TARGET_APT_ARCH \ + libpipewire-0.3-dev$TARGET_APT_ARCH \ + libdecor-0-dev$TARGET_APT_ARCH fi # Build SDL -pushd SDL >/dev/null -git reset --hard HEAD +pushd SDL +git reset --hard HEAD || echo "Failed to clean up the repository" + +if [[ $RUNNER_OS == 'Windows' ]]; then + echo "Patching SDL to not include gameinput.h" + sed -i 's/#include /#_include /g' CMakeLists.txt +fi + cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON cmake --build build/ --config Release $SUDO cmake --install build/ --prefix install_output --config Release -popd >/dev/null +popd # Move build lib into correct folders if [[ $RUNNER_OS == 'Windows' ]]; then @@ -103,14 +95,14 @@ elif [[ $RUNNER_OS == 'macOS' ]]; then fi # Build SDL_image -pushd SDL_image >/dev/null +pushd SDL_image git reset --hard HEAD # -DSDLIMAGE_AVIF=OFF is used because windows requires special setup to build avif support (nasm) # TODO: Add support for avif on windows (VisualC script uses dynamic imports) cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON -DCMAKE_PREFIX_PATH="../SDL/install_output/cmake/" -DSDLIMAGE_AVIF=OFF cmake --build build/ --config Release $SUDO cmake --install build/ --prefix install_output --config Release -popd >/dev/null +popd # Move build lib into correct folders if [[ $RUNNER_OS == 'Windows' ]]; then @@ -126,14 +118,13 @@ elif [[ $RUNNER_OS == 'macOS' ]]; then # TODO: find out if webp, etc. are also needed on macOS here fi - # Build SDL_ttf -pushd SDL_ttf >/dev/null +pushd SDL_ttf git reset --hard HEAD cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON -DCMAKE_PREFIX_PATH="../SDL/install_output/cmake/" cmake --build build/ --config Release $SUDO cmake --install build/ --prefix install_output --config Release -popd >/dev/null +popd # Move build lib into correct folders if [[ $RUNNER_OS == 'Windows' ]]; then @@ -144,6 +135,4 @@ elif [[ $RUNNER_OS == 'macOS' ]]; then cp SDL3_ttf/install_output/lib/libSDL3_ttf.dylib ../native/$NAME/libSDL3_ttf.dylib fi - -# pop External -popd >/dev/null +popd diff --git a/README.md b/README.md index f76e4f3..4b963ae 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,15 @@ The library is functional and available for public use. While it is actively mai Contributions to keep the bindings up-to-date with upstream SDL3 changes are welcome. If you have improvements or updates, feel free to submit a pull request. +## Generating Bindings + +Bindings should be generated via the provided Dockerfile: + +```sh +docker build -t 'sdl-gen' . +docker run --rm -v .:/app -w /app -it sdl-gen +``` + ## License This code is released under [MIT](LICENCE). diff --git a/SDL3-CS.Android.slnf b/SDL3-CS.Android.slnf index a966f98..87feeeb 100644 --- a/SDL3-CS.Android.slnf +++ b/SDL3-CS.Android.slnf @@ -6,7 +6,6 @@ "SDL3_ttf-CS\\SDL3_ttf-CS.csproj", "SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj", - "SDL3-CS.Android\\SDL3-CS.Android.csproj", "SDL3-CS.Tests\\SDL3-CS.Tests.csproj", "SDL3-CS.Tests.Android\\SDL3-CS.Tests.Android.csproj" ] diff --git a/SDL3-CS.Android/Jars/SDL3AndroidBridge.jar b/SDL3-CS.Android/Jars/SDL3AndroidBridge.jar deleted file mode 100644 index c3b00da..0000000 Binary files a/SDL3-CS.Android/Jars/SDL3AndroidBridge.jar and /dev/null differ diff --git a/SDL3-CS.Android/SDL3-CS.Android.csproj b/SDL3-CS.Android/SDL3-CS.Android.csproj deleted file mode 100644 index ec12aaa..0000000 --- a/SDL3-CS.Android/SDL3-CS.Android.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - net8.0-android - 21 - SDL.Android - enable - enable - - - - ppy Pty Ltd - ppy Pty Ltd - Copyright (c) 2024 ppy Pty Ltd - ppy.SDL3-CS.Android - ppy.SDL3-CS.Android - Automated release. - MIT - https://github.com/ppy/SDL3-CS - https://github.com/ppy/SDL3-CS - - - - - - diff --git a/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj b/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj index e84e625..e639325 100644 --- a/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj +++ b/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj @@ -13,7 +13,6 @@ - diff --git a/SDL3-CS.Tests.iOS/SDL3-CS.Tests.iOS.csproj b/SDL3-CS.Tests.iOS/SDL3-CS.Tests.iOS.csproj index db14f90..31c6e93 100644 --- a/SDL3-CS.Tests.iOS/SDL3-CS.Tests.iOS.csproj +++ b/SDL3-CS.Tests.iOS/SDL3-CS.Tests.iOS.csproj @@ -8,6 +8,7 @@ true 13.0 true + iPhone Developer diff --git a/SDL3-CS.Tests/Program.cs b/SDL3-CS.Tests/Program.cs index 8e44865..acfa9bb 100644 --- a/SDL3-CS.Tests/Program.cs +++ b/SDL3-CS.Tests/Program.cs @@ -32,6 +32,8 @@ namespace SDL.Tests window.Setup(); window.Create(); + printWindows(); + const SDL_Keymod state = SDL_Keymod.SDL_KMOD_CAPS | SDL_Keymod.SDL_KMOD_ALT; SDL_SetModState(state); Debug.Assert(SDL_GetModState() == state); @@ -64,5 +66,17 @@ namespace SDL.Tests } } } + + private static unsafe void printWindows() + { + using var windows = SDL_GetWindows(); + if (windows == null) + return; + + for (int i = 0; i < windows.Count; i++) + { + Console.WriteLine($"Window {i} title: {SDL_GetWindowTitle(windows[i])}"); + } + } } } diff --git a/SDL3-CS.Tests/TestPositionalInputVisualisation.cs b/SDL3-CS.Tests/TestPositionalInputVisualisation.cs index 1515d83..51e3c87 100644 --- a/SDL3-CS.Tests/TestPositionalInputVisualisation.cs +++ b/SDL3-CS.Tests/TestPositionalInputVisualisation.cs @@ -2,10 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using System.Drawing; +using NUnit.Framework; using static SDL.SDL3; namespace SDL.Tests { + [Explicit("Uses an interactive window.")] public unsafe class TestPositionalInputVisualisation : MainCallbacksTest { private SDL_Window* window; diff --git a/SDL3-CS.Tests/TestTray.cs b/SDL3-CS.Tests/TestTray.cs new file mode 100644 index 0000000..02ad4df --- /dev/null +++ b/SDL3-CS.Tests/TestTray.cs @@ -0,0 +1,43 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using static SDL.SDL3; + +namespace SDL.Tests +{ + [Explicit("Uses an interactive tray icon.")] + public unsafe class TestTray : TrayTest + { + private volatile bool running; + + [Test] + public void TestBasic() + { + var checkbox = SDL_InsertTrayEntryAt(RootMenu, -1, "Check box?", SDL_TrayEntryFlags.SDL_TRAYENTRY_CHECKBOX); + Assert.That(checkbox != null, SDL_GetError); + SetCallback(checkbox, () => Console.WriteLine("Checkbox was toggled.")); + + var separator = SDL_InsertTrayEntryAt(RootMenu, -1, (byte*)null, 0); + Assert.That(separator != null, SDL_GetError); + + var exit = SDL_InsertTrayEntryAt(RootMenu, -1, "Exit tray", SDL_TrayEntryFlags.SDL_TRAYENTRY_BUTTON); + Assert.That(exit != null, SDL_GetError); + SetCallback(exit, () => running = false); + + var entries = SDL_GetTrayEntries(RootMenu); + Assert.That(entries, Is.Not.Null, SDL_GetError); + Assert.That(entries!.Count, Is.EqualTo(3)); + + for (int i = 0; i < entries.Count; i++) + Console.WriteLine($"{i}. {SDL_GetTrayEntryLabel(entries[i]) ?? ""}"); + + running = true; + + while (running) + { + SDL_PumpEvents(); + } + } + } +} diff --git a/SDL3-CS.Tests/TrayTest.cs b/SDL3-CS.Tests/TrayTest.cs new file mode 100644 index 0000000..ad754ce --- /dev/null +++ b/SDL3-CS.Tests/TrayTest.cs @@ -0,0 +1,52 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using NUnit.Framework; + +namespace SDL.Tests +{ + [TestFixture] + public abstract unsafe class TrayTest + { + private SDL_Tray* tray; + protected SDL_TrayMenu* RootMenu { get; private set; } + + [SetUp] + public void SetUp() + { + Assert.That(SDL3.SDL_Init(SDL_InitFlags.SDL_INIT_VIDEO), SDL3.SDL_GetError); + tray = SDL3.SDL_CreateTray(null, "Test tray"); + Assert.That(tray != null, SDL3.SDL_GetError); + RootMenu = SDL3.SDL_CreateTrayMenu(tray); + Assert.That(RootMenu != null, SDL3.SDL_GetError); + } + + protected static void SetCallback(SDL_TrayEntry* entry, Action callback) + { + var objectHandle = new ObjectHandle(callback, GCHandleType.Normal); + SDL3.SDL_SetTrayEntryCallback(entry, &nativeOnSelect, objectHandle.Handle); // this is leaking object handles, fine for tests + } + + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvCdecl)])] + private static void nativeOnSelect(IntPtr userdata, SDL_TrayEntry* entry) + { + var objectHandle = new ObjectHandle(userdata, true); + + if (objectHandle.GetTarget(out var action)) + action(); + else + Assert.Fail("Accessing disposed object handle."); + } + + [TearDown] + public void TearDown() + { + if (tray != null) + SDL3.SDL_DestroyTray(tray); + + SDL3.SDL_Quit(); + } + } +} diff --git a/SDL3-CS.sln b/SDL3-CS.sln index c0b2111..ae0c151 100644 --- a/SDL3-CS.sln +++ b/SDL3-CS.sln @@ -19,8 +19,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3-CS.SourceGeneration", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3-CS.Tests", "SDL3-CS.Tests\SDL3-CS.Tests.csproj", "{CF980481-8227-4BED-970E-6433C83F64CB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Android", "SDL3-CS.Android\SDL3-CS.Android.csproj", "{CA28F49C-D0BE-47D6-9E82-7A0B8C380B8B}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.Android", "SDL3-CS.Tests.Android\SDL3-CS.Tests.Android.csproj", "{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.iOS", "SDL3-CS.Tests.iOS\SDL3-CS.Tests.iOS.csproj", "{CCDD11EE-D552-4925-8B68-351AC9317589}" @@ -49,10 +47,6 @@ Global {CF980481-8227-4BED-970E-6433C83F64CB}.Debug|Any CPU.Build.0 = Debug|Any CPU {CF980481-8227-4BED-970E-6433C83F64CB}.Release|Any CPU.ActiveCfg = Release|Any CPU {CF980481-8227-4BED-970E-6433C83F64CB}.Release|Any CPU.Build.0 = Release|Any CPU - {CA28F49C-D0BE-47D6-9E82-7A0B8C380B8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CA28F49C-D0BE-47D6-9E82-7A0B8C380B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CA28F49C-D0BE-47D6-9E82-7A0B8C380B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CA28F49C-D0BE-47D6-9E82-7A0B8C380B8B}.Release|Any CPU.Build.0 = Release|Any CPU {E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/SDL3-CS.Android/Additions/AboutAdditions.txt b/SDL3-CS/Additions/AboutAdditions.txt similarity index 100% rename from SDL3-CS.Android/Additions/AboutAdditions.txt rename to SDL3-CS/Additions/AboutAdditions.txt diff --git a/SDL3-CS/Jars/SDL3AndroidBridge.jar b/SDL3-CS/Jars/SDL3AndroidBridge.jar new file mode 100644 index 0000000..8a7bb16 Binary files /dev/null and b/SDL3-CS/Jars/SDL3AndroidBridge.jar differ diff --git a/SDL3-CS/SDL3-CS.csproj b/SDL3-CS/SDL3-CS.csproj index 84ef448..a8a6123 100644 --- a/SDL3-CS/SDL3-CS.csproj +++ b/SDL3-CS/SDL3-CS.csproj @@ -1,11 +1,13 @@  - net8.0 SDL + net8.0;net8.0-android + 21 enable true $(NoWarn);SYSLIB1054;CA1401 + $(DefineConstants);JETBRAINS_ANNOTATIONS @@ -93,6 +95,7 @@ runtimes/android-x86/native true + diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_asyncio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_asyncio.g.cs new file mode 100644 index 0000000..d991bfd --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_asyncio.g.cs @@ -0,0 +1,119 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_AsyncIO + { + } + + public enum SDL_AsyncIOTaskType + { + SDL_ASYNCIO_TASK_READ, + SDL_ASYNCIO_TASK_WRITE, + SDL_ASYNCIO_TASK_CLOSE, + } + + public enum SDL_AsyncIOResult + { + SDL_ASYNCIO_COMPLETE, + SDL_ASYNCIO_FAILURE, + SDL_ASYNCIO_CANCELED, + } + + public unsafe partial struct SDL_AsyncIOOutcome + { + public SDL_AsyncIO* asyncio; + + public SDL_AsyncIOTaskType type; + + public SDL_AsyncIOResult result; + + [NativeTypeName("void*")] + public IntPtr buffer; + + [NativeTypeName("Uint64")] + public ulong offset; + + [NativeTypeName("Uint64")] + public ulong bytes_requested; + + [NativeTypeName("Uint64")] + public ulong bytes_transferred; + + [NativeTypeName("void*")] + public IntPtr userdata; + } + + public partial struct SDL_AsyncIOQueue + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_AsyncIO* SDL_AsyncIOFromFile([NativeTypeName("const char *")] byte* file, [NativeTypeName("const char *")] byte* mode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Sint64")] + public static extern long SDL_GetAsyncIOSize(SDL_AsyncIO* asyncio); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_ReadAsyncIO(SDL_AsyncIO* asyncio, [NativeTypeName("void*")] IntPtr ptr, [NativeTypeName("Uint64")] ulong offset, [NativeTypeName("Uint64")] ulong size, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_WriteAsyncIO(SDL_AsyncIO* asyncio, [NativeTypeName("void*")] IntPtr ptr, [NativeTypeName("Uint64")] ulong offset, [NativeTypeName("Uint64")] ulong size, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_CloseAsyncIO(SDL_AsyncIO* asyncio, [NativeTypeName("bool")] SDLBool flush, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_AsyncIOQueue* SDL_CreateAsyncIOQueue(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue* queue); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_GetAsyncIOResult(SDL_AsyncIOQueue* queue, SDL_AsyncIOOutcome* outcome); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_WaitAsyncIOResult(SDL_AsyncIOQueue* queue, SDL_AsyncIOOutcome* outcome, [NativeTypeName("Sint32")] int timeoutMS); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SignalAsyncIOQueue(SDL_AsyncIOQueue* queue); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_LoadFileAsync([NativeTypeName("const char *")] byte* file, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index de63476..8fa1701 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -89,15 +89,23 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] - public static extern SDLBool SDL_PauseAudioDevice(SDL_AudioDeviceID dev); + public static extern SDLBool SDL_IsAudioDevicePhysical(SDL_AudioDeviceID devid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] - public static extern SDLBool SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); + public static extern SDLBool SDL_IsAudioDevicePlayback(SDL_AudioDeviceID devid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] - public static extern SDLBool SDL_AudioDevicePaused(SDL_AudioDeviceID dev); + public static extern SDLBool SDL_PauseAudioDevice(SDL_AudioDeviceID devid); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_ResumeAudioDevice(SDL_AudioDeviceID devid); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_AudioDevicePaused(SDL_AudioDeviceID devid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern float SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid); @@ -111,14 +119,14 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] - public static extern SDLBool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream** streams, int num_streams); + public static extern SDLBool SDL_BindAudioStreams(SDL_AudioDeviceID devid, [NativeTypeName("SDL_AudioStream *const *")] SDL_AudioStream** streams, int num_streams); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] public static extern SDLBool SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream* stream); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_UnbindAudioStreams(SDL_AudioStream** streams, int num_streams); + public static extern void SDL_UnbindAudioStreams([NativeTypeName("SDL_AudioStream *const *")] SDL_AudioStream** streams, int num_streams); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_UnbindAudioStream(SDL_AudioStream* stream); @@ -197,6 +205,10 @@ namespace SDL [return: NativeTypeName("bool")] public static extern SDLBool SDL_ResumeAudioStreamDevice(SDL_AudioStream* stream); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_AudioStreamDevicePaused(SDL_AudioStream* stream); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] public static extern SDLBool SDL_LockAudioStream(SDL_AudioStream* stream); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs index 062ecc6..49740d7 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs @@ -70,7 +70,7 @@ namespace SDL public static extern SDL_CameraID* SDL_GetCameras(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_CameraSpec** SDL_GetCameraSupportedFormats(SDL_CameraID devid, int* count); + public static extern SDL_CameraSpec** SDL_GetCameraSupportedFormats(SDL_CameraID instance_id, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraName", ExactSpelling = true)] [return: NativeTypeName("const char *")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs index 7109c6b..8c09112 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs @@ -37,6 +37,13 @@ namespace SDL public byte* pattern; } + public enum SDL_FileDialogType + { + SDL_FILEDIALOG_OPENFILE, + SDL_FILEDIALOG_SAVEFILE, + SDL_FILEDIALOG_OPENFOLDER, + } + public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -47,5 +54,32 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_ShowOpenFolderDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, SDL_Window* window, [NativeTypeName("const char *")] byte* default_location, [NativeTypeName("bool")] SDLBool allow_many); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_ShowFileDialogWithProperties(SDL_FileDialogType type, [NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, SDL_PropertiesID props); + + [NativeTypeName("#define SDL_PROP_FILE_DIALOG_FILTERS_POINTER \"SDL.filedialog.filters\"")] + public static ReadOnlySpan SDL_PROP_FILE_DIALOG_FILTERS_POINTER => "SDL.filedialog.filters"u8; + + [NativeTypeName("#define SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER \"SDL.filedialog.nfilters\"")] + public static ReadOnlySpan SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER => "SDL.filedialog.nfilters"u8; + + [NativeTypeName("#define SDL_PROP_FILE_DIALOG_WINDOW_POINTER \"SDL.filedialog.window\"")] + public static ReadOnlySpan SDL_PROP_FILE_DIALOG_WINDOW_POINTER => "SDL.filedialog.window"u8; + + [NativeTypeName("#define SDL_PROP_FILE_DIALOG_LOCATION_STRING \"SDL.filedialog.location\"")] + public static ReadOnlySpan SDL_PROP_FILE_DIALOG_LOCATION_STRING => "SDL.filedialog.location"u8; + + [NativeTypeName("#define SDL_PROP_FILE_DIALOG_MANY_BOOLEAN \"SDL.filedialog.many\"")] + public static ReadOnlySpan SDL_PROP_FILE_DIALOG_MANY_BOOLEAN => "SDL.filedialog.many"u8; + + [NativeTypeName("#define SDL_PROP_FILE_DIALOG_TITLE_STRING \"SDL.filedialog.title\"")] + public static ReadOnlySpan SDL_PROP_FILE_DIALOG_TITLE_STRING => "SDL.filedialog.title"u8; + + [NativeTypeName("#define SDL_PROP_FILE_DIALOG_ACCEPT_STRING \"SDL.filedialog.accept\"")] + public static ReadOnlySpan SDL_PROP_FILE_DIALOG_ACCEPT_STRING => "SDL.filedialog.accept"u8; + + [NativeTypeName("#define SDL_PROP_FILE_DIALOG_CANCEL_STRING \"SDL.filedialog.cancel\"")] + public static ReadOnlySpan SDL_PROP_FILE_DIALOG_CANCEL_STRING => "SDL.filedialog.cancel"u8; } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs index 99b24ba..c35da6e 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs @@ -115,6 +115,7 @@ namespace SDL SDL_EVENT_FINGER_DOWN = 0x700, SDL_EVENT_FINGER_UP, SDL_EVENT_FINGER_MOTION, + SDL_EVENT_FINGER_CANCELED, SDL_EVENT_CLIPBOARD_UPDATE = 0x900, SDL_EVENT_DROP_FILE = 0x1000, SDL_EVENT_DROP_TEXT, @@ -711,6 +712,19 @@ namespace SDL public SDL_CameraID which; } + public partial struct SDL_RenderEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + public SDL_WindowID windowID; + } + public partial struct SDL_TouchFingerEvent { public SDL_EventType type; @@ -890,7 +904,7 @@ namespace SDL public SDLBool owner; [NativeTypeName("Sint32")] - public int n_mime_types; + public int num_mime_types; [NativeTypeName("const char **")] public byte** mime_types; @@ -1064,6 +1078,9 @@ namespace SDL [FieldOffset(0)] public SDL_PenAxisEvent paxis; + [FieldOffset(0)] + public SDL_RenderEvent render; + [FieldOffset(0)] public SDL_DropEvent drop; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs index 2806487..4faaf1e 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs @@ -115,6 +115,10 @@ namespace SDL [return: NativeTypeName("char **")] public static extern byte** SDL_GlobDirectory([NativeTypeName("const char *")] byte* path, [NativeTypeName("const char *")] byte* pattern, SDL_GlobFlags flags, int* count); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCurrentDirectory", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_GetCurrentDirectory(); + [NativeTypeName("#define SDL_GLOB_CASEINSENSITIVE (1u << 0)")] public const uint SDL_GLOB_CASEINSENSITIVE = (1U << 0); } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs index 906e827..d9395c1 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs @@ -117,12 +117,12 @@ namespace SDL { public SDL_GamepadBindingType input_type; - [NativeTypeName("__AnonymousRecord_SDL_gamepad_L247_C5")] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L265_C5")] public _input_e__Union input; public SDL_GamepadBindingType output_type; - [NativeTypeName("__AnonymousRecord_SDL_gamepad_L267_C5")] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L285_C5")] public _output_e__Union output; [StructLayout(LayoutKind.Explicit)] @@ -132,11 +132,11 @@ namespace SDL public int button; [FieldOffset(0)] - [NativeTypeName("__AnonymousRecord_SDL_gamepad_L251_C9")] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L269_C9")] public _axis_e__Struct axis; [FieldOffset(0)] - [NativeTypeName("__AnonymousRecord_SDL_gamepad_L258_C9")] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L276_C9")] public _hat_e__Struct hat; public partial struct _axis_e__Struct @@ -163,7 +163,7 @@ namespace SDL public SDL_GamepadButton button; [FieldOffset(0)] - [NativeTypeName("__AnonymousRecord_SDL_gamepad_L271_C9")] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L289_C9")] public _axis_e__Struct axis; public partial struct _axis_e__Struct diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_gpu.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_gpu.g.cs index 2eb4d23..3c6ff62 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_gpu.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_gpu.g.cs @@ -403,7 +403,7 @@ namespace SDL SDL_GPU_SWAPCHAINCOMPOSITION_SDR, SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR, SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR, - SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048, + SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084, } public partial struct SDL_GPUViewport @@ -1335,6 +1335,10 @@ namespace SDL [return: NativeTypeName("bool")] public static extern SDLBool SDL_SetGPUSwapchainParameters(SDL_GPUDevice* device, SDL_Window* window, SDL_GPUSwapchainComposition swapchain_composition, SDL_GPUPresentMode present_mode); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_SetGPUAllowedFramesInFlight(SDL_GPUDevice* device, [NativeTypeName("Uint32")] uint allowed_frames_in_flight); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat(SDL_GPUDevice* device, SDL_Window* window); @@ -1342,6 +1346,14 @@ namespace SDL [return: NativeTypeName("bool")] public static extern SDLBool SDL_AcquireGPUSwapchainTexture(SDL_GPUCommandBuffer* command_buffer, SDL_Window* window, SDL_GPUTexture** swapchain_texture, [NativeTypeName("Uint32 *")] uint* swapchain_texture_width, [NativeTypeName("Uint32 *")] uint* swapchain_texture_height); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_WaitForGPUSwapchain(SDL_GPUDevice* device, SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_WaitAndAcquireGPUSwapchainTexture(SDL_GPUCommandBuffer* command_buffer, SDL_Window* window, SDL_GPUTexture** swapchain_texture, [NativeTypeName("Uint32 *")] uint* swapchain_texture_width, [NativeTypeName("Uint32 *")] uint* swapchain_texture_height); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] public static extern SDLBool SDL_SubmitGPUCommandBuffer(SDL_GPUCommandBuffer* command_buffer); @@ -1456,24 +1468,6 @@ namespace SDL [NativeTypeName("#define SDL_GPU_COLORCOMPONENT_A (1u << 3)")] public const uint SDL_GPU_COLORCOMPONENT_A = (1U << 3); - [NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT \"SDL.gpu.createtexture.d3d12.clear.r\"")] - public static ReadOnlySpan SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT => "SDL.gpu.createtexture.d3d12.clear.r"u8; - - [NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT \"SDL.gpu.createtexture.d3d12.clear.g\"")] - public static ReadOnlySpan SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT => "SDL.gpu.createtexture.d3d12.clear.g"u8; - - [NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT \"SDL.gpu.createtexture.d3d12.clear.b\"")] - public static ReadOnlySpan SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT => "SDL.gpu.createtexture.d3d12.clear.b"u8; - - [NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT \"SDL.gpu.createtexture.d3d12.clear.a\"")] - public static ReadOnlySpan SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT => "SDL.gpu.createtexture.d3d12.clear.a"u8; - - [NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT \"SDL.gpu.createtexture.d3d12.clear.depth\"")] - public static ReadOnlySpan SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT => "SDL.gpu.createtexture.d3d12.clear.depth"u8; - - [NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 \"SDL.gpu.createtexture.d3d12.clear.stencil\"")] - public static ReadOnlySpan SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 => "SDL.gpu.createtexture.d3d12.clear.stencil"u8; - [NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN \"SDL.gpu.device.create.debugmode\"")] public static ReadOnlySpan SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN => "SDL.gpu.device.create.debugmode"u8; @@ -1503,5 +1497,44 @@ namespace SDL [NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING \"SDL.gpu.device.create.d3d12.semantic\"")] public static ReadOnlySpan SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING => "SDL.gpu.device.create.d3d12.semantic"u8; + + [NativeTypeName("#define SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING \"SDL.gpu.computepipeline.create.name\"")] + public static ReadOnlySpan SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING => "SDL.gpu.computepipeline.create.name"u8; + + [NativeTypeName("#define SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING \"SDL.gpu.graphicspipeline.create.name\"")] + public static ReadOnlySpan SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING => "SDL.gpu.graphicspipeline.create.name"u8; + + [NativeTypeName("#define SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING \"SDL.gpu.sampler.create.name\"")] + public static ReadOnlySpan SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING => "SDL.gpu.sampler.create.name"u8; + + [NativeTypeName("#define SDL_PROP_GPU_SHADER_CREATE_NAME_STRING \"SDL.gpu.shader.create.name\"")] + public static ReadOnlySpan SDL_PROP_GPU_SHADER_CREATE_NAME_STRING => "SDL.gpu.shader.create.name"u8; + + [NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT \"SDL.gpu.texture.create.d3d12.clear.r\"")] + public static ReadOnlySpan SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT => "SDL.gpu.texture.create.d3d12.clear.r"u8; + + [NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT \"SDL.gpu.texture.create.d3d12.clear.g\"")] + public static ReadOnlySpan SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT => "SDL.gpu.texture.create.d3d12.clear.g"u8; + + [NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT \"SDL.gpu.texture.create.d3d12.clear.b\"")] + public static ReadOnlySpan SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT => "SDL.gpu.texture.create.d3d12.clear.b"u8; + + [NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT \"SDL.gpu.texture.create.d3d12.clear.a\"")] + public static ReadOnlySpan SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT => "SDL.gpu.texture.create.d3d12.clear.a"u8; + + [NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT \"SDL.gpu.texture.create.d3d12.clear.depth\"")] + public static ReadOnlySpan SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT => "SDL.gpu.texture.create.d3d12.clear.depth"u8; + + [NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8 \"SDL.gpu.texture.create.d3d12.clear.stencil\"")] + public static ReadOnlySpan SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8 => "SDL.gpu.texture.create.d3d12.clear.stencil"u8; + + [NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING \"SDL.gpu.texture.create.name\"")] + public static ReadOnlySpan SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING => "SDL.gpu.texture.create.name"u8; + + [NativeTypeName("#define SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING \"SDL.gpu.buffer.create.name\"")] + public static ReadOnlySpan SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING => "SDL.gpu.buffer.create.name"u8; + + [NativeTypeName("#define SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING \"SDL.gpu.transferbuffer.create.name\"")] + public static ReadOnlySpan SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING => "SDL.gpu.transferbuffer.create.name"u8; } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs index fed523f..8cc24ea 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs @@ -97,6 +97,12 @@ namespace SDL [NativeTypeName("#define SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE \"SDL_AUDIO_ALSA_DEFAULT_DEVICE\"")] public static ReadOnlySpan SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE => "SDL_AUDIO_ALSA_DEFAULT_DEVICE"u8; + [NativeTypeName("#define SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE \"SDL_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE\"")] + public static ReadOnlySpan SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE => "SDL_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE"u8; + + [NativeTypeName("#define SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE \"SDL_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE\"")] + public static ReadOnlySpan SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE => "SDL_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE"u8; + [NativeTypeName("#define SDL_HINT_AUDIO_CATEGORY \"SDL_AUDIO_CATEGORY\"")] public static ReadOnlySpan SDL_HINT_AUDIO_CATEGORY => "SDL_AUDIO_CATEGORY"u8; @@ -262,6 +268,9 @@ namespace SDL [NativeTypeName("#define SDL_HINT_JOYSTICK_DEVICE \"SDL_JOYSTICK_DEVICE\"")] public static ReadOnlySpan SDL_HINT_JOYSTICK_DEVICE => "SDL_JOYSTICK_DEVICE"u8; + [NativeTypeName("#define SDL_HINT_JOYSTICK_ENHANCED_REPORTS \"SDL_JOYSTICK_ENHANCED_REPORTS\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_ENHANCED_REPORTS => "SDL_JOYSTICK_ENHANCED_REPORTS"u8; + [NativeTypeName("#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES \"SDL_JOYSTICK_FLIGHTSTICK_DEVICES\"")] public static ReadOnlySpan SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES => "SDL_JOYSTICK_FLIGHTSTICK_DEVICES"u8; @@ -313,18 +322,12 @@ namespace SDL [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL \"SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL\"")] public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL => "SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL"u8; - [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE \"SDL_JOYSTICK_HIDAPI_PS4_RUMBLE\"")] - public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE => "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"u8; - [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5 \"SDL_JOYSTICK_HIDAPI_PS5\"")] public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS5 => "SDL_JOYSTICK_HIDAPI_PS5"u8; [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED \"SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED\"")] public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED => "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED"u8; - [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE \"SDL_JOYSTICK_HIDAPI_PS5_RUMBLE\"")] - public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE => "SDL_JOYSTICK_HIDAPI_PS5_RUMBLE"u8; - [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SHIELD \"SDL_JOYSTICK_HIDAPI_SHIELD\"")] public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_SHIELD => "SDL_JOYSTICK_HIDAPI_SHIELD"u8; @@ -334,6 +337,9 @@ namespace SDL [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAM \"SDL_JOYSTICK_HIDAPI_STEAM\"")] public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_STEAM => "SDL_JOYSTICK_HIDAPI_STEAM"u8; + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED \"SDL_JOYSTICK_HIDAPI_STEAM_HOME_LED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED => "SDL_JOYSTICK_HIDAPI_STEAM_HOME_LED"u8; + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK \"SDL_JOYSTICK_HIDAPI_STEAMDECK\"")] public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK => "SDL_JOYSTICK_HIDAPI_STEAMDECK"u8; @@ -445,6 +451,9 @@ namespace SDL [NativeTypeName("#define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH \"SDL_MAC_OPENGL_ASYNC_DISPATCH\"")] public static ReadOnlySpan SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH => "SDL_MAC_OPENGL_ASYNC_DISPATCH"u8; + [NativeTypeName("#define SDL_HINT_MAC_OPTION_AS_ALT \"SDL_MAC_OPTION_AS_ALT\"")] + public static ReadOnlySpan SDL_HINT_MAC_OPTION_AS_ALT => "SDL_MAC_OPTION_AS_ALT"u8; + [NativeTypeName("#define SDL_HINT_MAC_SCROLL_MOMENTUM \"SDL_MAC_SCROLL_MOMENTUM\"")] public static ReadOnlySpan SDL_HINT_MAC_SCROLL_MOMENTUM => "SDL_MAC_SCROLL_MOMENTUM"u8; @@ -460,6 +469,9 @@ namespace SDL [NativeTypeName("#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME \"SDL_MOUSE_DOUBLE_CLICK_TIME\"")] public static ReadOnlySpan SDL_HINT_MOUSE_DOUBLE_CLICK_TIME => "SDL_MOUSE_DOUBLE_CLICK_TIME"u8; + [NativeTypeName("#define SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR \"SDL_MOUSE_DEFAULT_SYSTEM_CURSOR\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR => "SDL_MOUSE_DEFAULT_SYSTEM_CURSOR"u8; + [NativeTypeName("#define SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE \"SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE\"")] public static ReadOnlySpan SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE => "SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE"u8; @@ -472,9 +484,6 @@ namespace SDL [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_MODE_CENTER \"SDL_MOUSE_RELATIVE_MODE_CENTER\"")] public static ReadOnlySpan SDL_HINT_MOUSE_RELATIVE_MODE_CENTER => "SDL_MOUSE_RELATIVE_MODE_CENTER"u8; - [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP \"SDL_MOUSE_RELATIVE_MODE_WARP\"")] - public static ReadOnlySpan SDL_HINT_MOUSE_RELATIVE_MODE_WARP => "SDL_MOUSE_RELATIVE_MODE_WARP"u8; - [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE \"SDL_MOUSE_RELATIVE_SPEED_SCALE\"")] public static ReadOnlySpan SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE => "SDL_MOUSE_RELATIVE_SPEED_SCALE"u8; @@ -487,9 +496,6 @@ namespace SDL [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE \"SDL_MOUSE_RELATIVE_CURSOR_VISIBLE\"")] public static ReadOnlySpan SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE => "SDL_MOUSE_RELATIVE_CURSOR_VISIBLE"u8; - [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_CLIP_INTERVAL \"SDL_MOUSE_RELATIVE_CLIP_INTERVAL\"")] - public static ReadOnlySpan SDL_HINT_MOUSE_RELATIVE_CLIP_INTERVAL => "SDL_MOUSE_RELATIVE_CLIP_INTERVAL"u8; - [NativeTypeName("#define SDL_HINT_MOUSE_TOUCH_EVENTS \"SDL_MOUSE_TOUCH_EVENTS\"")] public static ReadOnlySpan SDL_HINT_MOUSE_TOUCH_EVENTS => "SDL_MOUSE_TOUCH_EVENTS"u8; @@ -502,6 +508,9 @@ namespace SDL [NativeTypeName("#define SDL_HINT_OPENGL_LIBRARY \"SDL_OPENGL_LIBRARY\"")] public static ReadOnlySpan SDL_HINT_OPENGL_LIBRARY => "SDL_OPENGL_LIBRARY"u8; + [NativeTypeName("#define SDL_HINT_EGL_LIBRARY \"SDL_EGL_LIBRARY\"")] + public static ReadOnlySpan SDL_HINT_EGL_LIBRARY => "SDL_EGL_LIBRARY"u8; + [NativeTypeName("#define SDL_HINT_OPENGL_ES_DRIVER \"SDL_OPENGL_ES_DRIVER\"")] public static ReadOnlySpan SDL_HINT_OPENGL_ES_DRIVER => "SDL_OPENGL_ES_DRIVER"u8; @@ -613,6 +622,9 @@ namespace SDL [NativeTypeName("#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES \"SDL_VIDEO_MAC_FULLSCREEN_SPACES\"")] public static ReadOnlySpan SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES => "SDL_VIDEO_MAC_FULLSCREEN_SPACES"u8; + [NativeTypeName("#define SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY \"SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY => "SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY"u8; + [NativeTypeName("#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS \"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS\"")] public static ReadOnlySpan SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS => "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"u8; @@ -756,5 +768,11 @@ namespace SDL [NativeTypeName("#define SDL_HINT_ASSERT \"SDL_ASSERT\"")] public static ReadOnlySpan SDL_HINT_ASSERT => "SDL_ASSERT"u8; + + [NativeTypeName("#define SDL_HINT_PEN_MOUSE_EVENTS \"SDL_PEN_MOUSE_EVENTS\"")] + public static ReadOnlySpan SDL_HINT_PEN_MOUSE_EVENTS => "SDL_PEN_MOUSE_EVENTS"u8; + + [NativeTypeName("#define SDL_HINT_PEN_TOUCH_EVENTS \"SDL_PEN_TOUCH_EVENTS\"")] + public static ReadOnlySpan SDL_HINT_PEN_TOUCH_EVENTS => "SDL_PEN_TOUCH_EVENTS"u8; } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs index 058bf20..8a1b196 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs @@ -54,6 +54,14 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_Quit(); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_IsMainThread(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_RunOnMainThread([NativeTypeName("SDL_MainThreadCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, [NativeTypeName("bool")] SDLBool wait_complete); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] public static extern SDLBool SDL_SetAppMetadata([NativeTypeName("const char *")] byte* appname, [NativeTypeName("const char *")] byte* appversion, [NativeTypeName("const char *")] byte* appidentifier); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs index f6136de..9371ea1 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs @@ -27,7 +27,10 @@ namespace SDL { public static partial class SDL3 { - [NativeTypeName("#define SDLK_SCANCODE_MASK (1u<<30)")] + [NativeTypeName("#define SDLK_EXTENDED_MASK (1u << 29)")] + public const uint SDLK_EXTENDED_MASK = (1U << 29); + + [NativeTypeName("#define SDLK_SCANCODE_MASK (1u << 30)")] public const uint SDLK_SCANCODE_MASK = (1U << 30); [NativeTypeName("#define SDLK_UNKNOWN 0x00000000u")] @@ -777,6 +780,27 @@ namespace SDL [NativeTypeName("#define SDLK_ENDCALL 0x40000122u")] public const uint SDLK_ENDCALL = 0x40000122U; + [NativeTypeName("#define SDLK_LEFT_TAB 0x20000001u")] + public const uint SDLK_LEFT_TAB = 0x20000001U; + + [NativeTypeName("#define SDLK_LEVEL5_SHIFT 0x20000002u")] + public const uint SDLK_LEVEL5_SHIFT = 0x20000002U; + + [NativeTypeName("#define SDLK_MULTI_KEY_COMPOSE 0x20000003u")] + public const uint SDLK_MULTI_KEY_COMPOSE = 0x20000003U; + + [NativeTypeName("#define SDLK_LMETA 0x20000004u")] + public const uint SDLK_LMETA = 0x20000004U; + + [NativeTypeName("#define SDLK_RMETA 0x20000005u")] + public const uint SDLK_RMETA = 0x20000005U; + + [NativeTypeName("#define SDLK_LHYPER 0x20000006u")] + public const uint SDLK_LHYPER = 0x20000006U; + + [NativeTypeName("#define SDLK_RHYPER 0x20000007u")] + public const uint SDLK_RHYPER = 0x20000007U; + [NativeTypeName("#define SDL_KMOD_NONE 0x0000u")] public const uint SDL_KMOD_NONE = 0x0000U; @@ -786,6 +810,9 @@ namespace SDL [NativeTypeName("#define SDL_KMOD_RSHIFT 0x0002u")] public const uint SDL_KMOD_RSHIFT = 0x0002U; + [NativeTypeName("#define SDL_KMOD_LEVEL5 0x0004u")] + public const uint SDL_KMOD_LEVEL5 = 0x0004U; + [NativeTypeName("#define SDL_KMOD_LCTRL 0x0040u")] public const uint SDL_KMOD_LCTRL = 0x0040U; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.GDK.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.GDK.g.cs index 6fecaff..e69de29 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_main.GDK.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.GDK.g.cs @@ -1,37 +0,0 @@ -/* - - C# bindings for Simple DirectMedia Layer. - Original copyright notice of input files: - - Simple DirectMedia Layer - Copyright (C) 1997-2024 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -using System.Runtime.InteropServices; -using System.Runtime.Versioning; - -namespace SDL -{ - public static partial class SDL3 - { - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [SupportedOSPlatform("Windows")] - public static extern void SDL_GDKSuspendComplete(); - } -} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs index e40081d..d6a859c 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs @@ -38,5 +38,8 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_EnterAppMainCallbacks(int argc, [NativeTypeName("char *[]")] byte** argv, [NativeTypeName("SDL_AppInit_func")] delegate* unmanaged[Cdecl] appinit, [NativeTypeName("SDL_AppIterate_func")] delegate* unmanaged[Cdecl] appiter, [NativeTypeName("SDL_AppEvent_func")] delegate* unmanaged[Cdecl] appevent, [NativeTypeName("SDL_AppQuit_func")] delegate* unmanaged[Cdecl] appquit); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_GDKSuspendComplete(); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs index aae40df..d408245 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs @@ -155,6 +155,7 @@ namespace SDL SDL_PIXELFORMAT_NV21 = 0x3132564eU, SDL_PIXELFORMAT_P010 = 0x30313050U, SDL_PIXELFORMAT_EXTERNAL_OES = 0x2053454fU, + SDL_PIXELFORMAT_MJPG = 0x47504a4dU, } public enum SDL_ColorType diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs index f4db088..54836f9 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs @@ -124,7 +124,7 @@ namespace SDL } [return: NativeTypeName("bool")] - public static SDLBool SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, [NativeTypeName("const float")] float epsilon) + public static SDLBool SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, float epsilon) { return ((a) != null && (b) != null && ((a == b) || ((SDL_fabsf(a->x - b->x) <= epsilon) && (SDL_fabsf(a->y - b->y) <= epsilon) && (SDL_fabsf(a->w - b->w) <= epsilon) && (SDL_fabsf(a->h - b->h) <= epsilon)))) ? true : false; } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs index 3f00a6d..94175d7 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs @@ -344,6 +344,10 @@ namespace SDL [return: NativeTypeName("bool")] public static extern SDLBool SDL_RenderTextureRotated(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect, double angle, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* center, SDL_FlipMode flip); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_RenderTextureAffine(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* origin, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* right, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* down); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] public static extern SDLBool SDL_RenderTextureTiled(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, float scale, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect); @@ -401,6 +405,10 @@ namespace SDL [return: NativeTypeName("bool")] public static extern SDLBool SDL_RenderDebugText(SDL_Renderer* renderer, float x, float y, [NativeTypeName("const char *")] byte* str); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_RenderDebugTextFormat(SDL_Renderer* renderer, float x, float y, [NativeTypeName("const char *")] byte* fmt, __arglist); + [NativeTypeName("#define SDL_SOFTWARE_RENDERER \"software\"")] public static ReadOnlySpan SDL_SOFTWARE_RENDERER => "software"u8; @@ -506,6 +514,9 @@ namespace SDL [NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER \"SDL.renderer.vulkan.swapchain_image_count\"")] public static ReadOnlySpan SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER => "SDL.renderer.vulkan.swapchain_image_count"u8; + [NativeTypeName("#define SDL_PROP_RENDERER_GPU_DEVICE_POINTER \"SDL.renderer.gpu.device\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_GPU_DEVICE_POINTER => "SDL.renderer.gpu.device"u8; + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER \"SDL.texture.create.colorspace\"")] public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER => "SDL.texture.create.colorspace"u8; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index c44d5d0..30c997b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -322,7 +322,7 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strtok_r", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* Unsafe_SDL_strtok_r([NativeTypeName("char *")] byte* s1, [NativeTypeName("const char *")] byte* s2, [NativeTypeName("char **")] byte** saveptr); + public static extern byte* Unsafe_SDL_strtok_r([NativeTypeName("char *")] byte* str, [NativeTypeName("const char *")] byte* delim, [NativeTypeName("char **")] byte** saveptr); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs index f9dc6a8..ba78f25 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs @@ -240,6 +240,10 @@ namespace SDL [return: NativeTypeName("bool")] public static extern SDLBool SDL_BlitSurfaceUncheckedScaled(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect, SDL_ScaleMode scaleMode); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_StretchSurface(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect, SDL_ScaleMode scaleMode); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("bool")] public static extern SDLBool SDL_BlitSurfaceTiled(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect); @@ -296,5 +300,11 @@ namespace SDL [NativeTypeName("#define SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING \"SDL.surface.tonemap\"")] public static ReadOnlySpan SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING => "SDL.surface.tonemap"u8; + + [NativeTypeName("#define SDL_PROP_SURFACE_HOTSPOT_X_NUMBER \"SDL.surface.hotspot.x\"")] + public static ReadOnlySpan SDL_PROP_SURFACE_HOTSPOT_X_NUMBER => "SDL.surface.hotspot.x"u8; + + [NativeTypeName("#define SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER \"SDL.surface.hotspot.y\"")] + public static ReadOnlySpan SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER => "SDL.surface.hotspot.y"u8; } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs index 6ba1b5f..cfe1614 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs @@ -40,6 +40,14 @@ namespace SDL SDL_THREAD_PRIORITY_TIME_CRITICAL, } + public enum SDL_ThreadState + { + SDL_THREAD_UNKNOWN, + SDL_THREAD_ALIVE, + SDL_THREAD_DETACHED, + SDL_THREAD_COMPLETE, + } + public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -65,6 +73,9 @@ namespace SDL [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_WaitThread(SDL_Thread* thread, int* status); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_ThreadState SDL_GetThreadState(SDL_Thread* thread); + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_DetachThread(SDL_Thread* thread); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_tray.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_tray.g.cs new file mode 100644 index 0000000..d6017d5 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_tray.g.cs @@ -0,0 +1,133 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Tray + { + } + + public partial struct SDL_TrayMenu + { + } + + public partial struct SDL_TrayEntry + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Tray* SDL_CreateTray(SDL_Surface* icon, [NativeTypeName("const char *")] byte* tooltip); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetTrayIcon(SDL_Tray* tray, SDL_Surface* icon); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetTrayTooltip(SDL_Tray* tray, [NativeTypeName("const char *")] byte* tooltip); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_TrayMenu* SDL_CreateTrayMenu(SDL_Tray* tray); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_TrayMenu* SDL_CreateTraySubmenu(SDL_TrayEntry* entry); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_TrayMenu* SDL_GetTrayMenu(SDL_Tray* tray); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_TrayMenu* SDL_GetTraySubmenu(SDL_TrayEntry* entry); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const SDL_TrayEntry **")] + public static extern SDL_TrayEntry** SDL_GetTrayEntries(SDL_TrayMenu* menu, int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_RemoveTrayEntry(SDL_TrayEntry* entry); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_TrayEntry* SDL_InsertTrayEntryAt(SDL_TrayMenu* menu, int pos, [NativeTypeName("const char *")] byte* label, SDL_TrayEntryFlags flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetTrayEntryLabel(SDL_TrayEntry* entry, [NativeTypeName("const char *")] byte* label); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetTrayEntryLabel", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetTrayEntryLabel(SDL_TrayEntry* entry); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetTrayEntryChecked(SDL_TrayEntry* entry, [NativeTypeName("bool")] SDLBool @checked); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_GetTrayEntryChecked(SDL_TrayEntry* entry); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetTrayEntryEnabled(SDL_TrayEntry* entry, [NativeTypeName("bool")] SDLBool enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_GetTrayEntryEnabled(SDL_TrayEntry* entry); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetTrayEntryCallback(SDL_TrayEntry* entry, [NativeTypeName("SDL_TrayCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_ClickTrayEntry(SDL_TrayEntry* entry); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyTray(SDL_Tray* tray); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_TrayMenu* SDL_GetTrayEntryParent(SDL_TrayEntry* entry); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_TrayEntry* SDL_GetTrayMenuParentEntry(SDL_TrayMenu* menu); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Tray* SDL_GetTrayMenuParentTray(SDL_TrayMenu* menu); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UpdateTrays(); + + [NativeTypeName("#define SDL_TRAYENTRY_BUTTON 0x00000001u")] + public const uint SDL_TRAYENTRY_BUTTON = 0x00000001U; + + [NativeTypeName("#define SDL_TRAYENTRY_CHECKBOX 0x00000002u")] + public const uint SDL_TRAYENTRY_CHECKBOX = 0x00000002U; + + [NativeTypeName("#define SDL_TRAYENTRY_SUBMENU 0x00000004u")] + public const uint SDL_TRAYENTRY_SUBMENU = 0x00000004U; + + [NativeTypeName("#define SDL_TRAYENTRY_DISABLED 0x80000000u")] + public const uint SDL_TRAYENTRY_DISABLED = 0x80000000U; + + [NativeTypeName("#define SDL_TRAYENTRY_CHECKED 0x40000000u")] + public const uint SDL_TRAYENTRY_CHECKED = 0x40000000U; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs index cd9e5dc..5a92dba 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs @@ -39,10 +39,10 @@ namespace SDL [NativeTypeName("#define SDL_MAJOR_VERSION 3")] public const int SDL_MAJOR_VERSION = 3; - [NativeTypeName("#define SDL_MINOR_VERSION 1")] - public const int SDL_MINOR_VERSION = 1; + [NativeTypeName("#define SDL_MINOR_VERSION 2")] + public const int SDL_MINOR_VERSION = 2; - [NativeTypeName("#define SDL_MICRO_VERSION 7")] - public const int SDL_MICRO_VERSION = 7; + [NativeTypeName("#define SDL_MICRO_VERSION 5")] + public const int SDL_MICRO_VERSION = 5; } } diff --git a/SDL3-CS/SDL3/SDL_keycode.cs b/SDL3-CS/SDL3/SDL_keycode.cs index 6dd3dea..7adf7f2 100644 --- a/SDL3-CS/SDL3/SDL_keycode.cs +++ b/SDL3-CS/SDL3/SDL_keycode.cs @@ -8,6 +8,7 @@ namespace SDL [Typedef] public enum SDL_Keycode : UInt32 { + SDLK_EXTENDED_MASK = SDL3.SDLK_EXTENDED_MASK, SDLK_SCANCODE_MASK = SDL3.SDLK_SCANCODE_MASK, SDLK_UNKNOWN = SDL3.SDLK_UNKNOWN, SDLK_RETURN = SDL3.SDLK_RETURN, @@ -258,6 +259,13 @@ namespace SDL SDLK_SOFTRIGHT = SDL3.SDLK_SOFTRIGHT, SDLK_CALL = SDL3.SDLK_CALL, SDLK_ENDCALL = SDL3.SDLK_ENDCALL, + SDLK_LEFT_TAB = SDL3.SDLK_LEFT_TAB, + SDLK_LEVEL5_SHIFT = SDL3.SDLK_LEVEL5_SHIFT, + SDLK_MULTI_KEY_COMPOSE = SDL3.SDLK_MULTI_KEY_COMPOSE, + SDLK_LMETA = SDL3.SDLK_LMETA, + SDLK_RMETA = SDL3.SDLK_RMETA, + SDLK_LHYPER = SDL3.SDLK_LHYPER, + SDLK_RHYPER = SDL3.SDLK_RHYPER, } [Flags] @@ -267,6 +275,7 @@ namespace SDL SDL_KMOD_NONE = (UInt16)SDL3.SDL_KMOD_NONE, SDL_KMOD_LSHIFT = (UInt16)SDL3.SDL_KMOD_LSHIFT, SDL_KMOD_RSHIFT = (UInt16)SDL3.SDL_KMOD_RSHIFT, + SDL_KMOD_LEVEL5 = (UInt16)SDL3.SDL_KMOD_LEVEL5, SDL_KMOD_LCTRL = (UInt16)SDL3.SDL_KMOD_LCTRL, SDL_KMOD_RCTRL = (UInt16)SDL3.SDL_KMOD_RCTRL, SDL_KMOD_LALT = (UInt16)SDL3.SDL_KMOD_LALT, diff --git a/SDL3-CS/SDL3/SDL_pen.cs b/SDL3-CS/SDL3/SDL_pen.cs index 751bbe0..579b8be 100644 --- a/SDL3-CS/SDL3/SDL_pen.cs +++ b/SDL3-CS/SDL3/SDL_pen.cs @@ -20,4 +20,13 @@ namespace SDL SDL_PEN_INPUT_BUTTON_5 = SDL3.SDL_PEN_INPUT_BUTTON_5, SDL_PEN_INPUT_ERASER_TIP = SDL3.SDL_PEN_INPUT_ERASER_TIP, } + + public static partial class SDL3 + { + [Constant] + public const SDL_MouseID SDL_PEN_MOUSEID = unchecked((SDL_MouseID)(-2)); + + [Constant] + public const SDL_TouchID SDL_PEN_TOUCHID = unchecked((SDL_TouchID)(-2)); + } } diff --git a/SDL3-CS/SDL3/SDL_tray.cs b/SDL3-CS/SDL3/SDL_tray.cs new file mode 100644 index 0000000..15840e4 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_tray.cs @@ -0,0 +1,28 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Flags] + [Typedef] + public enum SDL_TrayEntryFlags : UInt32 + { + SDL_TRAYENTRY_BUTTON = SDL3.SDL_TRAYENTRY_BUTTON, + SDL_TRAYENTRY_CHECKBOX = SDL3.SDL_TRAYENTRY_CHECKBOX, + SDL_TRAYENTRY_SUBMENU = SDL3.SDL_TRAYENTRY_SUBMENU, + SDL_TRAYENTRY_DISABLED = SDL3.SDL_TRAYENTRY_DISABLED, + SDL_TRAYENTRY_CHECKED = SDL3.SDL_TRAYENTRY_CHECKED, + } + + public static partial class SDL3 + { + public static unsafe SDLConstOpaquePointerArray? SDL_GetTrayEntries(SDL_TrayMenu* menu) + { + int count; + var array = SDL_GetTrayEntries(menu, &count); + return SDLArray.CreateConstOpaque(array, count); + } + } +} diff --git a/SDL3-CS/SDL3/SDL_video.cs b/SDL3-CS/SDL3/SDL_video.cs index 0b952ab..2641bb6 100644 --- a/SDL3-CS/SDL3/SDL_video.cs +++ b/SDL3-CS/SDL3/SDL_video.cs @@ -107,11 +107,11 @@ namespace SDL } [MustDisposeResource] - public static unsafe SDLPointerArray? SDL_GetWindows() + public static unsafe SDLOpaquePointerArray? SDL_GetWindows() { int count; var array = SDL_GetWindows(&count); - return SDLArray.Create(array, count); + return SDLArray.CreateOpaque(array, count); } } } diff --git a/SDL3-CS/SDLArray.cs b/SDL3-CS/SDLArray.cs index 91f1d60..36cde5c 100644 --- a/SDL3-CS/SDLArray.cs +++ b/SDL3-CS/SDLArray.cs @@ -63,5 +63,24 @@ namespace SDL return new SDLPointerArray(array, count); } + + [MustDisposeResource] + internal static SDLOpaquePointerArray? CreateOpaque(T** array, int count) + where T : unmanaged + { + if (array == null) + return null; + + return new SDLOpaquePointerArray(array, count); + } + + internal static SDLConstOpaquePointerArray? CreateConstOpaque(T** array, int count) + where T : unmanaged + { + if (array == null) + return null; + + return new SDLConstOpaquePointerArray(array, count); + } } } diff --git a/SDL3-CS/SDLConstOpaquePointerArray.cs b/SDL3-CS/SDLConstOpaquePointerArray.cs new file mode 100644 index 0000000..f4854eb --- /dev/null +++ b/SDL3-CS/SDLConstOpaquePointerArray.cs @@ -0,0 +1,32 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Diagnostics; + +namespace SDL +{ + public sealed unsafe class SDLConstOpaquePointerArray + where T : unmanaged + { + private readonly T** array; + public readonly int Count; + + internal SDLConstOpaquePointerArray(T** array, int count) + { + this.array = array; + Count = count; + } + + public T* this[int index] + { + get + { + ArgumentOutOfRangeException.ThrowIfNegative(index); + ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, Count); + Debug.Assert(array[index] != null); + return array[index]; + } + } + } +} diff --git a/SDL3-CS/SDLOpaquePointerArray.cs b/SDL3-CS/SDLOpaquePointerArray.cs new file mode 100644 index 0000000..4123e91 --- /dev/null +++ b/SDL3-CS/SDLOpaquePointerArray.cs @@ -0,0 +1,46 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Diagnostics; +using JetBrains.Annotations; + +namespace SDL +{ + [MustDisposeResource] + public sealed unsafe class SDLOpaquePointerArray : IDisposable + where T : unmanaged + { + private readonly T** array; + public readonly int Count; + private bool isDisposed; + + internal SDLOpaquePointerArray(T** array, int count) + { + this.array = array; + Count = count; + } + + public T* this[int index] + { + get + { + ObjectDisposedException.ThrowIf(isDisposed, this); + ArgumentOutOfRangeException.ThrowIfNegative(index); + ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, Count); + Debug.Assert(array[index] != null); + return array[index]; + } + } + + public void Dispose() + { + if (isDisposed) + return; + + isDisposed = true; + + SDL3.SDL_free(array); + } + } +} diff --git a/SDL3-CS.Android/Transforms/EnumFields.xml b/SDL3-CS/Transforms/EnumFields.xml similarity index 100% rename from SDL3-CS.Android/Transforms/EnumFields.xml rename to SDL3-CS/Transforms/EnumFields.xml diff --git a/SDL3-CS.Android/Transforms/EnumMethods.xml b/SDL3-CS/Transforms/EnumMethods.xml similarity index 100% rename from SDL3-CS.Android/Transforms/EnumMethods.xml rename to SDL3-CS/Transforms/EnumMethods.xml diff --git a/SDL3-CS.Android/Transforms/Metadata.xml b/SDL3-CS/Transforms/Metadata.xml similarity index 100% rename from SDL3-CS.Android/Transforms/Metadata.xml rename to SDL3-CS/Transforms/Metadata.xml diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 9a784fc..71666c9 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -118,6 +118,7 @@ def add(s: str): headers = [ add("SDL3/SDL_atomic.h"), + add("SDL3/SDL_asyncio.h"), add("SDL3/SDL_audio.h"), add("SDL3/SDL_blendmode.h"), add("SDL3/SDL_camera.h"), @@ -163,6 +164,7 @@ headers = [ add("SDL3/SDL_thread.h"), add("SDL3/SDL_time.h"), add("SDL3/SDL_timer.h"), + add("SDL3/SDL_tray.h"), add("SDL3/SDL_touch.h"), add("SDL3/SDL_version.h"), add("SDL3/SDL_video.h"), @@ -411,7 +413,6 @@ def main(): if not should_skip(solo_headers, main_header): generate_platform_specific_headers(sdl_api, main_header, [ (["SDL_PLATFORM_WINDOWS"], "Windows", "Windows"), - (["SDL_PLATFORM_GDK"], "GDK", "Windows"), ]) system_header = add("SDL3/SDL_system.h") diff --git a/native/android/arm64-v8a/libSDL3.so b/native/android/arm64-v8a/libSDL3.so index bc4e807..0bff457 100755 Binary files a/native/android/arm64-v8a/libSDL3.so and b/native/android/arm64-v8a/libSDL3.so differ diff --git a/native/android/armeabi-v7a/libSDL3.so b/native/android/armeabi-v7a/libSDL3.so index 7e9448a..fc899a9 100755 Binary files a/native/android/armeabi-v7a/libSDL3.so and b/native/android/armeabi-v7a/libSDL3.so differ diff --git a/native/android/x86/libSDL3.so b/native/android/x86/libSDL3.so index 7b20006..3342332 100755 Binary files a/native/android/x86/libSDL3.so and b/native/android/x86/libSDL3.so differ diff --git a/native/android/x86_64/libSDL3.so b/native/android/x86_64/libSDL3.so index 23305c1..04ceba4 100755 Binary files a/native/android/x86_64/libSDL3.so and b/native/android/x86_64/libSDL3.so differ diff --git a/native/ios/SDL3.xcframework/Info.plist b/native/ios/SDL3.xcframework/Info.plist index 097af4b..00b186e 100644 --- a/native/ios/SDL3.xcframework/Info.plist +++ b/native/ios/SDL3.xcframework/Info.plist @@ -4,23 +4,6 @@ AvailableLibraries - - BinaryPath - SDL3.framework/SDL3 - LibraryIdentifier - tvos-arm64_x86_64-simulator - LibraryPath - SDL3.framework - SupportedArchitectures - - arm64 - x86_64 - - SupportedPlatform - tvos - SupportedPlatformVariant - simulator - BinaryPath SDL3.framework/SDL3 @@ -49,6 +32,23 @@ SupportedPlatform ios + + BinaryPath + SDL3.framework/SDL3 + LibraryIdentifier + tvos-arm64_x86_64-simulator + LibraryPath + SDL3.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + tvos + SupportedPlatformVariant + simulator + BinaryPath SDL3.framework/SDL3 diff --git a/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/Info.plist b/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/Info.plist index 605dfba..54e1b81 100644 Binary files a/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/Info.plist and b/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/Info.plist differ diff --git a/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/SDL3 b/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/SDL3 index 27090b6..b919a9a 100755 Binary files a/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/SDL3 and b/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/SDL3 differ diff --git a/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/Info.plist b/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/Info.plist index a681dfd..6fad444 100644 Binary files a/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/Info.plist and b/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/Info.plist differ diff --git a/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/SDL3 b/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/SDL3 index b474f1f..a2604be 100755 Binary files a/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/SDL3 and b/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/SDL3 differ diff --git a/native/linux-arm/libSDL3.so b/native/linux-arm/libSDL3.so index e2c965f..de6fb3a 100644 Binary files a/native/linux-arm/libSDL3.so and b/native/linux-arm/libSDL3.so differ diff --git a/native/linux-arm64/libSDL3.so b/native/linux-arm64/libSDL3.so index 16d6c73..2efbfa1 100644 Binary files a/native/linux-arm64/libSDL3.so and b/native/linux-arm64/libSDL3.so differ diff --git a/native/linux-x64/libSDL3.so b/native/linux-x64/libSDL3.so index 828e953..1783353 100644 Binary files a/native/linux-x64/libSDL3.so and b/native/linux-x64/libSDL3.so differ diff --git a/native/linux-x86/libSDL3.so b/native/linux-x86/libSDL3.so index 20bc64a..9fc8a8b 100644 Binary files a/native/linux-x86/libSDL3.so and b/native/linux-x86/libSDL3.so differ diff --git a/native/osx-arm64/libSDL3.dylib b/native/osx-arm64/libSDL3.dylib index 2856ce4..fa43b4e 100755 Binary files a/native/osx-arm64/libSDL3.dylib and b/native/osx-arm64/libSDL3.dylib differ diff --git a/native/osx-x64/libSDL3.dylib b/native/osx-x64/libSDL3.dylib index 509ad03..84374e1 100755 Binary files a/native/osx-x64/libSDL3.dylib and b/native/osx-x64/libSDL3.dylib differ diff --git a/native/win-arm64/SDL3.dll b/native/win-arm64/SDL3.dll index 0c9bbe5..86e3ec8 100644 Binary files a/native/win-arm64/SDL3.dll and b/native/win-arm64/SDL3.dll differ diff --git a/native/win-x64/SDL3.dll b/native/win-x64/SDL3.dll index 2212a1c..77aac5f 100644 Binary files a/native/win-x64/SDL3.dll and b/native/win-x64/SDL3.dll differ diff --git a/native/win-x86/SDL3.dll b/native/win-x86/SDL3.dll index e387fb2..92d9757 100644 Binary files a/native/win-x86/SDL3.dll and b/native/win-x86/SDL3.dll differ