Compare commits

...

162 Commits

Author SHA1 Message Date
Dan Balasescu 3767eb2ab9
Merge pull request #266 from Susko3/fix-SDL_mixer-friendly-overloads
Fix SDL_mixer friendly overloads not generating
2025-12-13 13:28:34 +09:00
Dan Balasescu 4988d55819
Merge pull request #265 from Susko3/cleanup-error
Add tests for `SDL_error.cs` and ensure u8 constants are explicitly null-terminated
2025-12-13 13:26:29 +09:00
Susko3 3c21f68505 Hard-code string-returning functions in SDL_mixer 2025-12-13 03:11:02 +01:00
Susko3 2c185bf63b Fix SDL_mixer function prefix 2025-12-13 03:09:51 +01:00
Susko3 508573fe62 Add failing tests for SDL_mixer
They don't compile because of missing friendly overloads.
2025-12-13 03:09:01 +01:00
Susko3 2b556b39ce Ensure that format strings are null-terminated
u8 constants are implicitly null-terminated, but it's not really documented.
2025-12-13 02:29:00 +01:00
Susko3 40707381f6 Add tests for SDL_error.cs 2025-12-13 02:17:34 +01:00
Susko3 64a12c444b
Merge pull request #263 from MrLimeick/master
Adding missing values ​​to SDL_WindowFlags
2025-12-08 21:06:49 +01:00
MrLimeick 6e700651b2 Adding missing values ​​to SDL_WindowFlags 2025-12-08 18:57:20 +03:00
Dan Balasescu 32a04fb36a
Merge pull request #261 from ppy/update-native-binaries
Update native binaries
2025-12-05 22:06:42 +09:00
smoogipoo 227d48fe68 Update native binaries 2025-12-05 13:04:32 +00:00
Susko3 b20de5fa9c
Merge pull request #260 from hwsmm/update
Update SDL bindings
2025-12-05 13:47:03 +01:00
hwsmm ddf8f1f478 Update SDL bindings 2025-12-05 20:54:03 +09:00
Dan Balasescu 4022f0aa04
Merge pull request #259 from ppy/update-native-binaries
Update native binaries
2025-11-18 14:01:29 +09:00
smoogipoo 3cda196b20 Update native binaries 2025-11-18 03:08:55 +00:00
Dan Balasescu 3427250b38
Merge pull request #258 from Susko3/update-sdl
Update SDL bindings
2025-11-18 11:50:02 +09:00
Susko3 a27547bece Update SDL bindings 2025-11-17 18:23:31 +01:00
Susko3 c0765ca155
Merge pull request #257 from ppy/update-native-binaries
Update native binaries
2025-11-15 11:14:34 +01:00
smoogipoo 8838d6792e Update native binaries 2025-11-15 08:06:45 +00:00
Dan Balasescu 9d79ba7ade
Merge pull request #256 from Susko3/update-sdl
Update SDL bindings, with two input fixes and one feature
2025-11-15 16:54:56 +09:00
Susko3 95165b55ea Update SDL bindings 2025-11-15 01:05:22 +01:00
Dan Balasescu b71f522dfe
Merge pull request #254 from ppy/update-native-binaries
Update native binaries
2025-09-20 09:02:44 +09:00
smoogipoo 9601d75096 Update native binaries 2025-09-19 23:59:51 +00:00
Dan Balasescu 83d7db12b8
Merge pull request #253 from Susko3/fix-ANDROID_PLATFORM
Target API 21 in Android builds to fix them not working on older versions
2025-09-20 08:48:41 +09:00
Dan Balasescu dbbd262631
Merge pull request #252 from Susko3/fix-win-x86
Fix libflac build by using windows-2022 for x86
2025-09-20 08:44:02 +09:00
Susko3 d942aece9e Add explanatory comment about the android API 24 change to SDL_mixer 2025-09-19 16:32:52 +02:00
Susko3 240d008900 Only build SDL_mixer for API 24 2025-09-19 16:10:55 +02:00
Susko3 9f1c305ab2 Fix libflac build by using windows-2022 2025-09-19 15:56:49 +02:00
Susko3 fb36b24faf Target API 24 to fix 32-bit Android builds
32-bit (x86, arm) builds are failing because libFLAC and opusfile are using
fseeko, ftello, etc. which were added in API 24.
Why 64-bit builds are not failing is beyond me.
2025-09-19 15:37:46 +02:00
Susko3 5096d33d1b Always build SDL3 libs with Android 5.0 (API 21) min version 2025-09-19 14:40:08 +02:00
Dean Herbert 2fe9cb8ed5
Merge pull request #251 from smoogipoo/sdl-mixer-flac
Update bindings + re-enable libFLAC support in SDL_mixer
2025-09-11 13:50:00 +09:00
Dan Balasescu 4f817f6bce
Re-enable libFLAC 2025-09-11 09:32:47 +09:00
Dan Balasescu 2d7d0ddecc
Regenerate bindings 2025-09-11 09:13:38 +09:00
Dan Balasescu 565ba9fe41
Update submodules 2025-09-11 09:13:08 +09:00
Dan Balasescu fdd9cef146
Merge pull request #249 from Susko3/add-ci-build-workflow
Add CI build workflow
2025-08-31 08:02:59 +09:00
Susko3 95010b0846 Add envvar CI_DONT_TARGET_ANDROID=1 to fix CI build without android workload 2025-08-30 23:14:43 +02:00
Susko3 db3993e71b Fix build failing if SDL is not cloned 2025-08-30 23:14:43 +02:00
Susko3 c42876e0ee Add simple CI workflow that builds all platforms 2025-08-30 23:14:37 +02:00
Dan Balasescu 16c954ebc2
Merge pull request #248 from Susko3/fix-bindings
Fix bindings not compiling
2025-08-28 21:09:42 +09:00
Susko3 a4781c9b58 Fix bindings not compiling 2025-08-28 14:07:13 +02:00
Susko3 e2ead20a3d
Merge pull request #247 from ppy/update-native-binaries
Update native binaries
2025-08-28 14:04:50 +02:00
smoogipoo e7bbd4461d Update native binaries 2025-08-28 11:57:01 +00:00
Dan Balasescu ecd3c1d004
Merge pull request #246 from Susko3/update-bindings
Update bindings with fix for startup crash on Android
2025-08-28 20:43:21 +09:00
Susko3 b59358dbf5 Update bindings 2025-08-28 13:37:09 +02:00
Dan Balasescu ab2f57804c
Merge pull request #245 from smoogipoo/add-package-tags
Add package tags
2025-08-26 08:50:04 +09:00
Dan Balasescu 579cf8b380
Add package tags 2025-08-26 08:49:04 +09:00
Dan Balasescu d230747cd1
Merge pull request #244 from ppy/update-native-binaries
Update native binaries
2025-08-26 08:41:00 +09:00
smoogipoo e865ccc395 Update native binaries 2025-08-25 23:37:49 +00:00
Dan Balasescu 4f19a14331
Merge pull request #243 from smoogipoo/update-bindings
Update bindings
2025-08-26 08:25:50 +09:00
Dan Balasescu e8a54c5506
Attempt to fix iOS build
Similar sort of fix applied to all of our other repositories.
2025-08-26 08:14:01 +09:00
Dan Balasescu 742ac35cbc
Update bindings 2025-08-26 07:57:26 +09:00
Susko3 f57452fd77
Merge pull request #241 from smoogipoo/improve-builds
Improve local builds
2025-08-17 16:57:17 +02:00
Dan Balasescu 98a962deef
Merge pull request #240 from smoogipoo/upgrade-ndk
Upgrade NDK to r28c
2025-08-17 23:33:44 +09:00
Dan Balasescu 7078b56bcc
Improve lib resolving for desktop project 2025-08-17 19:58:28 +09:00
Dan Balasescu a9ec26bcbd
Add SDL3_mixer to Desktop .slnf 2025-08-17 19:28:52 +09:00
Dan Balasescu 6fc5f872ed
Fix runtime crash due to missing AOT module 2025-08-17 19:27:36 +09:00
Dan Balasescu 11604347e1
Add other libraries to iOS build 2025-08-17 19:19:56 +09:00
Dan Balasescu 12d3f7a37f
Add SDL3_mixer to iOS .slnf 2025-08-17 17:57:52 +09:00
Dan Balasescu 9165d3b077
Shortcase Android library includes 2025-08-17 17:56:33 +09:00
Dan Balasescu 76b0b15d97
Add SDL3_mixer to Android .slnf 2025-08-17 17:56:22 +09:00
Dan Balasescu dab8abd1da
Upgrade NDK to r28c 2025-08-17 16:41:48 +09:00
Dan Balasescu 8afca73432
Merge pull request #239 from ppy/update-native-binaries
Update native binaries
2025-08-16 15:01:06 +09:00
Susko3 7258fc2aaf Update native binaries 2025-08-15 19:58:20 +00:00
Susko3 2e68c991fc
Merge pull request #238 from smoogipoo/fix-build
Fix build by disabling mpg123 and libflac
2025-08-15 21:42:32 +02:00
Susko3 9a9cc1576e Fix missing info in comment 2025-08-15 21:37:16 +02:00
Dan Balasescu 01def28739
Fix build by disabling mpg123 and libflac 2025-08-14 02:43:33 +09:00
Dan Balasescu 5a16446ded
Regenerate bindings 2025-08-14 02:28:02 +09:00
Dan Balasescu 454e23e98f
Update submodules 2025-08-14 02:28:02 +09:00
Susko3 c483a94aea
Merge pull request #236 from smoogipoo/update-bindings
Update bindings
2025-08-03 12:10:43 +02:00
Susko3 523649fd77 Write SDL_MIXER_VERSION_ATLEAST macro 2025-08-03 12:09:27 +02:00
Dan Balasescu f51f432541
Fix prefix 2025-08-03 00:14:47 +09:00
Dan Balasescu 6d367145ed
Update bindings 2025-08-03 00:03:07 +09:00
Dan Balasescu 8a9ec08e66
Merge pull request #234 from ppy/update-native-binaries
Update native binaries
2025-07-03 13:58:38 +09:00
Dan Balasescu 68b514a2bb
Fix iOS package paths 2025-07-03 13:50:39 +09:00
smoogipoo d94b725f97 Update native binaries 2025-07-03 04:23:29 +00:00
Dan Balasescu 76dcb21019
Fill in iOS support in README 2025-07-03 13:10:16 +09:00
Dan Balasescu 2fdd152592
Package SDL3 extension libs for iOS 2025-07-03 13:08:50 +09:00
Dan Balasescu 73b855b9ba
Merge pull request #233 from jairov4/build_libs_ios
Build the libraries SDL_image, SDL_ttf, SDL_mixer for iOS in CI
2025-07-03 13:06:40 +09:00
Dan Balasescu 18df50890a
Fix line endings 2025-07-03 13:04:26 +09:00
Dan Balasescu 2a51be187b
Merge pull request #232 from hwsmm/build-refactor
Build Android satellite libraries and refactor build script
2025-07-03 13:00:03 +09:00
hwsmm bde92020d7
Add SDL3_mixer in Android test library list 2025-06-29 22:03:21 +09:00
MINI\jairo 91b98d57a1 Remove a line not needed 2025-06-29 08:00:59 -05:00
hwsmm 4813f8dc59 Add satellite libraries to test, and simply test availability 2025-06-29 19:51:18 +09:00
hwsmm 1f60742d1b Add Android target for satellite libraries and include Android native libraries 2025-06-29 19:49:48 +09:00
hwsmm 71611c90ab Refactor build script and build satellite libraries for Android 2025-06-29 19:48:22 +09:00
Dan Balasescu d920afefe2
Merge pull request #231 from ppy/update-native-binaries
Update native binaries
2025-06-29 15:06:01 +09:00
smoogipoo 91e05b56fe Update native binaries 2025-06-29 06:03:19 +00:00
Dan Balasescu d76c671a48
Add `SDL_mixer` to readme 2025-06-29 14:57:12 +09:00
Dan Balasescu 4ced795244
Merge pull request #229 from jairov4/feature/sdl_mixer
Introduce SDL_mixer build
2025-06-29 14:43:40 +09:00
jairov4 d12cbe2dec Update native binaries
Build other libs for iOS

Build other libs for iOS

Build other libs for iOS

Fix typo in build for iOS

Use recursive for iOS build

Enable back other jobs

Enable back other jobs

Revert "Update native binaries"

This reverts commit 1c4b14cced6ec2cfd185fdc9996feb6746afde59.
2025-06-28 23:05:19 -05:00
MINI\jairo c7b853e9ce Handle Mix_ methods 2025-06-28 22:37:36 -05:00
MINI\jairo c202ba42ea Add CS generated files for SDL_mixer 2025-06-28 08:12:51 -05:00
MINI\jairo bb74b2cf57 Fix 32-bit versions for ARM and x86 2025-06-26 20:10:16 -05:00
MINI\jairo 8c63fd801f Fix 32-bit versions for ARM and x86 2025-06-26 20:03:11 -05:00
MINI\jairo a02671332d Fix 32-bit versions for ARM and x86 2025-06-26 19:12:36 -05:00
MINI\jairo 33023e7db5 Fix 32-bit versions for ARM and x86 2025-06-26 19:07:55 -05:00
MINI\jairo d68ff4dcdf Fix 32-bit versions for ARM and x86 2025-06-26 18:39:40 -05:00
MINI\jairo 742dec521a Fix doubious ownership error 2025-06-26 18:14:24 -05:00
MINI\jairo 7d094dc1c0 Introduce SDL_mixer build 2025-06-26 18:00:19 -05:00
Dean Herbert cdf3dc8f51
Merge pull request #227 from smoogipoo/private-jetbrains-annotatinos
Mark `JetBrains.Annotations` as private package
2025-06-25 15:46:31 +09:00
Dan Balasescu beecade72f
Mark `JetBrains.Annotations` as private package 2025-06-25 12:40:26 +09:00
Dan Balasescu 5bf8143c4a
Merge pull request #226 from Susko3/let-sdl-version-generate
Let SDL*_VERSION constants autogenerate
2025-06-24 18:37:15 +09:00
Susko3 7ad887b2a6 Let SDL*_VERSION autogenerate 2025-06-24 11:25:18 +02:00
Dan Balasescu a984a31341
Merge pull request #225 from Susko3/fix-unsafe-sdl-ttf
Fix `Unsafe_` method generation in SDL_ttf
2025-06-24 18:16:17 +09:00
Susko3 88efab5deb Fix `Unsafe_` method generation in SDL_ttf 2025-06-24 11:00:53 +02:00
Dan Balasescu bfa753159c
Merge pull request #224 from ppy/update-native-binaries
Update native binaries
2025-06-24 17:29:15 +09:00
smoogipoo bba374d541 Update native binaries 2025-06-24 08:19:56 +00:00
Dan Balasescu 17a6a1b74c
Merge pull request #223 from Susko3/update-bindings
Update bindings of all SDL3 libraries
2025-06-24 17:13:07 +09:00
Dan Balasescu 424a42fcff
Merge pull request #221 from Susko3/add-missing-enum-macro
Add missing enum typedefs and macros
2025-06-24 17:10:55 +09:00
Dean Herbert dc1e1a10af
Merge pull request #222 from Susko3/fix-line-endings-in-g.cs
Fix checked out line endings in `*.g.cs` files
2025-06-24 16:58:03 +09:00
Susko3 1c1dbaa8cd Fix SDL_image tests not compiling 2025-06-23 23:13:18 +02:00
Susko3 9b834790d4 Update bindings of SDL3 libraries
This brings SDL_image and SDL_ttf up-to-date.
2025-06-23 23:07:46 +02:00
Susko3 f9345ed38a Fix checkout line endings in .g.cs files
ClangSharp will always generate files with LF, but the --headerFile is copied as-is.
This resulted in files with CR LF and LF line endings, confusing git which would always
report changes in line endings.

This is fixed by checking out *.g.cs and the license headers fed into ClangSharp with LF.

The files have always beeen normalised to LF endings on commit, so this change is not visible in git.
2025-06-23 22:41:40 +02:00
Susko3 d93df5517f Add missing macros for version checks 2025-06-23 22:15:01 +02:00
Susko3 0d8e49ef64 Add missing enum typedef in SDL_ttf 2025-06-23 22:15:01 +02:00
Susko3 b7ca494978 Fix underlying enum types 2025-06-23 22:15:01 +02:00
Dan Balasescu dddb17d34d
Merge pull request #217 from Susko3/rework-sdl-interface
Rework SDL_INIT_INTERFACE and add missing interfaces
2025-06-23 22:27:15 +09:00
Dan Balasescu 90ce8877df
Merge pull request #219 from Susko3/add-simple-image-ttf-tests
Add simple tests for SDL_image and SDL_ttf
2025-06-23 22:12:29 +09:00
Dan Balasescu 5d7ad9a1b8
Init SDL too 2025-06-23 22:10:36 +09:00
Susko3 28951012e3 Add simple tests for SDL_image and SDL_ttf 2025-06-22 14:30:20 +02:00
Susko3 bb247fa952 Rework SDL_INIT_INTERFACE and add missing interfaces 2025-06-22 01:39:15 +02:00
Dan Balasescu 9dd8657b8f
Merge pull request #216 from ppy/update-native-binaries
Update native binaries
2025-06-21 01:01:55 +09:00
smoogipoo 24c8b21804 Update native binaries 2025-06-20 15:54:55 +00:00
Dan Balasescu e7f0df7e8b
Merge pull request #215 from hwsmm/static-deps
Build SDL_image/ttf dependencies statically
2025-06-21 00:47:45 +09:00
Dean Herbert f632aa0fdd
Merge pull request #214 from smoogipoo/improve-readme
Add packages + platforms to README, general rewordings & improvements
2025-06-20 19:42:43 +09:00
hwsmm 7878370bab No longer packs dependencies of SDL_image 2025-06-20 18:45:56 +09:00
hwsmm 63e3724920 Remove unneeded binaries 2025-06-20 18:45:40 +09:00
hwsmm 3a3633b96d Fix typo 2025-06-20 18:21:10 +09:00
hwsmm 1d059287f5 Try building dependencies statically 2025-06-20 18:10:19 +09:00
Dan Balasescu 9c587389c2
Add condensed readme to package 2025-06-20 03:33:57 +09:00
Dan Balasescu efe88bd6c0
Remove package name from badges 2025-06-20 03:25:42 +09:00
Dan Balasescu 8172ba94e1
Add CLI usage string 2025-06-20 03:20:01 +09:00
Dan Balasescu 5e4097b1fe
Add packages + platforms to README, general improvements 2025-06-20 03:11:24 +09:00
Dan Balasescu 66fc81f489
Pack individual projects to remove workload requirement
Can't really install iOS workload on Linux, iirc.
2025-06-20 01:19:26 +09:00
Dan Balasescu 59a1369175
Merge pull request #211 from ppy/update-native-binaries
Update native binaries
2025-06-20 01:09:25 +09:00
smoogipoo c92afe97ac Update native binaries 2025-06-19 16:07:49 +00:00
Dan Balasescu ac2e352e81
Merge pull request #179 from WizzardMaker/feature/sdl-libs
Adds support for sdl_image and sdl_ttf (also other libs)
2025-06-20 01:01:30 +09:00
Dan Balasescu 225ae22e6b
Merge remote-tracking branch 'jairov4/feature/sdl-libs' into feature/sdl-libs 2025-06-20 00:46:52 +09:00
Dan Balasescu 32b5f88a5e
Adjust deploy script to build all packages 2025-06-20 00:45:54 +09:00
Dan Balasescu c563ecc3be
Mark test projects as non-packable 2025-06-20 00:38:43 +09:00
Dan Balasescu b0260c0d31
Exclude iOS/Android libs from package 2025-06-20 00:32:12 +09:00
MINI\jairo 63df878dec Fix build for macos intel 2025-06-19 09:30:43 -05:00
MINI\jairo 477bd7da13 Fix dubious ownership in repository when running in container 2025-06-19 08:27:07 -05:00
MINI\jairo 3471b34007 Fix dubious ownership in repository when running in container 2025-06-19 08:15:50 -05:00
MINI\jairo b8f0998d8c Fix path for CMAKE_PREFIX_PATH in different archs 2025-06-19 07:46:22 -05:00
MINI\jairo 06fdeb01b3 Fix path for CMAKE_PREFIX_PATH in different archs 2025-06-19 07:42:09 -05:00
MINI\jairo 5b535590d5 Fix path for CMAKE_PREFIX_PATH in different archs 2025-06-19 07:37:52 -05:00
MINI\jairo f5dcc15710 Fix path for CMAKE_PREFIX_PATH in different archs 2025-06-19 07:29:52 -05:00
MINI\jairo 49da8cf519 Fix path for copying DLLs of SDL3_ttf 2025-06-19 07:18:45 -05:00
MINI\jairo 318c2d8527 Fix path for copying DLLs of SDL3_ttf 2025-06-19 07:18:20 -05:00
MINI\jairo 1616f6056c Fix fetch submodule recursively for libtiff 2025-06-19 07:08:49 -05:00
Dan Balasescu 7124e530e1
Merge branch 'master' into feature/sdl-libs 2025-05-20 15:20:06 +09:00
Dan Balasescu b3dec6b80c
Refactor source generator a bit 2024-12-09 10:51:26 +09:00
Dan Balasescu 53a87f4a74
Fix SDL3-CS iOS native include 2024-12-09 10:42:27 +09:00
Dan Balasescu 491a9bceae
Adjust SDL3-CS references 2024-12-09 10:38:11 +09:00
Dan Balasescu 8e928a4f2e
Fix filtered solutions 2024-12-09 10:31:25 +09:00
WizzardMaker 06fabcf8b0 added enums to ttf and image 2024-12-03 15:44:40 +01:00
WizzardMaker 957e29d137 updated SDL build script to build ttf and image 2024-12-03 15:44:40 +01:00
WizzardMaker 52c2c1b31e split up sdl libraries into separate projects 2024-12-03 15:44:40 +01:00
WizzardMaker af476b4cc4 added sister projects to visible internals in SDL3-CS 2024-12-03 15:44:40 +01:00
WizzardMaker 1e78619716 updated c# source generator to also take other SDL methods into account 2024-12-03 15:44:40 +01:00
WizzardMaker 5b0abdca7c added sdl_image and sdl_ttf 2024-12-03 15:44:40 +01:00
150 changed files with 3578 additions and 294 deletions

6
.gitattributes vendored
View File

@ -22,4 +22,8 @@ App.config text eol=crlf
.gitignore text eol=lf
.gitattributes text eol=lf
*.md text eol=lf
.travis.yml text eol=lf
.travis.yml text eol=lf
# Use lf for files used by ClangSharpPInvokeGenerator
*-license-header.txt text eol=lf
*.g.cs text eol=lf

View File

@ -5,6 +5,8 @@ on:
# - cron: '0 0 * * *'
env:
BUILD_TYPE: Release
NDK_VER: 28.2.13676358
PLATFORM_VER: 35
jobs:
build:
@ -15,19 +17,40 @@ jobs:
matrix:
platform:
- { name: win-x64, os: windows-latest, flags: -A x64 }
- { name: win-x86, os: windows-latest, flags: -A Win32 }
- { name: win-x86, os: windows-2022, flags: -A Win32 }
- { name: win-arm64, os: windows-latest, flags: -A ARM64 }
- { name: linux-x64, os: ubuntu-22.04, flags: -GNinja, target_apt_arch: ":amd64" }
- { name: linux-x86, os: ubuntu-22.04, flags: -GNinja -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32", target_apt_arch: ":i386" }
- { name: linux-x86, os: ubuntu-22.04, flags: -GNinja -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DWAVPACK_ENABLE_ASM=OFF, target_apt_arch: ":i386" }
- { name: linux-arm64, os: ubuntu-22.04-arm, flags: -GNinja, target_apt_arch: ":arm64", container: "arm64v8/ubuntu:22.04" }
- { name: linux-arm, os: ubuntu-22.04-arm, flags: -GNinja, target_apt_arch: ":armhf", container: "arm32v7/ubuntu:22.04" }
- { name: osx-x64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 }
- { name: linux-arm, os: ubuntu-22.04-arm, flags: -GNinja -DCMAKE_C_FLAGS=-mfpu=neon -DCMAKE_CXX_FLAGS=-mfpu=neon, target_apt_arch: ":armhf", container: "arm32v7/ubuntu:22.04" }
- { name: osx-x64, os: macos-13, flags: -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 }
# NOTE: macOS 11.0 is the first released supported by Apple Silicon.
- { name: osx-arm64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 }
- { name: android-arm64, os: ubuntu-22.04, flags: -GNinja, abi: arm64-v8a }
- { name: android-arm, os: ubuntu-22.04, flags: -GNinja, abi: armeabi-v7a }
- { name: android-x64, os: ubuntu-22.04, flags: -GNinja, abi: x86_64 }
- { name: android-x86, os: ubuntu-22.04, flags: -GNinja, abi: x86 }
steps:
- uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Setup JDK
if: contains(matrix.platform.name, 'android')
uses: actions/setup-java@v4
with:
distribution: microsoft
java-version: 17
- name: Install Android SDK Manager
if: contains(matrix.platform.name, 'android')
uses: android-actions/setup-android@v3
- name: Install Android SDK
if: contains(matrix.platform.name, 'android')
run: |
sdkmanager --install "platforms;android-$PLATFORM_VER"
sdkmanager --install "ndk;$NDK_VER"
- name: Build (Linux ARM)
if: contains(matrix.platform.container, 'arm')
@ -39,11 +62,10 @@ jobs:
-e NAME=${{ matrix.platform.name }}
-e TARGET_APT_ARCH=${{ matrix.platform.target_apt_arch }}
-e RUNNER_OS=${{ runner.os }}
-e FLAGS=${{ matrix.platform.flags }}
-e BUILD_TYPE=${{ env.BUILD_TYPE }}
run: |
cd /workspace
./External/build.sh
FLAGS="${{ matrix.platform.flags }}" ./External/build.sh
- name: Build
if: ${{ !contains(matrix.platform.container, 'arm') }}
@ -53,6 +75,7 @@ jobs:
TARGET_APT_ARCH: ${{ matrix.platform.target_apt_arch }}
RUNNER_OS: ${{ runner.os }}
FLAGS: ${{ matrix.platform.flags }}
ANDROID_ABI: ${{ matrix.platform.abi }}
run: ./External/build.sh
- name: Get Actions user id
@ -67,7 +90,12 @@ jobs:
user_id: ${{ steps.get_uid.outputs.uid }}
- name: Compress native directory
run: tar -cf native-${{ matrix.platform.name }}.tar native/${{ matrix.platform.name }}
if: ${{ !contains(matrix.platform.name, 'android') }}
run: tar -cvf native-${{ matrix.platform.name }}.tar native/${{ matrix.platform.name }}
- name: Compress native directory (Android)
if: contains(matrix.platform.name, 'android')
run: tar -cvf native-${{ matrix.platform.name }}.tar native/android/${{ matrix.platform.abi }}
- name: Upload native artifact
uses: actions/upload-artifact@v4
@ -78,30 +106,46 @@ jobs:
build-ios:
name: ios
runs-on: macos-latest
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
# https://github.com/dotnet/macios/issues/19157
# https://github.com/actions/runner-images/issues/12758
- name: Use Xcode 16.4
run: sudo xcode-select -switch /Applications/Xcode_16.4.app
- name: Build (iOS)
run: xcodebuild -project External/SDL/Xcode/SDL/SDL.xcodeproj -target SDL3.xcframework -configuration Release
- name: Prepare release directory (iOS)
run: mkdir -p native/ios
- name: Prepare release (iOS)
run: |
mkdir -p native/ios/SDL3.xcframework/ios-arm64/SDL3.framework;
mkdir -p native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework;
cp External/SDL/Xcode/SDL/build/SDL3.xcframework/Info.plist native/ios/SDL3.xcframework/Info.plist;
cp External/SDL/Xcode/SDL/build/SDL3.xcframework/ios-arm64/SDL3.framework/SDL3 native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/SDL3;
cp External/SDL/Xcode/SDL/build/SDL3.xcframework/ios-arm64/SDL3.framework/Info.plist native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/Info.plist;
cp External/SDL/Xcode/SDL/build/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/SDL3 native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/SDL3;
cp External/SDL/Xcode/SDL/build/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/Info.plist native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/Info.plist;
modules=("SDL3" "SDL3_image" "SDL3_ttf" "SDL3_mixer")
architectures=("ios-arm64" "ios-arm64_x86_64-simulator")
for module in "${modules[@]}"; do
module0="${module/SDL3/SDL}"
directory="External/${module0}/Xcode"
if [ "$module" == "SDL3" ]; then
directory+="/SDL"
fi
target="${module}.xcframework"
framework="${module}.framework"
output_dir="native/ios/${target}"
xcodebuild -project "${directory}/${module0}.xcodeproj" -target "${target}" -configuration Release
build_dir="${directory}/build/${target}"
for arch in "${architectures[@]}"; do
mkdir -p "${output_dir}/${arch}/${framework}"
cp "${build_dir}/${arch}/${framework}/${module}" "${output_dir}/${arch}/${framework}/${module}"
cp "${build_dir}/${arch}/${framework}/Info.plist" "${output_dir}/${arch}/${framework}/Info.plist"
done
cp "${build_dir}/Info.plist" "${output_dir}/Info.plist"
done
- name: Compress native directory
run: tar -cf native-ios.tar native/ios
run: tar -cvf native-ios.tar native/ios
- name: Upload native artifact
uses: actions/upload-artifact@v4
@ -110,12 +154,9 @@ jobs:
path: native-ios.tar
if-no-files-found: error
build-android:
name: android
build-android-jar:
name: android-jar
runs-on: ubuntu-22.04
env:
NDK_VER: 23.1.7779620
PLATFORM_VER: android-34
steps:
- uses: actions/checkout@v4
with:
@ -131,22 +172,10 @@ jobs:
- name: Install Android SDK Manager
uses: android-actions/setup-android@v3
with:
packages: ''
- name: Install Android SDK
run: |
sdkmanager --install "platform-tools" "platforms;$PLATFORM_VER"
sdkmanager --install "ndk;$NDK_VER" --channel=3
- name: Build (Android)
run: |
export PATH=$ANDROID_HOME/ndk/$NDK_VER:$PATH
export OUTPUT=$PWD/native/android
rm -rf $OUTPUT && mkdir -p $OUTPUT
# Build SDL3
./External/SDL/build-scripts/androidbuildlibs.sh APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" NDK_LIBS_OUT="$OUTPUT"
sdkmanager --install "platforms;android-$PLATFORM_VER"
- name: Build SDL3 Android Java
run: |
@ -157,19 +186,9 @@ jobs:
# Build SDL3 Android Java part
cd ./External/SDL/android-project/app/src/main/java
javac -cp $ANDROID_HOME/platforms/$PLATFORM_VER/android.jar -encoding utf8 org/libsdl/app/*.java
javac -cp $ANDROID_HOME/platforms/android-$PLATFORM_VER/android.jar -encoding utf8 org/libsdl/app/*.java
jar cvf $OUTPUT/SDL3AndroidBridge.jar org/libsdl/app/*.class
- name: Compress native directory
run: tar -cf native-android.tar native/android
- name: Upload native artifact
uses: actions/upload-artifact@v4
with:
name: native-android
path: native-android.tar
if-no-files-found: error
- name: Upload JAR artifact
uses: actions/upload-artifact@v4
with:
@ -180,7 +199,7 @@ jobs:
make-pr:
name: Submit pull request
runs-on: ubuntu-latest
needs: [ build, build-ios, build-android ]
needs: [ build, build-ios, build-android-jar ]
steps:
- uses: actions/checkout@v4

79
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,79 @@
name: Continuous Integration
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build-only-desktop:
name: Build only (Desktop)
runs-on: ubuntu-latest
timeout-minutes: 60
env:
CI_DONT_TARGET_ANDROID: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Build
run: dotnet build -c Debug SDL3-CS.Desktop.slnf
build-only-android:
name: Build only (Android)
runs-on: windows-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JDK 11
uses: actions/setup-java@v4
with:
distribution: microsoft
java-version: 11
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Install .NET workloads
run: dotnet workload install android
- name: Build
run: dotnet build -c Debug SDL3-CS.Android.slnf
build-only-ios:
name: Build only (iOS)
runs-on: macos-15
timeout-minutes: 60
env:
CI_DONT_TARGET_ANDROID: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Install .NET Workloads
run: dotnet workload install ios
# https://github.com/dotnet/macios/issues/19157
# https://github.com/actions/runner-images/issues/12758
- name: Use Xcode 16.4
run: sudo xcode-select -switch /Applications/Xcode_16.4.app
- name: Build
run: dotnet build -c Debug SDL3-CS.iOS.slnf

View File

@ -26,16 +26,20 @@ jobs:
uses: android-actions/setup-android@v3
- name: Install .NET workloads
run: dotnet workload restore SDL3-CS/SDL3-CS.csproj
run: dotnet workload restore
- 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) -o artifacts
dotnet pack SDL3_image-CS/SDL3_image-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts
dotnet pack SDL3_ttf-CS/SDL3_ttf-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts
dotnet pack SDL3_mixer-CS/SDL3_mixer-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: SDL3-CS
path: SDL3-CS/bin/Release/ppy.*.nupkg
name: Packages
path: artifacts/ppy.*.nupkg
- 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 artifacts/ppy.*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}}

2
.gitignore vendored
View File

@ -338,3 +338,5 @@ inspectcodereport.xml
inspectcode
sdl.json
install_output/

12
.gitmodules vendored
View File

@ -1,3 +1,15 @@
[submodule "SDL"]
path = External/SDL
url = https://github.com/libsdl-org/SDL
[submodule "SDL_image"]
path = External/SDL_image
url = https://github.com/libsdl-org/SDL_image.git
branch = main
[submodule "SDL_ttf"]
path = External/SDL_ttf
url = https://github.com/libsdl-org/SDL_ttf.git
branch = main
[submodule "SDL_mixer"]
path = External/SDL_mixer
url = https://github.com/libsdl-org/SDL_mixer.git
branch = main

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>

8
External/.idea/indexLayout.xml vendored Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</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 7dd5e765df239986f78c9b0016e3f3023d885084
Subproject commit 8e644111c2220e654f53de4ea0aa3afdfc7813c5

1
External/SDL_image vendored Submodule

@ -0,0 +1 @@
Subproject commit 13ec6e9be1d69d2a989ec1fc4f09e8743ef3932d

1
External/SDL_mixer vendored Submodule

@ -0,0 +1 @@
Subproject commit 7d6e46ad28cc33ad1e87a46df739a7cba47f57fa

1
External/SDL_ttf vendored Submodule

@ -0,0 +1 @@
Subproject commit d929bc0d84bfaf3a71ec7f6be27aeb466380c1a0

229
External/build.sh vendored
View File

@ -5,93 +5,182 @@ set -e
pushd "$(dirname "$0")"
# Check if environment variables are defined
if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then
if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS || -z $BUILD_TYPE ]]; then
echo "One or more required environment variables are not defined."
exit 1
fi
SUDO=$(which sudo || exit 0)
if [[ $RUNNER_OS == 'Windows' ]]; then
SUDO=""
else
SUDO=$(which sudo || exit 0)
fi
if [[ -n $ANDROID_ABI ]]; then
BUILD_PLATFORM="Android"
else
BUILD_PLATFORM="$RUNNER_OS"
fi
export DEBIAN_FRONTEND=noninteractive
if [[ $RUNNER_OS == 'Linux' ]]; then
# Setup Linux dependencies
if [[ $TARGET_APT_ARCH == :i386 ]]; then
$SUDO dpkg --add-architecture i386
if [[ $BUILD_PLATFORM != 'Android' ]]; then
NATIVE_PATH="$NAME"
if [[ $BUILD_PLATFORM == 'Linux' ]]; then
# Setup Linux dependencies
if [[ $TARGET_APT_ARCH == :i386 ]]; then
$SUDO dpkg --add-architecture i386
fi
$SUDO apt-get update -y -qq
if [[ $NAME != 'linux-x86' && $NAME != 'linux-x64' ]]; then
GCC="gcc"
GPP="g++"
else
GCC="gcc-multilib"
GPP="g++-multilib"
fi
$SUDO apt-get install -y \
$GCC \
$GPP \
git \
cmake \
ninja-build \
wayland-scanner++ \
wayland-protocols \
meson \
pkg-config$TARGET_APT_ARCH \
libasound2-dev$TARGET_APT_ARCH \
libdbus-1-dev$TARGET_APT_ARCH \
libegl1-mesa-dev$TARGET_APT_ARCH \
libgl1-mesa-dev$TARGET_APT_ARCH \
libgles2-mesa-dev$TARGET_APT_ARCH \
libglu1-mesa-dev$TARGET_APT_ARCH \
libgtk-3-dev$TARGET_APT_ARCH \
libibus-1.0-dev$TARGET_APT_ARCH \
libpango1.0-dev$TARGET_APT_ARCH \
libpulse-dev$TARGET_APT_ARCH \
libsndio-dev$TARGET_APT_ARCH \
libudev-dev$TARGET_APT_ARCH \
libwayland-dev$TARGET_APT_ARCH \
libx11-dev$TARGET_APT_ARCH \
libxcursor-dev$TARGET_APT_ARCH \
libxext-dev$TARGET_APT_ARCH \
libxi-dev$TARGET_APT_ARCH \
libxinerama-dev$TARGET_APT_ARCH \
libxkbcommon-dev$TARGET_APT_ARCH \
libxrandr-dev$TARGET_APT_ARCH \
libxss-dev$TARGET_APT_ARCH \
libxt-dev$TARGET_APT_ARCH \
libxv-dev$TARGET_APT_ARCH \
libxxf86vm-dev$TARGET_APT_ARCH \
libdrm-dev$TARGET_APT_ARCH \
libgbm-dev$TARGET_APT_ARCH \
libpulse-dev$TARGET_APT_ARCH \
libpipewire-0.3-dev$TARGET_APT_ARCH \
libdecor-0-dev$TARGET_APT_ARCH
fi
else
if [[ -z $ANDROID_HOME || -z $NDK_VER || -z $ANDROID_ABI ]]; then
echo "One or more required environment variables are not defined."
exit 1
fi
$SUDO apt-get update -y -qq
NATIVE_PATH="android/$ANDROID_ABI"
if [[ $NAME != 'linux-x86' && $NAME != 'linux-x64' ]]; then
GCC="gcc"
GPP="g++"
else
GCC="gcc-multilib"
GPP="g++-multilib"
fi
export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/$NDK_VER"
export FLAGS="$FLAGS -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
-DANDROID_HOME=$ANDROID_HOME \
-DANDROID_PLATFORM=21 \
-DANDROID_ABI=$ANDROID_ABI \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH \
-DCMAKE_INSTALL_INCLUDEDIR=include \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_DATAROOTDIR=share \
-DSDL_ANDROID_JAR=OFF"
$SUDO apt-get install -y \
$GCC \
$GPP \
git \
cmake \
ninja-build \
wayland-scanner++ \
wayland-protocols \
meson \
pkg-config$TARGET_APT_ARCH \
libasound2-dev$TARGET_APT_ARCH \
libdbus-1-dev$TARGET_APT_ARCH \
libegl1-mesa-dev$TARGET_APT_ARCH \
libgl1-mesa-dev$TARGET_APT_ARCH \
libgles2-mesa-dev$TARGET_APT_ARCH \
libglu1-mesa-dev$TARGET_APT_ARCH \
libgtk-3-dev$TARGET_APT_ARCH \
libibus-1.0-dev$TARGET_APT_ARCH \
libpango1.0-dev$TARGET_APT_ARCH \
libpulse-dev$TARGET_APT_ARCH \
libsndio-dev$TARGET_APT_ARCH \
libudev-dev$TARGET_APT_ARCH \
libwayland-dev$TARGET_APT_ARCH \
libx11-dev$TARGET_APT_ARCH \
libxcursor-dev$TARGET_APT_ARCH \
libxext-dev$TARGET_APT_ARCH \
libxi-dev$TARGET_APT_ARCH \
libxinerama-dev$TARGET_APT_ARCH \
libxkbcommon-dev$TARGET_APT_ARCH \
libxrandr-dev$TARGET_APT_ARCH \
libxss-dev$TARGET_APT_ARCH \
libxt-dev$TARGET_APT_ARCH \
libxv-dev$TARGET_APT_ARCH \
libxxf86vm-dev$TARGET_APT_ARCH \
libdrm-dev$TARGET_APT_ARCH \
libgbm-dev$TARGET_APT_ARCH \
libpulse-dev$TARGET_APT_ARCH \
libpipewire-0.3-dev$TARGET_APT_ARCH \
libdecor-0-dev$TARGET_APT_ARCH
git \
cmake \
ninja-build \
meson
fi
# Build SDL
pushd SDL
git reset --hard HEAD || echo "Failed to clean up the repository"
if [[ $RUNNER_OS == 'Windows' ]]; then
echo "Patching SDL to not include gameinput.h"
sed -i 's/#include <gameinput.h>/#_include <gameinput.h>/g' CMakeLists.txt
if [[ $RUNNER_OS == 'Linux' ]]; then
git config --global --add safe.directory $PWD/SDL
git config --global --add safe.directory $PWD/SDL_image
git config --global --add safe.directory $PWD/SDL_ttf
git config --global --add safe.directory $PWD/SDL_mixer
fi
cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON
cmake --build build/ --config Release
$SUDO cmake --install build/ --prefix install_output --config Release
popd
CMAKE_INSTALL_PREFIX="$PWD/install_output"
rm -rf $CMAKE_INSTALL_PREFIX
# Move build lib into correct folders
if [[ $RUNNER_OS == 'Windows' ]]; then
cp SDL/install_output/bin/SDL3.dll ../native/$NAME/SDL3.dll
elif [[ $RUNNER_OS == 'Linux' ]]; then
cp SDL/install_output/lib/libSDL3.so ../native/$NAME/libSDL3.so
elif [[ $RUNNER_OS == 'macOS' ]]; then
cp SDL/install_output/lib/libSDL3.dylib ../native/$NAME/libSDL3.dylib
if [[ $BUILD_PLATFORM == 'Android' ]]; then
OUTPUT_LIB="lib/libSDL3variant.so"
elif [[ $BUILD_PLATFORM == 'Windows' ]]; then
OUTPUT_LIB="bin/SDL3variant.dll"
elif [[ $BUILD_PLATFORM == 'Linux' ]]; then
OUTPUT_LIB="lib/libSDL3variant.so"
elif [[ $BUILD_PLATFORM == 'macOS' ]]; then
OUTPUT_LIB="lib/libSDL3variant.dylib"
fi
# Use the correct CMAKE_PREFIX_PATH for SDL_image and SDL_ttf, probably due differences in Cmake versions.
if [[ $BUILD_PLATFORM == 'Android' ]]; then
CMAKE_PREFIX_PATH="$CMAKE_INSTALL_PREFIX"
elif [[ $BUILD_PLATFORM == 'Windows' ]]; then
CMAKE_PREFIX_PATH="$CMAKE_INSTALL_PREFIX/cmake/"
elif [[ $BUILD_PLATFORM == 'Linux' ]]; then
CMAKE_PREFIX_PATH="$CMAKE_INSTALL_PREFIX/lib/cmake/"
elif [[ $BUILD_PLATFORM == 'macOS' ]]; then
CMAKE_PREFIX_PATH="$CMAKE_INSTALL_PREFIX/lib/cmake/"
fi
run_cmake() {
LIB_NAME=$1
LIB_OUTPUT=$2
pushd $LIB_NAME
git reset --hard HEAD || echo "Failed to clean up the repository"
if [[ $BUILD_PLATFORM == 'Windows' && $LIB_NAME == 'SDL' ]]; then
echo "Patching SDL to not include gameinput.h"
sed -i 's/#include <gameinput.h>/#_include <gameinput.h>/g' CMakeLists.txt
fi
# Change the minumum Android API level for SDL_mixer to API 24 as opusfile and libflac fail to build on lower versions.
if [[ $BUILD_PLATFORM == 'Android' && $LIB_NAME == 'SDL_mixer' ]]; then
export FLAGS="${FLAGS/-DANDROID_PLATFORM=21/-DANDROID_PLATFORM=24}"
fi
rm -rf build
cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED=ON -DSDL_STATIC=OFF "${@:3}"
cmake --build build/ --config $BUILD_TYPE --verbose
cmake --install build/ --prefix $CMAKE_INSTALL_PREFIX --config $BUILD_TYPE
# Move build lib into correct folders
cp $CMAKE_INSTALL_PREFIX/$LIB_OUTPUT ../../native/$NATIVE_PATH
popd
}
run_cmake SDL ${OUTPUT_LIB/variant/}
run_cmake SDL_ttf ${OUTPUT_LIB/variant/_ttf} -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DSDLTTF_VENDORED=ON
# -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)
run_cmake SDL_image ${OUTPUT_LIB/variant/_image} -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DSDLIMAGE_AVIF=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_VENDORED=ON
# -DSDLMIXER_MP3_MPG123=OFF is used because upstream build is broken. Fallback to dr_mp3.
# See: https://github.com/libsdl-org/SDL_mixer/pull/744#issuecomment-3180682130
# Fixing using the proposed solution causes more issues.
run_cmake SDL_mixer ${OUTPUT_LIB/variant/_mixer} -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DSDLMIXER_MP3_MPG123=OFF -DSDLMIXER_DEPS_SHARED=OFF -DSDLMIXER_VENDORED=ON
popd

View File

@ -1,16 +1,28 @@
# SDL3-CS
SDL3-CS is [SDL3](https://github.com/libsdl-org/SDL) bindings, developed for internal use and available publicly on [NuGet.org](https://www.nuget.org/packages/ppy.SDL3-CS).
C# bindings for the [SDL3](https://github.com/libsdl-org/SDL) family of libraries.
## About
| Product | Usage | Package |
|------------------------------------------------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| [`SDL`](https://github.com/libsdl-org/SDL/tree/main) | `dotnet add package ppy.SDL3-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3-CS) |
| [`SDL_image`](https://github.com/libsdl-org/SDL_image/tree/main) | `dotnet add package ppy.SDL3_image-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_image-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_image-CS) |
| [`SDL_ttf`](https://github.com/libsdl-org/SDL_ttf/tree/main) | `dotnet add package ppy.SDL3_ttf-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_ttf-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_ttf-CS) |
| [`SDL_mixer`](https://github.com/libsdl-org/SDL_mixer/tree/main) | `dotnet add package ppy.SDL3_mixer-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_mixer-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_mixer-CS) |
The library is functional and available for public use. While it is actively maintained, updates are primarily driven by our internal needs. Please set your expectations accordingly when using or adapting SDL3-CS in your own projects.
Contributions to keep the bindings up-to-date with upstream 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.
## Platform support
## Generating Bindings
| Product | `win-x64` | `win-x86` | `win-arm64` | `osx-arm64` | `osx-x64` | `linux-x64` | `linux-x86` | `linux-arm64` | `linux-arm` | `ios` | `android` |
|-----------------|-----------|-----------|-------------|-------------|-----------|-------------|-------------|---------------|-------------|---------|-----------|
| `SDL3-CS` | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; |
| `SDL3_image-CS` | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; |
| `SDL3_ttf-CS` | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; |
| `SDL3_mixer-CS` | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | API 24+ |
Bindings should be generated via the provided Dockerfile:
## Generating bindings
Bindings are generated via the provided Dockerfile:
```sh
docker build -t 'sdl-gen' .

19
README_nuget.md Normal file
View File

@ -0,0 +1,19 @@
C# bindings for the [SDL3](https://github.com/libsdl-org/SDL) family of libraries.
| Product | Usage | Package |
|------------------------------------------------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| [`SDL`](https://github.com/libsdl-org/SDL/tree/main) | `dotnet add package ppy.SDL3-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3-CS) |
| [`SDL_image`](https://github.com/libsdl-org/SDL_image/tree/main) | `dotnet add package ppy.SDL3_image-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_image-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_image-CS) |
| [`SDL_ttf`](https://github.com/libsdl-org/SDL_ttf/tree/main) | `dotnet add package ppy.SDL3_ttf-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_ttf-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_ttf-CS) |
| [`SDL_mixer`](https://github.com/libsdl-org/SDL_mixer/tree/main) | `dotnet add package ppy.SDL3_mixer-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_mixer-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_mixer-CS) |
Contributions to keep the bindings up-to-date with upstream changes are welcome. If you have improvements or updates, feel free to submit a pull request.
## Platform support
| Product | `win-x64` | `win-x86` | `win-arm64` | `osx-arm64` | `osx-x64` | `linux-x64` | `linux-x86` | `linux-arm64` | `linux-arm` | `ios` | `android` |
|-----------------|-----------|-----------|-------------|-------------|-----------|-------------|-------------|---------------|-------------|---------|-----------|
| `SDL3-CS` | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; |
| `SDL3_image-CS` | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; |
| `SDL3_ttf-CS` | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; |
| `SDL3_mixer-CS` | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | &check; | API 24+ |

View File

@ -2,10 +2,13 @@
"solution": {
"path": "SDL3-CS.sln",
"projects": [
"SDL3-CS\\SDL3-CS.csproj",
"SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj",
"SDL3-CS.Tests.Android\\SDL3-CS.Tests.Android.csproj",
"SDL3-CS.Tests\\SDL3-CS.Tests.csproj",
"SDL3-CS.Tests.Android\\SDL3-CS.Tests.Android.csproj"
"SDL3-CS\\SDL3-CS.csproj",
"SDL3_image-CS\\SDL3_image-CS.csproj",
"SDL3_mixer-CS\\SDL3_mixer-CS.csproj",
"SDL3_ttf-CS\\SDL3_ttf-CS.csproj"
]
}
}
}

View File

@ -2,10 +2,13 @@
"solution": {
"path": "SDL3-CS.sln",
"projects": [
"SDL3-CS\\SDL3-CS.csproj",
"SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj",
"SDL3-CS.Tests.Desktop\\SDL3-CS.Tests.Desktop.csproj",
"SDL3-CS.Tests\\SDL3-CS.Tests.csproj",
"SDL3-CS.Tests.Desktop\\SDL3-CS.Tests.Desktop.csproj"
"SDL3-CS\\SDL3-CS.csproj",
"SDL3_image-CS\\SDL3_image-CS.csproj",
"SDL3_mixer-CS\\SDL3_mixer-CS.csproj",
"SDL3_ttf-CS\\SDL3_ttf-CS.csproj"
]
}
}
}

View File

@ -32,9 +32,14 @@ using System;
foreach (var kvp in finder.Methods)
{
if (kvp.Value.Count == 0)
return;
string filename = kvp.Key;
var foundMethods = kvp.Value;
string className = ClassNameFromMethod(foundMethods.First().NativeMethod);
var result = new StringBuilder();
result.Append(file_header);
result.Append(
@ -42,7 +47,7 @@ using System;
SyntaxFactory.IdentifierName("SDL"))
.WithMembers(
SyntaxFactory.SingletonList<MemberDeclarationSyntax>(
SyntaxFactory.ClassDeclaration("SDL3")
SyntaxFactory.ClassDeclaration(className)
.WithModifiers(
SyntaxFactory.TokenList(
SyntaxFactory.Token(SyntaxKind.UnsafeKeyword),
@ -54,6 +59,16 @@ using System;
}
}
private static string ClassNameFromMethod(MethodDeclarationSyntax methodNode)
{
if (methodNode.Parent is ClassDeclarationSyntax classDeclaration)
{
return classDeclaration.Identifier.Text;
}
return "SDL3"; // fallback!
}
private static MemberDeclarationSyntax makeFriendlyMethod(GeneratedMethod gm)
{
var returnType = gm.RequiredChanges.HasFlag(Changes.ChangeReturnTypeToString)
@ -126,7 +141,10 @@ using System;
if (gm.RequiredChanges.HasFlag(Changes.ChangeReturnTypeToString))
{
expr = SyntaxFactory.InvocationExpression(
SyntaxFactory.IdentifierName("PtrToStringUTF8"))
SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
SyntaxFactory.IdentifierName("SDL3"),
SyntaxFactory.IdentifierName("PtrToStringUTF8")))
.WithArguments(new[]
{
SyntaxFactory.Argument(makeFunctionCall(gm)),

View File

@ -15,14 +15,31 @@ namespace SDL.SourceGeneration
{
public readonly Dictionary<string, List<GeneratedMethod>> Methods = new Dictionary<string, List<GeneratedMethod>>();
private static readonly string[] sdlPrefixes = ["SDL_", "TTF_", "IMG_", "MIX_"];
/// <summary>
/// Checks whether the method is from any SDL library.
/// It identifies those by checking the SDL prefix in the method name.
/// </summary>
private static bool IsMethodFromSDL(MethodDeclarationSyntax methodNode)
{
foreach (string prefix in sdlPrefixes)
{
if (methodNode.Identifier.ValueText.StartsWith(prefix, StringComparison.Ordinal))
return true;
}
return false;
}
public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
{
if (syntaxNode is MethodDeclarationSyntax method)
{
string name = method.Identifier.ValueText;
bool isUnsafe = name.StartsWith($"{Helper.UnsafePrefix}SDL_", StringComparison.Ordinal);
bool isUnsafe = name.StartsWith(Helper.UnsafePrefix, StringComparison.Ordinal);
if (!name.StartsWith("SDL_", StringComparison.Ordinal) && !isUnsafe)
if (!IsMethodFromSDL(method) && !isUnsafe)
return;
if (method.ParameterList.Parameters.Any(p => p.Identifier.IsKind(SyntaxKind.ArgListKeyword)))

View File

@ -5,7 +5,7 @@ namespace SDL.Tests.Android
[Activity(Label = "SDL3-CS Android Tests", MainLauncher = true)]
public class MainActivity : SDLActivity
{
protected override string[] GetLibraries() => ["SDL3"];
protected override string[] GetLibraries() => ["SDL3", "SDL3_image", "SDL3_ttf", "SDL3_mixer"];
protected override void Main() => Program.Main();
}

View File

@ -9,6 +9,11 @@
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationId>SDL.Tests.Android</ApplicationId>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<PropertyGroup Label="NuGet">
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
@ -16,16 +21,16 @@
</ItemGroup>
<ItemGroup>
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)..\native\android\armeabi-v7a\libSDL3.so">
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)..\native\android\armeabi-v7a\*.so">
<Abi>armeabi-v7a</Abi>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)..\native\android\arm64-v8a\libSDL3.so">
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)..\native\android\arm64-v8a\*.so">
<Abi>arm64-v8a</Abi>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)..\native\android\x86\libSDL3.so">
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)..\native\android\x86\*.so">
<Abi>x86</Abi>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)..\native\android\x86_64\libSDL3.so">
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)..\native\android\x86_64\*.so">
<Abi>x86_64</Abi>
</AndroidNativeLibrary>
</ItemGroup>

View File

@ -8,26 +8,21 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Label="NuGet">
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SDL3-CS.Tests\SDL3-CS.Tests.csproj"/>
</ItemGroup>
<PropertyGroup>
<SDLArch>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</SDLArch>
<!-- If RID is specified -->
<SDLNativeLib Condition=" $(RuntimeIdentifier.StartsWith('win')) ">$(RuntimeIdentifier)\SDL3.dll</SDLNativeLib>
<SDLNativeLib Condition=" $(RuntimeIdentifier.StartsWith('linux')) ">$(RuntimeIdentifier)\libSDL3.so</SDLNativeLib>
<SDLNativeLib Condition=" $(RuntimeIdentifier.StartsWith('osx')) ">$(RuntimeIdentifier)\libSDL3.dylib</SDLNativeLib>
<!-- If RID is not specified -->
<SDLNativeLib Condition=" '$(SDLNativeLib)' == '' And '$([MSBuild]::IsOSPlatform(Windows))' ">win-$(SDLArch.ToLower())\SDL3.dll</SDLNativeLib>
<SDLNativeLib Condition=" '$(SDLNativeLib)' == '' And '$([MSBuild]::IsOSPlatform(Linux))' ">linux-$(SDLArch.ToLower())\libSDL3.so</SDLNativeLib>
<SDLNativeLib Condition=" '$(SDLNativeLib)' == '' And '$([MSBuild]::IsOSPlatform(OSX))' ">osx-$(SDLArch.ToLower())\libSDL3.dylib</SDLNativeLib>
<SDLArch Condition="'$(RuntimeIdentifier)' == ''">$(NETCoreSdkRuntimeIdentifier)</SDLArch>
<SDLArch Condition="'$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier)</SDLArch>
</PropertyGroup>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)..\native\$(SDLNativeLib)">
<Content Include="$(MSBuildThisFileDirectory)..\native\$(SDLArch)\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

View File

@ -7,6 +7,9 @@ public class Program
public static unsafe void Main(string[] args)
{
NativeLibrary.SetDllImportResolver(typeof(SDL3).Assembly, (_, assembly, path) => NativeLibrary.Load("@rpath/SDL3.framework/SDL3", assembly, path));
NativeLibrary.SetDllImportResolver(typeof(SDL3_image).Assembly, (_, assembly, path) => NativeLibrary.Load("@rpath/SDL3_image.framework/SDL3_image", assembly, path));
NativeLibrary.SetDllImportResolver(typeof(SDL3_ttf).Assembly, (_, assembly, path) => NativeLibrary.Load("@rpath/SDL3_ttf.framework/SDL3_ttf", assembly, path));
NativeLibrary.SetDllImportResolver(typeof(SDL3_mixer).Assembly, (_, assembly, path) => NativeLibrary.Load("@rpath/SDL3_mixer.framework/SDL3_mixer", assembly, path));
SDL3.SDL_RunApp(0, null, &main, IntPtr.Zero);
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-ios</TargetFramework>
@ -11,12 +11,19 @@
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Label="NuGet">
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SDL3-CS.Tests\SDL3-CS.Tests.csproj" PrivateAssets="all"/>
</ItemGroup>
<ItemGroup>
<NativeReference Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3.xcframework"/>
<NativeReference Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3_image.xcframework"/>
<NativeReference Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3_ttf.xcframework"/>
<NativeReference Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3_mixer.xcframework"/>
</ItemGroup>
</Project>

View File

@ -3,6 +3,9 @@
using System.Diagnostics;
using System.Text;
using static SDL.SDL3_image;
using static SDL.SDL3_ttf;
using static SDL.SDL3_mixer;
using static SDL.SDL3;
namespace SDL.Tests
@ -25,7 +28,8 @@ namespace SDL.Tests
using (var window = new MyWindow())
{
Console.WriteLine($"SDL revision: {SDL_GetRevision()}");
// Check if satellite libraries exist.
Console.WriteLine($"SDL revision: {SDL_GetRevision()}, IMG {IMG_Version()}, TTF {TTF_Version()}, Mixer {MIX_Version()}");
printDisplays();

View File

@ -10,6 +10,10 @@
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
<PropertyGroup Label="NuGet">
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0"/>
<PackageReference Include="NUnit" Version="3.13.3"/>
@ -18,6 +22,16 @@
<ItemGroup>
<ProjectReference Include="..\SDL3-CS\SDL3-CS.csproj"/>
<ProjectReference Include="..\SDL3_image-CS\SDL3_image-CS.csproj"/>
<ProjectReference Include="..\SDL3_ttf-CS\SDL3_ttf-CS.csproj"/>
<ProjectReference Include="..\SDL3_mixer-CS\SDL3_mixer-CS.csproj"/>
</ItemGroup>
<ItemGroup>
<None Include="..\External\SDL_image\test\sample.png" Condition="Exists('..\External\SDL_image\test\sample.png')">
<Link>sample.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,25 @@
// 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;
namespace SDL.Tests
{
[TestFixture]
public class TestError
{
[Test]
public void TestUnsupported()
{
Assert.That((bool)SDL3.SDL_Unsupported(), Is.False);
Assert.That(SDL3.SDL_GetError(), Is.EqualTo("That operation is not supported"));
}
[Test]
public void TestInvalidParam()
{
Assert.That((bool)SDL3.SDL_InvalidParamError("test"), Is.False);
Assert.That(SDL3.SDL_GetError(), Is.EqualTo("Parameter 'test' is invalid"));
}
}
}

View File

@ -0,0 +1,41 @@
// 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_image;
using static SDL.SDL3;
namespace SDL.Tests
{
public unsafe class TestImage
{
[Test]
public void TestBasic()
{
SDL_Init(0);
try
{
Assert.That(IMG_Version(), Is.EqualTo(SDL_IMAGE_VERSION));
Assume.That("sample.png", Does.Exist);
var image = IMG_Load("sample.png");
try
{
Assert.That(image != null, SDL_GetError);
Assert.That(image->w, Is.EqualTo(23));
Assert.That(image->h, Is.EqualTo(42));
}
finally
{
SDL_DestroySurface(image);
}
}
finally
{
SDL_Quit();
}
}
}
}

View File

@ -0,0 +1,41 @@
// 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_mixer;
using static SDL.SDL3;
namespace SDL.Tests
{
[TestFixture]
public class TestMixer
{
[Test]
public unsafe void TestBasic()
{
SDL_Init(0);
bool init = MIX_Init();
try
{
Assert.That(init, Is.True, SDL_GetError);
Assert.That(MIX_Version(), Is.EqualTo(SDL_MIXER_VERSION));
Assume.That(MIX_GetNumAudioDecoders() > 0);
string? name = MIX_GetAudioDecoder(0);
Assert.That(name, Is.Not.Null, SDL_GetError);
Assume.That(@"C:\Windows\Media\Windows Logon.wav", Does.Exist);
var decoder = MIX_CreateAudioDecoder(@"C:\Windows\Media\Windows Logon.wav", 0);
Assert.That(decoder != null, SDL_GetError);
MIX_DestroyAudioDecoder(decoder);
}
finally
{
MIX_Quit();
SDL_Quit();
}
}
}
}

44
SDL3-CS.Tests/TestTTF.cs Normal file
View File

@ -0,0 +1,44 @@
// 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_ttf;
using static SDL.SDL3;
namespace SDL.Tests
{
public unsafe class TestTTF
{
[Test]
public void TestBasic()
{
SDL_Init(0);
bool init = TTF_Init();
try
{
Assert.That(init, Is.True, SDL_GetError);
Assert.That(TTF_Version(), Is.EqualTo(SDL_TTF_VERSION));
Assume.That(@"C:\Windows\Fonts\times.ttf", Does.Exist);
var font = TTF_OpenFont(@"C:\Windows\Fonts\times.ttf", 12f);
try
{
Assert.That(font != null, SDL_GetError);
Assert.That(TTF_GetFontFamilyName(font), Is.EqualTo("Times New Roman"));
}
finally
{
TTF_CloseFont(font);
}
}
finally
{
TTF_Quit();
SDL_Quit();
}
}
}
}

View File

@ -2,10 +2,13 @@
"solution": {
"path": "SDL3-CS.sln",
"projects": [
"SDL3-CS\\SDL3-CS.csproj",
"SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj",
"SDL3-CS.Tests.iOS\\SDL3-CS.Tests.iOS.csproj",
"SDL3-CS.Tests\\SDL3-CS.Tests.csproj",
"SDL3-CS.Tests.iOS\\SDL3-CS.Tests.iOS.csproj"
"SDL3-CS\\SDL3-CS.csproj",
"SDL3_image-CS\\SDL3_image-CS.csproj",
"SDL3_mixer-CS\\SDL3_mixer-CS.csproj",
"SDL3_ttf-CS\\SDL3_ttf-CS.csproj"
]
}
}
}

View File

@ -25,6 +25,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.iOS", "SDL3-C
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.Desktop", "SDL3-CS.Tests.Desktop\SDL3-CS.Tests.Desktop.csproj", "{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3_ttf-CS", "SDL3_ttf-CS\SDL3_ttf-CS.csproj", "{8E37EB82-ACC4-4656-A6E5-DB298AE72066}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3_image-CS", "SDL3_image-CS\SDL3_image-CS.csproj", "{A0D6FC5F-BA26-4298-ABF0-234D2481E323}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3_mixer-CS", "SDL3_mixer-CS\SDL3_mixer-CS.csproj", "{421748C4-B51F-4B00-9637-566DBFD96E02}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -55,6 +61,18 @@ Global
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Release|Any CPU.Build.0 = Release|Any CPU
{8E37EB82-ACC4-4656-A6E5-DB298AE72066}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E37EB82-ACC4-4656-A6E5-DB298AE72066}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E37EB82-ACC4-4656-A6E5-DB298AE72066}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E37EB82-ACC4-4656-A6E5-DB298AE72066}.Release|Any CPU.Build.0 = Release|Any CPU
{A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Release|Any CPU.Build.0 = Release|Any CPU
{421748C4-B51F-4B00-9637-566DBFD96E02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{421748C4-B51F-4B00-9637-566DBFD96E02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{421748C4-B51F-4B00-9637-566DBFD96E02}.Release|Any CPU.ActiveCfg = Release|Any CPU
{421748C4-B51F-4B00-9637-566DBFD96E02}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Binary file not shown.

View File

@ -0,0 +1,29 @@
// 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;
// https://github.com/JetBrains/JetBrains.Annotations/blob/988289d09aad925b22a5321c075a735cb9597e59/src/Annotations.cs
namespace JetBrains.Annotations
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Parameter)]
internal sealed class MustDisposeResourceAttribute : Attribute
{
public MustDisposeResourceAttribute()
{
Value = true;
}
public MustDisposeResourceAttribute(bool value)
{
Value = value;
}
/// <summary>
/// When set to <c>false</c>, disposing of the resource is not obligatory.
/// The main use-case for explicit <c>[MustDisposeResource(false)]</c> annotation
/// is to loosen the annotation for inheritors.
/// </summary>
public bool Value { get; }
}
}

View File

@ -4,3 +4,8 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("SDL3-CS.Tests")]
// Allow access to internal CodeGen members (e.g. NativeTypeNameAttribute, etc.) for SDL sister projects:
[assembly: InternalsVisibleTo("SDL3_ttf-CS")]
[assembly: InternalsVisibleTo("SDL3_image-CS")]
[assembly: InternalsVisibleTo("SDL3_mixer-CS")]

View File

@ -2,7 +2,8 @@
<PropertyGroup>
<RootNamespace>SDL</RootNamespace>
<TargetFrameworks>net8.0;net8.0-android</TargetFrameworks>
<TargetFrameworks Condition=" '$(CI_DONT_TARGET_ANDROID)' != '1' ">net8.0;net8.0-android</TargetFrameworks>
<TargetFramework Condition=" '$(CI_DONT_TARGET_ANDROID)' == '1' ">net8.0</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@ -16,19 +17,23 @@
<Copyright>Copyright (c) 2024 ppy Pty Ltd</Copyright>
<Product>ppy.SDL3-CS</Product>
<PackageId>ppy.SDL3-CS</PackageId>
<PackageTags>SDL;SDL3;SDL3-CS</PackageTags>
<PackageReleaseNotes>Automated release.</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ppy/SDL3-CS</PackageProjectUrl>
<PackageReadmeFile>README_nuget.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/ppy/SDL3-CS</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\README_nuget.md" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SDL3-CS.SourceGeneration\SDL3-CS.SourceGeneration.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
<PackageReference Include="libclang" Version="17.0.4">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
@ -75,8 +80,8 @@
<PackagePath>runtimes/linux-arm/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\ios\**\*">
<PackagePath>runtimes/ios/native</PackagePath>
<None Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3.xcframework\**\*">
<PackagePath>runtimes/ios/native/SDL3.xcframework</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\armeabi-v7a\libSDL3.so">
@ -95,7 +100,7 @@
<PackagePath>runtimes/android-x86/native</PackagePath>
<Pack>true</Pack>
</None>
<EmbeddedJar Include="Jars\SDL3AndroidBridge.jar" />
<EmbeddedJar Include="Jars\SDL3AndroidBridge.jar"/>
</ItemGroup>
</Project>

View File

@ -82,6 +82,10 @@ namespace SDL
[return: NativeTypeName("Uint32")]
public static extern uint SDL_GetAtomicU32(SDL_AtomicU32* a);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint32")]
public static extern uint SDL_AddAtomicU32(SDL_AtomicU32* a, int v);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_CompareAndSwapAtomicPointer([NativeTypeName("void **")] IntPtr* a, [NativeTypeName("void*")] IntPtr oldval, [NativeTypeName("void*")] IntPtr newval);

View File

@ -239,10 +239,6 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_AudioStream* SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl]<IntPtr, SDL_AudioStream*, int, int, void> callback, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetAudioIterationCallbacks(SDL_AudioDeviceID devid, [NativeTypeName("SDL_AudioIterationCallback")] delegate* unmanaged[Cdecl]<IntPtr, SDL_AudioDeviceID, SDLBool, void> start, [NativeTypeName("SDL_AudioIterationCallback")] delegate* unmanaged[Cdecl]<IntPtr, SDL_AudioDeviceID, SDLBool, void> end, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, [NativeTypeName("SDL_AudioPostmixCallback")] delegate* unmanaged[Cdecl]<IntPtr, SDL_AudioSpec*, float*, int, void> callback, [NativeTypeName("void*")] IntPtr userdata);
@ -287,5 +283,8 @@ namespace SDL
[NativeTypeName("#define SDL_AUDIO_DEVICE_DEFAULT_RECORDING ((SDL_AudioDeviceID) 0xFFFFFFFEu)")]
public const SDL_AudioDeviceID SDL_AUDIO_DEVICE_DEFAULT_RECORDING = ((SDL_AudioDeviceID)(0xFFFFFFFEU));
[NativeTypeName("#define SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN \"SDL.audiostream.auto_cleanup\"")]
public static ReadOnlySpan<byte> SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN => "SDL.audiostream.auto_cleanup"u8;
}
}

View File

@ -53,6 +53,13 @@ namespace SDL
SDL_CAMERA_POSITION_BACK_FACING,
}
public enum SDL_CameraPermissionState
{
SDL_CAMERA_PERMISSION_STATE_DENIED = -1,
SDL_CAMERA_PERMISSION_STATE_PENDING,
SDL_CAMERA_PERMISSION_STATE_APPROVED,
}
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -83,7 +90,7 @@ namespace SDL
public static extern SDL_Camera* SDL_OpenCamera(SDL_CameraID instance_id, [NativeTypeName("const SDL_CameraSpec *")] SDL_CameraSpec* spec);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetCameraPermissionState(SDL_Camera* camera);
public static extern SDL_CameraPermissionState SDL_GetCameraPermissionState(SDL_Camera* camera);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_CameraID SDL_GetCameraID(SDL_Camera* camera);

View File

@ -98,6 +98,9 @@ namespace SDL
[return: NativeTypeName("size_t")]
public static extern nuint SDL_GetSIMDAlignment();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetSystemPageSize();
[NativeTypeName("#define SDL_CACHELINE_SIZE 128")]
public const int SDL_CACHELINE_SIZE = 128;
}

View File

@ -48,8 +48,9 @@ namespace SDL
SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED,
SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED,
SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED,
SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED,
SDL_EVENT_DISPLAY_FIRST = SDL_EVENT_DISPLAY_ORIENTATION,
SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED,
SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED,
SDL_EVENT_WINDOW_SHOWN = 0x202,
SDL_EVENT_WINDOW_HIDDEN,
SDL_EVENT_WINDOW_EXPOSED,
@ -85,6 +86,8 @@ namespace SDL
SDL_EVENT_KEYBOARD_ADDED,
SDL_EVENT_KEYBOARD_REMOVED,
SDL_EVENT_TEXT_EDITING_CANDIDATES,
SDL_EVENT_SCREEN_KEYBOARD_SHOWN,
SDL_EVENT_SCREEN_KEYBOARD_HIDDEN,
SDL_EVENT_MOUSE_MOTION = 0x400,
SDL_EVENT_MOUSE_BUTTON_DOWN,
SDL_EVENT_MOUSE_BUTTON_UP,
@ -116,6 +119,9 @@ namespace SDL
SDL_EVENT_FINGER_UP,
SDL_EVENT_FINGER_MOTION,
SDL_EVENT_FINGER_CANCELED,
SDL_EVENT_PINCH_BEGIN = 0x710,
SDL_EVENT_PINCH_UPDATE,
SDL_EVENT_PINCH_END,
SDL_EVENT_CLIPBOARD_UPDATE = 0x900,
SDL_EVENT_DROP_FILE = 0x1000,
SDL_EVENT_DROP_TEXT,
@ -758,6 +764,21 @@ namespace SDL
public SDL_WindowID windowID;
}
public partial struct SDL_PinchFingerEvent
{
public SDL_EventType type;
[NativeTypeName("Uint32")]
public uint reserved;
[NativeTypeName("Uint64")]
public ulong timestamp;
public float scale;
public SDL_WindowID windowID;
}
public partial struct SDL_PenProximityEvent
{
public SDL_EventType type;
@ -1069,6 +1090,9 @@ namespace SDL
[FieldOffset(0)]
public SDL_TouchFingerEvent tfinger;
[FieldOffset(0)]
public SDL_PinchFingerEvent pinch;
[FieldOffset(0)]
public SDL_PenProximityEvent pproximity;

View File

@ -1008,10 +1008,10 @@ namespace SDL
public byte clear_stencil;
[NativeTypeName("Uint8")]
public byte padding1;
public byte mip_level;
[NativeTypeName("Uint8")]
public byte padding2;
public byte layer;
}
public partial struct SDL_GPUBlitInfo
@ -1096,6 +1096,30 @@ namespace SDL
public byte padding3;
}
public unsafe partial struct SDL_GPUVulkanOptions
{
[NativeTypeName("Uint32")]
public uint vulkan_api_version;
[NativeTypeName("void*")]
public IntPtr feature_list;
[NativeTypeName("void*")]
public IntPtr vulkan_10_physical_device_features;
[NativeTypeName("Uint32")]
public uint device_extension_count;
[NativeTypeName("const char **")]
public byte** device_extension_names;
[NativeTypeName("Uint32")]
public uint instance_extension_count;
[NativeTypeName("const char **")]
public byte** instance_extension_names;
}
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -1399,6 +1423,12 @@ namespace SDL
[return: NativeTypeName("Uint32")]
public static extern uint SDL_CalculateGPUTextureFormatSize(SDL_GPUTextureFormat format, [NativeTypeName("Uint32")] uint width, [NativeTypeName("Uint32")] uint height, [NativeTypeName("Uint32")] uint depth_or_layer_count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PixelFormat SDL_GetPixelFormatFromGPUTextureFormat(SDL_GPUTextureFormat format);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_GPUTextureFormat SDL_GetGPUTextureFormatFromPixelFormat(SDL_PixelFormat format);
[NativeTypeName("#define SDL_GPU_TEXTUREUSAGE_SAMPLER (1u << 0)")]
public const uint SDL_GPU_TEXTUREUSAGE_SAMPLER = (1U << 0);
@ -1483,6 +1513,18 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING \"SDL.gpu.device.create.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING => "SDL.gpu.device.create.name"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN \"SDL.gpu.device.create.feature.clip_distance\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN => "SDL.gpu.device.create.feature.clip_distance"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN \"SDL.gpu.device.create.feature.depth_clamping\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN => "SDL.gpu.device.create.feature.depth_clamping"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN \"SDL.gpu.device.create.feature.indirect_draw_first_instance\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN => "SDL.gpu.device.create.feature.indirect_draw_first_instance"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN \"SDL.gpu.device.create.feature.anisotropy\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN => "SDL.gpu.device.create.feature.anisotropy"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN \"SDL.gpu.device.create.shaders.private\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN => "SDL.gpu.device.create.shaders.private"u8;
@ -1501,20 +1543,17 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN \"SDL.gpu.device.create.shaders.metallib\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN => "SDL.gpu.device.create.shaders.metallib"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN \"SDL.gpu.device.create.d3d12.allowtier1resourcebinding\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN => "SDL.gpu.device.create.d3d12.allowtier1resourcebinding"u8;
[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;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SHADERCLIPDISTANCE_BOOLEAN \"SDL.gpu.device.create.vulkan.shaderclipdistance\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SHADERCLIPDISTANCE_BOOLEAN => "SDL.gpu.device.create.vulkan.shaderclipdistance"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN \"SDL.gpu.device.create.vulkan.requirehardwareacceleration\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN => "SDL.gpu.device.create.vulkan.requirehardwareacceleration"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DEPTHCLAMP_BOOLEAN \"SDL.gpu.device.create.vulkan.depthclamp\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DEPTHCLAMP_BOOLEAN => "SDL.gpu.device.create.vulkan.depthclamp"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DRAWINDIRECTFIRST_BOOLEAN \"SDL.gpu.device.create.vulkan.drawindirectfirstinstance\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_VULKAN_DRAWINDIRECTFIRST_BOOLEAN => "SDL.gpu.device.create.vulkan.drawindirectfirstinstance"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SAMPLERANISOTROPY_BOOLEAN \"SDL.gpu.device.create.vulkan.sampleranisotropy\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_VULKAN_SAMPLERANISOTROPY_BOOLEAN => "SDL.gpu.device.create.vulkan.sampleranisotropy"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER \"SDL.gpu.device.create.vulkan.options\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER => "SDL.gpu.device.create.vulkan.options"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_NAME_STRING \"SDL.gpu.device.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_NAME_STRING => "SDL.gpu.device.name"u8;

View File

@ -108,6 +108,9 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_hid_device* SDL_hid_open_path([NativeTypeName("const char *")] byte* path);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID SDL_hid_get_properties(SDL_hid_device* dev);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_write(SDL_hid_device* dev, [NativeTypeName("const unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length);
@ -152,5 +155,8 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_hid_ble_scan([NativeTypeName("bool")] SDLBool active);
[NativeTypeName("#define SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER \"SDL.hidapi.libusb.device.handle\"")]
public static ReadOnlySpan<byte> SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER => "SDL.hidapi.libusb.device.handle"u8;
}
}

View File

@ -121,6 +121,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_AUDIO_DEVICE_STREAM_ROLE \"SDL_AUDIO_DEVICE_STREAM_ROLE\"")]
public static ReadOnlySpan<byte> SDL_HINT_AUDIO_DEVICE_STREAM_ROLE => "SDL_AUDIO_DEVICE_STREAM_ROLE"u8;
[NativeTypeName("#define SDL_HINT_AUDIO_DEVICE_RAW_STREAM \"SDL_AUDIO_DEVICE_RAW_STREAM\"")]
public static ReadOnlySpan<byte> SDL_HINT_AUDIO_DEVICE_RAW_STREAM => "SDL_AUDIO_DEVICE_RAW_STREAM"u8;
[NativeTypeName("#define SDL_HINT_AUDIO_DISK_INPUT_FILE \"SDL_AUDIO_DISK_INPUT_FILE\"")]
public static ReadOnlySpan<byte> SDL_HINT_AUDIO_DISK_INPUT_FILE => "SDL_AUDIO_DISK_INPUT_FILE"u8;
@ -169,6 +172,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_DISPLAY_USABLE_BOUNDS \"SDL_DISPLAY_USABLE_BOUNDS\"")]
public static ReadOnlySpan<byte> SDL_HINT_DISPLAY_USABLE_BOUNDS => "SDL_DISPLAY_USABLE_BOUNDS"u8;
[NativeTypeName("#define SDL_HINT_INVALID_PARAM_CHECKS \"SDL_INVALID_PARAM_CHECKS\"")]
public static ReadOnlySpan<byte> SDL_HINT_INVALID_PARAM_CHECKS => "SDL_INVALID_PARAM_CHECKS"u8;
[NativeTypeName("#define SDL_HINT_EMSCRIPTEN_ASYNCIFY \"SDL_EMSCRIPTEN_ASYNCIFY\"")]
public static ReadOnlySpan<byte> SDL_HINT_EMSCRIPTEN_ASYNCIFY => "SDL_EMSCRIPTEN_ASYNCIFY"u8;
@ -178,6 +184,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT \"SDL_EMSCRIPTEN_KEYBOARD_ELEMENT\"")]
public static ReadOnlySpan<byte> SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT => "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"u8;
[NativeTypeName("#define SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT \"SDL_EMSCRIPTEN_FILL_DOCUMENT\"")]
public static ReadOnlySpan<byte> SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT => "SDL_EMSCRIPTEN_FILL_DOCUMENT"u8;
[NativeTypeName("#define SDL_HINT_ENABLE_SCREEN_KEYBOARD \"SDL_ENABLE_SCREEN_KEYBOARD\"")]
public static ReadOnlySpan<byte> SDL_HINT_ENABLE_SCREEN_KEYBOARD => "SDL_ENABLE_SCREEN_KEYBOARD"u8;
@ -352,6 +361,12 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_8BITDO \"SDL_JOYSTICK_HIDAPI_8BITDO\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_8BITDO => "SDL_JOYSTICK_HIDAPI_8BITDO"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SINPUT \"SDL_JOYSTICK_HIDAPI_SINPUT\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_SINPUT => "SDL_JOYSTICK_HIDAPI_SINPUT"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_ZUIKI \"SDL_JOYSTICK_HIDAPI_ZUIKI\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_ZUIKI => "SDL_JOYSTICK_HIDAPI_ZUIKI"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_FLYDIGI \"SDL_JOYSTICK_HIDAPI_FLYDIGI\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_FLYDIGI => "SDL_JOYSTICK_HIDAPI_FLYDIGI"u8;
@ -364,6 +379,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED \"SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED => "SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH2 \"SDL_JOYSTICK_HIDAPI_SWITCH2\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_SWITCH2 => "SDL_JOYSTICK_HIDAPI_SWITCH2"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS \"SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS => "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS"u8;
@ -457,6 +475,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER \"SDL_KMSDRM_REQUIRE_DRM_MASTER\"")]
public static ReadOnlySpan<byte> SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER => "SDL_KMSDRM_REQUIRE_DRM_MASTER"u8;
[NativeTypeName("#define SDL_HINT_KMSDRM_ATOMIC \"SDL_KMSDRM_ATOMIC\"")]
public static ReadOnlySpan<byte> SDL_HINT_KMSDRM_ATOMIC => "SDL_KMSDRM_ATOMIC"u8;
[NativeTypeName("#define SDL_HINT_LOGGING \"SDL_LOGGING\"")]
public static ReadOnlySpan<byte> SDL_HINT_LOGGING => "SDL_LOGGING"u8;
@ -475,6 +496,9 @@ namespace SDL
[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;
[NativeTypeName("#define SDL_HINT_MAC_PRESS_AND_HOLD \"SDL_MAC_PRESS_AND_HOLD\"")]
public static ReadOnlySpan<byte> SDL_HINT_MAC_PRESS_AND_HOLD => "SDL_MAC_PRESS_AND_HOLD"u8;
[NativeTypeName("#define SDL_HINT_MAIN_CALLBACK_RATE \"SDL_MAIN_CALLBACK_RATE\"")]
public static ReadOnlySpan<byte> SDL_HINT_MAIN_CALLBACK_RATE => "SDL_MAIN_CALLBACK_RATE"u8;
@ -553,6 +577,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_RENDER_DIRECT3D11_DEBUG \"SDL_RENDER_DIRECT3D11_DEBUG\"")]
public static ReadOnlySpan<byte> SDL_HINT_RENDER_DIRECT3D11_DEBUG => "SDL_RENDER_DIRECT3D11_DEBUG"u8;
[NativeTypeName("#define SDL_HINT_RENDER_DIRECT3D11_WARP \"SDL_RENDER_DIRECT3D11_WARP\"")]
public static ReadOnlySpan<byte> SDL_HINT_RENDER_DIRECT3D11_WARP => "SDL_RENDER_DIRECT3D11_WARP"u8;
[NativeTypeName("#define SDL_HINT_RENDER_VULKAN_DEBUG \"SDL_RENDER_VULKAN_DEBUG\"")]
public static ReadOnlySpan<byte> SDL_HINT_RENDER_VULKAN_DEBUG => "SDL_RENDER_VULKAN_DEBUG"u8;
@ -583,6 +610,18 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED \"SDL_ROG_GAMEPAD_MICE_EXCLUDED\"")]
public static ReadOnlySpan<byte> SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED => "SDL_ROG_GAMEPAD_MICE_EXCLUDED"u8;
[NativeTypeName("#define SDL_HINT_PS2_GS_WIDTH \"SDL_PS2_GS_WIDTH\"")]
public static ReadOnlySpan<byte> SDL_HINT_PS2_GS_WIDTH => "SDL_PS2_GS_WIDTH"u8;
[NativeTypeName("#define SDL_HINT_PS2_GS_HEIGHT \"SDL_PS2_GS_HEIGHT\"")]
public static ReadOnlySpan<byte> SDL_HINT_PS2_GS_HEIGHT => "SDL_PS2_GS_HEIGHT"u8;
[NativeTypeName("#define SDL_HINT_PS2_GS_PROGRESSIVE \"SDL_PS2_GS_PROGRESSIVE\"")]
public static ReadOnlySpan<byte> SDL_HINT_PS2_GS_PROGRESSIVE => "SDL_PS2_GS_PROGRESSIVE"u8;
[NativeTypeName("#define SDL_HINT_PS2_GS_MODE \"SDL_PS2_GS_MODE\"")]
public static ReadOnlySpan<byte> SDL_HINT_PS2_GS_MODE => "SDL_PS2_GS_MODE"u8;
[NativeTypeName("#define SDL_HINT_RPI_VIDEO_LAYER \"SDL_RPI_VIDEO_LAYER\"")]
public static ReadOnlySpan<byte> SDL_HINT_RPI_VIDEO_LAYER => "SDL_RPI_VIDEO_LAYER"u8;
@ -643,6 +682,9 @@ namespace SDL
[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_METAL_AUTO_RESIZE_DRAWABLE \"SDL_VIDEO_METAL_AUTO_RESIZE_DRAWABLE\"")]
public static ReadOnlySpan<byte> SDL_HINT_VIDEO_METAL_AUTO_RESIZE_DRAWABLE => "SDL_VIDEO_METAL_AUTO_RESIZE_DRAWABLE"u8;
[NativeTypeName("#define SDL_HINT_VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE \"SDL_VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE\"")]
public static ReadOnlySpan<byte> SDL_HINT_VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE => "SDL_VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE"u8;
@ -763,6 +805,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_WINDOWS_RAW_KEYBOARD \"SDL_WINDOWS_RAW_KEYBOARD\"")]
public static ReadOnlySpan<byte> SDL_HINT_WINDOWS_RAW_KEYBOARD => "SDL_WINDOWS_RAW_KEYBOARD"u8;
[NativeTypeName("#define SDL_HINT_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS \"SDL_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS\"")]
public static ReadOnlySpan<byte> SDL_HINT_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS => "SDL_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS"u8;
[NativeTypeName("#define SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL \"SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL\"")]
public static ReadOnlySpan<byte> SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL => "SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL"u8;

View File

@ -278,6 +278,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER \"SDL.iostream.memory.size\"")]
public static ReadOnlySpan<byte> SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER => "SDL.iostream.memory.size"u8;
[NativeTypeName("#define SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER \"SDL.iostream.memory.free\"")]
public static ReadOnlySpan<byte> SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER => "SDL.iostream.memory.free"u8;
[NativeTypeName("#define SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER \"SDL.iostream.dynamic.memory\"")]
public static ReadOnlySpan<byte> SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER => "SDL.iostream.dynamic.memory"u8;

View File

@ -63,6 +63,14 @@ namespace SDL
SDL_MOUSEWHEEL_FLIPPED,
}
public unsafe partial struct SDL_CursorFrameInfo
{
public SDL_Surface* surface;
[NativeTypeName("Uint32")]
public uint duration;
}
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -117,6 +125,9 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Cursor* SDL_CreateColorCursor(SDL_Surface* surface, int hot_x, int hot_y);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Cursor* SDL_CreateAnimatedCursor(SDL_CursorFrameInfo* frames, int frame_count, int hot_x, int hot_y);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Cursor* SDL_CreateSystemCursor(SDL_SystemCursor id);

View File

@ -23,6 +23,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
using System.Runtime.InteropServices;
namespace SDL
{
public enum SDL_PenAxis
@ -37,8 +39,19 @@ namespace SDL
SDL_PEN_AXIS_COUNT,
}
public enum SDL_PenDeviceType
{
SDL_PEN_DEVICE_TYPE_INVALID = -1,
SDL_PEN_DEVICE_TYPE_UNKNOWN,
SDL_PEN_DEVICE_TYPE_DIRECT,
SDL_PEN_DEVICE_TYPE_INDIRECT,
}
public static partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PenDeviceType SDL_GetPenDeviceType(SDL_PenID instance_id);
[NativeTypeName("#define SDL_PEN_INPUT_DOWN (1u << 0)")]
public const uint SDL_PEN_INPUT_DOWN = (1U << 0);
@ -59,5 +72,8 @@ namespace SDL
[NativeTypeName("#define SDL_PEN_INPUT_ERASER_TIP (1u << 30)")]
public const uint SDL_PEN_INPUT_ERASER_TIP = (1U << 30);
[NativeTypeName("#define SDL_PEN_INPUT_IN_PROXIMITY (1u << 31)")]
public const uint SDL_PEN_INPUT_IN_PROXIMITY = (1U << 31);
}
}

View File

@ -254,7 +254,7 @@ namespace SDL
SDL_COLORSPACE_BT2020_LIMITED = 0x21102609U,
SDL_COLORSPACE_BT2020_FULL = 0x22102609U,
SDL_COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_SRGB,
SDL_COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_JPEG,
SDL_COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_BT601_LIMITED,
}
public partial struct SDL_Color

View File

@ -117,5 +117,8 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_DestroyProperties(SDL_PropertiesID props);
[NativeTypeName("#define SDL_PROP_NAME_STRING \"SDL.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_NAME_STRING => "SDL.name"u8;
}
}

View File

@ -76,11 +76,8 @@ namespace SDL
public int refcount;
}
public unsafe partial struct SDL_GPURenderStateDesc
public unsafe partial struct SDL_GPURenderStateCreateInfo
{
[NativeTypeName("Uint32")]
public uint version;
public SDL_GPUShader* fragment_shader;
[NativeTypeName("Sint32")]
@ -100,6 +97,8 @@ namespace SDL
[NativeTypeName("SDL_GPUBuffer *const *")]
public SDL_GPUBuffer** storage_buffers;
public SDL_PropertiesID props;
}
public partial struct SDL_GPURenderState
@ -126,7 +125,10 @@ namespace SDL
public static extern SDL_Renderer* SDL_CreateRendererWithProperties(SDL_PropertiesID props);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Renderer* SDL_CreateGPURenderer(SDL_Window* window, SDL_GPUShaderFormat format_flags, SDL_GPUDevice** device);
public static extern SDL_Renderer* SDL_CreateGPURenderer(SDL_GPUDevice* device, SDL_Window* window);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_GPUDevice* SDL_GetGPURendererDevice(SDL_Renderer* renderer);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Renderer* SDL_CreateSoftwareRenderer(SDL_Surface* surface);
@ -171,6 +173,13 @@ namespace SDL
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_GetTextureSize(SDL_Texture* texture, float* w, float* h);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetTexturePalette(SDL_Texture* texture, SDL_Palette* palette);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Palette* SDL_GetTexturePalette(SDL_Texture* texture);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetTextureColorMod(SDL_Texture* texture, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b);
@ -471,7 +480,7 @@ namespace SDL
public static extern SDLBool SDL_GetDefaultTextureScaleMode(SDL_Renderer* renderer, SDL_ScaleMode* scale_mode);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_GPURenderState* SDL_CreateGPURenderState(SDL_Renderer* renderer, SDL_GPURenderStateDesc* desc);
public static extern SDL_GPURenderState* SDL_CreateGPURenderState(SDL_Renderer* renderer, SDL_GPURenderStateCreateInfo* createinfo);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
@ -479,7 +488,7 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetRenderGPUState(SDL_Renderer* renderer, SDL_GPURenderState* state);
public static extern SDLBool SDL_SetGPURenderState(SDL_Renderer* renderer, SDL_GPURenderState* state);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_DestroyGPURenderState(SDL_GPURenderState* state);
@ -487,6 +496,9 @@ namespace SDL
[NativeTypeName("#define SDL_SOFTWARE_RENDERER \"software\"")]
public static ReadOnlySpan<byte> SDL_SOFTWARE_RENDERER => "software"u8;
[NativeTypeName("#define SDL_GPU_RENDERER \"gpu\"")]
public static ReadOnlySpan<byte> SDL_GPU_RENDERER => "gpu"u8;
[NativeTypeName("#define SDL_PROP_RENDERER_CREATE_NAME_STRING \"SDL.renderer.create.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_CREATE_NAME_STRING => "SDL.renderer.create.name"u8;
@ -502,6 +514,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER \"SDL.renderer.create.present_vsync\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER => "SDL.renderer.create.present_vsync"u8;
[NativeTypeName("#define SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER \"SDL.renderer.create.gpu.device\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER => "SDL.renderer.create.gpu.device"u8;
[NativeTypeName("#define SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN \"SDL.renderer.create.gpu.shaders_spirv\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN => "SDL.renderer.create.gpu.shaders_spirv"u8;
@ -547,6 +562,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER \"SDL.renderer.texture_formats\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER => "SDL.renderer.texture_formats"u8;
[NativeTypeName("#define SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN \"SDL.renderer.texture_wrapping\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN => "SDL.renderer.texture_wrapping"u8;
[NativeTypeName("#define SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER \"SDL.renderer.output_colorspace\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER => "SDL.renderer.output_colorspace"u8;
@ -616,6 +634,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER \"SDL.texture.create.height\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER => "SDL.texture.create.height"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER \"SDL.texture.create.palette\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER => "SDL.texture.create.palette"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT \"SDL.texture.create.SDR_white_point\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT => "SDL.texture.create.SDR_white_point"u8;
@ -670,6 +691,18 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER \"SDL.texture.create.vulkan.texture\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER => "SDL.texture.create.vulkan.texture"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER \"SDL.texture.create.gpu.texture\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER => "SDL.texture.create.gpu.texture"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER \"SDL.texture.create.gpu.texture_uv\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER => "SDL.texture.create.gpu.texture_uv"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER \"SDL.texture.create.gpu.texture_u\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER => "SDL.texture.create.gpu.texture_u"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER \"SDL.texture.create.gpu.texture_v\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER => "SDL.texture.create.gpu.texture_v"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_COLORSPACE_NUMBER \"SDL.texture.colorspace\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_COLORSPACE_NUMBER => "SDL.texture.colorspace"u8;
@ -748,6 +781,18 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER \"SDL.texture.vulkan.texture\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER => "SDL.texture.vulkan.texture"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER \"SDL.texture.gpu.texture\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER => "SDL.texture.gpu.texture"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER \"SDL.texture.gpu.texture_uv\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER => "SDL.texture.gpu.texture_uv"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER \"SDL.texture.gpu.texture_u\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER => "SDL.texture.gpu.texture_u"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER \"SDL.texture.gpu.texture_v\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER => "SDL.texture.gpu.texture_v"u8;
[NativeTypeName("#define SDL_RENDERER_VSYNC_DISABLED 0")]
public const int SDL_RENDERER_VSYNC_DISABLED = 0;

View File

@ -41,6 +41,7 @@ namespace SDL
SDL_SENSOR_GYRO_L,
SDL_SENSOR_ACCEL_R,
SDL_SENSOR_GYRO_R,
SDL_SENSOR_COUNT,
}
public static unsafe partial class SDL3

View File

@ -41,6 +41,7 @@ namespace SDL
SDL_FLIP_NONE,
SDL_FLIP_HORIZONTAL,
SDL_FLIP_VERTICAL,
SDL_FLIP_HORIZONTAL_AND_VERTICAL = (SDL_FLIP_HORIZONTAL | SDL_FLIP_VERTICAL),
}
public partial struct SDL_Surface
@ -116,6 +117,12 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_UnlockSurface(SDL_Surface* surface);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_LoadSurface_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_LoadSurface([NativeTypeName("const char *")] byte* file);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_LoadBMP_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio);
@ -130,6 +137,20 @@ namespace SDL
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SaveBMP(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_LoadPNG_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_LoadPNG([NativeTypeName("const char *")] byte* file);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SavePNG_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SavePNG(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetSurfaceRLE(SDL_Surface* surface, [NativeTypeName("bool")] SDLBool enabled);
@ -186,6 +207,9 @@ namespace SDL
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_FlipSurface(SDL_Surface* surface, SDL_FlipMode flip);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_RotateSurface(SDL_Surface* surface, float angle);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_DuplicateSurface(SDL_Surface* surface);

View File

@ -42,7 +42,10 @@ namespace SDL
[NativeTypeName("#define SDL_MINOR_VERSION 3")]
public const int SDL_MINOR_VERSION = 3;
[NativeTypeName("#define SDL_MICRO_VERSION 0")]
public const int SDL_MICRO_VERSION = 0;
[NativeTypeName("#define SDL_MICRO_VERSION 3")]
public const int SDL_MICRO_VERSION = 3;
[NativeTypeName("#define SDL_VERSION SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION)")]
public const int SDL_VERSION = ((3) * 1000000 + (3) * 1000 + (3));
}
}

View File

@ -692,6 +692,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER \"SDL.display.wayland.wl_output\"")]
public static ReadOnlySpan<byte> SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER => "SDL.display.wayland.wl_output"u8;
[NativeTypeName("#define SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER \"SDL.display.windows.hmonitor\"")]
public static ReadOnlySpan<byte> SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER => "SDL.display.windows.hmonitor"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN \"SDL.window.create.always_on_top\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN => "SDL.window.create.always_on_top"u8;
@ -779,6 +782,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER \"SDL.window.create.cocoa.view\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER => "SDL.window.create.cocoa.view"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER \"SDL.window.create.uikit.windowscene\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER => "SDL.window.create.uikit.windowscene"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN \"SDL.window.create.wayland.surface_role_custom\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN => "SDL.window.create.wayland.surface_role_custom"u8;
@ -800,6 +806,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING \"SDL.window.create.emscripten.canvas_id\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING => "SDL.window.create.emscripten.canvas_id"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN \"SDL.window.create.emscripten.fill_document\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN => "SDL.window.create.emscripten.fill_document"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING \"SDL.window.create.emscripten.keyboard_element\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING => "SDL.window.create.emscripten.keyboard_element"u8;
@ -911,6 +920,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING \"SDL.window.emscripten.canvas_id\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING => "SDL.window.emscripten.canvas_id"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN \"SDL.window.emscripten.fill_document\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN => "SDL.window.emscripten.fill_document"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING \"SDL.window.emscripten.keyboard_element\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING => "SDL.window.emscripten.keyboard_element"u8;

View File

@ -8,14 +8,14 @@ namespace SDL
[Macro]
public static unsafe SDLBool SDL_Unsupported()
{
fixed (byte* fmt = "That operation is not supported"u8)
fixed (byte* fmt = "That operation is not supported\0"u8)
return SDL_SetError(fmt, __arglist());
}
[Macro]
public static unsafe SDLBool SDL_InvalidParamError([NativeTypeName("const char *")] byte* param)
{
fixed (byte* fmt = "Parameter '%s' is invalid"u8)
fixed (byte* fmt = "Parameter '%s' is invalid\0"u8)
return SDL_SetError(fmt, __arglist(param));
}
}

View File

@ -50,8 +50,4 @@ namespace SDL
SDL_GPU_COLORCOMPONENT_B = (byte)SDL3.SDL_GPU_COLORCOMPONENT_B,
SDL_GPU_COLORCOMPONENT_A = (byte)SDL3.SDL_GPU_COLORCOMPONENT_A,
}
public static partial class SDL3
{
}
}
}

View File

@ -0,0 +1,12 @@
// 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.
namespace SDL
{
#pragma warning disable CS0618 // Type or member is obsolete
public partial struct SDL_IOStreamInterface : SDL3.ISDLInterface
#pragma warning restore CS0618 // Type or member is obsolete
{
uint SDL3.ISDLInterface.version { set => version = value; }
}
}

View File

@ -19,4 +19,11 @@ namespace SDL
return SDLArray.Create(array, count);
}
}
#pragma warning disable CS0618 // Type or member is obsolete
public partial struct SDL_VirtualJoystickDesc : SDL3.ISDLInterface
#pragma warning restore CS0618 // Type or member is obsolete
{
uint SDL3.ISDLInterface.version { set => version = value; }
}
}

View File

@ -19,6 +19,7 @@ namespace SDL
SDL_PEN_INPUT_BUTTON_4 = SDL3.SDL_PEN_INPUT_BUTTON_4,
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_IN_PROXIMITY = SDL3.SDL_PEN_INPUT_IN_PROXIMITY,
}
public static partial class SDL3

View File

@ -46,18 +46,20 @@ namespace SDL
[Macro]
public static uint SDL_FOURCC(byte A, byte B, byte C, byte D) => (uint)((A << 0) | (B << 8) | (C << 16) | (D << 24));
[Macro]
public static unsafe void SDL_INIT_INTERFACE(out SDL_IOStreamInterface iface)
[Obsolete("Do not use.")] // used internally
public interface ISDLInterface
{
iface = default;
iface.version = (uint)sizeof(SDL_IOStreamInterface);
internal uint version { set; }
}
[Macro]
public static unsafe void SDL_INIT_INTERFACE(out SDL_StorageInterface iface)
public static unsafe void SDL_INIT_INTERFACE<T>(out T iface)
#pragma warning disable CS0618 // Type or member is obsolete
where T : unmanaged, ISDLInterface
#pragma warning restore CS0618 // Type or member is obsolete
{
iface = default;
iface.version = (uint)sizeof(SDL_StorageInterface);
iface.version = (uint)sizeof(T);
}
public static unsafe void SDL_free(void* mem) => SDL_free((IntPtr)mem);

View File

@ -7,6 +7,13 @@ using JetBrains.Annotations;
namespace SDL
{
#pragma warning disable CS0618 // Type or member is obsolete
public partial struct SDL_StorageInterface : SDL3.ISDLInterface
#pragma warning restore CS0618 // Type or member is obsolete
{
uint SDL3.ISDLInterface.version { set => version = value; }
}
public static partial class SDL3
{
/// <returns>

View File

@ -18,9 +18,6 @@ namespace SDL
[Macro]
public static int SDL_VERSIONNUM_MICRO(int version) => ((version) % 1000);
[Constant]
public static readonly int SDL_VERSION = SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION);
[Macro]
public static bool SDL_VERSION_ATLEAST(int X, int Y, int Z) => SDL_VERSION >= SDL_VERSIONNUM(X, Y, Z);
}

View File

@ -28,8 +28,10 @@ namespace SDL
SDL_WINDOW_INPUT_FOCUS = SDL3.SDL_WINDOW_INPUT_FOCUS,
SDL_WINDOW_MOUSE_FOCUS = SDL3.SDL_WINDOW_MOUSE_FOCUS,
SDL_WINDOW_EXTERNAL = SDL3.SDL_WINDOW_EXTERNAL,
SDL_WINDOW_MODAL = SDL3.SDL_WINDOW_MODAL,
SDL_WINDOW_HIGH_PIXEL_DENSITY = SDL3.SDL_WINDOW_HIGH_PIXEL_DENSITY,
SDL_WINDOW_MOUSE_CAPTURE = SDL3.SDL_WINDOW_MOUSE_CAPTURE,
SDL_WINDOW_MOUSE_RELATIVE_MODE = SDL3.SDL_WINDOW_MOUSE_RELATIVE_MODE,
SDL_WINDOW_ALWAYS_ON_TOP = SDL3.SDL_WINDOW_ALWAYS_ON_TOP,
SDL_WINDOW_UTILITY = SDL3.SDL_WINDOW_UTILITY,
SDL_WINDOW_TOOLTIP = SDL3.SDL_WINDOW_TOOLTIP,

View File

@ -16,6 +16,7 @@ Usage:
Example:
- python generate_bindings.py
- python generate_bindings.py SDL3/SDL_audio.h
- python generate_bindings.py SDL3_ttf/SDL_ttf.h
- python generate_bindings.py SDL_audio.h
- python generate_bindings.py SDL_audio
- python generate_bindings.py audio
@ -34,8 +35,15 @@ unsafe_prefix = "Unsafe_"
repository_root = pathlib.Path(__file__).resolve().parents[1]
SDL_root = repository_root / "External" / "SDL"
SDL_include_root = SDL_root / "include"
SDL_lib_root = "External"
SDL_libs = ["SDL", "SDL_image", "SDL_ttf", "SDL_mixer"]
SDL_lib_include_root = {
"SDL3": SDL_lib_root + "/SDL/include",
"SDL3_image": SDL_lib_root + "/SDL_image/include",
"SDL3_ttf": SDL_lib_root + "/SDL_ttf/include",
"SDL3_mixer": SDL_lib_root + "/SDL_mixer/include",
}
SDL3_header_base = "SDL3" # base folder of header files
csproj_root = repository_root / "SDL3-CS"
@ -44,12 +52,13 @@ csproj_root = repository_root / "SDL3-CS"
class Header:
"""Represents a SDL header file that is used in ClangSharp generation."""
def __init__(self, base: str, name: str, output_suffix=None):
assert base == SDL3_header_base
def __init__(self, base: str, name: str, folder: str, output_suffix=None):
assert base in SDL_lib_include_root
assert name.startswith("SDL")
assert not name.endswith(".h")
self.base = base
self.name = name
self.folder = folder
self.output_suffix = output_suffix
def __str__(self):
@ -60,28 +69,28 @@ class Header:
return f"{self.name}.h"
def input_file(self):
"""Input header file relative to SDL_include_root."""
return f"{self.base}/{self.name}.h"
"""Input header file relative to repository_root."""
return f"{self.folder}/{self.base}/{self.name}.h"
def output_file(self):
"""Location of generated C# file."""
if self.output_suffix is None:
return csproj_root / f"{self.base}/ClangSharp/{self.name}.g.cs"
return repository_root / f"{self.base}-CS" / f"{self.base}/ClangSharp/{self.name}.g.cs"
else:
return csproj_root / f"{self.base}/ClangSharp/{self.name}.{self.output_suffix}.g.cs"
return repository_root / f"{self.base}-CS" / f"{self.base}/ClangSharp/{self.name}.{self.output_suffix}.g.cs"
def rsp_files(self):
"""Location of ClangSharp response files."""
yield csproj_root / f"{self.base}/{self.name}.rsp"
yield repository_root / f"{self.base}-CS" / f"{self.base}/{self.name}.rsp"
if self.output_suffix is not None:
yield csproj_root / f"{self.base}/{self.name}.{self.output_suffix}.rsp"
yield repository_root / f"{self.base}-CS" / f"{self.base}/{self.name}.{self.output_suffix}.rsp"
def cs_file(self):
"""Location of the manually-written C# file that implements some parts of the header."""
if self.output_suffix is None:
return csproj_root / f"{self.base}/{self.name}.cs"
return repository_root / f"{self.base}-CS" / f"{self.base}/{self.name}.cs"
else:
return csproj_root / f"{self.base}/{self.name}.{self.output_suffix}.cs"
return repository_root / f"{self.base}-CS" / f"{self.base}/{self.name}.{self.output_suffix}.cs"
def make_header_fuzzy(s: str) -> Header:
@ -99,14 +108,14 @@ def make_header_fuzzy(s: str) -> Header:
if name.endswith(".h"):
name = name.replace(".h", "")
return Header(base, name)
return Header(base, name, SDL_lib_include_root[base])
def add(s: str):
base, name = s.split("/")
assert s.endswith(".h")
name = name.replace(".h", "")
return Header(base, name)
return Header(base, name, SDL_lib_include_root[base])
headers = [
@ -162,22 +171,27 @@ headers = [
add("SDL3/SDL_version.h"),
add("SDL3/SDL_video.h"),
add("SDL3/SDL_vulkan.h"),
add("SDL3_image/SDL_image.h"),
add("SDL3_ttf/SDL_ttf.h"),
add("SDL3_ttf/SDL_textengine.h"),
add("SDL3_mixer/SDL_mixer.h"),
]
def prepare_sdl_source():
subprocess.run([
"git",
"reset",
"--hard",
"HEAD"
], cwd=SDL_root)
for lib in SDL_libs:
subprocess.run([
"git",
"reset",
"--hard",
"HEAD"
], cwd=repository_root / SDL_lib_root / lib)
def get_sdl_api_dump():
subprocess.run([
sys.executable,
SDL_root / "src" / "dynapi" / "gendynapi.py",
repository_root / SDL_lib_root / "SDL" / "src" / "dynapi" / "gendynapi.py",
"--dump"
])
@ -212,7 +226,7 @@ def check_generated_functions(sdl_api, header, generated_file_paths):
print(f"[⚠️ Warning] Function {name} not found in generated files:", *generated_file_paths)
defined_constant_regex = re.compile(r"\[Constant]\s*public (const|static readonly) \w+ (SDL_\w+) = ", re.MULTILINE)
defined_constant_regex = re.compile(r"\[Constant]\s*public (const|static readonly) \w+ (\w+_\w+) = ", re.MULTILINE)
def get_manually_written_symbols(header):
@ -223,11 +237,10 @@ def get_manually_written_symbols(header):
text = f.read()
for match in defined_constant_regex.finditer(text):
m = match.group(2)
assert m.startswith("SDL_")
yield m
typedef_enum_regex = re.compile(r"\[Typedef]\s*public enum (SDL_\w+)", re.MULTILINE)
typedef_enum_regex = re.compile(r"\[Typedef]\s*public enum (\w+_\w+)", re.MULTILINE)
def get_typedefs():
@ -245,17 +258,18 @@ def typedef(t):
base_command = [
"dotnet", "tool", "run", "ClangSharpPInvokeGenerator",
"--headerFile", csproj_root / "SDL.licenseheader",
"--headerFile", csproj_root / "SDL-license-header.txt",
"--config",
"latest-codegen",
"windows-types",
"generate-macro-bindings",
"--file-directory", SDL_include_root,
"--include-directory", SDL_include_root,
"--libraryPath", "SDL3",
"--methodClassName", "SDL3",
"--file-directory", repository_root,
"--include-directory", repository_root / SDL_lib_include_root["SDL3"],
"--include-directory", repository_root / SDL_lib_include_root["SDL3_image"],
"--include-directory", repository_root / SDL_lib_include_root["SDL3_ttf"],
"--include-directory", repository_root / SDL_lib_include_root["SDL3_mixer"],
"--namespace", "SDL",
"--remap",
@ -297,6 +311,8 @@ def run_clangsharp(command, header: Header):
cmd = command + [
"--file", header.input_file(),
"--output", header.output_file(),
"--libraryPath", header.base,
"--methodClassName", header.base,
]
for rsp in header.rsp_files():
@ -352,7 +368,12 @@ def generate_platform_specific_headers(sdl_api, header: Header, platforms):
def get_string_returning_functions(sdl_api):
for f in sdl_api:
if f["retval"] in ("const char*", "char*"):
yield f
yield f["name"]
yield "TTF_GetFontFamilyName"
yield "TTF_GetFontStyleName"
yield "MIX_GetAudioDecoder"
def should_skip(solo_headers: list[Header], header: Header):
@ -384,8 +405,7 @@ def main():
str_ret_funcs = list(get_string_returning_functions(sdl_api))
if str_ret_funcs:
base_command.append("--remap")
for func in str_ret_funcs:
name = func["name"]
for name in str_ret_funcs:
# add unsafe prefix to `const char *` functions so that the source generator can make friendly overloads with the unprefixed name.
base_command.append(f"{name}={unsafe_prefix}{name}")

View File

@ -0,0 +1,94 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks Condition=" '$(CI_DONT_TARGET_ANDROID)' != '1' ">net8.0;net8.0-android</TargetFrameworks>
<TargetFramework Condition=" '$(CI_DONT_TARGET_ANDROID)' == '1' ">net8.0</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<RootNamespace>SDL</RootNamespace>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);SYSLIB1054;CA1401</NoWarn>
</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_image-CS</Product>
<PackageId>ppy.SDL3_image-CS</PackageId>
<PackageReleaseNotes>Automated release.</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ppy/SDL3-CS</PackageProjectUrl>
<PackageReadmeFile>README_nuget.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/ppy/SDL3-CS</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\README_nuget.md" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SDL3-CS.SourceGeneration\SDL3-CS.SourceGeneration.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
<ProjectReference Include="..\SDL3-CS\SDL3-CS.csproj"/>
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\native\win-x64\SDL3_image.dll">
<PackagePath>runtimes/win-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\win-arm64\SDL3_image.dll">
<PackagePath>runtimes/win-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\win-x86\SDL3_image.dll">
<PackagePath>runtimes/win-x86/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\osx-x64\libSDL3_image.dylib">
<PackagePath>runtimes/osx-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\osx-arm64\libSDL3_image.dylib">
<PackagePath>runtimes/osx-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-x64\libSDL3_image.so">
<PackagePath>runtimes/linux-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-x86\libSDL3_image.so">
<PackagePath>runtimes/linux-x86/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-arm64\libSDL3_image.so">
<PackagePath>runtimes/linux-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-arm\libSDL3_image.so">
<PackagePath>runtimes/linux-arm/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3_image.xcframework\**\*">
<PackagePath>runtimes/ios/native/SDL3_image.xcframework</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\armeabi-v7a\libSDL3_image.so">
<PackagePath>runtimes/android-arm/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\arm64-v8a\libSDL3_image.so">
<PackagePath>runtimes/android-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\x86_64\libSDL3_image.so">
<PackagePath>runtimes/android-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\x86\libSDL3_image.so">
<PackagePath>runtimes/android-x86/native</PackagePath>
<Pack>true</Pack>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,482 @@
/*
<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 unsafe partial struct IMG_Animation
{
public int w;
public int h;
public int count;
public SDL_Surface** frames;
public int* delays;
}
public partial struct IMG_AnimationEncoder
{
}
public enum IMG_AnimationDecoderStatus
{
IMG_DECODER_STATUS_INVALID = -1,
IMG_DECODER_STATUS_OK,
IMG_DECODER_STATUS_FAILED,
IMG_DECODER_STATUS_COMPLETE,
}
public partial struct IMG_AnimationDecoder
{
}
public static unsafe partial class SDL3_image
{
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int IMG_Version();
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_Load([NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_Load_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadTyped_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio, [NativeTypeName("const char *")] byte* type);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Texture* IMG_LoadTexture(SDL_Renderer* renderer, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Texture* IMG_LoadTexture_IO(SDL_Renderer* renderer, SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Texture* IMG_LoadTextureTyped_IO(SDL_Renderer* renderer, SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio, [NativeTypeName("const char *")] byte* type);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_GetClipboardImage();
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isANI(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isAVIF(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isCUR(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isBMP(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isGIF(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isICO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isJPG(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isJXL(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isLBM(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isPCX(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isPNG(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isPNM(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isQOI(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isSVG(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isTIF(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isWEBP(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isXCF(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isXPM(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_isXV(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadAVIF_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadBMP_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadCUR_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadGIF_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadICO_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadJPG_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadJXL_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadLBM_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadPCX_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadPNG_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadPNM_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadSVG_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadSizedSVG_IO(SDL_IOStream* src, int width, int height);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadQOI_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadTGA_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadTIF_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadWEBP_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadXCF_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadXPM_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_LoadXV_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_ReadXPMFromArray([NativeTypeName("char **")] byte** xpm);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* IMG_ReadXPMFromArrayToRGB888([NativeTypeName("char **")] byte** xpm);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_Save(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveTyped_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio, [NativeTypeName("const char *")] byte* type);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveAVIF(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file, int quality);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveAVIF_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio, int quality);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveBMP(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveBMP_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveCUR(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveCUR_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveGIF(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveGIF_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveICO(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveICO_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveJPG(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file, int quality);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveJPG_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio, int quality);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SavePNG(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SavePNG_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveTGA(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveTGA_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveWEBP(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file, float quality);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveWEBP_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio, float quality);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_Animation* IMG_LoadAnimation([NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_Animation* IMG_LoadAnimation_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_Animation* IMG_LoadAnimationTyped_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio, [NativeTypeName("const char *")] byte* type);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_Animation* IMG_LoadANIAnimation_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_Animation* IMG_LoadAPNGAnimation_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_Animation* IMG_LoadAVIFAnimation_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_Animation* IMG_LoadGIFAnimation_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_Animation* IMG_LoadWEBPAnimation_IO(SDL_IOStream* src);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveAnimation(IMG_Animation* anim, [NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveAnimationTyped_IO(IMG_Animation* anim, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio, [NativeTypeName("const char *")] byte* type);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveANIAnimation_IO(IMG_Animation* anim, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveAPNGAnimation_IO(IMG_Animation* anim, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveAVIFAnimation_IO(IMG_Animation* anim, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio, int quality);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveGIFAnimation_IO(IMG_Animation* anim, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_SaveWEBPAnimation_IO(IMG_Animation* anim, SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio, int quality);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Cursor* IMG_CreateAnimatedCursor(IMG_Animation* anim, int hot_x, int hot_y);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void IMG_FreeAnimation(IMG_Animation* anim);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_AnimationEncoder* IMG_CreateAnimationEncoder([NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_AnimationEncoder* IMG_CreateAnimationEncoder_IO(SDL_IOStream* dst, [NativeTypeName("bool")] SDLBool closeio, [NativeTypeName("const char *")] byte* type);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_AnimationEncoder* IMG_CreateAnimationEncoderWithProperties(SDL_PropertiesID props);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_AddAnimationEncoderFrame(IMG_AnimationEncoder* encoder, SDL_Surface* surface, [NativeTypeName("Uint64")] ulong duration);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_CloseAnimationEncoder(IMG_AnimationEncoder* encoder);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_AnimationDecoder* IMG_CreateAnimationDecoder([NativeTypeName("const char *")] byte* file);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_AnimationDecoder* IMG_CreateAnimationDecoder_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio, [NativeTypeName("const char *")] byte* type);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_AnimationDecoder* IMG_CreateAnimationDecoderWithProperties(SDL_PropertiesID props);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID IMG_GetAnimationDecoderProperties(IMG_AnimationDecoder* decoder);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_GetAnimationDecoderFrame(IMG_AnimationDecoder* decoder, SDL_Surface** frame, [NativeTypeName("Uint64 *")] ulong* duration);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern IMG_AnimationDecoderStatus IMG_GetAnimationDecoderStatus(IMG_AnimationDecoder* decoder);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_ResetAnimationDecoder(IMG_AnimationDecoder* decoder);
[DllImport("SDL3_image", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool IMG_CloseAnimationDecoder(IMG_AnimationDecoder* decoder);
[NativeTypeName("#define SDL_IMAGE_MAJOR_VERSION 3")]
public const int SDL_IMAGE_MAJOR_VERSION = 3;
[NativeTypeName("#define SDL_IMAGE_MINOR_VERSION 3")]
public const int SDL_IMAGE_MINOR_VERSION = 3;
[NativeTypeName("#define SDL_IMAGE_MICRO_VERSION 0")]
public const int SDL_IMAGE_MICRO_VERSION = 0;
[NativeTypeName("#define SDL_IMAGE_VERSION SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_MICRO_VERSION)")]
public const int SDL_IMAGE_VERSION = ((3) * 1000000 + (3) * 1000 + (0));
[NativeTypeName("#define IMG_PROP_ANIMATION_ENCODER_CREATE_FILENAME_STRING \"SDL_image.animation_encoder.create.filename\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_ENCODER_CREATE_FILENAME_STRING => "SDL_image.animation_encoder.create.filename"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_ENCODER_CREATE_IOSTREAM_POINTER \"SDL_image.animation_encoder.create.iostream\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_ENCODER_CREATE_IOSTREAM_POINTER => "SDL_image.animation_encoder.create.iostream"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_ENCODER_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN \"SDL_image.animation_encoder.create.iostream.autoclose\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_ENCODER_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN => "SDL_image.animation_encoder.create.iostream.autoclose"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_ENCODER_CREATE_TYPE_STRING \"SDL_image.animation_encoder.create.type\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_ENCODER_CREATE_TYPE_STRING => "SDL_image.animation_encoder.create.type"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_ENCODER_CREATE_QUALITY_NUMBER \"SDL_image.animation_encoder.create.quality\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_ENCODER_CREATE_QUALITY_NUMBER => "SDL_image.animation_encoder.create.quality"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_NUMERATOR_NUMBER \"SDL_image.animation_encoder.create.timebase.numerator\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_NUMERATOR_NUMBER => "SDL_image.animation_encoder.create.timebase.numerator"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER \"SDL_image.animation_encoder.create.timebase.denominator\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER => "SDL_image.animation_encoder.create.timebase.denominator"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_DECODER_CREATE_FILENAME_STRING \"SDL_image.animation_decoder.create.filename\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_DECODER_CREATE_FILENAME_STRING => "SDL_image.animation_decoder.create.filename"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_DECODER_CREATE_IOSTREAM_POINTER \"SDL_image.animation_decoder.create.iostream\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_DECODER_CREATE_IOSTREAM_POINTER => "SDL_image.animation_decoder.create.iostream"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_DECODER_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN \"SDL_image.animation_decoder.create.iostream.autoclose\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_DECODER_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN => "SDL_image.animation_decoder.create.iostream.autoclose"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_DECODER_CREATE_TYPE_STRING \"SDL_image.animation_decoder.create.type\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_DECODER_CREATE_TYPE_STRING => "SDL_image.animation_decoder.create.type"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_NUMERATOR_NUMBER \"SDL_image.animation_decoder.create.timebase.numerator\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_NUMERATOR_NUMBER => "SDL_image.animation_decoder.create.timebase.numerator"u8;
[NativeTypeName("#define IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER \"SDL_image.animation_decoder.create.timebase.denominator\"")]
public static ReadOnlySpan<byte> IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER => "SDL_image.animation_decoder.create.timebase.denominator"u8;
[NativeTypeName("#define IMG_PROP_METADATA_IGNORE_PROPS_BOOLEAN \"SDL_image.metadata.ignore_props\"")]
public static ReadOnlySpan<byte> IMG_PROP_METADATA_IGNORE_PROPS_BOOLEAN => "SDL_image.metadata.ignore_props"u8;
[NativeTypeName("#define IMG_PROP_METADATA_DESCRIPTION_STRING \"SDL_image.metadata.description\"")]
public static ReadOnlySpan<byte> IMG_PROP_METADATA_DESCRIPTION_STRING => "SDL_image.metadata.description"u8;
[NativeTypeName("#define IMG_PROP_METADATA_COPYRIGHT_STRING \"SDL_image.metadata.copyright\"")]
public static ReadOnlySpan<byte> IMG_PROP_METADATA_COPYRIGHT_STRING => "SDL_image.metadata.copyright"u8;
[NativeTypeName("#define IMG_PROP_METADATA_TITLE_STRING \"SDL_image.metadata.title\"")]
public static ReadOnlySpan<byte> IMG_PROP_METADATA_TITLE_STRING => "SDL_image.metadata.title"u8;
[NativeTypeName("#define IMG_PROP_METADATA_AUTHOR_STRING \"SDL_image.metadata.author\"")]
public static ReadOnlySpan<byte> IMG_PROP_METADATA_AUTHOR_STRING => "SDL_image.metadata.author"u8;
[NativeTypeName("#define IMG_PROP_METADATA_CREATION_TIME_STRING \"SDL_image.metadata.creation_time\"")]
public static ReadOnlySpan<byte> IMG_PROP_METADATA_CREATION_TIME_STRING => "SDL_image.metadata.creation_time"u8;
[NativeTypeName("#define IMG_PROP_METADATA_LOOP_COUNT_NUMBER \"SDL_image.metadata.loop_count\"")]
public static ReadOnlySpan<byte> IMG_PROP_METADATA_LOOP_COUNT_NUMBER => "SDL_image.metadata.loop_count"u8;
}
}

View File

@ -0,0 +1,14 @@
// 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.
namespace SDL
{
public static unsafe partial class SDL3_image
{
[Macro]
public static bool SDL_IMAGE_VERSION_ATLEAST(int X, int Y, int Z) =>
((SDL_IMAGE_MAJOR_VERSION >= X) &&
(SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION >= Y) &&
(SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION > Y || SDL_IMAGE_MICRO_VERSION >= Z));
}
}

View File

@ -0,0 +1,94 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks Condition=" '$(CI_DONT_TARGET_ANDROID)' != '1' ">net8.0;net8.0-android</TargetFrameworks>
<TargetFramework Condition=" '$(CI_DONT_TARGET_ANDROID)' == '1' ">net8.0</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<RootNamespace>SDL</RootNamespace>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);SYSLIB1054;CA1401</NoWarn>
</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_mixer-CS</Product>
<PackageId>ppy.SDL3_mixer-CS</PackageId>
<PackageReleaseNotes>Automated release.</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ppy/SDL3-CS</PackageProjectUrl>
<PackageReadmeFile>README_nuget.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/ppy/SDL3-CS</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\README_nuget.md" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SDL3-CS.SourceGeneration\SDL3-CS.SourceGeneration.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
<ProjectReference Include="..\SDL3-CS\SDL3-CS.csproj"/>
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\native\win-x64\SDL3_mixer.dll">
<PackagePath>runtimes/win-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\win-arm64\SDL3_mixer.dll">
<PackagePath>runtimes/win-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\win-x86\SDL3_mixer.dll">
<PackagePath>runtimes/win-x86/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\osx-x64\libSDL3_mixer.dylib">
<PackagePath>runtimes/osx-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\osx-arm64\libSDL3_mixer.dylib">
<PackagePath>runtimes/osx-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-x64\libSDL3_mixer.so">
<PackagePath>runtimes/linux-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-x86\libSDL3_mixer.so">
<PackagePath>runtimes/linux-x86/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-arm64\libSDL3_mixer.so">
<PackagePath>runtimes/linux-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-arm\libSDL3_mixer.so">
<PackagePath>runtimes/linux-arm/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3_mixer.xcframework\**\*">
<PackagePath>runtimes/ios/native/SDL3_mixer.xcframework</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\armeabi-v7a\libSDL3_mixer.so">
<PackagePath>runtimes/android-arm/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\arm64-v8a\libSDL3_mixer.so">
<PackagePath>runtimes/android-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\x86_64\libSDL3_mixer.so">
<PackagePath>runtimes/android-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\x86\libSDL3_mixer.so">
<PackagePath>runtimes/android-x86/native</PackagePath>
<Pack>true</Pack>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,470 @@
/*
<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 MIX_Mixer
{
}
public partial struct MIX_Audio
{
}
public partial struct MIX_Track
{
}
public partial struct MIX_Group
{
}
public partial struct MIX_StereoGains
{
public float left;
public float right;
}
public partial struct MIX_Point3D
{
public float x;
public float y;
public float z;
}
public partial struct MIX_AudioDecoder
{
}
public static unsafe partial class SDL3_mixer
{
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int MIX_Version();
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_Init();
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void MIX_Quit();
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int MIX_GetNumAudioDecoders();
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, EntryPoint = "MIX_GetAudioDecoder", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_MIX_GetAudioDecoder(int index);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Mixer* MIX_CreateMixerDevice(SDL_AudioDeviceID devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Mixer* MIX_CreateMixer([NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void MIX_DestroyMixer(MIX_Mixer* mixer);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID MIX_GetMixerProperties(MIX_Mixer* mixer);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_GetMixerFormat(MIX_Mixer* mixer, SDL_AudioSpec* spec);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Audio* MIX_LoadAudio_IO(MIX_Mixer* mixer, SDL_IOStream* io, [NativeTypeName("bool")] SDLBool predecode, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Audio* MIX_LoadAudio(MIX_Mixer* mixer, [NativeTypeName("const char *")] byte* path, [NativeTypeName("bool")] SDLBool predecode);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Audio* MIX_LoadAudioWithProperties(SDL_PropertiesID props);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Audio* MIX_LoadRawAudio_IO(MIX_Mixer* mixer, SDL_IOStream* io, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Audio* MIX_LoadRawAudio(MIX_Mixer* mixer, [NativeTypeName("const void *")] IntPtr data, [NativeTypeName("size_t")] nuint datalen, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Audio* MIX_LoadRawAudioNoCopy(MIX_Mixer* mixer, [NativeTypeName("const void *")] IntPtr data, [NativeTypeName("size_t")] nuint datalen, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec, [NativeTypeName("bool")] SDLBool free_when_done);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Audio* MIX_CreateSineWaveAudio(MIX_Mixer* mixer, int hz, float amplitude);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID MIX_GetAudioProperties(MIX_Audio* audio);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Sint64")]
public static extern long MIX_GetAudioDuration(MIX_Audio* audio);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_GetAudioFormat(MIX_Audio* audio, SDL_AudioSpec* spec);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void MIX_DestroyAudio(MIX_Audio* audio);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Track* MIX_CreateTrack(MIX_Mixer* mixer);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void MIX_DestroyTrack(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID MIX_GetTrackProperties(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Mixer* MIX_GetTrackMixer(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackAudio(MIX_Track* track, MIX_Audio* audio);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackAudioStream(MIX_Track* track, SDL_AudioStream* stream);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackIOStream(MIX_Track* track, SDL_IOStream* io, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackRawIOStream(MIX_Track* track, SDL_IOStream* io, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec, [NativeTypeName("bool")] SDLBool closeio);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_TagTrack(MIX_Track* track, [NativeTypeName("const char *")] byte* tag);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void MIX_UntagTrack(MIX_Track* track, [NativeTypeName("const char *")] byte* tag);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackPlaybackPosition(MIX_Track* track, [NativeTypeName("Sint64")] long frames);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Sint64")]
public static extern long MIX_GetTrackPlaybackPosition(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_TrackLooping(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Audio* MIX_GetTrackAudio(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_AudioStream* MIX_GetTrackAudioStream(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Sint64")]
public static extern long MIX_GetTrackRemaining(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Sint64")]
public static extern long MIX_TrackMSToFrames(MIX_Track* track, [NativeTypeName("Sint64")] long ms);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Sint64")]
public static extern long MIX_TrackFramesToMS(MIX_Track* track, [NativeTypeName("Sint64")] long frames);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Sint64")]
public static extern long MIX_AudioMSToFrames(MIX_Audio* audio, [NativeTypeName("Sint64")] long ms);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Sint64")]
public static extern long MIX_AudioFramesToMS(MIX_Audio* audio, [NativeTypeName("Sint64")] long frames);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Sint64")]
public static extern long MIX_MSToFrames(int sample_rate, [NativeTypeName("Sint64")] long ms);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Sint64")]
public static extern long MIX_FramesToMS(int sample_rate, [NativeTypeName("Sint64")] long frames);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_PlayTrack(MIX_Track* track, SDL_PropertiesID options);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_PlayTag(MIX_Mixer* mixer, [NativeTypeName("const char *")] byte* tag, SDL_PropertiesID options);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_PlayAudio(MIX_Mixer* mixer, MIX_Audio* audio);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_StopTrack(MIX_Track* track, [NativeTypeName("Sint64")] long fade_out_frames);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_StopAllTracks(MIX_Mixer* mixer, [NativeTypeName("Sint64")] long fade_out_ms);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_StopTag(MIX_Mixer* mixer, [NativeTypeName("const char *")] byte* tag, [NativeTypeName("Sint64")] long fade_out_ms);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_PauseTrack(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_PauseAllTracks(MIX_Mixer* mixer);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_PauseTag(MIX_Mixer* mixer, [NativeTypeName("const char *")] byte* tag);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_ResumeTrack(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_ResumeAllTracks(MIX_Mixer* mixer);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_ResumeTag(MIX_Mixer* mixer, [NativeTypeName("const char *")] byte* tag);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_TrackPlaying(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_TrackPaused(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetMasterGain(MIX_Mixer* mixer, float gain);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float MIX_GetMasterGain(MIX_Mixer* mixer);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackGain(MIX_Track* track, float gain);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float MIX_GetTrackGain(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTagGain(MIX_Mixer* mixer, [NativeTypeName("const char *")] byte* tag, float gain);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackFrequencyRatio(MIX_Track* track, float ratio);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float MIX_GetTrackFrequencyRatio(MIX_Track* track);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackOutputChannelMap(MIX_Track* track, [NativeTypeName("const int *")] int* chmap, int count);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackStereo(MIX_Track* track, [NativeTypeName("const MIX_StereoGains *")] MIX_StereoGains* gains);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrack3DPosition(MIX_Track* track, [NativeTypeName("const MIX_Point3D *")] MIX_Point3D* position);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_GetTrack3DPosition(MIX_Track* track, MIX_Point3D* position);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Group* MIX_CreateGroup(MIX_Mixer* mixer);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void MIX_DestroyGroup(MIX_Group* group);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID MIX_GetGroupProperties(MIX_Group* group);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_Mixer* MIX_GetGroupMixer(MIX_Group* group);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackGroup(MIX_Track* track, MIX_Group* group);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackStoppedCallback(MIX_Track* track, [NativeTypeName("MIX_TrackStoppedCallback")] delegate* unmanaged[Cdecl]<IntPtr, MIX_Track*, void> cb, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackRawCallback(MIX_Track* track, [NativeTypeName("MIX_TrackMixCallback")] delegate* unmanaged[Cdecl]<IntPtr, MIX_Track*, SDL_AudioSpec*, float*, int, void> cb, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetTrackCookedCallback(MIX_Track* track, [NativeTypeName("MIX_TrackMixCallback")] delegate* unmanaged[Cdecl]<IntPtr, MIX_Track*, SDL_AudioSpec*, float*, int, void> cb, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetGroupPostMixCallback(MIX_Group* group, [NativeTypeName("MIX_GroupMixCallback")] delegate* unmanaged[Cdecl]<IntPtr, MIX_Group*, SDL_AudioSpec*, float*, int, void> cb, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_SetPostMixCallback(MIX_Mixer* mixer, [NativeTypeName("MIX_PostMixCallback")] delegate* unmanaged[Cdecl]<IntPtr, MIX_Mixer*, SDL_AudioSpec*, float*, int, void> cb, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_Generate(MIX_Mixer* mixer, [NativeTypeName("void*")] IntPtr buffer, int buflen);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_AudioDecoder* MIX_CreateAudioDecoder([NativeTypeName("const char *")] byte* path, SDL_PropertiesID props);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern MIX_AudioDecoder* MIX_CreateAudioDecoder_IO(SDL_IOStream* io, [NativeTypeName("bool")] SDLBool closeio, SDL_PropertiesID props);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void MIX_DestroyAudioDecoder(MIX_AudioDecoder* audiodecoder);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID MIX_GetAudioDecoderProperties(MIX_AudioDecoder* audiodecoder);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool MIX_GetAudioDecoderFormat(MIX_AudioDecoder* audiodecoder, SDL_AudioSpec* spec);
[DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int MIX_DecodeAudio(MIX_AudioDecoder* audiodecoder, [NativeTypeName("void*")] IntPtr buffer, int buflen, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec);
[NativeTypeName("#define SDL_MIXER_MAJOR_VERSION 3")]
public const int SDL_MIXER_MAJOR_VERSION = 3;
[NativeTypeName("#define SDL_MIXER_MINOR_VERSION 1")]
public const int SDL_MIXER_MINOR_VERSION = 1;
[NativeTypeName("#define SDL_MIXER_MICRO_VERSION 0")]
public const int SDL_MIXER_MICRO_VERSION = 0;
[NativeTypeName("#define SDL_MIXER_VERSION SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_MICRO_VERSION)")]
public const int SDL_MIXER_VERSION = ((3) * 1000000 + (1) * 1000 + (0));
[NativeTypeName("#define MIX_PROP_AUDIO_LOAD_IOSTREAM_POINTER \"SDL_mixer.audio.load.iostream\"")]
public static ReadOnlySpan<byte> MIX_PROP_AUDIO_LOAD_IOSTREAM_POINTER => "SDL_mixer.audio.load.iostream"u8;
[NativeTypeName("#define MIX_PROP_AUDIO_LOAD_CLOSEIO_BOOLEAN \"SDL_mixer.audio.load.closeio\"")]
public static ReadOnlySpan<byte> MIX_PROP_AUDIO_LOAD_CLOSEIO_BOOLEAN => "SDL_mixer.audio.load.closeio"u8;
[NativeTypeName("#define MIX_PROP_AUDIO_LOAD_PREDECODE_BOOLEAN \"SDL_mixer.audio.load.predecode\"")]
public static ReadOnlySpan<byte> MIX_PROP_AUDIO_LOAD_PREDECODE_BOOLEAN => "SDL_mixer.audio.load.predecode"u8;
[NativeTypeName("#define MIX_PROP_AUDIO_LOAD_PREFERRED_MIXER_POINTER \"SDL_mixer.audio.load.preferred_mixer\"")]
public static ReadOnlySpan<byte> MIX_PROP_AUDIO_LOAD_PREFERRED_MIXER_POINTER => "SDL_mixer.audio.load.preferred_mixer"u8;
[NativeTypeName("#define MIX_PROP_AUDIO_LOAD_SKIP_METADATA_TAGS_BOOLEAN \"SDL_mixer.audio.load.skip_metadata_tags\"")]
public static ReadOnlySpan<byte> MIX_PROP_AUDIO_LOAD_SKIP_METADATA_TAGS_BOOLEAN => "SDL_mixer.audio.load.skip_metadata_tags"u8;
[NativeTypeName("#define MIX_PROP_AUDIO_DECODER_STRING \"SDL_mixer.audio.decoder\"")]
public static ReadOnlySpan<byte> MIX_PROP_AUDIO_DECODER_STRING => "SDL_mixer.audio.decoder"u8;
[NativeTypeName("#define MIX_PROP_METADATA_TITLE_STRING \"SDL_mixer.metadata.title\"")]
public static ReadOnlySpan<byte> MIX_PROP_METADATA_TITLE_STRING => "SDL_mixer.metadata.title"u8;
[NativeTypeName("#define MIX_PROP_METADATA_ARTIST_STRING \"SDL_mixer.metadata.artist\"")]
public static ReadOnlySpan<byte> MIX_PROP_METADATA_ARTIST_STRING => "SDL_mixer.metadata.artist"u8;
[NativeTypeName("#define MIX_PROP_METADATA_ALBUM_STRING \"SDL_mixer.metadata.album\"")]
public static ReadOnlySpan<byte> MIX_PROP_METADATA_ALBUM_STRING => "SDL_mixer.metadata.album"u8;
[NativeTypeName("#define MIX_PROP_METADATA_COPYRIGHT_STRING \"SDL_mixer.metadata.copyright\"")]
public static ReadOnlySpan<byte> MIX_PROP_METADATA_COPYRIGHT_STRING => "SDL_mixer.metadata.copyright"u8;
[NativeTypeName("#define MIX_PROP_METADATA_TRACK_NUMBER \"SDL_mixer.metadata.track\"")]
public static ReadOnlySpan<byte> MIX_PROP_METADATA_TRACK_NUMBER => "SDL_mixer.metadata.track"u8;
[NativeTypeName("#define MIX_PROP_METADATA_TOTAL_TRACKS_NUMBER \"SDL_mixer.metadata.total_tracks\"")]
public static ReadOnlySpan<byte> MIX_PROP_METADATA_TOTAL_TRACKS_NUMBER => "SDL_mixer.metadata.total_tracks"u8;
[NativeTypeName("#define MIX_PROP_METADATA_YEAR_NUMBER \"SDL_mixer.metadata.year\"")]
public static ReadOnlySpan<byte> MIX_PROP_METADATA_YEAR_NUMBER => "SDL_mixer.metadata.year"u8;
[NativeTypeName("#define MIX_PROP_METADATA_DURATION_FRAMES_NUMBER \"SDL_mixer.metadata.duration_frames\"")]
public static ReadOnlySpan<byte> MIX_PROP_METADATA_DURATION_FRAMES_NUMBER => "SDL_mixer.metadata.duration_frames"u8;
[NativeTypeName("#define MIX_PROP_METADATA_DURATION_INFINITE_BOOLEAN \"SDL_mixer.metadata.duration_infinite\"")]
public static ReadOnlySpan<byte> MIX_PROP_METADATA_DURATION_INFINITE_BOOLEAN => "SDL_mixer.metadata.duration_infinite"u8;
[NativeTypeName("#define MIX_DURATION_UNKNOWN -1")]
public const int MIX_DURATION_UNKNOWN = -1;
[NativeTypeName("#define MIX_DURATION_INFINITE -2")]
public const int MIX_DURATION_INFINITE = -2;
[NativeTypeName("#define MIX_PROP_PLAY_LOOPS_NUMBER \"SDL_mixer.play.loops\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_LOOPS_NUMBER => "SDL_mixer.play.loops"u8;
[NativeTypeName("#define MIX_PROP_PLAY_MAX_FRAME_NUMBER \"SDL_mixer.play.max_frame\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_MAX_FRAME_NUMBER => "SDL_mixer.play.max_frame"u8;
[NativeTypeName("#define MIX_PROP_PLAY_MAX_MILLISECONDS_NUMBER \"SDL_mixer.play.max_milliseconds\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_MAX_MILLISECONDS_NUMBER => "SDL_mixer.play.max_milliseconds"u8;
[NativeTypeName("#define MIX_PROP_PLAY_START_FRAME_NUMBER \"SDL_mixer.play.start_frame\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_START_FRAME_NUMBER => "SDL_mixer.play.start_frame"u8;
[NativeTypeName("#define MIX_PROP_PLAY_START_MILLISECOND_NUMBER \"SDL_mixer.play.start_millisecond\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_START_MILLISECOND_NUMBER => "SDL_mixer.play.start_millisecond"u8;
[NativeTypeName("#define MIX_PROP_PLAY_LOOP_START_FRAME_NUMBER \"SDL_mixer.play.loop_start_frame\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_LOOP_START_FRAME_NUMBER => "SDL_mixer.play.loop_start_frame"u8;
[NativeTypeName("#define MIX_PROP_PLAY_LOOP_START_MILLISECOND_NUMBER \"SDL_mixer.play.loop_start_millisecond\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_LOOP_START_MILLISECOND_NUMBER => "SDL_mixer.play.loop_start_millisecond"u8;
[NativeTypeName("#define MIX_PROP_PLAY_FADE_IN_FRAMES_NUMBER \"SDL_mixer.play.fade_in_frames\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_FADE_IN_FRAMES_NUMBER => "SDL_mixer.play.fade_in_frames"u8;
[NativeTypeName("#define MIX_PROP_PLAY_FADE_IN_MILLISECONDS_NUMBER \"SDL_mixer.play.fade_in_milliseconds\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_FADE_IN_MILLISECONDS_NUMBER => "SDL_mixer.play.fade_in_milliseconds"u8;
[NativeTypeName("#define MIX_PROP_PLAY_APPEND_SILENCE_FRAMES_NUMBER \"SDL_mixer.play.append_silence_frames\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_APPEND_SILENCE_FRAMES_NUMBER => "SDL_mixer.play.append_silence_frames"u8;
[NativeTypeName("#define MIX_PROP_PLAY_APPEND_SILENCE_MILLISECONDS_NUMBER \"SDL_mixer.play.append_silence_milliseconds\"")]
public static ReadOnlySpan<byte> MIX_PROP_PLAY_APPEND_SILENCE_MILLISECONDS_NUMBER => "SDL_mixer.play.append_silence_milliseconds"u8;
}
}

View File

@ -0,0 +1,19 @@
// 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 static SDL.SDL3;
namespace SDL
{
public static unsafe partial class SDL3_mixer
{
[Constant]
public static readonly SDL_AudioFormat MIX_DEFAULT_FORMAT = SDL_AUDIO_S16;
[Macro]
public static bool SDL_MIXER_VERSION_ATLEAST(int X, int Y, int Z) =>
((SDL_MIXER_MAJOR_VERSION >= X) &&
(SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION >= Y) &&
(SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION > Y || SDL_MIXER_MICRO_VERSION >= Z));
}
}

View File

@ -0,0 +1,94 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks Condition=" '$(CI_DONT_TARGET_ANDROID)' != '1' ">net8.0;net8.0-android</TargetFrameworks>
<TargetFramework Condition=" '$(CI_DONT_TARGET_ANDROID)' == '1' ">net8.0</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<RootNamespace>SDL</RootNamespace>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);SYSLIB1054;CA1401</NoWarn>
</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_ttf-CS</Product>
<PackageId>ppy.SDL3_ttf-CS</PackageId>
<PackageReleaseNotes>Automated release.</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ppy/SDL3-CS</PackageProjectUrl>
<PackageReadmeFile>README_nuget.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/ppy/SDL3-CS</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\README_nuget.md" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SDL3-CS.SourceGeneration\SDL3-CS.SourceGeneration.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
<ProjectReference Include="..\SDL3-CS\SDL3-CS.csproj"/>
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\native\win-x64\SDL3_ttf.dll">
<PackagePath>runtimes/win-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\win-arm64\SDL3_ttf.dll">
<PackagePath>runtimes/win-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\win-x86\SDL3_ttf.dll">
<PackagePath>runtimes/win-x86/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\osx-x64\libSDL3_ttf.dylib">
<PackagePath>runtimes/osx-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\osx-arm64\libSDL3_ttf.dylib">
<PackagePath>runtimes/osx-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-x64\libSDL3_ttf.so">
<PackagePath>runtimes/linux-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-x86\libSDL3_ttf.so">
<PackagePath>runtimes/linux-x86/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-arm64\libSDL3_ttf.so">
<PackagePath>runtimes/linux-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-arm\libSDL3_ttf.so">
<PackagePath>runtimes/linux-arm/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3_ttf.xcframework\**\*">
<PackagePath>runtimes/ios/native/SDL3_ttf.xcframework</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\armeabi-v7a\libSDL3_ttf.so">
<PackagePath>runtimes/android-arm/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\arm64-v8a\libSDL3_ttf.so">
<PackagePath>runtimes/android-arm64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\x86_64\libSDL3_ttf.so">
<PackagePath>runtimes/android-x64/native</PackagePath>
<Pack>true</Pack>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\x86\libSDL3_ttf.so">
<PackagePath>runtimes/android-x86/native</PackagePath>
<Pack>true</Pack>
</None>
</ItemGroup>
</Project>

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 enum TTF_DrawCommand
{
TTF_DRAW_COMMAND_NOOP,
TTF_DRAW_COMMAND_FILL,
TTF_DRAW_COMMAND_COPY,
}
public partial struct TTF_FillOperation
{
public TTF_DrawCommand cmd;
public SDL_Rect rect;
}
public unsafe partial struct TTF_CopyOperation
{
public TTF_DrawCommand cmd;
public int text_offset;
public TTF_Font* glyph_font;
[NativeTypeName("Uint32")]
public uint glyph_index;
public SDL_Rect src;
public SDL_Rect dst;
[NativeTypeName("void*")]
public IntPtr reserved;
}
[StructLayout(LayoutKind.Explicit)]
public partial struct TTF_DrawOperation
{
[FieldOffset(0)]
public TTF_DrawCommand cmd;
[FieldOffset(0)]
public TTF_FillOperation fill;
[FieldOffset(0)]
public TTF_CopyOperation copy;
}
public partial struct TTF_TextLayout
{
}
public unsafe partial struct TTF_TextData
{
public TTF_Font* font;
public SDL_FColor color;
[NativeTypeName("bool")]
public SDLBool needs_layout_update;
public TTF_TextLayout* layout;
public int x;
public int y;
public int w;
public int h;
public int num_ops;
public TTF_DrawOperation* ops;
public int num_clusters;
public TTF_SubString* clusters;
public SDL_PropertiesID props;
[NativeTypeName("bool")]
public SDLBool needs_engine_update;
public TTF_TextEngine* engine;
[NativeTypeName("void*")]
public IntPtr engine_text;
}
public unsafe partial struct TTF_TextEngine
{
[NativeTypeName("Uint32")]
public uint version;
[NativeTypeName("void*")]
public IntPtr userdata;
[NativeTypeName("bool (*)(void *, TTF_Text *)")]
public delegate* unmanaged[Cdecl]<IntPtr, TTF_Text*, SDLBool> CreateText;
[NativeTypeName("void (*)(void *, TTF_Text *)")]
public delegate* unmanaged[Cdecl]<IntPtr, TTF_Text*, void> DestroyText;
}
}

View File

@ -0,0 +1,666 @@
/*
<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 TTF_Font
{
}
public enum TTF_HintingFlags
{
TTF_HINTING_INVALID = -1,
TTF_HINTING_NORMAL,
TTF_HINTING_LIGHT,
TTF_HINTING_MONO,
TTF_HINTING_NONE,
TTF_HINTING_LIGHT_SUBPIXEL,
}
public enum TTF_HorizontalAlignment
{
TTF_HORIZONTAL_ALIGN_INVALID = -1,
TTF_HORIZONTAL_ALIGN_LEFT,
TTF_HORIZONTAL_ALIGN_CENTER,
TTF_HORIZONTAL_ALIGN_RIGHT,
}
public enum TTF_Direction
{
TTF_DIRECTION_INVALID = 0,
TTF_DIRECTION_LTR = 4,
TTF_DIRECTION_RTL,
TTF_DIRECTION_TTB,
TTF_DIRECTION_BTT,
}
public enum TTF_ImageType
{
TTF_IMAGE_INVALID,
TTF_IMAGE_ALPHA,
TTF_IMAGE_COLOR,
TTF_IMAGE_SDF,
}
public partial struct TTF_TextEngine
{
}
public partial struct TTF_TextData
{
}
public unsafe partial struct TTF_Text
{
[NativeTypeName("char *")]
public byte* text;
public int num_lines;
public int refcount;
public TTF_TextData* @internal;
}
public unsafe partial struct TTF_GPUAtlasDrawSequence
{
public SDL_GPUTexture* atlas_texture;
public SDL_FPoint* xy;
public SDL_FPoint* uv;
public int num_vertices;
public int* indices;
public int num_indices;
public TTF_ImageType image_type;
[NativeTypeName("struct TTF_GPUAtlasDrawSequence *")]
public TTF_GPUAtlasDrawSequence* next;
}
public enum TTF_GPUTextEngineWinding
{
TTF_GPU_TEXTENGINE_WINDING_INVALID = -1,
TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE,
TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE,
}
public partial struct TTF_SubString
{
public TTF_SubStringFlags flags;
public int offset;
public int length;
public int line_index;
public int cluster_index;
public SDL_Rect rect;
}
public static unsafe partial class SDL3_ttf
{
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int TTF_Version();
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_GetFreeTypeVersion(int* major, int* minor, int* patch);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_GetHarfBuzzVersion(int* major, int* minor, int* patch);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_Init();
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_Font* TTF_OpenFont([NativeTypeName("const char *")] byte* file, float ptsize);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_Font* TTF_OpenFontIO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio, float ptsize);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_Font* TTF_OpenFontWithProperties(SDL_PropertiesID props);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_Font* TTF_CopyFont(TTF_Font* existing_font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID TTF_GetFontProperties(TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint32")]
public static extern uint TTF_GetFontGeneration(TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_AddFallbackFont(TTF_Font* font, TTF_Font* fallback);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_RemoveFallbackFont(TTF_Font* font, TTF_Font* fallback);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_ClearFallbackFonts(TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetFontSize(TTF_Font* font, float ptsize);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetFontSizeDPI(TTF_Font* font, float ptsize, int hdpi, int vdpi);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float TTF_GetFontSize(TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetFontDPI(TTF_Font* font, int* hdpi, int* vdpi);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_SetFontStyle(TTF_Font* font, TTF_FontStyleFlags style);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_FontStyleFlags TTF_GetFontStyle([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetFontOutline(TTF_Font* font, int outline);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int TTF_GetFontOutline([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_SetFontHinting(TTF_Font* font, TTF_HintingFlags hinting);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int TTF_GetNumFontFaces([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_HintingFlags TTF_GetFontHinting([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetFontSDF(TTF_Font* font, [NativeTypeName("bool")] SDLBool enabled);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetFontSDF([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int TTF_GetFontWeight([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_SetFontWrapAlignment(TTF_Font* font, TTF_HorizontalAlignment align);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_HorizontalAlignment TTF_GetFontWrapAlignment([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int TTF_GetFontHeight([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int TTF_GetFontAscent([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int TTF_GetFontDescent([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_SetFontLineSkip(TTF_Font* font, int lineskip);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int TTF_GetFontLineSkip([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_SetFontKerning(TTF_Font* font, [NativeTypeName("bool")] SDLBool enabled);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetFontKerning([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_FontIsFixedWidth([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_FontIsScalable([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_GetFontFamilyName", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_TTF_GetFontFamilyName([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_GetFontStyleName", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_TTF_GetFontStyleName([NativeTypeName("const TTF_Font *")] TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetFontDirection(TTF_Font* font, TTF_Direction direction);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_Direction TTF_GetFontDirection(TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetFontCharSpacing(TTF_Font* font, int spacing);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int TTF_GetFontCharSpacing(TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint32")]
public static extern uint TTF_StringToTag([NativeTypeName("const char *")] byte* @string);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_TagToString([NativeTypeName("Uint32")] uint tag, [NativeTypeName("char *")] byte* @string, [NativeTypeName("size_t")] nuint size);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetFontScript(TTF_Font* font, [NativeTypeName("Uint32")] uint script);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint32")]
public static extern uint TTF_GetFontScript(TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint32")]
public static extern uint TTF_GetGlyphScript([NativeTypeName("Uint32")] uint ch);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetFontLanguage(TTF_Font* font, [NativeTypeName("const char *")] byte* language_bcp47);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_FontHasGlyph(TTF_Font* font, [NativeTypeName("Uint32")] uint ch);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_GetGlyphImage(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, TTF_ImageType* image_type);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_GetGlyphImageForIndex(TTF_Font* font, [NativeTypeName("Uint32")] uint glyph_index, TTF_ImageType* image_type);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetGlyphMetrics(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, int* minx, int* maxx, int* miny, int* maxy, int* advance);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetGlyphKerning(TTF_Font* font, [NativeTypeName("Uint32")] uint previous_ch, [NativeTypeName("Uint32")] uint ch, int* kerning);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetStringSize(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, int* w, int* h);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetStringSizeWrapped(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, int wrap_width, int* w, int* h);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_MeasureString(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, int max_width, int* measured_width, [NativeTypeName("size_t *")] nuint* measured_length);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderText_Solid(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderText_Solid_Wrapped(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, int wrapLength);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderGlyph_Solid(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, SDL_Color fg);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderText_Shaded(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, SDL_Color bg);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderText_Shaded_Wrapped(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, SDL_Color bg, int wrap_width);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderGlyph_Shaded(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, SDL_Color fg, SDL_Color bg);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderText_Blended(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderText_Blended_Wrapped(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, int wrap_width);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderGlyph_Blended(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, SDL_Color fg);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderText_LCD(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, SDL_Color bg);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderText_LCD_Wrapped(TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length, SDL_Color fg, SDL_Color bg, int wrap_width);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* TTF_RenderGlyph_LCD(TTF_Font* font, [NativeTypeName("Uint32")] uint ch, SDL_Color fg, SDL_Color bg);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_TextEngine* TTF_CreateSurfaceTextEngine();
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_DrawSurfaceText(TTF_Text* text, int x, int y, SDL_Surface* surface);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_DestroySurfaceTextEngine(TTF_TextEngine* engine);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_TextEngine* TTF_CreateRendererTextEngine(SDL_Renderer* renderer);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_TextEngine* TTF_CreateRendererTextEngineWithProperties(SDL_PropertiesID props);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_DrawRendererText(TTF_Text* text, float x, float y);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_DestroyRendererTextEngine(TTF_TextEngine* engine);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_TextEngine* TTF_CreateGPUTextEngine(SDL_GPUDevice* device);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_TextEngine* TTF_CreateGPUTextEngineWithProperties(SDL_PropertiesID props);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_GPUAtlasDrawSequence* TTF_GetGPUTextDrawData(TTF_Text* text);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_DestroyGPUTextEngine(TTF_TextEngine* engine);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_SetGPUTextEngineWinding(TTF_TextEngine* engine, TTF_GPUTextEngineWinding winding);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_GPUTextEngineWinding TTF_GetGPUTextEngineWinding([NativeTypeName("const TTF_TextEngine *")] TTF_TextEngine* engine);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_Text* TTF_CreateText(TTF_TextEngine* engine, TTF_Font* font, [NativeTypeName("const char *")] byte* text, [NativeTypeName("size_t")] nuint length);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID TTF_GetTextProperties(TTF_Text* text);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetTextEngine(TTF_Text* text, TTF_TextEngine* engine);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_TextEngine* TTF_GetTextEngine(TTF_Text* text);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetTextFont(TTF_Text* text, TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_Font* TTF_GetTextFont(TTF_Text* text);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetTextDirection(TTF_Text* text, TTF_Direction direction);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_Direction TTF_GetTextDirection(TTF_Text* text);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetTextScript(TTF_Text* text, [NativeTypeName("Uint32")] uint script);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Uint32")]
public static extern uint TTF_GetTextScript(TTF_Text* text);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetTextColor(TTF_Text* text, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b, [NativeTypeName("Uint8")] byte a);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetTextColorFloat(TTF_Text* text, float r, float g, float b, float a);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetTextColor(TTF_Text* text, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b, [NativeTypeName("Uint8 *")] byte* a);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetTextColorFloat(TTF_Text* text, float* r, float* g, float* b, float* a);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetTextPosition(TTF_Text* text, int x, int y);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetTextPosition(TTF_Text* text, int* x, int* y);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetTextWrapWidth(TTF_Text* text, int wrap_width);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetTextWrapWidth(TTF_Text* text, int* wrap_width);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetTextWrapWhitespaceVisible(TTF_Text* text, [NativeTypeName("bool")] SDLBool visible);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_TextWrapWhitespaceVisible(TTF_Text* text);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_SetTextString(TTF_Text* text, [NativeTypeName("const char *")] byte* @string, [NativeTypeName("size_t")] nuint length);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_InsertTextString(TTF_Text* text, int offset, [NativeTypeName("const char *")] byte* @string, [NativeTypeName("size_t")] nuint length);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_AppendTextString(TTF_Text* text, [NativeTypeName("const char *")] byte* @string, [NativeTypeName("size_t")] nuint length);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_DeleteTextString(TTF_Text* text, int offset, int length);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetTextSize(TTF_Text* text, int* w, int* h);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetTextSubString(TTF_Text* text, int offset, TTF_SubString* substring);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetTextSubStringForLine(TTF_Text* text, int line, TTF_SubString* substring);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern TTF_SubString** TTF_GetTextSubStringsForRange(TTF_Text* text, int offset, int length, int* count);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetTextSubStringForPoint(TTF_Text* text, int x, int y, TTF_SubString* substring);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetPreviousTextSubString(TTF_Text* text, [NativeTypeName("const TTF_SubString *")] TTF_SubString* substring, TTF_SubString* previous);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_GetNextTextSubString(TTF_Text* text, [NativeTypeName("const TTF_SubString *")] TTF_SubString* substring, TTF_SubString* next);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool TTF_UpdateText(TTF_Text* text);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_DestroyText(TTF_Text* text);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_CloseFont(TTF_Font* font);
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void TTF_Quit();
[DllImport("SDL3_ttf", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int TTF_WasInit();
[NativeTypeName("#define SDL_TTF_MAJOR_VERSION 3")]
public const int SDL_TTF_MAJOR_VERSION = 3;
[NativeTypeName("#define SDL_TTF_MINOR_VERSION 3")]
public const int SDL_TTF_MINOR_VERSION = 3;
[NativeTypeName("#define SDL_TTF_MICRO_VERSION 0")]
public const int SDL_TTF_MICRO_VERSION = 0;
[NativeTypeName("#define SDL_TTF_VERSION SDL_VERSIONNUM(SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)")]
public const int SDL_TTF_VERSION = ((3) * 1000000 + (3) * 1000 + (0));
[NativeTypeName("#define TTF_PROP_FONT_CREATE_FILENAME_STRING \"SDL_ttf.font.create.filename\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_CREATE_FILENAME_STRING => "SDL_ttf.font.create.filename"u8;
[NativeTypeName("#define TTF_PROP_FONT_CREATE_IOSTREAM_POINTER \"SDL_ttf.font.create.iostream\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_CREATE_IOSTREAM_POINTER => "SDL_ttf.font.create.iostream"u8;
[NativeTypeName("#define TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER \"SDL_ttf.font.create.iostream.offset\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER => "SDL_ttf.font.create.iostream.offset"u8;
[NativeTypeName("#define TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN \"SDL_ttf.font.create.iostream.autoclose\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN => "SDL_ttf.font.create.iostream.autoclose"u8;
[NativeTypeName("#define TTF_PROP_FONT_CREATE_SIZE_FLOAT \"SDL_ttf.font.create.size\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_CREATE_SIZE_FLOAT => "SDL_ttf.font.create.size"u8;
[NativeTypeName("#define TTF_PROP_FONT_CREATE_FACE_NUMBER \"SDL_ttf.font.create.face\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_CREATE_FACE_NUMBER => "SDL_ttf.font.create.face"u8;
[NativeTypeName("#define TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER \"SDL_ttf.font.create.hdpi\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER => "SDL_ttf.font.create.hdpi"u8;
[NativeTypeName("#define TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER \"SDL_ttf.font.create.vdpi\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER => "SDL_ttf.font.create.vdpi"u8;
[NativeTypeName("#define TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER \"SDL_ttf.font.create.existing_font\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER => "SDL_ttf.font.create.existing_font"u8;
[NativeTypeName("#define TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER \"SDL_ttf.font.outline.line_cap\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER => "SDL_ttf.font.outline.line_cap"u8;
[NativeTypeName("#define TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER \"SDL_ttf.font.outline.line_join\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER => "SDL_ttf.font.outline.line_join"u8;
[NativeTypeName("#define TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER \"SDL_ttf.font.outline.miter_limit\"")]
public static ReadOnlySpan<byte> TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER => "SDL_ttf.font.outline.miter_limit"u8;
[NativeTypeName("#define TTF_STYLE_NORMAL 0x00")]
public const int TTF_STYLE_NORMAL = 0x00;
[NativeTypeName("#define TTF_STYLE_BOLD 0x01")]
public const int TTF_STYLE_BOLD = 0x01;
[NativeTypeName("#define TTF_STYLE_ITALIC 0x02")]
public const int TTF_STYLE_ITALIC = 0x02;
[NativeTypeName("#define TTF_STYLE_UNDERLINE 0x04")]
public const int TTF_STYLE_UNDERLINE = 0x04;
[NativeTypeName("#define TTF_STYLE_STRIKETHROUGH 0x08")]
public const int TTF_STYLE_STRIKETHROUGH = 0x08;
[NativeTypeName("#define TTF_FONT_WEIGHT_THIN 100")]
public const int TTF_FONT_WEIGHT_THIN = 100;
[NativeTypeName("#define TTF_FONT_WEIGHT_EXTRA_LIGHT 200")]
public const int TTF_FONT_WEIGHT_EXTRA_LIGHT = 200;
[NativeTypeName("#define TTF_FONT_WEIGHT_LIGHT 300")]
public const int TTF_FONT_WEIGHT_LIGHT = 300;
[NativeTypeName("#define TTF_FONT_WEIGHT_NORMAL 400")]
public const int TTF_FONT_WEIGHT_NORMAL = 400;
[NativeTypeName("#define TTF_FONT_WEIGHT_MEDIUM 500")]
public const int TTF_FONT_WEIGHT_MEDIUM = 500;
[NativeTypeName("#define TTF_FONT_WEIGHT_SEMI_BOLD 600")]
public const int TTF_FONT_WEIGHT_SEMI_BOLD = 600;
[NativeTypeName("#define TTF_FONT_WEIGHT_BOLD 700")]
public const int TTF_FONT_WEIGHT_BOLD = 700;
[NativeTypeName("#define TTF_FONT_WEIGHT_EXTRA_BOLD 800")]
public const int TTF_FONT_WEIGHT_EXTRA_BOLD = 800;
[NativeTypeName("#define TTF_FONT_WEIGHT_BLACK 900")]
public const int TTF_FONT_WEIGHT_BLACK = 900;
[NativeTypeName("#define TTF_FONT_WEIGHT_EXTRA_BLACK 950")]
public const int TTF_FONT_WEIGHT_EXTRA_BLACK = 950;
[NativeTypeName("#define TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER_POINTER \"SDL_ttf.renderer_text_engine.create.renderer\"")]
public static ReadOnlySpan<byte> TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER_POINTER => "SDL_ttf.renderer_text_engine.create.renderer"u8;
[NativeTypeName("#define TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER \"SDL_ttf.renderer_text_engine.create.atlas_texture_size\"")]
public static ReadOnlySpan<byte> TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER => "SDL_ttf.renderer_text_engine.create.atlas_texture_size"u8;
[NativeTypeName("#define TTF_PROP_GPU_TEXT_ENGINE_DEVICE_POINTER \"SDL_ttf.gpu_text_engine.create.device\"")]
public static ReadOnlySpan<byte> TTF_PROP_GPU_TEXT_ENGINE_DEVICE_POINTER => "SDL_ttf.gpu_text_engine.create.device"u8;
[NativeTypeName("#define TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER \"SDL_ttf.gpu_text_engine.create.atlas_texture_size\"")]
public static ReadOnlySpan<byte> TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER => "SDL_ttf.gpu_text_engine.create.atlas_texture_size"u8;
[NativeTypeName("#define TTF_SUBSTRING_DIRECTION_MASK 0x000000FF")]
public const int TTF_SUBSTRING_DIRECTION_MASK = 0x000000FF;
[NativeTypeName("#define TTF_SUBSTRING_TEXT_START 0x00000100")]
public const int TTF_SUBSTRING_TEXT_START = 0x00000100;
[NativeTypeName("#define TTF_SUBSTRING_LINE_START 0x00000200")]
public const int TTF_SUBSTRING_LINE_START = 0x00000200;
[NativeTypeName("#define TTF_SUBSTRING_LINE_END 0x00000400")]
public const int TTF_SUBSTRING_LINE_END = 0x00000400;
[NativeTypeName("#define TTF_SUBSTRING_TEXT_END 0x00000800")]
public const int TTF_SUBSTRING_TEXT_END = 0x00000800;
}
}

View File

@ -0,0 +1,12 @@
// 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.
namespace SDL
{
#pragma warning disable CS0618 // Type or member is obsolete
public partial struct TTF_TextEngine : SDL3.ISDLInterface
#pragma warning restore CS0618 // Type or member is obsolete
{
uint SDL3.ISDLInterface.version { set => version = value; }
}
}

View File

@ -0,0 +1,38 @@
// 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 TTF_FontStyleFlags : UInt32
{
TTF_STYLE_NORMAL = SDL3_ttf.TTF_STYLE_NORMAL,
TTF_STYLE_BOLD = SDL3_ttf.TTF_STYLE_BOLD,
TTF_STYLE_ITALIC = SDL3_ttf.TTF_STYLE_ITALIC,
TTF_STYLE_UNDERLINE = SDL3_ttf.TTF_STYLE_UNDERLINE,
TTF_STYLE_STRIKETHROUGH = SDL3_ttf.TTF_STYLE_STRIKETHROUGH,
}
[Flags]
[Typedef]
public enum TTF_SubStringFlags : UInt32
{
TTF_SUBSTRING_DIRECTION_MASK = SDL3_ttf.TTF_SUBSTRING_DIRECTION_MASK,
TTF_SUBSTRING_TEXT_START = SDL3_ttf.TTF_SUBSTRING_TEXT_START,
TTF_SUBSTRING_LINE_START = SDL3_ttf.TTF_SUBSTRING_LINE_START,
TTF_SUBSTRING_LINE_END = SDL3_ttf.TTF_SUBSTRING_LINE_END,
TTF_SUBSTRING_TEXT_END = SDL3_ttf.TTF_SUBSTRING_TEXT_END,
}
public static unsafe partial class SDL3_ttf
{
[Macro]
public static bool SDL_TTF_VERSION_ATLEAST(int X, int Y, int Z) =>
((SDL_TTF_MAJOR_VERSION >= X) &&
(SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION >= Y) &&
(SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION > Y || SDL_TTF_MICRO_VERSION >= Z));
}
}

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,35 +4,6 @@
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/Versions/A/SDL3</string>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
@ -50,6 +21,55 @@
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/Versions/A/SDL3</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>tvos-arm64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
@ -67,20 +87,6 @@
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3.framework/SDL3</string>
<key>LibraryIdentifier</key>
<string>tvos-arm64</string>
<key>LibraryPath</key>
<string>SDL3.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>SDL3_image.framework/SDL3_image</string>
<key>LibraryIdentifier</key>
<string>tvos-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>SDL3_image.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>
<key>BinaryPath</key>
<string>SDL3_image.framework/SDL3_image</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>SDL3_image.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3_image.framework/SDL3_image</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>SDL3_image.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3_image.framework/Versions/A/SDL3_image</string>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>SDL3_image.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>SDL3_image.framework/SDL3_image</string>
<key>LibraryIdentifier</key>
<string>tvos-arm64</string>
<key>LibraryPath</key>
<string>SDL3_image.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

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