Merge branch 'master' into feature/sdl-libs

This commit is contained in:
Dan Balasescu 2025-05-20 15:14:25 +09:00
commit 7124e530e1
No known key found for this signature in database
75 changed files with 913 additions and 241 deletions

View File

@ -14,25 +14,21 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
platform: platform:
- { name: win-x64, os: windows-latest, flags: -A x64 } - { name: win-x64, os: windows-latest, flags: -A x64 }
- { name: win-x86, os: windows-latest, flags: -A Win32 } - { name: win-x86, os: windows-latest, flags: -A Win32 }
- { name: win-arm64, os: windows-latest, flags: -A ARM64 } - { name: win-arm64, os: windows-latest, flags: -A ARM64 }
- { name: linux-x64, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":amd64" } - { name: linux-x64, os: ubuntu-22.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-x86, os: ubuntu-22.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-arm64, os: ubuntu-22.04-arm, flags: -GNinja, target_apt_arch: ":arm64", container: "arm64v8/ubuntu:22.04" }
- { name: linux-arm, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":armhf", container: arm32v7/ubuntu, docker_platform: linux/arm/v7 } - { 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 } - { 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. # 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: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: Set up QEMU
if: contains(matrix.platform.container, 'arm')
uses: docker/setup-qemu-action@v3
- name: Build (Linux ARM) - name: Build (Linux ARM)
if: contains(matrix.platform.container, 'arm') if: contains(matrix.platform.container, 'arm')
uses: addnab/docker-run-action@v3 uses: addnab/docker-run-action@v3
@ -45,7 +41,6 @@ jobs:
-e RUNNER_OS=${{ runner.os }} -e RUNNER_OS=${{ runner.os }}
-e FLAGS=${{ matrix.platform.flags }} -e FLAGS=${{ matrix.platform.flags }}
-e BUILD_TYPE=${{ env.BUILD_TYPE }} -e BUILD_TYPE=${{ env.BUILD_TYPE }}
--platform ${{ matrix.platform.docker_platform }}
run: | run: |
cd /workspace cd /workspace
./External/build.sh ./External/build.sh
@ -117,7 +112,7 @@ jobs:
build-android: build-android:
name: android name: android
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
env: env:
NDK_VER: 23.1.7779620 NDK_VER: 23.1.7779620
PLATFORM_VER: android-34 PLATFORM_VER: android-34
@ -157,7 +152,7 @@ jobs:
run: | run: |
export JAVA_HOME=$JAVA_HOME_11_X64 export JAVA_HOME=$JAVA_HOME_11_X64
export PATH=$JAVA_HOME_11_X64/bin:$PATH 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 rm -rf $OUTPUT && mkdir -p $OUTPUT
# Build SDL3 Android Java part # Build SDL3 Android Java part
@ -179,7 +174,7 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: android-jar name: android-jar
path: SDL3-CS.Android/Jars/SDL3AndroidBridge.jar path: SDL3-CS/Jars/SDL3AndroidBridge.jar
if-no-files-found: error if-no-files-found: error
make-pr: make-pr:
@ -207,7 +202,7 @@ jobs:
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: android-jar name: android-jar
path: SDL3-CS.Android/Jars/ path: SDL3-CS/Jars/
- name: Create pull request - name: Create pull request
uses: peter-evans/create-pull-request@v6 uses: peter-evans/create-pull-request@v6

View File

@ -6,7 +6,7 @@ on:
- '*' - '*'
jobs: jobs:
desktop: pack:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -16,10 +16,19 @@ jobs:
with: with:
dotnet-version: 8.0.x dotnet-version: 8.0.x
- name: Build - name: Setup JDK 17
run: dotnet build SDL3-CS.Desktop.slnf -c Release 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) run: dotnet pack SDL3-CS/SDL3-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD)
- name: Upload artifact - name: Upload artifact
@ -30,34 +39,3 @@ jobs:
- name: Publish tagged release to nuget.org - 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}} 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}}

View File

@ -1 +0,0 @@
SDL3-CS.Android

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="vcsConfiguration" value="2" />
</component>
</project>

View File

@ -6,6 +6,12 @@ RUN apt-get update && \
WORKDIR /tmp WORKDIR /tmp
COPY .config/dotnet-tools.json .config/dotnet-tools.json COPY .config/dotnet-tools.json .config/dotnet-tools.json
COPY SDL3-CS/SDL3-CS.csproj SDL3-CS/SDL3-CS.csproj 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/<TargetFrameworks.*$/<TargetFramework>net8.0<\/TargetFramework>/' SDL3-CS/SDL3-CS.csproj
RUN dotnet tool restore && \ RUN dotnet tool restore && \
dotnet restore --ucr SDL3-CS/SDL3-CS.csproj dotnet restore --ucr SDL3-CS/SDL3-CS.csproj

4
External/.idea/encodings.xml vendored Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

60
External/.idea/misc.xml vendored Normal file
View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectUserFactors">
<factor id="completionFinishedType">
<dailyData date="26-06-2023">
<observation name="cancelled" value="31.0" />
<observation name="explicitSelect" value="7.0" />
</dailyData>
</factor>
<factor id="completionType">
<dailyData date="26-06-2023">
<observation name="BASIC" value="31.0" />
</dailyData>
</factor>
<factor id="completionUsage">
<dailyData date="26-06-2023">
<observation name="count" value="38.0" />
</dailyData>
</factor>
<factor id="itemPosition">
<dailyData date="26-06-2023">
<observation name="0" value="6.0" />
<observation name="86" value="1.0" />
</dailyData>
</factor>
<factor id="mnemonicsUsage">
<dailyData date="26-06-2023">
<observation name="total" value="7.0" />
<observation name="withMnemonics" value="0.0" />
</dailyData>
</factor>
<factor id="prefixLength">
<dailyData date="26-06-2023">
<observation name="21" value="1.0" />
<observation name="24" value="1.0" />
<observation name="26" value="1.0" />
<observation name="28" value="1.0" />
<observation name="29" value="2.0" />
<observation name="32" value="1.0" />
</dailyData>
</factor>
<factor id="prefixMatchingType">
<dailyData date="26-06-2023">
<observation name="GREEDY_WITH_CASE" value="4.0" />
<observation name="WORDS_FIRST_CHAR" value="1.0" />
</dailyData>
</factor>
<factor id="templatesUsage">
<dailyData date="26-06-2023">
<observation name="totalStartingWithPrefix" value="7.0" />
</dailyData>
</factor>
<factor id="timeBetweenTyping">
<dailyData date="26-06-2023">
<observation name="average" value="115.76087" />
<observation name="count" value="92.0" />
</dailyData>
</factor>
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="singleClickDiffPreview" value="1" />
<option name="unhandledExceptionsIgnoreList" value="1" />
<option name="vcsConfiguration" value="3" />
</component>
</project>

2
External/SDL vendored

@ -1 +1 @@
Subproject commit e027b85cc457556071cbb2f3f1bcf8803c1bc001 Subproject commit a40b2de9466c41426a5a24662c5a17374ea36f0d

65
External/build.sh vendored
View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
pushd "$(dirname "$0")" >/dev/null set -e
pushd "$(dirname "$0")"
# Check if environment variables are defined # Check if environment variables are defined
if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then
@ -8,7 +10,9 @@ if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then
exit 1 exit 1
fi fi
SUDO=$(which sudo) SUDO=$(which sudo || exit 0)
export DEBIAN_FRONTEND=noninteractive
if [[ $RUNNER_OS == 'Linux' ]]; then if [[ $RUNNER_OS == 'Linux' ]]; then
# Setup Linux dependencies # Setup Linux dependencies
@ -18,11 +22,6 @@ if [[ $RUNNER_OS == 'Linux' ]]; then
$SUDO apt-get update -y -qq $SUDO apt-get update -y -qq
if [[ $TARGET_APT_ARCH == :i386 ]]; then
# Workaround GitHub's ubuntu-20.04 image issue <https://github.com/actions/virtual-environments/issues/4589>
$SUDO apt-get install -y --allow-downgrades libpcre2-8-0=10.34-7
fi
if [[ $NAME != 'linux-x86' && $NAME != 'linux-x64' ]]; then if [[ $NAME != 'linux-x86' && $NAME != 'linux-x64' ]]; then
GCC="gcc" GCC="gcc"
GPP="g++" GPP="g++"
@ -34,12 +33,12 @@ if [[ $RUNNER_OS == 'Linux' ]]; then
$SUDO apt-get install -y \ $SUDO apt-get install -y \
$GCC \ $GCC \
$GPP \ $GPP \
git \ git \
cmake \ cmake \
ninja-build \ ninja-build \
wayland-scanner++ \ wayland-scanner++ \
wayland-protocols \ wayland-protocols \
meson \ meson \
pkg-config$TARGET_APT_ARCH \ pkg-config$TARGET_APT_ARCH \
libasound2-dev$TARGET_APT_ARCH \ libasound2-dev$TARGET_APT_ARCH \
libdbus-1-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 \ libgl1-mesa-dev$TARGET_APT_ARCH \
libgles2-mesa-dev$TARGET_APT_ARCH \ libgles2-mesa-dev$TARGET_APT_ARCH \
libglu1-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 \ libibus-1.0-dev$TARGET_APT_ARCH \
libpango1.0-dev$TARGET_APT_ARCH \ libpango1.0-dev$TARGET_APT_ARCH \
libpulse-dev$TARGET_APT_ARCH \ libpulse-dev$TARGET_APT_ARCH \
libsndio-dev$TARGET_APT_ARCH \ libsndio-dev$TARGET_APT_ARCH \
libudev-dev$TARGET_APT_ARCH \ libudev-dev$TARGET_APT_ARCH \
@ -67,31 +66,24 @@ if [[ $RUNNER_OS == 'Linux' ]]; then
libxxf86vm-dev$TARGET_APT_ARCH \ libxxf86vm-dev$TARGET_APT_ARCH \
libdrm-dev$TARGET_APT_ARCH \ libdrm-dev$TARGET_APT_ARCH \
libgbm-dev$TARGET_APT_ARCH \ libgbm-dev$TARGET_APT_ARCH \
libpulse-dev$TARGET_APT_ARCH libpulse-dev$TARGET_APT_ARCH \
libpipewire-0.3-dev$TARGET_APT_ARCH \
if [[ $TARGET_APT_ARCH != :i386 ]]; then libdecor-0-dev$TARGET_APT_ARCH
# 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
fi fi
# Build SDL # Build SDL
pushd SDL >/dev/null pushd SDL
git reset --hard HEAD 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 <gameinput.h>/#_include <gameinput.h>/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 -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 cmake --build build/ --config Release
$SUDO cmake --install build/ --prefix install_output --config Release $SUDO cmake --install build/ --prefix install_output --config Release
popd >/dev/null popd
# Move build lib into correct folders # Move build lib into correct folders
if [[ $RUNNER_OS == 'Windows' ]]; then if [[ $RUNNER_OS == 'Windows' ]]; then
@ -103,14 +95,14 @@ elif [[ $RUNNER_OS == 'macOS' ]]; then
fi fi
# Build SDL_image # Build SDL_image
pushd SDL_image >/dev/null pushd SDL_image
git reset --hard HEAD git reset --hard HEAD
# -DSDLIMAGE_AVIF=OFF is used because windows requires special setup to build avif support (nasm) # -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) # 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 -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 cmake --build build/ --config Release
$SUDO cmake --install build/ --prefix install_output --config Release $SUDO cmake --install build/ --prefix install_output --config Release
popd >/dev/null popd
# Move build lib into correct folders # Move build lib into correct folders
if [[ $RUNNER_OS == 'Windows' ]]; then 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 # TODO: find out if webp, etc. are also needed on macOS here
fi fi
# Build SDL_ttf # Build SDL_ttf
pushd SDL_ttf >/dev/null pushd SDL_ttf
git reset --hard HEAD 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 -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 cmake --build build/ --config Release
$SUDO cmake --install build/ --prefix install_output --config Release $SUDO cmake --install build/ --prefix install_output --config Release
popd >/dev/null popd
# Move build lib into correct folders # Move build lib into correct folders
if [[ $RUNNER_OS == 'Windows' ]]; then 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 cp SDL3_ttf/install_output/lib/libSDL3_ttf.dylib ../native/$NAME/libSDL3_ttf.dylib
fi fi
popd
# pop External
popd >/dev/null

View File

@ -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. 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 ## License
This code is released under [MIT](LICENCE). This code is released under [MIT](LICENCE).

View File

@ -6,7 +6,6 @@
"SDL3_ttf-CS\\SDL3_ttf-CS.csproj", "SDL3_ttf-CS\\SDL3_ttf-CS.csproj",
"SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3_image-CS\\SDL3_image-CS.csproj",
"SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.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\\SDL3-CS.Tests.csproj",
"SDL3-CS.Tests.Android\\SDL3-CS.Tests.Android.csproj" "SDL3-CS.Tests.Android\\SDL3-CS.Tests.Android.csproj"
] ]

View File

@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<RootNamespace>SDL.Android</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup Label="NuGet">
<Authors>ppy Pty Ltd</Authors>
<Company>ppy Pty Ltd</Company>
<Copyright>Copyright (c) 2024 ppy Pty Ltd</Copyright>
<Product>ppy.SDL3-CS.Android</Product>
<PackageId>ppy.SDL3-CS.Android</PackageId>
<PackageReleaseNotes>Automated release.</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ppy/SDL3-CS</PackageProjectUrl>
<RepositoryUrl>https://github.com/ppy/SDL3-CS</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<EmbeddedJar Include="Jars\SDL3AndroidBridge.jar" />
</ItemGroup>
</Project>

View File

@ -13,7 +13,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SDL3-CS.Tests\SDL3-CS.Tests.csproj"/> <ProjectReference Include="..\SDL3-CS.Tests\SDL3-CS.Tests.csproj"/>
<ProjectReference Include="..\SDL3-CS.Android\SDL3-CS.Android.csproj"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -8,6 +8,7 @@
<ImplicitUsings>true</ImplicitUsings> <ImplicitUsings>true</ImplicitUsings>
<SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -32,6 +32,8 @@ namespace SDL.Tests
window.Setup(); window.Setup();
window.Create(); window.Create();
printWindows();
const SDL_Keymod state = SDL_Keymod.SDL_KMOD_CAPS | SDL_Keymod.SDL_KMOD_ALT; const SDL_Keymod state = SDL_Keymod.SDL_KMOD_CAPS | SDL_Keymod.SDL_KMOD_ALT;
SDL_SetModState(state); SDL_SetModState(state);
Debug.Assert(SDL_GetModState() == 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])}");
}
}
} }
} }

View File

@ -2,10 +2,12 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Drawing; using System.Drawing;
using NUnit.Framework;
using static SDL.SDL3; using static SDL.SDL3;
namespace SDL.Tests namespace SDL.Tests
{ {
[Explicit("Uses an interactive window.")]
public unsafe class TestPositionalInputVisualisation : MainCallbacksTest public unsafe class TestPositionalInputVisualisation : MainCallbacksTest
{ {
private SDL_Window* window; private SDL_Window* window;

43
SDL3-CS.Tests/TestTray.cs Normal file
View File

@ -0,0 +1,43 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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]) ?? "<null>"}");
running = true;
while (running)
{
SDL_PumpEvents();
}
}
}
}

52
SDL3-CS.Tests/TrayTest.cs Normal file
View File

@ -0,0 +1,52 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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<Action>(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<Action>(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();
}
}
}

View File

@ -19,8 +19,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3-CS.SourceGeneration",
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3-CS.Tests", "SDL3-CS.Tests\SDL3-CS.Tests.csproj", "{CF980481-8227-4BED-970E-6433C83F64CB}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3-CS.Tests", "SDL3-CS.Tests\SDL3-CS.Tests.csproj", "{CF980481-8227-4BED-970E-6433C83F64CB}"
EndProject 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}" 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 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}" 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}.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.ActiveCfg = Release|Any CPU
{CF980481-8227-4BED-970E-6433C83F64CB}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Debug|Any CPU.Build.0 = 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 {E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU

Binary file not shown.

View File

@ -1,11 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SDL</RootNamespace> <RootNamespace>SDL</RootNamespace>
<TargetFrameworks>net8.0;net8.0-android</TargetFrameworks>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);SYSLIB1054;CA1401</NoWarn> <NoWarn>$(NoWarn);SYSLIB1054;CA1401</NoWarn>
<DefineConstants>$(DefineConstants);JETBRAINS_ANNOTATIONS</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="NuGet"> <PropertyGroup Label="NuGet">
@ -93,6 +95,7 @@
<PackagePath>runtimes/android-x86/native</PackagePath> <PackagePath>runtimes/android-x86/native</PackagePath>
<Pack>true</Pack> <Pack>true</Pack>
</None> </None>
<EmbeddedJar Include="Jars\SDL3AndroidBridge.jar" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,119 @@
/*
<auto-generated/>
C# bindings for Simple DirectMedia Layer.
Original copyright notice of input files:
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
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);
}
}

View File

@ -89,15 +89,23 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid); public static extern float SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid);
@ -111,14 +119,14 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream* stream); public static extern SDLBool SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream* stream);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_UnbindAudioStream(SDL_AudioStream* stream); public static extern void SDL_UnbindAudioStream(SDL_AudioStream* stream);
@ -197,6 +205,10 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_ResumeAudioStreamDevice(SDL_AudioStream* stream); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_LockAudioStream(SDL_AudioStream* stream); public static extern SDLBool SDL_LockAudioStream(SDL_AudioStream* stream);

View File

@ -70,7 +70,7 @@ namespace SDL
public static extern SDL_CameraID* SDL_GetCameras(int* count); public static extern SDL_CameraID* SDL_GetCameras(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraName", ExactSpelling = true)]
[return: NativeTypeName("const char *")] [return: NativeTypeName("const char *")]

View File

@ -37,6 +37,13 @@ namespace SDL
public byte* pattern; public byte* pattern;
} }
public enum SDL_FileDialogType
{
SDL_FILEDIALOG_OPENFILE,
SDL_FILEDIALOG_SAVEFILE,
SDL_FILEDIALOG_OPENFOLDER,
}
public static unsafe partial class SDL3 public static unsafe partial class SDL3
{ {
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -47,5 +54,32 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_ShowOpenFolderDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl]<IntPtr, byte**, int, void> callback, [NativeTypeName("void*")] IntPtr userdata, SDL_Window* window, [NativeTypeName("const char *")] byte* default_location, [NativeTypeName("bool")] SDLBool allow_many); public static extern void SDL_ShowOpenFolderDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl]<IntPtr, byte**, int, void> 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]<IntPtr, byte**, int, void> callback, [NativeTypeName("void*")] IntPtr userdata, SDL_PropertiesID props);
[NativeTypeName("#define SDL_PROP_FILE_DIALOG_FILTERS_POINTER \"SDL.filedialog.filters\"")]
public static ReadOnlySpan<byte> SDL_PROP_FILE_DIALOG_FILTERS_POINTER => "SDL.filedialog.filters"u8;
[NativeTypeName("#define SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER \"SDL.filedialog.nfilters\"")]
public static ReadOnlySpan<byte> SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER => "SDL.filedialog.nfilters"u8;
[NativeTypeName("#define SDL_PROP_FILE_DIALOG_WINDOW_POINTER \"SDL.filedialog.window\"")]
public static ReadOnlySpan<byte> SDL_PROP_FILE_DIALOG_WINDOW_POINTER => "SDL.filedialog.window"u8;
[NativeTypeName("#define SDL_PROP_FILE_DIALOG_LOCATION_STRING \"SDL.filedialog.location\"")]
public static ReadOnlySpan<byte> SDL_PROP_FILE_DIALOG_LOCATION_STRING => "SDL.filedialog.location"u8;
[NativeTypeName("#define SDL_PROP_FILE_DIALOG_MANY_BOOLEAN \"SDL.filedialog.many\"")]
public static ReadOnlySpan<byte> SDL_PROP_FILE_DIALOG_MANY_BOOLEAN => "SDL.filedialog.many"u8;
[NativeTypeName("#define SDL_PROP_FILE_DIALOG_TITLE_STRING \"SDL.filedialog.title\"")]
public static ReadOnlySpan<byte> SDL_PROP_FILE_DIALOG_TITLE_STRING => "SDL.filedialog.title"u8;
[NativeTypeName("#define SDL_PROP_FILE_DIALOG_ACCEPT_STRING \"SDL.filedialog.accept\"")]
public static ReadOnlySpan<byte> SDL_PROP_FILE_DIALOG_ACCEPT_STRING => "SDL.filedialog.accept"u8;
[NativeTypeName("#define SDL_PROP_FILE_DIALOG_CANCEL_STRING \"SDL.filedialog.cancel\"")]
public static ReadOnlySpan<byte> SDL_PROP_FILE_DIALOG_CANCEL_STRING => "SDL.filedialog.cancel"u8;
} }
} }

View File

@ -115,6 +115,7 @@ namespace SDL
SDL_EVENT_FINGER_DOWN = 0x700, SDL_EVENT_FINGER_DOWN = 0x700,
SDL_EVENT_FINGER_UP, SDL_EVENT_FINGER_UP,
SDL_EVENT_FINGER_MOTION, SDL_EVENT_FINGER_MOTION,
SDL_EVENT_FINGER_CANCELED,
SDL_EVENT_CLIPBOARD_UPDATE = 0x900, SDL_EVENT_CLIPBOARD_UPDATE = 0x900,
SDL_EVENT_DROP_FILE = 0x1000, SDL_EVENT_DROP_FILE = 0x1000,
SDL_EVENT_DROP_TEXT, SDL_EVENT_DROP_TEXT,
@ -711,6 +712,19 @@ namespace SDL
public SDL_CameraID which; 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 partial struct SDL_TouchFingerEvent
{ {
public SDL_EventType type; public SDL_EventType type;
@ -890,7 +904,7 @@ namespace SDL
public SDLBool owner; public SDLBool owner;
[NativeTypeName("Sint32")] [NativeTypeName("Sint32")]
public int n_mime_types; public int num_mime_types;
[NativeTypeName("const char **")] [NativeTypeName("const char **")]
public byte** mime_types; public byte** mime_types;
@ -1064,6 +1078,9 @@ namespace SDL
[FieldOffset(0)] [FieldOffset(0)]
public SDL_PenAxisEvent paxis; public SDL_PenAxisEvent paxis;
[FieldOffset(0)]
public SDL_RenderEvent render;
[FieldOffset(0)] [FieldOffset(0)]
public SDL_DropEvent drop; public SDL_DropEvent drop;

View File

@ -115,6 +115,10 @@ namespace SDL
[return: NativeTypeName("char **")] [return: NativeTypeName("char **")]
public static extern byte** SDL_GlobDirectory([NativeTypeName("const char *")] byte* path, [NativeTypeName("const char *")] byte* pattern, SDL_GlobFlags flags, int* count); 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)")] [NativeTypeName("#define SDL_GLOB_CASEINSENSITIVE (1u << 0)")]
public const uint SDL_GLOB_CASEINSENSITIVE = (1U << 0); public const uint SDL_GLOB_CASEINSENSITIVE = (1U << 0);
} }

View File

@ -117,12 +117,12 @@ namespace SDL
{ {
public SDL_GamepadBindingType input_type; public SDL_GamepadBindingType input_type;
[NativeTypeName("__AnonymousRecord_SDL_gamepad_L247_C5")] [NativeTypeName("__AnonymousRecord_SDL_gamepad_L265_C5")]
public _input_e__Union input; public _input_e__Union input;
public SDL_GamepadBindingType output_type; public SDL_GamepadBindingType output_type;
[NativeTypeName("__AnonymousRecord_SDL_gamepad_L267_C5")] [NativeTypeName("__AnonymousRecord_SDL_gamepad_L285_C5")]
public _output_e__Union output; public _output_e__Union output;
[StructLayout(LayoutKind.Explicit)] [StructLayout(LayoutKind.Explicit)]
@ -132,11 +132,11 @@ namespace SDL
public int button; public int button;
[FieldOffset(0)] [FieldOffset(0)]
[NativeTypeName("__AnonymousRecord_SDL_gamepad_L251_C9")] [NativeTypeName("__AnonymousRecord_SDL_gamepad_L269_C9")]
public _axis_e__Struct axis; public _axis_e__Struct axis;
[FieldOffset(0)] [FieldOffset(0)]
[NativeTypeName("__AnonymousRecord_SDL_gamepad_L258_C9")] [NativeTypeName("__AnonymousRecord_SDL_gamepad_L276_C9")]
public _hat_e__Struct hat; public _hat_e__Struct hat;
public partial struct _axis_e__Struct public partial struct _axis_e__Struct
@ -163,7 +163,7 @@ namespace SDL
public SDL_GamepadButton button; public SDL_GamepadButton button;
[FieldOffset(0)] [FieldOffset(0)]
[NativeTypeName("__AnonymousRecord_SDL_gamepad_L271_C9")] [NativeTypeName("__AnonymousRecord_SDL_gamepad_L289_C9")]
public _axis_e__Struct axis; public _axis_e__Struct axis;
public partial struct _axis_e__Struct public partial struct _axis_e__Struct

View File

@ -403,7 +403,7 @@ namespace SDL
SDL_GPU_SWAPCHAINCOMPOSITION_SDR, SDL_GPU_SWAPCHAINCOMPOSITION_SDR,
SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR, SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR,
SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR, SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR,
SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048, SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084,
} }
public partial struct SDL_GPUViewport public partial struct SDL_GPUViewport
@ -1335,6 +1335,10 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetGPUSwapchainParameters(SDL_GPUDevice* device, SDL_Window* window, SDL_GPUSwapchainComposition swapchain_composition, SDL_GPUPresentMode present_mode); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat(SDL_GPUDevice* device, SDL_Window* window); public static extern SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat(SDL_GPUDevice* device, SDL_Window* window);
@ -1342,6 +1346,14 @@ namespace SDL
[return: NativeTypeName("bool")] [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); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_SubmitGPUCommandBuffer(SDL_GPUCommandBuffer* command_buffer); public static extern SDLBool SDL_SubmitGPUCommandBuffer(SDL_GPUCommandBuffer* command_buffer);
@ -1456,24 +1468,6 @@ namespace SDL
[NativeTypeName("#define SDL_GPU_COLORCOMPONENT_A (1u << 3)")] [NativeTypeName("#define SDL_GPU_COLORCOMPONENT_A (1u << 3)")]
public const uint 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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\"")] [NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN \"SDL.gpu.device.create.debugmode\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN => "SDL.gpu.device.create.debugmode"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING \"SDL.gpu.device.create.d3d12.semantic\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING => "SDL.gpu.device.create.d3d12.semantic"u8; public static ReadOnlySpan<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING => "SDL.gpu.transferbuffer.create.name"u8;
} }
} }

View File

@ -97,6 +97,12 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE \"SDL_AUDIO_ALSA_DEFAULT_DEVICE\"")] [NativeTypeName("#define SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE \"SDL_AUDIO_ALSA_DEFAULT_DEVICE\"")]
public static ReadOnlySpan<byte> SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE => "SDL_AUDIO_ALSA_DEFAULT_DEVICE"u8; public static ReadOnlySpan<byte> 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<byte> 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<byte> SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE => "SDL_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE"u8;
[NativeTypeName("#define SDL_HINT_AUDIO_CATEGORY \"SDL_AUDIO_CATEGORY\"")] [NativeTypeName("#define SDL_HINT_AUDIO_CATEGORY \"SDL_AUDIO_CATEGORY\"")]
public static ReadOnlySpan<byte> SDL_HINT_AUDIO_CATEGORY => "SDL_AUDIO_CATEGORY"u8; public static ReadOnlySpan<byte> SDL_HINT_AUDIO_CATEGORY => "SDL_AUDIO_CATEGORY"u8;
@ -262,6 +268,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_JOYSTICK_DEVICE \"SDL_JOYSTICK_DEVICE\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_DEVICE \"SDL_JOYSTICK_DEVICE\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_DEVICE => "SDL_JOYSTICK_DEVICE"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_DEVICE => "SDL_JOYSTICK_DEVICE"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_ENHANCED_REPORTS \"SDL_JOYSTICK_ENHANCED_REPORTS\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_ENHANCED_REPORTS => "SDL_JOYSTICK_ENHANCED_REPORTS"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES \"SDL_JOYSTICK_FLIGHTSTICK_DEVICES\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES \"SDL_JOYSTICK_FLIGHTSTICK_DEVICES\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES => "SDL_JOYSTICK_FLIGHTSTICK_DEVICES"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL \"SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL => "SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL"u8; public static ReadOnlySpan<byte> 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<byte> SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE => "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5 \"SDL_JOYSTICK_HIDAPI_PS5\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5 \"SDL_JOYSTICK_HIDAPI_PS5\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS5 => "SDL_JOYSTICK_HIDAPI_PS5"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED \"SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED => "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED"u8; public static ReadOnlySpan<byte> 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<byte> SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE => "SDL_JOYSTICK_HIDAPI_PS5_RUMBLE"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SHIELD \"SDL_JOYSTICK_HIDAPI_SHIELD\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SHIELD \"SDL_JOYSTICK_HIDAPI_SHIELD\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_SHIELD => "SDL_JOYSTICK_HIDAPI_SHIELD"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAM \"SDL_JOYSTICK_HIDAPI_STEAM\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_STEAM => "SDL_JOYSTICK_HIDAPI_STEAM"u8; public static ReadOnlySpan<byte> 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<byte> 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\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK \"SDL_JOYSTICK_HIDAPI_STEAMDECK\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK => "SDL_JOYSTICK_HIDAPI_STEAMDECK"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH \"SDL_MAC_OPENGL_ASYNC_DISPATCH\"")]
public static ReadOnlySpan<byte> SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH => "SDL_MAC_OPENGL_ASYNC_DISPATCH"u8; public static ReadOnlySpan<byte> 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<byte> SDL_HINT_MAC_OPTION_AS_ALT => "SDL_MAC_OPTION_AS_ALT"u8;
[NativeTypeName("#define SDL_HINT_MAC_SCROLL_MOMENTUM \"SDL_MAC_SCROLL_MOMENTUM\"")] [NativeTypeName("#define SDL_HINT_MAC_SCROLL_MOMENTUM \"SDL_MAC_SCROLL_MOMENTUM\"")]
public static ReadOnlySpan<byte> SDL_HINT_MAC_SCROLL_MOMENTUM => "SDL_MAC_SCROLL_MOMENTUM"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME \"SDL_MOUSE_DOUBLE_CLICK_TIME\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_DOUBLE_CLICK_TIME => "SDL_MOUSE_DOUBLE_CLICK_TIME"u8; public static ReadOnlySpan<byte> 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<byte> 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\"")] [NativeTypeName("#define SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE \"SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE => "SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_MODE_CENTER \"SDL_MOUSE_RELATIVE_MODE_CENTER\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_MODE_CENTER => "SDL_MOUSE_RELATIVE_MODE_CENTER"u8; public static ReadOnlySpan<byte> 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<byte> 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\"")] [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE \"SDL_MOUSE_RELATIVE_SPEED_SCALE\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE => "SDL_MOUSE_RELATIVE_SPEED_SCALE"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE \"SDL_MOUSE_RELATIVE_CURSOR_VISIBLE\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE => "SDL_MOUSE_RELATIVE_CURSOR_VISIBLE"u8; public static ReadOnlySpan<byte> 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<byte> SDL_HINT_MOUSE_RELATIVE_CLIP_INTERVAL => "SDL_MOUSE_RELATIVE_CLIP_INTERVAL"u8;
[NativeTypeName("#define SDL_HINT_MOUSE_TOUCH_EVENTS \"SDL_MOUSE_TOUCH_EVENTS\"")] [NativeTypeName("#define SDL_HINT_MOUSE_TOUCH_EVENTS \"SDL_MOUSE_TOUCH_EVENTS\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_TOUCH_EVENTS => "SDL_MOUSE_TOUCH_EVENTS"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_HINT_OPENGL_LIBRARY \"SDL_OPENGL_LIBRARY\"")]
public static ReadOnlySpan<byte> SDL_HINT_OPENGL_LIBRARY => "SDL_OPENGL_LIBRARY"u8; public static ReadOnlySpan<byte> SDL_HINT_OPENGL_LIBRARY => "SDL_OPENGL_LIBRARY"u8;
[NativeTypeName("#define SDL_HINT_EGL_LIBRARY \"SDL_EGL_LIBRARY\"")]
public static ReadOnlySpan<byte> SDL_HINT_EGL_LIBRARY => "SDL_EGL_LIBRARY"u8;
[NativeTypeName("#define SDL_HINT_OPENGL_ES_DRIVER \"SDL_OPENGL_ES_DRIVER\"")] [NativeTypeName("#define SDL_HINT_OPENGL_ES_DRIVER \"SDL_OPENGL_ES_DRIVER\"")]
public static ReadOnlySpan<byte> SDL_HINT_OPENGL_ES_DRIVER => "SDL_OPENGL_ES_DRIVER"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES \"SDL_VIDEO_MAC_FULLSCREEN_SPACES\"")]
public static ReadOnlySpan<byte> SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES => "SDL_VIDEO_MAC_FULLSCREEN_SPACES"u8; public static ReadOnlySpan<byte> 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<byte> 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\"")] [NativeTypeName("#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS \"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS\"")]
public static ReadOnlySpan<byte> SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS => "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_HINT_ASSERT \"SDL_ASSERT\"")]
public static ReadOnlySpan<byte> SDL_HINT_ASSERT => "SDL_ASSERT"u8; public static ReadOnlySpan<byte> SDL_HINT_ASSERT => "SDL_ASSERT"u8;
[NativeTypeName("#define SDL_HINT_PEN_MOUSE_EVENTS \"SDL_PEN_MOUSE_EVENTS\"")]
public static ReadOnlySpan<byte> SDL_HINT_PEN_MOUSE_EVENTS => "SDL_PEN_MOUSE_EVENTS"u8;
[NativeTypeName("#define SDL_HINT_PEN_TOUCH_EVENTS \"SDL_PEN_TOUCH_EVENTS\"")]
public static ReadOnlySpan<byte> SDL_HINT_PEN_TOUCH_EVENTS => "SDL_PEN_TOUCH_EVENTS"u8;
} }
} }

View File

@ -54,6 +54,14 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_Quit(); 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]<IntPtr, void> callback, [NativeTypeName("void*")] IntPtr userdata, [NativeTypeName("bool")] SDLBool wait_complete);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetAppMetadata([NativeTypeName("const char *")] byte* appname, [NativeTypeName("const char *")] byte* appversion, [NativeTypeName("const char *")] byte* appidentifier); public static extern SDLBool SDL_SetAppMetadata([NativeTypeName("const char *")] byte* appname, [NativeTypeName("const char *")] byte* appversion, [NativeTypeName("const char *")] byte* appidentifier);

View File

@ -27,7 +27,10 @@ namespace SDL
{ {
public static partial class SDL3 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); public const uint SDLK_SCANCODE_MASK = (1U << 30);
[NativeTypeName("#define SDLK_UNKNOWN 0x00000000u")] [NativeTypeName("#define SDLK_UNKNOWN 0x00000000u")]
@ -777,6 +780,27 @@ namespace SDL
[NativeTypeName("#define SDLK_ENDCALL 0x40000122u")] [NativeTypeName("#define SDLK_ENDCALL 0x40000122u")]
public const uint 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")] [NativeTypeName("#define SDL_KMOD_NONE 0x0000u")]
public const uint SDL_KMOD_NONE = 0x0000U; public const uint SDL_KMOD_NONE = 0x0000U;
@ -786,6 +810,9 @@ namespace SDL
[NativeTypeName("#define SDL_KMOD_RSHIFT 0x0002u")] [NativeTypeName("#define SDL_KMOD_RSHIFT 0x0002u")]
public const uint 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")] [NativeTypeName("#define SDL_KMOD_LCTRL 0x0040u")]
public const uint SDL_KMOD_LCTRL = 0x0040U; public const uint SDL_KMOD_LCTRL = 0x0040U;

View File

@ -1,37 +0,0 @@
/*
<auto-generated/>
C# bindings for Simple DirectMedia Layer.
Original copyright notice of input files:
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
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();
}
}

View File

@ -38,5 +38,8 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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]<IntPtr*, int, byte**, SDL_AppResult> appinit, [NativeTypeName("SDL_AppIterate_func")] delegate* unmanaged[Cdecl]<IntPtr, SDL_AppResult> appiter, [NativeTypeName("SDL_AppEvent_func")] delegate* unmanaged[Cdecl]<IntPtr, SDL_Event*, SDL_AppResult> appevent, [NativeTypeName("SDL_AppQuit_func")] delegate* unmanaged[Cdecl]<IntPtr, SDL_AppResult, void> appquit); public static extern int SDL_EnterAppMainCallbacks(int argc, [NativeTypeName("char *[]")] byte** argv, [NativeTypeName("SDL_AppInit_func")] delegate* unmanaged[Cdecl]<IntPtr*, int, byte**, SDL_AppResult> appinit, [NativeTypeName("SDL_AppIterate_func")] delegate* unmanaged[Cdecl]<IntPtr, SDL_AppResult> appiter, [NativeTypeName("SDL_AppEvent_func")] delegate* unmanaged[Cdecl]<IntPtr, SDL_Event*, SDL_AppResult> appevent, [NativeTypeName("SDL_AppQuit_func")] delegate* unmanaged[Cdecl]<IntPtr, SDL_AppResult, void> appquit);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_GDKSuspendComplete();
} }
} }

View File

@ -155,6 +155,7 @@ namespace SDL
SDL_PIXELFORMAT_NV21 = 0x3132564eU, SDL_PIXELFORMAT_NV21 = 0x3132564eU,
SDL_PIXELFORMAT_P010 = 0x30313050U, SDL_PIXELFORMAT_P010 = 0x30313050U,
SDL_PIXELFORMAT_EXTERNAL_OES = 0x2053454fU, SDL_PIXELFORMAT_EXTERNAL_OES = 0x2053454fU,
SDL_PIXELFORMAT_MJPG = 0x47504a4dU,
} }
public enum SDL_ColorType public enum SDL_ColorType

View File

@ -124,7 +124,7 @@ namespace SDL
} }
[return: NativeTypeName("bool")] [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; 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;
} }

View File

@ -344,6 +344,10 @@ namespace SDL
[return: NativeTypeName("bool")] [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); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [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); 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")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_RenderDebugText(SDL_Renderer* renderer, float x, float y, [NativeTypeName("const char *")] byte* str); 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\"")] [NativeTypeName("#define SDL_SOFTWARE_RENDERER \"software\"")]
public static ReadOnlySpan<byte> SDL_SOFTWARE_RENDERER => "software"u8; public static ReadOnlySpan<byte> 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\"")] [NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER \"SDL.renderer.vulkan.swapchain_image_count\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER => "SDL.renderer.vulkan.swapchain_image_count"u8; public static ReadOnlySpan<byte> 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<byte> SDL_PROP_RENDERER_GPU_DEVICE_POINTER => "SDL.renderer.gpu.device"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER \"SDL.texture.create.colorspace\"")] [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER \"SDL.texture.create.colorspace\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER => "SDL.texture.create.colorspace"u8; public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER => "SDL.texture.create.colorspace"u8;

View File

@ -322,7 +322,7 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strtok_r", ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strtok_r", ExactSpelling = true)]
[return: NativeTypeName("char *")] [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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")] [return: NativeTypeName("size_t")]

View File

@ -240,6 +240,10 @@ namespace SDL
[return: NativeTypeName("bool")] [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); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [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); 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\"")] [NativeTypeName("#define SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING \"SDL.surface.tonemap\"")]
public static ReadOnlySpan<byte> SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING => "SDL.surface.tonemap"u8; public static ReadOnlySpan<byte> 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<byte> 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<byte> SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER => "SDL.surface.hotspot.y"u8;
} }
} }

View File

@ -40,6 +40,14 @@ namespace SDL
SDL_THREAD_PRIORITY_TIME_CRITICAL, 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 public static unsafe partial class SDL3
{ {
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -65,6 +73,9 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_WaitThread(SDL_Thread* thread, int* status); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_DetachThread(SDL_Thread* thread); public static extern void SDL_DetachThread(SDL_Thread* thread);

View File

@ -0,0 +1,133 @@
/*
<auto-generated/>
C# bindings for Simple DirectMedia Layer.
Original copyright notice of input files:
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
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]<IntPtr, SDL_TrayEntry*, void> 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;
}
}

View File

@ -39,10 +39,10 @@ namespace SDL
[NativeTypeName("#define SDL_MAJOR_VERSION 3")] [NativeTypeName("#define SDL_MAJOR_VERSION 3")]
public const int SDL_MAJOR_VERSION = 3; public const int SDL_MAJOR_VERSION = 3;
[NativeTypeName("#define SDL_MINOR_VERSION 1")] [NativeTypeName("#define SDL_MINOR_VERSION 2")]
public const int SDL_MINOR_VERSION = 1; public const int SDL_MINOR_VERSION = 2;
[NativeTypeName("#define SDL_MICRO_VERSION 7")] [NativeTypeName("#define SDL_MICRO_VERSION 5")]
public const int SDL_MICRO_VERSION = 7; public const int SDL_MICRO_VERSION = 5;
} }
} }

View File

@ -8,6 +8,7 @@ namespace SDL
[Typedef] [Typedef]
public enum SDL_Keycode : UInt32 public enum SDL_Keycode : UInt32
{ {
SDLK_EXTENDED_MASK = SDL3.SDLK_EXTENDED_MASK,
SDLK_SCANCODE_MASK = SDL3.SDLK_SCANCODE_MASK, SDLK_SCANCODE_MASK = SDL3.SDLK_SCANCODE_MASK,
SDLK_UNKNOWN = SDL3.SDLK_UNKNOWN, SDLK_UNKNOWN = SDL3.SDLK_UNKNOWN,
SDLK_RETURN = SDL3.SDLK_RETURN, SDLK_RETURN = SDL3.SDLK_RETURN,
@ -258,6 +259,13 @@ namespace SDL
SDLK_SOFTRIGHT = SDL3.SDLK_SOFTRIGHT, SDLK_SOFTRIGHT = SDL3.SDLK_SOFTRIGHT,
SDLK_CALL = SDL3.SDLK_CALL, SDLK_CALL = SDL3.SDLK_CALL,
SDLK_ENDCALL = SDL3.SDLK_ENDCALL, 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] [Flags]
@ -267,6 +275,7 @@ namespace SDL
SDL_KMOD_NONE = (UInt16)SDL3.SDL_KMOD_NONE, SDL_KMOD_NONE = (UInt16)SDL3.SDL_KMOD_NONE,
SDL_KMOD_LSHIFT = (UInt16)SDL3.SDL_KMOD_LSHIFT, SDL_KMOD_LSHIFT = (UInt16)SDL3.SDL_KMOD_LSHIFT,
SDL_KMOD_RSHIFT = (UInt16)SDL3.SDL_KMOD_RSHIFT, 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_LCTRL = (UInt16)SDL3.SDL_KMOD_LCTRL,
SDL_KMOD_RCTRL = (UInt16)SDL3.SDL_KMOD_RCTRL, SDL_KMOD_RCTRL = (UInt16)SDL3.SDL_KMOD_RCTRL,
SDL_KMOD_LALT = (UInt16)SDL3.SDL_KMOD_LALT, SDL_KMOD_LALT = (UInt16)SDL3.SDL_KMOD_LALT,

View File

@ -20,4 +20,13 @@ namespace SDL
SDL_PEN_INPUT_BUTTON_5 = SDL3.SDL_PEN_INPUT_BUTTON_5, SDL_PEN_INPUT_BUTTON_5 = SDL3.SDL_PEN_INPUT_BUTTON_5,
SDL_PEN_INPUT_ERASER_TIP = SDL3.SDL_PEN_INPUT_ERASER_TIP, 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));
}
} }

28
SDL3-CS/SDL3/SDL_tray.cs Normal file
View File

@ -0,0 +1,28 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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_TrayEntry>? SDL_GetTrayEntries(SDL_TrayMenu* menu)
{
int count;
var array = SDL_GetTrayEntries(menu, &count);
return SDLArray.CreateConstOpaque(array, count);
}
}
}

View File

@ -107,11 +107,11 @@ namespace SDL
} }
[MustDisposeResource] [MustDisposeResource]
public static unsafe SDLPointerArray<SDL_Window>? SDL_GetWindows() public static unsafe SDLOpaquePointerArray<SDL_Window>? SDL_GetWindows()
{ {
int count; int count;
var array = SDL_GetWindows(&count); var array = SDL_GetWindows(&count);
return SDLArray.Create(array, count); return SDLArray.CreateOpaque(array, count);
} }
} }
} }

View File

@ -63,5 +63,24 @@ namespace SDL
return new SDLPointerArray<T>(array, count); return new SDLPointerArray<T>(array, count);
} }
[MustDisposeResource]
internal static SDLOpaquePointerArray<T>? CreateOpaque<T>(T** array, int count)
where T : unmanaged
{
if (array == null)
return null;
return new SDLOpaquePointerArray<T>(array, count);
}
internal static SDLConstOpaquePointerArray<T>? CreateConstOpaque<T>(T** array, int count)
where T : unmanaged
{
if (array == null)
return null;
return new SDLConstOpaquePointerArray<T>(array, count);
}
} }
} }

View File

@ -0,0 +1,32 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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<T>
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];
}
}
}
}

View File

@ -0,0 +1,46 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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<T> : 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);
}
}
}

View File

@ -118,6 +118,7 @@ def add(s: str):
headers = [ headers = [
add("SDL3/SDL_atomic.h"), add("SDL3/SDL_atomic.h"),
add("SDL3/SDL_asyncio.h"),
add("SDL3/SDL_audio.h"), add("SDL3/SDL_audio.h"),
add("SDL3/SDL_blendmode.h"), add("SDL3/SDL_blendmode.h"),
add("SDL3/SDL_camera.h"), add("SDL3/SDL_camera.h"),
@ -163,6 +164,7 @@ headers = [
add("SDL3/SDL_thread.h"), add("SDL3/SDL_thread.h"),
add("SDL3/SDL_time.h"), add("SDL3/SDL_time.h"),
add("SDL3/SDL_timer.h"), add("SDL3/SDL_timer.h"),
add("SDL3/SDL_tray.h"),
add("SDL3/SDL_touch.h"), add("SDL3/SDL_touch.h"),
add("SDL3/SDL_version.h"), add("SDL3/SDL_version.h"),
add("SDL3/SDL_video.h"), add("SDL3/SDL_video.h"),
@ -411,7 +413,6 @@ def main():
if not should_skip(solo_headers, main_header): if not should_skip(solo_headers, main_header):
generate_platform_specific_headers(sdl_api, main_header, [ generate_platform_specific_headers(sdl_api, main_header, [
(["SDL_PLATFORM_WINDOWS"], "Windows", "Windows"), (["SDL_PLATFORM_WINDOWS"], "Windows", "Windows"),
(["SDL_PLATFORM_GDK"], "GDK", "Windows"),
]) ])
system_header = add("SDL3/SDL_system.h") system_header = add("SDL3/SDL_system.h")

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,23 +4,6 @@
<dict> <dict>
<key>AvailableLibraries</key> <key>AvailableLibraries</key>
<array> <array>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
<key>LibraryIdentifier</key>
<string>tvos-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict> <dict>
<key>BinaryPath</key> <key>BinaryPath</key>
<string>SDL3.framework/SDL3</string> <string>SDL3.framework/SDL3</string>
@ -49,6 +32,23 @@
<key>SupportedPlatform</key> <key>SupportedPlatform</key>
<string>ios</string> <string>ios</string>
</dict> </dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
<key>LibraryIdentifier</key>
<string>tvos-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict> <dict>
<key>BinaryPath</key> <key>BinaryPath</key>
<string>SDL3.framework/SDL3</string> <string>SDL3.framework/SDL3</string>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.