Compare commits

...

230 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 e34ff3f25a
Merge pull request #210 from ppy/update-native-binaries
Update native binaries
2025-06-08 19:07:43 +09:00
smoogipoo 693fcf308b Update native binaries 2025-06-08 09:56:16 +00:00
Dan Balasescu bb19215b54
Merge pull request #209 from smoogipoo/update-bindings
Update bindings to 7dd5e765df239986f78c9b0016e3f3023d885084
2025-06-08 18:51:19 +09:00
Susko3 89fa65f30c Add comment about the chosen buffer size 2025-06-06 18:56:04 +02:00
Susko3 7f8ddcd477 Add SDL_GetEventDescription to tests 2025-06-06 18:53:31 +02:00
Susko3 53bedf11e3 Add new SDL_haptic typedefs and enums
While SDL_HapticEffectType has flag-like values, it's publicly not a [Flags] enum
as the possible values are exclusive.
See for example https://wiki.libsdl.org/SDL3/SDL_HapticPeriodic.
2025-06-06 18:47:40 +02:00
Susko3 29c7e9c126 Add SDL_GetEventDescription helper 2025-06-06 18:23:59 +02:00
Dan Balasescu 831d80fc10
Update bindings to 7dd5e765df239986f78c9b0016e3f3023d885084 2025-06-06 20:17:45 +09:00
Dan Balasescu 23a162db1e
Merge pull request #208 from SaxxonPike/Enumerable-SdlArrays
Allow `foreach` enumeration over `SDLArray`
2025-06-06 20:03:05 +09:00
Anthony Konzel 080b1e571e Allow `foreach` enumeration over SDLArray 2025-06-05 12:57:08 -05:00
Dan Balasescu c61b11ee5d
Merge pull request #207 from SaxxonPike/Utf8String-Allocations
Allocate string memory only once in Utf8String when input lacks null terminator
2025-06-05 13:38:25 +09:00
Susko3 e4a0124bfc Clean up code 2025-06-05 02:16:48 +02:00
Anthony Konzel e18e833799 Reduce the number of string allocations in Utf8String when input strings do not contain a null terminator 2025-06-04 16:40:37 -05:00
Dan Balasescu 7124e530e1
Merge branch 'master' into feature/sdl-libs 2025-05-20 15:20:06 +09:00
Bartłomiej Dach 7155c09e71
Merge pull request #203 from hwsmm/add-pw
Update dependencies for Ubuntu 22.04
2025-02-25 08:50:41 +01:00
hwsmm 0b4f2d1e85 Use distro libdecor instead 2025-02-20 21:53:36 +09:00
Bartłomiej Dach 4cc974e2bc
Merge pull request #202 from ppy/update-native-binaries
Update native binaries
2025-02-20 13:31:22 +01:00
hwsmm c4d3ee27e8 Add PipeWire dependency 2025-02-20 21:25:51 +09:00
bdach 507c28c23c Update native binaries 2025-02-20 12:25:31 +00:00
Bartłomiej Dach 40d5663603
Merge pull request #201 from hwsmm/update
Update bindings
2025-02-20 13:20:40 +01:00
hwsmm c747f1dcdd Update bindings 2025-02-20 20:49:58 +09:00
Bartłomiej Dach 6cbfbf8aad
Bump ubuntu images & runners to 22.04
While this may mean the binaries produced will no longer be compatible
with some unix installations with older glibc versions present,
GitHub are pulling support for the `ubuntu-20.04` runner on April 1,
so we don't really have much of a say in this matter.

The docker image tags could possibly stay for a while longer, but the
whole reason why GitHub are pulling the 20.04 runners is that the LTS
period for Ubuntu 20.04 *also* ends on April 1, so maybe best to just
get it out of the way all across the board.
2025-02-12 15:18:01 +01:00
Susko3 710d4787a6
Merge pull request #200 from ppy/update-native-binaries
Update native binaries
2025-01-25 18:06:08 +00:00
Susko3 490ffdcaa4 Update native binaries 2025-01-25 18:00:42 +00:00
Susko3 d5ae94981e
Merge pull request #199 from hwsmm/ubuntu-arm-ver
Use ARM runners and Ubuntu 20.04 ARM
2025-01-25 17:56:22 +00:00
hwsmm 5f4ba18c0d
Apply suggestion
Co-authored-by: Susko3 <Susko3@protonmail.com>
2025-01-26 02:50:00 +09:00
hwsmm 10972ff222 Try ARM runners 2025-01-26 02:33:08 +09:00
Susko3 96486c7a02
Merge pull request #198 from Susko3/fix-sdl_pen-constants
Fix SDL_Pen constants
2025-01-25 17:23:27 +00:00
Susko3 87b6598855 Fix SDL_Pen constants 2025-01-25 17:19:15 +00:00
hwsmm 4ac4588e18 Use Ubuntu 20.04 ARM and make apt noninteractive 2025-01-26 02:09:44 +09:00
Susko3 e1fb215d12
Merge pull request #197 from Susko3/update-bindings
Update SDL3 bindings for Windows Ink support
2025-01-25 15:47:19 +00:00
Susko3 e9be289b30 Add new enum members 2025-01-25 15:33:05 +00:00
Susko3 b00293457a Update SDL3 bindings for Windows Ink support 2025-01-25 15:00:58 +00:00
Dan Balasescu ab7c7f5a9c
Merge pull request #196 from Susko3/add-SDL_GetTrayEntries-helper
Implement helper for `SDL_GetTrayEntries()`
2025-01-05 17:24:19 +09:00
Susko3 f988cb2d0b Implement helper for SDL_GetTrayEntries()
The returned array should not be SDL_free'd as it's a `const` pointer.
2025-01-05 04:33:11 +00:00
Susko3 3681588414
Merge pull request #195 from ppy/update-native-binaries
Update native binaries
2025-01-03 20:12:36 +01:00
smoogipoo 31ee86e59e Update native binaries 2025-01-02 06:30:45 +00:00
Dan Balasescu 07db29ef06
Merge pull request #194 from hwsmm/fix-build
Fix Windows builds
2025-01-02 15:00:33 +09:00
hwsmm 2f7c96d5bd Ignore git reset error 2025-01-02 14:08:46 +09:00
hwsmm 23a3b77bcd Fix build.sh formatting 2025-01-02 13:46:35 +09:00
hwsmm 9daf986190 Don't suppress pushd/popd output to make output clear 2025-01-02 13:31:46 +09:00
hwsmm 3c24492891 Use sed instead of a patch 2025-01-02 13:23:25 +09:00
Susko3 c86db6c2fd Revert "Clearly signal that sudo is not available on windows"
Breaks linux-arm and linux-arm64 build for some reason.
This reverts commit d836630eab.
2025-01-02 00:05:23 +01:00
Susko3 d836630eab Clearly signal that sudo is not available on windows 2025-01-01 23:44:59 +01:00
hwsmm c3dee83d20 Make bash quit on a command error 2025-01-02 00:52:41 +09:00
hwsmm d2e30d2167 Patch SDL to not include gameinput.h 2025-01-02 00:51:58 +09:00
Dan Balasescu 20e10af7aa
Merge pull request #190 from Susko3/SDL_tray-tests
Add simple `SDL_tray` test
2025-01-01 21:02:38 +09:00
Dan Balasescu 365fe5c594
Merge pull request #189 from hwsmm/update
Update bindings
2025-01-01 20:59:49 +09:00
Susko3 4ee7f7e617 Mark interactive test with `[Explicit]` 2024-12-31 02:57:20 +01:00
Susko3 3a0f3844b7 Add simple SDL_tray test
Just to get a feel for the API and to see how it works/behaves across operating systems.
2024-12-31 02:56:57 +01:00
Susko3 e017626460 Add SDL_tray 2024-12-31 01:06:32 +01:00
hwsmm d393ea3354 Update bindings 2024-12-29 20:12:05 +09:00
Susko3 061ef9ebfb
Merge pull request #187 from smoogipoo/fix-dockerfile-android
Fix Dockerfile not working with multi-targeted project
2024-12-18 14:18:02 +01:00
Dan Balasescu 7137484799
Merge pull request #184 from Susko3/update-bindings
Update SDL bindings
2024-12-18 15:13:35 +09:00
Dan Balasescu 3d92f36990
Fix Dockerfile not working with multi-targeted project 2024-12-18 15:06:42 +09:00
Dan Balasescu 09cd92181a
Merge pull request #185 from Susko3/fix-SDL_GetWindows-managed-helper
Fix `SDL_GetWindows()` managed helper
2024-12-18 12:35:34 +09:00
Dan Balasescu b89c25b60e
Merge pull request #186 from Susko3/publish-jetbrains-annotations
Publish JetBrains annotations
2024-12-18 12:17:08 +09:00
Susko3 8932ea3b6c Publish JetBrains annotations
Mandatory for making `[MustDisposeResource]` useful
2024-12-17 17:26:18 +01:00
Susko3 be946eb23c Add `SDLOpaquePointerArray` and use it for SDL_GetWindows()
`SDLPointerArray` is inadequate as it does `*(SDL_Window*)ptr` which doesn't make sense
as SDL_Window* is an opaque pointer type
2024-12-17 17:20:45 +01:00
Susko3 d5287637ef Add a simple usage test for SDL_GetWindows() 2024-12-17 17:20:39 +01:00
Susko3 d86ca88246 Update SDL bindings 2024-12-17 15:49:42 +01:00
Dean Herbert 5a7b49ca74
Merge pull request #182 from frenzibyte/ios-codesign
Specify default codesign key for iOS test project
2024-12-10 05:45:16 -08:00
Salman Alshamrani aac627922e Specify default codesign key for iOS test project 2024-12-10 04:25:48 -05: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
Susko3 882a88219e
Merge pull request #181 from smoogipoo/merge-android
Merge Android into the main project + NuGet package
2024-12-04 18:20:11 +00:00
Dan Balasescu 2cc61ee837
Remove IDEA workspaces 2024-12-04 14:56:41 +09:00
Dan Balasescu be06fff363
Update GHA workflows 2024-12-04 14:56:41 +09:00
Dan Balasescu cc37b8245b
Merge SDL3-CS.Android into main project 2024-12-04 14:14:07 +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
Susko3 7803512144
Merge pull request #180 from smoogipoo/add-docker-readme
Document binding generation in README
2024-12-03 11:37:08 +00:00
Dan Balasescu 50c10fc39e
Document binding generation in README 2024-12-03 17:40:10 +09:00
187 changed files with 4826 additions and 489 deletions

6
.gitattributes vendored
View File

@ -22,4 +22,8 @@ App.config text eol=crlf
.gitignore text eol=lf .gitignore text eol=lf
.gitattributes text eol=lf .gitattributes text eol=lf
*.md 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 * * *' # - cron: '0 0 * * *'
env: env:
BUILD_TYPE: Release BUILD_TYPE: Release
NDK_VER: 28.2.13676358
PLATFORM_VER: 35
jobs: jobs:
build: build:
@ -14,24 +16,41 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
platform: platform:
- { name: win-x64, os: windows-latest, flags: -A x64 } - { name: win-x64, os: windows-latest, flags: -A x64 }
- { name: win-x86, os: windows-latest, flags: -A Win32 } - { name: win-x86, os: windows-2022, flags: -A Win32 }
- { name: win-arm64, os: windows-latest, flags: -A ARM64 } - { name: win-arm64, os: windows-latest, flags: -A ARM64 }
- { name: linux-x64, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":amd64" } - { name: linux-x64, os: ubuntu-22.04, flags: -GNinja, target_apt_arch: ":amd64" }
- { name: linux-x86, os: ubuntu-20.04, flags: -GNinja -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32", target_apt_arch: ":i386" } - { name: linux-x86, os: ubuntu-22.04, flags: -GNinja -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DWAVPACK_ENABLE_ASM=OFF, target_apt_arch: ":i386" }
- { name: linux-arm64, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":arm64", container: arm64v8/ubuntu, docker_platform: linux/arm64/v8 } - { name: linux-arm64, os: ubuntu-22.04-arm, flags: -GNinja, target_apt_arch: ":arm64", container: "arm64v8/ubuntu:22.04" }
- { name: linux-arm, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":armhf", container: arm32v7/ubuntu, docker_platform: linux/arm/v7 } - { name: linux-arm, os: ubuntu-22.04-arm, flags: -GNinja -DCMAKE_C_FLAGS=-mfpu=neon -DCMAKE_CXX_FLAGS=-mfpu=neon, target_apt_arch: ":armhf", container: "arm32v7/ubuntu:22.04" }
- { name: osx-x64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 } - { name: osx-x64, os: macos-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. # NOTE: macOS 11.0 is the first released supported by Apple Silicon.
- { name: osx-arm64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 } - { name: osx-arm64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 }
- { 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: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: true submodules: recursive
- name: Set up QEMU - name: Setup JDK
if: contains(matrix.platform.container, 'arm') if: contains(matrix.platform.name, 'android')
uses: docker/setup-qemu-action@v3 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) - name: Build (Linux ARM)
if: contains(matrix.platform.container, 'arm') if: contains(matrix.platform.container, 'arm')
@ -43,12 +62,10 @@ jobs:
-e NAME=${{ matrix.platform.name }} -e NAME=${{ matrix.platform.name }}
-e TARGET_APT_ARCH=${{ matrix.platform.target_apt_arch }} -e TARGET_APT_ARCH=${{ matrix.platform.target_apt_arch }}
-e RUNNER_OS=${{ runner.os }} -e RUNNER_OS=${{ runner.os }}
-e FLAGS=${{ matrix.platform.flags }}
-e BUILD_TYPE=${{ env.BUILD_TYPE }} -e BUILD_TYPE=${{ env.BUILD_TYPE }}
--platform ${{ matrix.platform.docker_platform }}
run: | run: |
cd /workspace cd /workspace
./External/build.sh FLAGS="${{ matrix.platform.flags }}" ./External/build.sh
- name: Build - name: Build
if: ${{ !contains(matrix.platform.container, 'arm') }} if: ${{ !contains(matrix.platform.container, 'arm') }}
@ -58,6 +75,7 @@ jobs:
TARGET_APT_ARCH: ${{ matrix.platform.target_apt_arch }} TARGET_APT_ARCH: ${{ matrix.platform.target_apt_arch }}
RUNNER_OS: ${{ runner.os }} RUNNER_OS: ${{ runner.os }}
FLAGS: ${{ matrix.platform.flags }} FLAGS: ${{ matrix.platform.flags }}
ANDROID_ABI: ${{ matrix.platform.abi }}
run: ./External/build.sh run: ./External/build.sh
- name: Get Actions user id - name: Get Actions user id
@ -72,7 +90,12 @@ jobs:
user_id: ${{ steps.get_uid.outputs.uid }} user_id: ${{ steps.get_uid.outputs.uid }}
- name: Compress native directory - 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 - name: Upload native artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -83,30 +106,46 @@ jobs:
build-ios: build-ios:
name: ios name: ios
runs-on: macos-latest runs-on: macos-15
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: 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) - 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: | run: |
mkdir -p native/ios/SDL3.xcframework/ios-arm64/SDL3.framework; modules=("SDL3" "SDL3_image" "SDL3_ttf" "SDL3_mixer")
mkdir -p native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework; architectures=("ios-arm64" "ios-arm64_x86_64-simulator")
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; for module in "${modules[@]}"; do
cp External/SDL/Xcode/SDL/build/SDL3.xcframework/ios-arm64/SDL3.framework/Info.plist native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/Info.plist; module0="${module/SDL3/SDL}"
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; directory="External/${module0}/Xcode"
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; 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 - name: Compress native directory
run: tar -cf native-ios.tar native/ios run: tar -cvf native-ios.tar native/ios
- name: Upload native artifact - name: Upload native artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -115,12 +154,9 @@ jobs:
path: native-ios.tar path: native-ios.tar
if-no-files-found: error if-no-files-found: error
build-android: build-android-jar:
name: android name: android-jar
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
env:
NDK_VER: 23.1.7779620
PLATFORM_VER: android-34
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -136,56 +172,34 @@ jobs:
- name: Install Android SDK Manager - name: Install Android SDK Manager
uses: android-actions/setup-android@v3 uses: android-actions/setup-android@v3
with:
packages: ''
- name: Install Android SDK - name: Install Android SDK
run: | run: |
sdkmanager --install "platform-tools" "platforms;$PLATFORM_VER" sdkmanager --install "platforms;android-$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"
- name: Build SDL3 Android Java - name: Build SDL3 Android Java
run: | run: |
export JAVA_HOME=$JAVA_HOME_11_X64 export JAVA_HOME=$JAVA_HOME_11_X64
export PATH=$JAVA_HOME_11_X64/bin:$PATH export PATH=$JAVA_HOME_11_X64/bin:$PATH
export OUTPUT=$PWD/SDL3-CS.Android/Jars/ export OUTPUT=$PWD/SDL3-CS/Jars/
rm -rf $OUTPUT && mkdir -p $OUTPUT rm -rf $OUTPUT && mkdir -p $OUTPUT
# Build SDL3 Android Java part # Build SDL3 Android Java part
cd ./External/SDL/android-project/app/src/main/java 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 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 - name: Upload JAR artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: android-jar name: android-jar
path: SDL3-CS.Android/Jars/SDL3AndroidBridge.jar path: SDL3-CS/Jars/SDL3AndroidBridge.jar
if-no-files-found: error if-no-files-found: error
make-pr: make-pr:
name: Submit pull request name: Submit pull request
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [ build, build-ios, build-android ] needs: [ build, build-ios, build-android-jar ]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -207,7 +221,7 @@ jobs:
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: android-jar name: android-jar
path: SDL3-CS.Android/Jars/ path: SDL3-CS/Jars/
- name: Create pull request - name: Create pull request
uses: peter-evans/create-pull-request@v6 uses: peter-evans/create-pull-request@v6

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

@ -6,7 +6,7 @@ on:
- '*' - '*'
jobs: jobs:
desktop: pack:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -16,48 +16,30 @@ jobs:
with: with:
dotnet-version: 8.0.x dotnet-version: 8.0.x
- name: Build - name: Setup JDK 17
run: dotnet build SDL3-CS.Desktop.slnf -c Release uses: actions/setup-java@v4
with:
distribution: microsoft
java-version: 17
- name: Pack - name: Setup Android SDK
run: dotnet pack SDL3-CS/SDL3-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) uses: android-actions/setup-android@v3
- name: Install .NET workloads
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) -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 - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: SDL3-CS name: Packages
path: SDL3-CS/bin/Release/ppy.*.nupkg path: artifacts/ppy.*.nupkg
- name: Publish tagged release to nuget.org - name: Publish tagged release to nuget.org
run: dotnet nuget push SDL3-CS/bin/Release/ppy.*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} run: dotnet nuget push artifacts/ppy.*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}}
android:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install Android workload
# since windows image 20241113.3.0, not specifying a version here
# installs the .NET 7 version of android workload for very unknown reasons.
# revisit once we upgrade to .NET 9, it's probably fixed there.
run: dotnet workload install android --version (dotnet --version)
- name: Build
run: dotnet build SDL3-CS.Android.slnf -c Release
- name: Pack
run: dotnet pack SDL3-CS.Android\SDL3-CS.Android.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD)
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: SDL3-CS.Android
path: SDL3-CS.Android\bin\Release\ppy.*.nupkg
- name: Publish tagged release to nuget.org
run: dotnet nuget push SDL3-CS.Android\bin\Release\ppy.*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}}

2
.gitignore vendored
View File

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

12
.gitmodules vendored
View File

@ -1,3 +1,15 @@
[submodule "SDL"] [submodule "SDL"]
path = External/SDL path = External/SDL
url = https://github.com/libsdl-org/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

View File

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

View File

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

View File

@ -6,6 +6,12 @@ RUN apt-get update && \
WORKDIR /tmp WORKDIR /tmp
COPY .config/dotnet-tools.json .config/dotnet-tools.json COPY .config/dotnet-tools.json .config/dotnet-tools.json
COPY SDL3-CS/SDL3-CS.csproj SDL3-CS/SDL3-CS.csproj COPY SDL3-CS/SDL3-CS.csproj SDL3-CS/SDL3-CS.csproj
# .NET 8 installed using the distro package does not support the android workload.
# Since the project is only used for reference purposes, we'll retarget it to a single framework.
# See: https://github.com/dotnet/core/discussions/9258#discussioncomment-9548857
RUN sed -i 's/<TargetFrameworks.*$/<TargetFramework>net8.0<\/TargetFramework>/' SDL3-CS/SDL3-CS.csproj
RUN dotnet tool restore && \ RUN dotnet tool restore && \
dotnet restore --ucr SDL3-CS/SDL3-CS.csproj dotnet restore --ucr SDL3-CS/SDL3-CS.csproj
@ -16,4 +22,4 @@ RUN echo '#!/bin/bash' >> entrypoint.sh && \
echo 'python3 SDL3-CS/generate_bindings.py "$@"' >> entrypoint.sh && \ echo 'python3 SDL3-CS/generate_bindings.py "$@"' >> entrypoint.sh && \
chmod +x entrypoint.sh chmod +x entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

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

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

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

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

View File

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

2
External/SDL vendored

@ -1 +1 @@
Subproject commit e027b85cc457556071cbb2f3f1bcf8803c1bc001 Subproject commit 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

253
External/build.sh vendored
View File

@ -1,105 +1,186 @@
#!/bin/bash #!/bin/bash
pushd "$(dirname "$0")" >/dev/null set -e
pushd "$(dirname "$0")"
# Check if environment variables are defined # Check if environment variables are defined
if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS || -z $BUILD_TYPE ]]; then
echo "One or more required environment variables are not defined." echo "One or more required environment variables are not defined."
exit 1 exit 1
fi fi
SUDO=$(which sudo) if [[ $RUNNER_OS == 'Windows' ]]; then
SUDO=""
else
SUDO=$(which sudo || exit 0)
fi
if [[ $RUNNER_OS == 'Linux' ]]; then if [[ -n $ANDROID_ABI ]]; then
# Setup Linux dependencies BUILD_PLATFORM="Android"
if [[ $TARGET_APT_ARCH == :i386 ]]; then else
$SUDO dpkg --add-architecture i386 BUILD_PLATFORM="$RUNNER_OS"
fi
export DEBIAN_FRONTEND=noninteractive
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 fi
$SUDO apt-get update -y -qq NATIVE_PATH="android/$ANDROID_ABI"
if [[ $TARGET_APT_ARCH == :i386 ]]; then export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/$NDK_VER"
# Workaround GitHub's ubuntu-20.04 image issue <https://github.com/actions/virtual-environments/issues/4589> export FLAGS="$FLAGS -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
$SUDO apt-get install -y --allow-downgrades libpcre2-8-0=10.34-7 -DANDROID_HOME=$ANDROID_HOME \
fi -DANDROID_PLATFORM=21 \
-DANDROID_ABI=$ANDROID_ABI \
if [[ $NAME != 'linux-x86' && $NAME != 'linux-x64' ]]; then -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
GCC="gcc" -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH \
GPP="g++" -DCMAKE_INSTALL_INCLUDEDIR=include \
else -DCMAKE_INSTALL_LIBDIR=lib \
GCC="gcc-multilib" -DCMAKE_INSTALL_DATAROOTDIR=share \
GPP="g++-multilib" -DSDL_ANDROID_JAR=OFF"
fi
$SUDO apt-get install -y \ $SUDO apt-get install -y \
$GCC \ git \
$GPP \ cmake \
git \ ninja-build \
cmake \ meson
ninja-build \ fi
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
if [[ $TARGET_APT_ARCH != :i386 ]]; then if [[ $RUNNER_OS == 'Linux' ]]; then
# Build libdecor. git config --global --add safe.directory $PWD/SDL
# This is required so that window decorations can work on wayland. git config --global --add safe.directory $PWD/SDL_image
# The support will only be enabled in SDL, but we're not shipping the libdecor binaries git config --global --add safe.directory $PWD/SDL_ttf
# because making them work from a c# app as everything else does (via runtimes) is too difficult. git config --global --add safe.directory $PWD/SDL_mixer
# Also skip i386 because attempting to support this for i386 is a pain. fi
# Special shoutouts to gnome for refusing to support server-side decorations.
git clone https://gitlab.freedesktop.org/libdecor/libdecor.git CMAKE_INSTALL_PREFIX="$PWD/install_output"
cd libdecor rm -rf $CMAKE_INSTALL_PREFIX
git checkout 0.2.2
meson build --buildtype release if [[ $BUILD_PLATFORM == 'Android' ]]; then
$SUDO meson install -C build OUTPUT_LIB="lib/libSDL3variant.so"
cd .. 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 fi
fi
# Build SDL # Change the minumum Android API level for SDL_mixer to API 24 as opusfile and libflac fail to build on lower versions.
pushd SDL >/dev/null if [[ $BUILD_PLATFORM == 'Android' && $LIB_NAME == 'SDL_mixer' ]]; then
git reset --hard HEAD export FLAGS="${FLAGS/-DANDROID_PLATFORM=21/-DANDROID_PLATFORM=24}"
cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON fi
cmake --build build/ --config Release
$SUDO cmake --install build/ --prefix install_output --config Release
popd >/dev/null
# Move build lib into correct folders rm -rf build
if [[ $RUNNER_OS == 'Windows' ]]; then cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED=ON -DSDL_STATIC=OFF "${@:3}"
cp SDL/install_output/bin/SDL3.dll ../native/$NAME/SDL3.dll cmake --build build/ --config $BUILD_TYPE --verbose
elif [[ $RUNNER_OS == 'Linux' ]]; then cmake --install build/ --prefix $CMAKE_INSTALL_PREFIX --config $BUILD_TYPE
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
fi
popd >/dev/null # 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,12 +1,33 @@
# SDL3-CS # 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
| 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+ |
## Generating bindings
Bindings are generated via the provided Dockerfile:
```sh
docker build -t 'sdl-gen' .
docker run --rm -v .:/app -w /app -it sdl-gen
```
## License ## License

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,11 +2,13 @@
"solution": { "solution": {
"path": "SDL3-CS.sln", "path": "SDL3-CS.sln",
"projects": [ "projects": [
"SDL3-CS\\SDL3-CS.csproj",
"SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj", "SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj",
"SDL3-CS.Android\\SDL3-CS.Android.csproj", "SDL3-CS.Tests.Android\\SDL3-CS.Tests.Android.csproj",
"SDL3-CS.Tests\\SDL3-CS.Tests.csproj", "SDL3-CS.Tests\\SDL3-CS.Tests.csproj",
"SDL3-CS.Tests.Android\\SDL3-CS.Tests.Android.csproj" "SDL3-CS\\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

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

View File

@ -2,10 +2,13 @@
"solution": { "solution": {
"path": "SDL3-CS.sln", "path": "SDL3-CS.sln",
"projects": [ "projects": [
"SDL3-CS\\SDL3-CS.csproj",
"SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.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\\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) foreach (var kvp in finder.Methods)
{ {
if (kvp.Value.Count == 0)
return;
string filename = kvp.Key; string filename = kvp.Key;
var foundMethods = kvp.Value; var foundMethods = kvp.Value;
string className = ClassNameFromMethod(foundMethods.First().NativeMethod);
var result = new StringBuilder(); var result = new StringBuilder();
result.Append(file_header); result.Append(file_header);
result.Append( result.Append(
@ -42,7 +47,7 @@ using System;
SyntaxFactory.IdentifierName("SDL")) SyntaxFactory.IdentifierName("SDL"))
.WithMembers( .WithMembers(
SyntaxFactory.SingletonList<MemberDeclarationSyntax>( SyntaxFactory.SingletonList<MemberDeclarationSyntax>(
SyntaxFactory.ClassDeclaration("SDL3") SyntaxFactory.ClassDeclaration(className)
.WithModifiers( .WithModifiers(
SyntaxFactory.TokenList( SyntaxFactory.TokenList(
SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), 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) private static MemberDeclarationSyntax makeFriendlyMethod(GeneratedMethod gm)
{ {
var returnType = gm.RequiredChanges.HasFlag(Changes.ChangeReturnTypeToString) var returnType = gm.RequiredChanges.HasFlag(Changes.ChangeReturnTypeToString)
@ -126,7 +141,10 @@ using System;
if (gm.RequiredChanges.HasFlag(Changes.ChangeReturnTypeToString)) if (gm.RequiredChanges.HasFlag(Changes.ChangeReturnTypeToString))
{ {
expr = SyntaxFactory.InvocationExpression( expr = SyntaxFactory.InvocationExpression(
SyntaxFactory.IdentifierName("PtrToStringUTF8")) SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
SyntaxFactory.IdentifierName("SDL3"),
SyntaxFactory.IdentifierName("PtrToStringUTF8")))
.WithArguments(new[] .WithArguments(new[]
{ {
SyntaxFactory.Argument(makeFunctionCall(gm)), 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>>(); 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) public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
{ {
if (syntaxNode is MethodDeclarationSyntax method) if (syntaxNode is MethodDeclarationSyntax method)
{ {
string name = method.Identifier.ValueText; 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; return;
if (method.ParameterList.Parameters.Any(p => p.Identifier.IsKind(SyntaxKind.ArgListKeyword))) 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)] [Activity(Label = "SDL3-CS Android Tests", MainLauncher = true)]
public class MainActivity : SDLActivity 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(); protected override void Main() => Program.Main();
} }

View File

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

View File

@ -8,26 +8,21 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="NuGet">
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SDL3-CS.Tests\SDL3-CS.Tests.csproj"/> <ProjectReference Include="..\SDL3-CS.Tests\SDL3-CS.Tests.csproj"/>
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<SDLArch>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</SDLArch> <SDLArch Condition="'$(RuntimeIdentifier)' == ''">$(NETCoreSdkRuntimeIdentifier)</SDLArch>
<SDLArch Condition="'$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier)</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>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)..\native\$(SDLNativeLib)"> <Content Include="$(MSBuildThisFileDirectory)..\native\$(SDLArch)\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>

View File

@ -7,6 +7,9 @@ public class Program
public static unsafe void Main(string[] args) 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).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); 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> <PropertyGroup>
<TargetFramework>net8.0-ios</TargetFramework> <TargetFramework>net8.0-ios</TargetFramework>
@ -8,6 +8,11 @@
<ImplicitUsings>true</ImplicitUsings> <ImplicitUsings>true</ImplicitUsings>
<SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Label="NuGet">
<IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -16,6 +21,9 @@
<ItemGroup> <ItemGroup>
<NativeReference Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3.xcframework"/> <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> </ItemGroup>
</Project> </Project>

View File

@ -158,6 +158,10 @@ namespace SDL.Tests
SDL_Keymod mod = e.key.mod; SDL_Keymod mod = e.key.mod;
Console.WriteLine(mod); Console.WriteLine(mod);
break; break;
case SDL_Keycode.SDLK_E:
Console.WriteLine(SDL_GetEventDescription(e));
break;
} }
break; break;

View File

@ -3,6 +3,9 @@
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using static SDL.SDL3_image;
using static SDL.SDL3_ttf;
using static SDL.SDL3_mixer;
using static SDL.SDL3; using static SDL.SDL3;
namespace SDL.Tests namespace SDL.Tests
@ -25,13 +28,16 @@ namespace SDL.Tests
using (var window = new MyWindow()) 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(); printDisplays();
window.Setup(); window.Setup();
window.Create(); window.Create();
printWindows();
const SDL_Keymod state = SDL_Keymod.SDL_KMOD_CAPS | SDL_Keymod.SDL_KMOD_ALT; const SDL_Keymod state = SDL_Keymod.SDL_KMOD_CAPS | SDL_Keymod.SDL_KMOD_ALT;
SDL_SetModState(state); SDL_SetModState(state);
Debug.Assert(SDL_GetModState() == state); Debug.Assert(SDL_GetModState() == state);
@ -64,5 +70,17 @@ namespace SDL.Tests
} }
} }
} }
private static unsafe void printWindows()
{
using var windows = SDL_GetWindows();
if (windows == null)
return;
for (int i = 0; i < windows.Count; i++)
{
Console.WriteLine($"Window {i} title: {SDL_GetWindowTitle(windows[i])}");
}
}
} }
} }

View File

@ -10,6 +10,10 @@
<GenerateProgramFile>false</GenerateProgramFile> <GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="NuGet">
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0"/> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0"/>
<PackageReference Include="NUnit" Version="3.13.3"/> <PackageReference Include="NUnit" Version="3.13.3"/>
@ -18,6 +22,16 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SDL3-CS\SDL3-CS.csproj"/> <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> </ItemGroup>
</Project> </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();
}
}
}
}

View File

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

View File

@ -0,0 +1,117 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Runtime.InteropServices;
using NUnit.Framework;
namespace SDL.Tests
{
[TestFixture]
public class TestSDLArray
{
private static unsafe T* CopyToSdl<T>(T[] array)
where T : unmanaged
{
UIntPtr size = (UIntPtr)(Marshal.SizeOf<T>() * array.Length);
IntPtr target = SDL3.SDL_malloc(size);
fixed (T* source = array)
{
SDL3.SDL_memcpy(target, (IntPtr)source, size);
}
return (T*)target;
}
private static unsafe T** CopyToSdl<T>(T*[] array)
where T : unmanaged
{
UIntPtr size = (UIntPtr)(sizeof(IntPtr) * array.Length);
IntPtr target = SDL3.SDL_malloc(size);
fixed (T** source = array)
{
SDL3.SDL_memcpy(target, (IntPtr)source, size);
}
return (T**)target;
}
[Test]
public unsafe void TestArrayEnumerator()
{
int[] values = [10, 20, 30, 40];
int* sdlMemory = CopyToSdl(values);
using var array = new SDLArray<int>(sdlMemory, values.Length);
int index = 0;
foreach (int i in array)
{
Assert.AreEqual(values[index++], i);
}
}
[Test]
public unsafe void TestConstOpaquePointerArrayEnumerator()
{
int a = 10, b = 20, c = 30, d = 40;
int*[] values = [&a, &b, &c, &d];
int** sdlMemory = null;
// Const pointer arrays are not freed automatically. Since the
// unit test owns the memory, this must be done at the end of the
// test.
try
{
sdlMemory = CopyToSdl(values);
var array = new SDLConstOpaquePointerArray<int>(sdlMemory, values.Length);
int index = 0;
foreach (int* i in array)
{
Assert.AreEqual((IntPtr)values[index++], (IntPtr)i);
}
}
finally
{
if (sdlMemory != null)
SDL3.SDL_free(sdlMemory);
}
}
[Test]
public unsafe void TestOpaquePointerArrayEnumerator()
{
int a = 10, b = 20, c = 30, d = 40;
int*[] values = [&a, &b, &c, &d];
int** sdlMemory = CopyToSdl(values);
using var array = new SDLOpaquePointerArray<int>(sdlMemory, values.Length);
int index = 0;
foreach (int* i in array)
{
Assert.AreEqual((IntPtr)values[index++], (IntPtr)i);
}
}
[Test]
public unsafe void TestPointerArrayEnumerator()
{
int a = 10, b = 20, c = 30, d = 40;
int*[] values = [&a, &b, &c, &d];
int** memory = CopyToSdl(values);
using var array = new SDLPointerArray<int>(memory, values.Length);
int index = 0;
foreach (int i in array)
{
Assert.AreEqual(*values[index++], i);
}
}
}
}

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();
}
}
}
}

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

@ -0,0 +1,43 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using static SDL.SDL3;
namespace SDL.Tests
{
[Explicit("Uses an interactive tray icon.")]
public unsafe class TestTray : TrayTest
{
private volatile bool running;
[Test]
public void TestBasic()
{
var checkbox = SDL_InsertTrayEntryAt(RootMenu, -1, "Check box?", SDL_TrayEntryFlags.SDL_TRAYENTRY_CHECKBOX);
Assert.That(checkbox != null, SDL_GetError);
SetCallback(checkbox, () => Console.WriteLine("Checkbox was toggled."));
var separator = SDL_InsertTrayEntryAt(RootMenu, -1, (byte*)null, 0);
Assert.That(separator != null, SDL_GetError);
var exit = SDL_InsertTrayEntryAt(RootMenu, -1, "Exit tray", SDL_TrayEntryFlags.SDL_TRAYENTRY_BUTTON);
Assert.That(exit != null, SDL_GetError);
SetCallback(exit, () => running = false);
var entries = SDL_GetTrayEntries(RootMenu);
Assert.That(entries, Is.Not.Null, SDL_GetError);
Assert.That(entries!.Count, Is.EqualTo(3));
for (int i = 0; i < entries.Count; i++)
Console.WriteLine($"{i}. {SDL_GetTrayEntryLabel(entries[i]) ?? "<null>"}");
running = true;
while (running)
{
SDL_PumpEvents();
}
}
}
}

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

@ -0,0 +1,52 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using NUnit.Framework;
namespace SDL.Tests
{
[TestFixture]
public abstract unsafe class TrayTest
{
private SDL_Tray* tray;
protected SDL_TrayMenu* RootMenu { get; private set; }
[SetUp]
public void SetUp()
{
Assert.That(SDL3.SDL_Init(SDL_InitFlags.SDL_INIT_VIDEO), SDL3.SDL_GetError);
tray = SDL3.SDL_CreateTray(null, "Test tray");
Assert.That(tray != null, SDL3.SDL_GetError);
RootMenu = SDL3.SDL_CreateTrayMenu(tray);
Assert.That(RootMenu != null, SDL3.SDL_GetError);
}
protected static void SetCallback(SDL_TrayEntry* entry, Action callback)
{
var objectHandle = new ObjectHandle<Action>(callback, GCHandleType.Normal);
SDL3.SDL_SetTrayEntryCallback(entry, &nativeOnSelect, objectHandle.Handle); // this is leaking object handles, fine for tests
}
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvCdecl)])]
private static void nativeOnSelect(IntPtr userdata, SDL_TrayEntry* entry)
{
var objectHandle = new ObjectHandle<Action>(userdata, true);
if (objectHandle.GetTarget(out var action))
action();
else
Assert.Fail("Accessing disposed object handle.");
}
[TearDown]
public void TearDown()
{
if (tray != null)
SDL3.SDL_DestroyTray(tray);
SDL3.SDL_Quit();
}
}
}

View File

@ -2,10 +2,13 @@
"solution": { "solution": {
"path": "SDL3-CS.sln", "path": "SDL3-CS.sln",
"projects": [ "projects": [
"SDL3-CS\\SDL3-CS.csproj",
"SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.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\\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

@ -19,14 +19,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3-CS.SourceGeneration",
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3-CS.Tests", "SDL3-CS.Tests\SDL3-CS.Tests.csproj", "{CF980481-8227-4BED-970E-6433C83F64CB}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3-CS.Tests", "SDL3-CS.Tests\SDL3-CS.Tests.csproj", "{CF980481-8227-4BED-970E-6433C83F64CB}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Android", "SDL3-CS.Android\SDL3-CS.Android.csproj", "{CA28F49C-D0BE-47D6-9E82-7A0B8C380B8B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.Android", "SDL3-CS.Tests.Android\SDL3-CS.Tests.Android.csproj", "{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.Android", "SDL3-CS.Tests.Android\SDL3-CS.Tests.Android.csproj", "{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.iOS", "SDL3-CS.Tests.iOS\SDL3-CS.Tests.iOS.csproj", "{CCDD11EE-D552-4925-8B68-351AC9317589}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.iOS", "SDL3-CS.Tests.iOS\SDL3-CS.Tests.iOS.csproj", "{CCDD11EE-D552-4925-8B68-351AC9317589}"
EndProject 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}" 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 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 Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -45,10 +49,6 @@ Global
{CF980481-8227-4BED-970E-6433C83F64CB}.Debug|Any CPU.Build.0 = Debug|Any CPU {CF980481-8227-4BED-970E-6433C83F64CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF980481-8227-4BED-970E-6433C83F64CB}.Release|Any CPU.ActiveCfg = Release|Any CPU {CF980481-8227-4BED-970E-6433C83F64CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF980481-8227-4BED-970E-6433C83F64CB}.Release|Any CPU.Build.0 = Release|Any CPU {CF980481-8227-4BED-970E-6433C83F64CB}.Release|Any CPU.Build.0 = Release|Any CPU
{CA28F49C-D0BE-47D6-9E82-7A0B8C380B8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA28F49C-D0BE-47D6-9E82-7A0B8C380B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA28F49C-D0BE-47D6-9E82-7A0B8C380B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA28F49C-D0BE-47D6-9E82-7A0B8C380B8B}.Release|Any CPU.Build.0 = Release|Any CPU
{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU {E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -61,6 +61,18 @@ Global
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Debug|Any CPU.Build.0 = Debug|Any CPU {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.ActiveCfg = Release|Any CPU
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE 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; using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("SDL3-CS.Tests")] [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

@ -1,11 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SDL</RootNamespace> <RootNamespace>SDL</RootNamespace>
<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> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);SYSLIB1054;CA1401</NoWarn> <NoWarn>$(NoWarn);SYSLIB1054;CA1401</NoWarn>
<DefineConstants>$(DefineConstants);JETBRAINS_ANNOTATIONS</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="NuGet"> <PropertyGroup Label="NuGet">
@ -14,19 +17,23 @@
<Copyright>Copyright (c) 2024 ppy Pty Ltd</Copyright> <Copyright>Copyright (c) 2024 ppy Pty Ltd</Copyright>
<Product>ppy.SDL3-CS</Product> <Product>ppy.SDL3-CS</Product>
<PackageId>ppy.SDL3-CS</PackageId> <PackageId>ppy.SDL3-CS</PackageId>
<PackageTags>SDL;SDL3;SDL3-CS</PackageTags>
<PackageReleaseNotes>Automated release.</PackageReleaseNotes> <PackageReleaseNotes>Automated release.</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ppy/SDL3-CS</PackageProjectUrl> <PackageProjectUrl>https://github.com/ppy/SDL3-CS</PackageProjectUrl>
<PackageReadmeFile>README_nuget.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/ppy/SDL3-CS</RepositoryUrl> <RepositoryUrl>https://github.com/ppy/SDL3-CS</RepositoryUrl>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\README_nuget.md" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SDL3-CS.SourceGeneration\SDL3-CS.SourceGeneration.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/> <ProjectReference Include="..\SDL3-CS.SourceGeneration\SDL3-CS.SourceGeneration.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
<PackageReference Include="libclang" Version="17.0.4"> <PackageReference Include="libclang" Version="17.0.4">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
@ -73,8 +80,8 @@
<PackagePath>runtimes/linux-arm/native</PackagePath> <PackagePath>runtimes/linux-arm/native</PackagePath>
<Pack>true</Pack> <Pack>true</Pack>
</None> </None>
<None Include="$(MSBuildThisFileDirectory)..\native\ios\**\*"> <None Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3.xcframework\**\*">
<PackagePath>runtimes/ios/native</PackagePath> <PackagePath>runtimes/ios/native/SDL3.xcframework</PackagePath>
<Pack>true</Pack> <Pack>true</Pack>
</None> </None>
<None Include="$(MSBuildThisFileDirectory)..\native\android\armeabi-v7a\libSDL3.so"> <None Include="$(MSBuildThisFileDirectory)..\native\android\armeabi-v7a\libSDL3.so">
@ -93,6 +100,7 @@
<PackagePath>runtimes/android-x86/native</PackagePath> <PackagePath>runtimes/android-x86/native</PackagePath>
<Pack>true</Pack> <Pack>true</Pack>
</None> </None>
<EmbeddedJar Include="Jars\SDL3AndroidBridge.jar"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,119 @@
/*
<auto-generated/>
C# bindings for Simple DirectMedia Layer.
Original copyright notice of input files:
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
using System;
using System.Runtime.InteropServices;
namespace SDL
{
public partial struct SDL_AsyncIO
{
}
public enum SDL_AsyncIOTaskType
{
SDL_ASYNCIO_TASK_READ,
SDL_ASYNCIO_TASK_WRITE,
SDL_ASYNCIO_TASK_CLOSE,
}
public enum SDL_AsyncIOResult
{
SDL_ASYNCIO_COMPLETE,
SDL_ASYNCIO_FAILURE,
SDL_ASYNCIO_CANCELED,
}
public unsafe partial struct SDL_AsyncIOOutcome
{
public SDL_AsyncIO* asyncio;
public SDL_AsyncIOTaskType type;
public SDL_AsyncIOResult result;
[NativeTypeName("void*")]
public IntPtr buffer;
[NativeTypeName("Uint64")]
public ulong offset;
[NativeTypeName("Uint64")]
public ulong bytes_requested;
[NativeTypeName("Uint64")]
public ulong bytes_transferred;
[NativeTypeName("void*")]
public IntPtr userdata;
}
public partial struct SDL_AsyncIOQueue
{
}
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_AsyncIO* SDL_AsyncIOFromFile([NativeTypeName("const char *")] byte* file, [NativeTypeName("const char *")] byte* mode);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("Sint64")]
public static extern long SDL_GetAsyncIOSize(SDL_AsyncIO* asyncio);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_ReadAsyncIO(SDL_AsyncIO* asyncio, [NativeTypeName("void*")] IntPtr ptr, [NativeTypeName("Uint64")] ulong offset, [NativeTypeName("Uint64")] ulong size, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_WriteAsyncIO(SDL_AsyncIO* asyncio, [NativeTypeName("void*")] IntPtr ptr, [NativeTypeName("Uint64")] ulong offset, [NativeTypeName("Uint64")] ulong size, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_CloseAsyncIO(SDL_AsyncIO* asyncio, [NativeTypeName("bool")] SDLBool flush, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_AsyncIOQueue* SDL_CreateAsyncIOQueue();
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue* queue);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_GetAsyncIOResult(SDL_AsyncIOQueue* queue, SDL_AsyncIOOutcome* outcome);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_WaitAsyncIOResult(SDL_AsyncIOQueue* queue, SDL_AsyncIOOutcome* outcome, [NativeTypeName("Sint32")] int timeoutMS);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_SignalAsyncIOQueue(SDL_AsyncIOQueue* queue);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_LoadFileAsync([NativeTypeName("const char *")] byte* file, SDL_AsyncIOQueue* queue, [NativeTypeName("void*")] IntPtr userdata);
}
}

View File

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

View File

@ -89,15 +89,23 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_PauseAudioDevice(SDL_AudioDeviceID dev); public static extern SDLBool SDL_IsAudioDevicePhysical(SDL_AudioDeviceID devid);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); public static extern SDLBool SDL_IsAudioDevicePlayback(SDL_AudioDeviceID devid);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_AudioDevicePaused(SDL_AudioDeviceID dev); public static extern SDLBool SDL_PauseAudioDevice(SDL_AudioDeviceID devid);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_ResumeAudioDevice(SDL_AudioDeviceID devid);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_AudioDevicePaused(SDL_AudioDeviceID devid);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid); public static extern float SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid);
@ -111,14 +119,14 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream** streams, int num_streams); public static extern SDLBool SDL_BindAudioStreams(SDL_AudioDeviceID devid, [NativeTypeName("SDL_AudioStream *const *")] SDL_AudioStream** streams, int num_streams);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream* stream); public static extern SDLBool SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream* stream);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_UnbindAudioStreams(SDL_AudioStream** streams, int num_streams); public static extern void SDL_UnbindAudioStreams([NativeTypeName("SDL_AudioStream *const *")] SDL_AudioStream** streams, int num_streams);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_UnbindAudioStream(SDL_AudioStream* stream); public static extern void SDL_UnbindAudioStream(SDL_AudioStream* stream);
@ -172,6 +180,14 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_PutAudioStreamData(SDL_AudioStream* stream, [NativeTypeName("const void *")] IntPtr buf, int len); public static extern SDLBool SDL_PutAudioStreamData(SDL_AudioStream* stream, [NativeTypeName("const void *")] IntPtr buf, int len);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_PutAudioStreamDataNoCopy(SDL_AudioStream* stream, [NativeTypeName("const void *")] IntPtr buf, int len, [NativeTypeName("SDL_AudioStreamDataCompleteCallback")] delegate* unmanaged[Cdecl]<IntPtr, IntPtr, int, void> callback, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_PutAudioStreamPlanarData(SDL_AudioStream* stream, [NativeTypeName("const void *const *")] IntPtr* channel_buffers, int num_channels, int num_samples);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetAudioStreamData(SDL_AudioStream* stream, [NativeTypeName("void*")] IntPtr buf, int len); public static extern int SDL_GetAudioStreamData(SDL_AudioStream* stream, [NativeTypeName("void*")] IntPtr buf, int len);
@ -197,6 +213,10 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_ResumeAudioStreamDevice(SDL_AudioStream* stream); public static extern SDLBool SDL_ResumeAudioStreamDevice(SDL_AudioStream* stream);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_AudioStreamDevicePaused(SDL_AudioStream* stream);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_LockAudioStream(SDL_AudioStream* stream); public static extern SDLBool SDL_LockAudioStream(SDL_AudioStream* stream);
@ -263,5 +283,8 @@ namespace SDL
[NativeTypeName("#define SDL_AUDIO_DEVICE_DEFAULT_RECORDING ((SDL_AudioDeviceID) 0xFFFFFFFEu)")] [NativeTypeName("#define SDL_AUDIO_DEVICE_DEFAULT_RECORDING ((SDL_AudioDeviceID) 0xFFFFFFFEu)")]
public const SDL_AudioDeviceID 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, 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 public static unsafe partial class SDL3
{ {
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -70,7 +77,7 @@ namespace SDL
public static extern SDL_CameraID* SDL_GetCameras(int* count); public static extern SDL_CameraID* SDL_GetCameras(int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_CameraSpec** SDL_GetCameraSupportedFormats(SDL_CameraID devid, int* count); public static extern SDL_CameraSpec** SDL_GetCameraSupportedFormats(SDL_CameraID instance_id, int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraName", ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraName", ExactSpelling = true)]
[return: NativeTypeName("const char *")] [return: NativeTypeName("const char *")]
@ -83,7 +90,7 @@ namespace SDL
public static extern SDL_Camera* SDL_OpenCamera(SDL_CameraID instance_id, [NativeTypeName("const SDL_CameraSpec *")] SDL_CameraSpec* spec); 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)] [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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_CameraID SDL_GetCameraID(SDL_Camera* camera); public static extern SDL_CameraID SDL_GetCameraID(SDL_Camera* camera);

View File

@ -98,6 +98,9 @@ namespace SDL
[return: NativeTypeName("size_t")] [return: NativeTypeName("size_t")]
public static extern nuint SDL_GetSIMDAlignment(); 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")] [NativeTypeName("#define SDL_CACHELINE_SIZE 128")]
public const int SDL_CACHELINE_SIZE = 128; public const int SDL_CACHELINE_SIZE = 128;
} }

View File

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

View File

@ -48,8 +48,9 @@ namespace SDL
SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED, SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED,
SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED, SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED,
SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED, SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED,
SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED,
SDL_EVENT_DISPLAY_FIRST = SDL_EVENT_DISPLAY_ORIENTATION, 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_SHOWN = 0x202,
SDL_EVENT_WINDOW_HIDDEN, SDL_EVENT_WINDOW_HIDDEN,
SDL_EVENT_WINDOW_EXPOSED, SDL_EVENT_WINDOW_EXPOSED,
@ -85,6 +86,8 @@ namespace SDL
SDL_EVENT_KEYBOARD_ADDED, SDL_EVENT_KEYBOARD_ADDED,
SDL_EVENT_KEYBOARD_REMOVED, SDL_EVENT_KEYBOARD_REMOVED,
SDL_EVENT_TEXT_EDITING_CANDIDATES, SDL_EVENT_TEXT_EDITING_CANDIDATES,
SDL_EVENT_SCREEN_KEYBOARD_SHOWN,
SDL_EVENT_SCREEN_KEYBOARD_HIDDEN,
SDL_EVENT_MOUSE_MOTION = 0x400, SDL_EVENT_MOUSE_MOTION = 0x400,
SDL_EVENT_MOUSE_BUTTON_DOWN, SDL_EVENT_MOUSE_BUTTON_DOWN,
SDL_EVENT_MOUSE_BUTTON_UP, SDL_EVENT_MOUSE_BUTTON_UP,
@ -115,6 +118,10 @@ namespace SDL
SDL_EVENT_FINGER_DOWN = 0x700, SDL_EVENT_FINGER_DOWN = 0x700,
SDL_EVENT_FINGER_UP, SDL_EVENT_FINGER_UP,
SDL_EVENT_FINGER_MOTION, SDL_EVENT_FINGER_MOTION,
SDL_EVENT_FINGER_CANCELED,
SDL_EVENT_PINCH_BEGIN = 0x710,
SDL_EVENT_PINCH_UPDATE,
SDL_EVENT_PINCH_END,
SDL_EVENT_CLIPBOARD_UPDATE = 0x900, SDL_EVENT_CLIPBOARD_UPDATE = 0x900,
SDL_EVENT_DROP_FILE = 0x1000, SDL_EVENT_DROP_FILE = 0x1000,
SDL_EVENT_DROP_TEXT, SDL_EVENT_DROP_TEXT,
@ -407,6 +414,12 @@ namespace SDL
public float mouse_x; public float mouse_x;
public float mouse_y; public float mouse_y;
[NativeTypeName("Sint32")]
public int integer_x;
[NativeTypeName("Sint32")]
public int integer_y;
} }
public partial struct SDL_JoyAxisEvent public partial struct SDL_JoyAxisEvent
@ -711,6 +724,19 @@ namespace SDL
public SDL_CameraID which; public SDL_CameraID which;
} }
public partial struct SDL_RenderEvent
{
public SDL_EventType type;
[NativeTypeName("Uint32")]
public uint reserved;
[NativeTypeName("Uint64")]
public ulong timestamp;
public SDL_WindowID windowID;
}
public partial struct SDL_TouchFingerEvent public partial struct SDL_TouchFingerEvent
{ {
public SDL_EventType type; public SDL_EventType type;
@ -738,6 +764,21 @@ namespace SDL
public SDL_WindowID windowID; 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 partial struct SDL_PenProximityEvent
{ {
public SDL_EventType type; public SDL_EventType type;
@ -890,7 +931,7 @@ namespace SDL
public SDLBool owner; public SDLBool owner;
[NativeTypeName("Sint32")] [NativeTypeName("Sint32")]
public int n_mime_types; public int num_mime_types;
[NativeTypeName("const char **")] [NativeTypeName("const char **")]
public byte** mime_types; public byte** mime_types;
@ -1049,6 +1090,9 @@ namespace SDL
[FieldOffset(0)] [FieldOffset(0)]
public SDL_TouchFingerEvent tfinger; public SDL_TouchFingerEvent tfinger;
[FieldOffset(0)]
public SDL_PinchFingerEvent pinch;
[FieldOffset(0)] [FieldOffset(0)]
public SDL_PenProximityEvent pproximity; public SDL_PenProximityEvent pproximity;
@ -1064,6 +1108,9 @@ namespace SDL
[FieldOffset(0)] [FieldOffset(0)]
public SDL_PenAxisEvent paxis; public SDL_PenAxisEvent paxis;
[FieldOffset(0)]
public SDL_RenderEvent render;
[FieldOffset(0)] [FieldOffset(0)]
public SDL_DropEvent drop; public SDL_DropEvent drop;
@ -1156,5 +1203,8 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Window* SDL_GetWindowFromEvent([NativeTypeName("const SDL_Event *")] SDL_Event* @event); public static extern SDL_Window* SDL_GetWindowFromEvent([NativeTypeName("const SDL_Event *")] SDL_Event* @event);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_GetEventDescription([NativeTypeName("const SDL_Event *")] SDL_Event* @event, [NativeTypeName("char *")] byte* buf, int buflen);
} }
} }

View File

@ -115,6 +115,10 @@ namespace SDL
[return: NativeTypeName("char **")] [return: NativeTypeName("char **")]
public static extern byte** SDL_GlobDirectory([NativeTypeName("const char *")] byte* path, [NativeTypeName("const char *")] byte* pattern, SDL_GlobFlags flags, int* count); public static extern byte** SDL_GlobDirectory([NativeTypeName("const char *")] byte* path, [NativeTypeName("const char *")] byte* pattern, SDL_GlobFlags flags, int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCurrentDirectory", ExactSpelling = true)]
[return: NativeTypeName("char *")]
public static extern byte* Unsafe_SDL_GetCurrentDirectory();
[NativeTypeName("#define SDL_GLOB_CASEINSENSITIVE (1u << 0)")] [NativeTypeName("#define SDL_GLOB_CASEINSENSITIVE (1u << 0)")]
public const uint SDL_GLOB_CASEINSENSITIVE = (1U << 0); public const uint SDL_GLOB_CASEINSENSITIVE = (1U << 0);
} }

View File

@ -45,6 +45,7 @@ namespace SDL
SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT,
SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT,
SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR, SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR,
SDL_GAMEPAD_TYPE_GAMECUBE,
SDL_GAMEPAD_TYPE_COUNT, SDL_GAMEPAD_TYPE_COUNT,
} }
@ -117,12 +118,12 @@ namespace SDL
{ {
public SDL_GamepadBindingType input_type; public SDL_GamepadBindingType input_type;
[NativeTypeName("__AnonymousRecord_SDL_gamepad_L247_C5")] [NativeTypeName("__AnonymousRecord_SDL_gamepad_L267_C5")]
public _input_e__Union input; public _input_e__Union input;
public SDL_GamepadBindingType output_type; public SDL_GamepadBindingType output_type;
[NativeTypeName("__AnonymousRecord_SDL_gamepad_L267_C5")] [NativeTypeName("__AnonymousRecord_SDL_gamepad_L287_C5")]
public _output_e__Union output; public _output_e__Union output;
[StructLayout(LayoutKind.Explicit)] [StructLayout(LayoutKind.Explicit)]
@ -132,11 +133,11 @@ namespace SDL
public int button; public int button;
[FieldOffset(0)] [FieldOffset(0)]
[NativeTypeName("__AnonymousRecord_SDL_gamepad_L251_C9")] [NativeTypeName("__AnonymousRecord_SDL_gamepad_L271_C9")]
public _axis_e__Struct axis; public _axis_e__Struct axis;
[FieldOffset(0)] [FieldOffset(0)]
[NativeTypeName("__AnonymousRecord_SDL_gamepad_L258_C9")] [NativeTypeName("__AnonymousRecord_SDL_gamepad_L278_C9")]
public _hat_e__Struct hat; public _hat_e__Struct hat;
public partial struct _axis_e__Struct public partial struct _axis_e__Struct
@ -163,7 +164,7 @@ namespace SDL
public SDL_GamepadButton button; public SDL_GamepadButton button;
[FieldOffset(0)] [FieldOffset(0)]
[NativeTypeName("__AnonymousRecord_SDL_gamepad_L271_C9")] [NativeTypeName("__AnonymousRecord_SDL_gamepad_L291_C9")]
public _axis_e__Struct axis; public _axis_e__Struct axis;
public partial struct _axis_e__Struct public partial struct _axis_e__Struct

View File

@ -403,7 +403,7 @@ namespace SDL
SDL_GPU_SWAPCHAINCOMPOSITION_SDR, SDL_GPU_SWAPCHAINCOMPOSITION_SDR,
SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR, SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR,
SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR, SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR,
SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048, SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084,
} }
public partial struct SDL_GPUViewport public partial struct SDL_GPUViewport
@ -813,8 +813,8 @@ namespace SDL
[NativeTypeName("bool")] [NativeTypeName("bool")]
public SDLBool enable_mask; public SDLBool enable_mask;
[NativeTypeName("Uint8")] [NativeTypeName("bool")]
public byte padding1; public SDLBool enable_alpha_to_coverage;
[NativeTypeName("Uint8")] [NativeTypeName("Uint8")]
public byte padding2; public byte padding2;
@ -1008,10 +1008,10 @@ namespace SDL
public byte clear_stencil; public byte clear_stencil;
[NativeTypeName("Uint8")] [NativeTypeName("Uint8")]
public byte padding1; public byte mip_level;
[NativeTypeName("Uint8")] [NativeTypeName("Uint8")]
public byte padding2; public byte layer;
} }
public partial struct SDL_GPUBlitInfo public partial struct SDL_GPUBlitInfo
@ -1096,6 +1096,30 @@ namespace SDL
public byte padding3; 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 public static unsafe partial class SDL3
{ {
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -1129,6 +1153,9 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_GPUShaderFormat SDL_GetGPUShaderFormats(SDL_GPUDevice* device); public static extern SDL_GPUShaderFormat SDL_GetGPUShaderFormats(SDL_GPUDevice* device);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_PropertiesID SDL_GetGPUDeviceProperties(SDL_GPUDevice* device);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_GPUComputePipeline* SDL_CreateGPUComputePipeline(SDL_GPUDevice* device, [NativeTypeName("const SDL_GPUComputePipelineCreateInfo *")] SDL_GPUComputePipelineCreateInfo* createinfo); public static extern SDL_GPUComputePipeline* SDL_CreateGPUComputePipeline(SDL_GPUDevice* device, [NativeTypeName("const SDL_GPUComputePipelineCreateInfo *")] SDL_GPUComputePipelineCreateInfo* createinfo);
@ -1335,6 +1362,10 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetGPUSwapchainParameters(SDL_GPUDevice* device, SDL_Window* window, SDL_GPUSwapchainComposition swapchain_composition, SDL_GPUPresentMode present_mode); public static extern SDLBool SDL_SetGPUSwapchainParameters(SDL_GPUDevice* device, SDL_Window* window, SDL_GPUSwapchainComposition swapchain_composition, SDL_GPUPresentMode present_mode);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetGPUAllowedFramesInFlight(SDL_GPUDevice* device, [NativeTypeName("Uint32")] uint allowed_frames_in_flight);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat(SDL_GPUDevice* device, SDL_Window* window); public static extern SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat(SDL_GPUDevice* device, SDL_Window* window);
@ -1342,6 +1373,14 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_AcquireGPUSwapchainTexture(SDL_GPUCommandBuffer* command_buffer, SDL_Window* window, SDL_GPUTexture** swapchain_texture, [NativeTypeName("Uint32 *")] uint* swapchain_texture_width, [NativeTypeName("Uint32 *")] uint* swapchain_texture_height); public static extern SDLBool SDL_AcquireGPUSwapchainTexture(SDL_GPUCommandBuffer* command_buffer, SDL_Window* window, SDL_GPUTexture** swapchain_texture, [NativeTypeName("Uint32 *")] uint* swapchain_texture_width, [NativeTypeName("Uint32 *")] uint* swapchain_texture_height);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_WaitForGPUSwapchain(SDL_GPUDevice* device, SDL_Window* window);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_WaitAndAcquireGPUSwapchainTexture(SDL_GPUCommandBuffer* command_buffer, SDL_Window* window, SDL_GPUTexture** swapchain_texture, [NativeTypeName("Uint32 *")] uint* swapchain_texture_width, [NativeTypeName("Uint32 *")] uint* swapchain_texture_height);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_SubmitGPUCommandBuffer(SDL_GPUCommandBuffer* command_buffer); public static extern SDLBool SDL_SubmitGPUCommandBuffer(SDL_GPUCommandBuffer* command_buffer);
@ -1384,6 +1423,12 @@ namespace SDL
[return: NativeTypeName("Uint32")] [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); 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)")] [NativeTypeName("#define SDL_GPU_TEXTUREUSAGE_SAMPLER (1u << 0)")]
public const uint SDL_GPU_TEXTUREUSAGE_SAMPLER = (1U << 0); public const uint SDL_GPU_TEXTUREUSAGE_SAMPLER = (1U << 0);
@ -1456,33 +1501,30 @@ namespace SDL
[NativeTypeName("#define SDL_GPU_COLORCOMPONENT_A (1u << 3)")] [NativeTypeName("#define SDL_GPU_COLORCOMPONENT_A (1u << 3)")]
public const uint SDL_GPU_COLORCOMPONENT_A = (1U << 3); public const uint SDL_GPU_COLORCOMPONENT_A = (1U << 3);
[NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT \"SDL.gpu.createtexture.d3d12.clear.r\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT => "SDL.gpu.createtexture.d3d12.clear.r"u8;
[NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT \"SDL.gpu.createtexture.d3d12.clear.g\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT => "SDL.gpu.createtexture.d3d12.clear.g"u8;
[NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT \"SDL.gpu.createtexture.d3d12.clear.b\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT => "SDL.gpu.createtexture.d3d12.clear.b"u8;
[NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT \"SDL.gpu.createtexture.d3d12.clear.a\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT => "SDL.gpu.createtexture.d3d12.clear.a"u8;
[NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT \"SDL.gpu.createtexture.d3d12.clear.depth\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT => "SDL.gpu.createtexture.d3d12.clear.depth"u8;
[NativeTypeName("#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 \"SDL.gpu.createtexture.d3d12.clear.stencil\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 => "SDL.gpu.createtexture.d3d12.clear.stencil"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN \"SDL.gpu.device.create.debugmode\"")] [NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN \"SDL.gpu.device.create.debugmode\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN => "SDL.gpu.device.create.debugmode"u8; public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN => "SDL.gpu.device.create.debugmode"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN \"SDL.gpu.device.create.preferlowpower\"")] [NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN \"SDL.gpu.device.create.preferlowpower\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN => "SDL.gpu.device.create.preferlowpower"u8; public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN => "SDL.gpu.device.create.preferlowpower"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN \"SDL.gpu.device.create.verbose\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN => "SDL.gpu.device.create.verbose"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING \"SDL.gpu.device.create.name\"")] [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; 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\"")] [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; public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN => "SDL.gpu.device.create.shaders.private"u8;
@ -1501,7 +1543,67 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN \"SDL.gpu.device.create.shaders.metallib\"")] [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; 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\"")] [NativeTypeName("#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING \"SDL.gpu.device.create.d3d12.semantic\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING => "SDL.gpu.device.create.d3d12.semantic"u8; public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING => "SDL.gpu.device.create.d3d12.semantic"u8;
[NativeTypeName("#define SDL_PROP_GPU_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_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;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING \"SDL.gpu.device.driver_name\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING => "SDL.gpu.device.driver_name"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING \"SDL.gpu.device.driver_version\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING => "SDL.gpu.device.driver_version"u8;
[NativeTypeName("#define SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING \"SDL.gpu.device.driver_info\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING => "SDL.gpu.device.driver_info"u8;
[NativeTypeName("#define SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING \"SDL.gpu.computepipeline.create.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING => "SDL.gpu.computepipeline.create.name"u8;
[NativeTypeName("#define SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING \"SDL.gpu.graphicspipeline.create.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING => "SDL.gpu.graphicspipeline.create.name"u8;
[NativeTypeName("#define SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING \"SDL.gpu.sampler.create.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING => "SDL.gpu.sampler.create.name"u8;
[NativeTypeName("#define SDL_PROP_GPU_SHADER_CREATE_NAME_STRING \"SDL.gpu.shader.create.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_SHADER_CREATE_NAME_STRING => "SDL.gpu.shader.create.name"u8;
[NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT \"SDL.gpu.texture.create.d3d12.clear.r\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT => "SDL.gpu.texture.create.d3d12.clear.r"u8;
[NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT \"SDL.gpu.texture.create.d3d12.clear.g\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT => "SDL.gpu.texture.create.d3d12.clear.g"u8;
[NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT \"SDL.gpu.texture.create.d3d12.clear.b\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT => "SDL.gpu.texture.create.d3d12.clear.b"u8;
[NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT \"SDL.gpu.texture.create.d3d12.clear.a\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT => "SDL.gpu.texture.create.d3d12.clear.a"u8;
[NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT \"SDL.gpu.texture.create.d3d12.clear.depth\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT => "SDL.gpu.texture.create.d3d12.clear.depth"u8;
[NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER \"SDL.gpu.texture.create.d3d12.clear.stencil\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER => "SDL.gpu.texture.create.d3d12.clear.stencil"u8;
[NativeTypeName("#define SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING \"SDL.gpu.texture.create.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING => "SDL.gpu.texture.create.name"u8;
[NativeTypeName("#define SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING \"SDL.gpu.buffer.create.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING => "SDL.gpu.buffer.create.name"u8;
[NativeTypeName("#define SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING \"SDL.gpu.transferbuffer.create.name\"")]
public static ReadOnlySpan<byte> SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING => "SDL.gpu.transferbuffer.create.name"u8;
} }
} }

View File

@ -34,8 +34,7 @@ namespace SDL
public partial struct SDL_HapticDirection public partial struct SDL_HapticDirection
{ {
[NativeTypeName("Uint8")] public SDL_HapticDirectionType type;
public byte type;
[NativeTypeName("Sint32[3]")] [NativeTypeName("Sint32[3]")]
public _dir_e__FixedBuffer dir; public _dir_e__FixedBuffer dir;
@ -49,8 +48,7 @@ namespace SDL
public partial struct SDL_HapticConstant public partial struct SDL_HapticConstant
{ {
[NativeTypeName("Uint16")] public SDL_HapticEffectType type;
public ushort type;
public SDL_HapticDirection direction; public SDL_HapticDirection direction;
@ -84,8 +82,7 @@ namespace SDL
public partial struct SDL_HapticPeriodic public partial struct SDL_HapticPeriodic
{ {
[NativeTypeName("Uint16")] public SDL_HapticEffectType type;
public ushort type;
public SDL_HapticDirection direction; public SDL_HapticDirection direction;
@ -128,8 +125,7 @@ namespace SDL
public partial struct SDL_HapticCondition public partial struct SDL_HapticCondition
{ {
[NativeTypeName("Uint16")] public SDL_HapticEffectType type;
public ushort type;
public SDL_HapticDirection direction; public SDL_HapticDirection direction;
@ -202,8 +198,7 @@ namespace SDL
public partial struct SDL_HapticRamp public partial struct SDL_HapticRamp
{ {
[NativeTypeName("Uint16")] public SDL_HapticEffectType type;
public ushort type;
public SDL_HapticDirection direction; public SDL_HapticDirection direction;
@ -240,8 +235,7 @@ namespace SDL
public partial struct SDL_HapticLeftRight public partial struct SDL_HapticLeftRight
{ {
[NativeTypeName("Uint16")] public SDL_HapticEffectType type;
public ushort type;
[NativeTypeName("Uint32")] [NativeTypeName("Uint32")]
public uint length; public uint length;
@ -255,8 +249,7 @@ namespace SDL
public unsafe partial struct SDL_HapticCustom public unsafe partial struct SDL_HapticCustom
{ {
[NativeTypeName("Uint16")] public SDL_HapticEffectType type;
public ushort type;
public SDL_HapticDirection direction; public SDL_HapticDirection direction;
@ -301,8 +294,7 @@ namespace SDL
public partial struct SDL_HapticEffect public partial struct SDL_HapticEffect
{ {
[FieldOffset(0)] [FieldOffset(0)]
[NativeTypeName("Uint16")] public SDL_HapticEffectType type;
public ushort type;
[FieldOffset(0)] [FieldOffset(0)]
public SDL_HapticConstant constant; public SDL_HapticConstant constant;
@ -380,26 +372,26 @@ namespace SDL
public static extern SDLBool SDL_HapticEffectSupported(SDL_Haptic* haptic, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* effect); public static extern SDLBool SDL_HapticEffectSupported(SDL_Haptic* haptic, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* effect);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_CreateHapticEffect(SDL_Haptic* haptic, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* effect); public static extern SDL_HapticEffectID SDL_CreateHapticEffect(SDL_Haptic* haptic, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* effect);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_UpdateHapticEffect(SDL_Haptic* haptic, int effect, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* data); public static extern SDLBool SDL_UpdateHapticEffect(SDL_Haptic* haptic, SDL_HapticEffectID effect, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* data);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_RunHapticEffect(SDL_Haptic* haptic, int effect, [NativeTypeName("Uint32")] uint iterations); public static extern SDLBool SDL_RunHapticEffect(SDL_Haptic* haptic, SDL_HapticEffectID effect, [NativeTypeName("Uint32")] uint iterations);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_StopHapticEffect(SDL_Haptic* haptic, int effect); public static extern SDLBool SDL_StopHapticEffect(SDL_Haptic* haptic, SDL_HapticEffectID effect);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_DestroyHapticEffect(SDL_Haptic* haptic, int effect); public static extern void SDL_DestroyHapticEffect(SDL_Haptic* haptic, SDL_HapticEffectID effect);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_GetHapticEffectStatus(SDL_Haptic* haptic, int effect); public static extern SDLBool SDL_GetHapticEffectStatus(SDL_Haptic* haptic, SDL_HapticEffectID effect);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
@ -437,6 +429,9 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_StopHapticRumble(SDL_Haptic* haptic); public static extern SDLBool SDL_StopHapticRumble(SDL_Haptic* haptic);
[NativeTypeName("#define SDL_HAPTIC_INFINITY 4294967295U")]
public const uint SDL_HAPTIC_INFINITY = 4294967295U;
[NativeTypeName("#define SDL_HAPTIC_CONSTANT (1u<<0)")] [NativeTypeName("#define SDL_HAPTIC_CONSTANT (1u<<0)")]
public const uint SDL_HAPTIC_CONSTANT = (1U << 0); public const uint SDL_HAPTIC_CONSTANT = (1U << 0);
@ -508,8 +503,5 @@ namespace SDL
[NativeTypeName("#define SDL_HAPTIC_STEERING_AXIS 3")] [NativeTypeName("#define SDL_HAPTIC_STEERING_AXIS 3")]
public const int SDL_HAPTIC_STEERING_AXIS = 3; public const int SDL_HAPTIC_STEERING_AXIS = 3;
[NativeTypeName("#define SDL_HAPTIC_INFINITY 4294967295U")]
public const uint SDL_HAPTIC_INFINITY = 4294967295U;
} }
} }

View File

@ -108,6 +108,9 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_hid_device* SDL_hid_open_path([NativeTypeName("const char *")] byte* path); 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)] [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); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_hid_ble_scan([NativeTypeName("bool")] SDLBool active); 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

@ -97,6 +97,12 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE \"SDL_AUDIO_ALSA_DEFAULT_DEVICE\"")] [NativeTypeName("#define SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE \"SDL_AUDIO_ALSA_DEFAULT_DEVICE\"")]
public static ReadOnlySpan<byte> SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE => "SDL_AUDIO_ALSA_DEFAULT_DEVICE"u8; public static ReadOnlySpan<byte> SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE => "SDL_AUDIO_ALSA_DEFAULT_DEVICE"u8;
[NativeTypeName("#define SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE \"SDL_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE\"")]
public static ReadOnlySpan<byte> SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE => "SDL_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE"u8;
[NativeTypeName("#define SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE \"SDL_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE\"")]
public static ReadOnlySpan<byte> SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE => "SDL_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE"u8;
[NativeTypeName("#define SDL_HINT_AUDIO_CATEGORY \"SDL_AUDIO_CATEGORY\"")] [NativeTypeName("#define SDL_HINT_AUDIO_CATEGORY \"SDL_AUDIO_CATEGORY\"")]
public static ReadOnlySpan<byte> SDL_HINT_AUDIO_CATEGORY => "SDL_AUDIO_CATEGORY"u8; public static ReadOnlySpan<byte> SDL_HINT_AUDIO_CATEGORY => "SDL_AUDIO_CATEGORY"u8;
@ -115,6 +121,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_AUDIO_DEVICE_STREAM_ROLE \"SDL_AUDIO_DEVICE_STREAM_ROLE\"")] [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; 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\"")] [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; public static ReadOnlySpan<byte> SDL_HINT_AUDIO_DISK_INPUT_FILE => "SDL_AUDIO_DISK_INPUT_FILE"u8;
@ -163,6 +172,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_DISPLAY_USABLE_BOUNDS \"SDL_DISPLAY_USABLE_BOUNDS\"")] [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; 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\"")] [NativeTypeName("#define SDL_HINT_EMSCRIPTEN_ASYNCIFY \"SDL_EMSCRIPTEN_ASYNCIFY\"")]
public static ReadOnlySpan<byte> SDL_HINT_EMSCRIPTEN_ASYNCIFY => "SDL_EMSCRIPTEN_ASYNCIFY"u8; public static ReadOnlySpan<byte> SDL_HINT_EMSCRIPTEN_ASYNCIFY => "SDL_EMSCRIPTEN_ASYNCIFY"u8;
@ -172,6 +184,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT \"SDL_EMSCRIPTEN_KEYBOARD_ELEMENT\"")] [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; 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\"")] [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; public static ReadOnlySpan<byte> SDL_HINT_ENABLE_SCREEN_KEYBOARD => "SDL_ENABLE_SCREEN_KEYBOARD"u8;
@ -262,6 +277,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_JOYSTICK_DEVICE \"SDL_JOYSTICK_DEVICE\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_DEVICE \"SDL_JOYSTICK_DEVICE\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_DEVICE => "SDL_JOYSTICK_DEVICE"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_DEVICE => "SDL_JOYSTICK_DEVICE"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_ENHANCED_REPORTS \"SDL_JOYSTICK_ENHANCED_REPORTS\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_ENHANCED_REPORTS => "SDL_JOYSTICK_ENHANCED_REPORTS"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES \"SDL_JOYSTICK_FLIGHTSTICK_DEVICES\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES \"SDL_JOYSTICK_FLIGHTSTICK_DEVICES\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES => "SDL_JOYSTICK_FLIGHTSTICK_DEVICES"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES => "SDL_JOYSTICK_FLIGHTSTICK_DEVICES"u8;
@ -313,18 +331,12 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL \"SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL \"SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL => "SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL => "SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE \"SDL_JOYSTICK_HIDAPI_PS4_RUMBLE\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE => "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5 \"SDL_JOYSTICK_HIDAPI_PS5\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5 \"SDL_JOYSTICK_HIDAPI_PS5\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS5 => "SDL_JOYSTICK_HIDAPI_PS5"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS5 => "SDL_JOYSTICK_HIDAPI_PS5"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED \"SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED \"SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED => "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED => "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE \"SDL_JOYSTICK_HIDAPI_PS5_RUMBLE\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE => "SDL_JOYSTICK_HIDAPI_PS5_RUMBLE"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SHIELD \"SDL_JOYSTICK_HIDAPI_SHIELD\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SHIELD \"SDL_JOYSTICK_HIDAPI_SHIELD\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_SHIELD => "SDL_JOYSTICK_HIDAPI_SHIELD"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_SHIELD => "SDL_JOYSTICK_HIDAPI_SHIELD"u8;
@ -334,12 +346,30 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAM \"SDL_JOYSTICK_HIDAPI_STEAM\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAM \"SDL_JOYSTICK_HIDAPI_STEAM\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_STEAM => "SDL_JOYSTICK_HIDAPI_STEAM"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_STEAM => "SDL_JOYSTICK_HIDAPI_STEAM"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED \"SDL_JOYSTICK_HIDAPI_STEAM_HOME_LED\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED => "SDL_JOYSTICK_HIDAPI_STEAM_HOME_LED"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK \"SDL_JOYSTICK_HIDAPI_STEAMDECK\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK \"SDL_JOYSTICK_HIDAPI_STEAMDECK\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK => "SDL_JOYSTICK_HIDAPI_STEAMDECK"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK => "SDL_JOYSTICK_HIDAPI_STEAMDECK"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAM_HORI \"SDL_JOYSTICK_HIDAPI_STEAM_HORI\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAM_HORI \"SDL_JOYSTICK_HIDAPI_STEAM_HORI\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_STEAM_HORI => "SDL_JOYSTICK_HIDAPI_STEAM_HORI"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_STEAM_HORI => "SDL_JOYSTICK_HIDAPI_STEAM_HORI"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_LG4FF \"SDL_JOYSTICK_HIDAPI_LG4FF\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_LG4FF => "SDL_JOYSTICK_HIDAPI_LG4FF"u8;
[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;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH \"SDL_JOYSTICK_HIDAPI_SWITCH\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH \"SDL_JOYSTICK_HIDAPI_SWITCH\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_SWITCH => "SDL_JOYSTICK_HIDAPI_SWITCH"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_SWITCH => "SDL_JOYSTICK_HIDAPI_SWITCH"u8;
@ -349,6 +379,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED \"SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED\"")] [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; 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\"")] [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; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS => "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS"u8;
@ -376,6 +409,12 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED \"SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED \"SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED => "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED => "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_GIP \"SDL_JOYSTICK_HIDAPI_GIP\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_GIP => "SDL_JOYSTICK_HIDAPI_GIP"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA \"SDL_JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA => "SDL_JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_IOKIT \"SDL_JOYSTICK_IOKIT\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_IOKIT \"SDL_JOYSTICK_IOKIT\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_IOKIT => "SDL_JOYSTICK_IOKIT"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_IOKIT => "SDL_JOYSTICK_IOKIT"u8;
@ -424,6 +463,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES \"SDL_JOYSTICK_ZERO_CENTERED_DEVICES\"")] [NativeTypeName("#define SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES \"SDL_JOYSTICK_ZERO_CENTERED_DEVICES\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES => "SDL_JOYSTICK_ZERO_CENTERED_DEVICES"u8; public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES => "SDL_JOYSTICK_ZERO_CENTERED_DEVICES"u8;
[NativeTypeName("#define SDL_HINT_JOYSTICK_HAPTIC_AXES \"SDL_JOYSTICK_HAPTIC_AXES\"")]
public static ReadOnlySpan<byte> SDL_HINT_JOYSTICK_HAPTIC_AXES => "SDL_JOYSTICK_HAPTIC_AXES"u8;
[NativeTypeName("#define SDL_HINT_KEYCODE_OPTIONS \"SDL_KEYCODE_OPTIONS\"")] [NativeTypeName("#define SDL_HINT_KEYCODE_OPTIONS \"SDL_KEYCODE_OPTIONS\"")]
public static ReadOnlySpan<byte> SDL_HINT_KEYCODE_OPTIONS => "SDL_KEYCODE_OPTIONS"u8; public static ReadOnlySpan<byte> SDL_HINT_KEYCODE_OPTIONS => "SDL_KEYCODE_OPTIONS"u8;
@ -433,6 +475,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER \"SDL_KMSDRM_REQUIRE_DRM_MASTER\"")] [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; 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\"")] [NativeTypeName("#define SDL_HINT_LOGGING \"SDL_LOGGING\"")]
public static ReadOnlySpan<byte> SDL_HINT_LOGGING => "SDL_LOGGING"u8; public static ReadOnlySpan<byte> SDL_HINT_LOGGING => "SDL_LOGGING"u8;
@ -445,9 +490,15 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH \"SDL_MAC_OPENGL_ASYNC_DISPATCH\"")] [NativeTypeName("#define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH \"SDL_MAC_OPENGL_ASYNC_DISPATCH\"")]
public static ReadOnlySpan<byte> SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH => "SDL_MAC_OPENGL_ASYNC_DISPATCH"u8; public static ReadOnlySpan<byte> SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH => "SDL_MAC_OPENGL_ASYNC_DISPATCH"u8;
[NativeTypeName("#define SDL_HINT_MAC_OPTION_AS_ALT \"SDL_MAC_OPTION_AS_ALT\"")]
public static ReadOnlySpan<byte> SDL_HINT_MAC_OPTION_AS_ALT => "SDL_MAC_OPTION_AS_ALT"u8;
[NativeTypeName("#define SDL_HINT_MAC_SCROLL_MOMENTUM \"SDL_MAC_SCROLL_MOMENTUM\"")] [NativeTypeName("#define SDL_HINT_MAC_SCROLL_MOMENTUM \"SDL_MAC_SCROLL_MOMENTUM\"")]
public static ReadOnlySpan<byte> SDL_HINT_MAC_SCROLL_MOMENTUM => "SDL_MAC_SCROLL_MOMENTUM"u8; public static ReadOnlySpan<byte> SDL_HINT_MAC_SCROLL_MOMENTUM => "SDL_MAC_SCROLL_MOMENTUM"u8;
[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\"")] [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; public static ReadOnlySpan<byte> SDL_HINT_MAIN_CALLBACK_RATE => "SDL_MAIN_CALLBACK_RATE"u8;
@ -460,6 +511,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME \"SDL_MOUSE_DOUBLE_CLICK_TIME\"")] [NativeTypeName("#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME \"SDL_MOUSE_DOUBLE_CLICK_TIME\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_DOUBLE_CLICK_TIME => "SDL_MOUSE_DOUBLE_CLICK_TIME"u8; public static ReadOnlySpan<byte> SDL_HINT_MOUSE_DOUBLE_CLICK_TIME => "SDL_MOUSE_DOUBLE_CLICK_TIME"u8;
[NativeTypeName("#define SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR \"SDL_MOUSE_DEFAULT_SYSTEM_CURSOR\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR => "SDL_MOUSE_DEFAULT_SYSTEM_CURSOR"u8;
[NativeTypeName("#define SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE \"SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE\"")] [NativeTypeName("#define SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE \"SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE => "SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE"u8; public static ReadOnlySpan<byte> SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE => "SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE"u8;
@ -472,9 +526,6 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_MODE_CENTER \"SDL_MOUSE_RELATIVE_MODE_CENTER\"")] [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_MODE_CENTER \"SDL_MOUSE_RELATIVE_MODE_CENTER\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_MODE_CENTER => "SDL_MOUSE_RELATIVE_MODE_CENTER"u8; public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_MODE_CENTER => "SDL_MOUSE_RELATIVE_MODE_CENTER"u8;
[NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP \"SDL_MOUSE_RELATIVE_MODE_WARP\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_MODE_WARP => "SDL_MOUSE_RELATIVE_MODE_WARP"u8;
[NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE \"SDL_MOUSE_RELATIVE_SPEED_SCALE\"")] [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE \"SDL_MOUSE_RELATIVE_SPEED_SCALE\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE => "SDL_MOUSE_RELATIVE_SPEED_SCALE"u8; public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE => "SDL_MOUSE_RELATIVE_SPEED_SCALE"u8;
@ -487,9 +538,6 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE \"SDL_MOUSE_RELATIVE_CURSOR_VISIBLE\"")] [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE \"SDL_MOUSE_RELATIVE_CURSOR_VISIBLE\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE => "SDL_MOUSE_RELATIVE_CURSOR_VISIBLE"u8; public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE => "SDL_MOUSE_RELATIVE_CURSOR_VISIBLE"u8;
[NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_CLIP_INTERVAL \"SDL_MOUSE_RELATIVE_CLIP_INTERVAL\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_RELATIVE_CLIP_INTERVAL => "SDL_MOUSE_RELATIVE_CLIP_INTERVAL"u8;
[NativeTypeName("#define SDL_HINT_MOUSE_TOUCH_EVENTS \"SDL_MOUSE_TOUCH_EVENTS\"")] [NativeTypeName("#define SDL_HINT_MOUSE_TOUCH_EVENTS \"SDL_MOUSE_TOUCH_EVENTS\"")]
public static ReadOnlySpan<byte> SDL_HINT_MOUSE_TOUCH_EVENTS => "SDL_MOUSE_TOUCH_EVENTS"u8; public static ReadOnlySpan<byte> SDL_HINT_MOUSE_TOUCH_EVENTS => "SDL_MOUSE_TOUCH_EVENTS"u8;
@ -502,6 +550,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_OPENGL_LIBRARY \"SDL_OPENGL_LIBRARY\"")] [NativeTypeName("#define SDL_HINT_OPENGL_LIBRARY \"SDL_OPENGL_LIBRARY\"")]
public static ReadOnlySpan<byte> SDL_HINT_OPENGL_LIBRARY => "SDL_OPENGL_LIBRARY"u8; public static ReadOnlySpan<byte> SDL_HINT_OPENGL_LIBRARY => "SDL_OPENGL_LIBRARY"u8;
[NativeTypeName("#define SDL_HINT_EGL_LIBRARY \"SDL_EGL_LIBRARY\"")]
public static ReadOnlySpan<byte> SDL_HINT_EGL_LIBRARY => "SDL_EGL_LIBRARY"u8;
[NativeTypeName("#define SDL_HINT_OPENGL_ES_DRIVER \"SDL_OPENGL_ES_DRIVER\"")] [NativeTypeName("#define SDL_HINT_OPENGL_ES_DRIVER \"SDL_OPENGL_ES_DRIVER\"")]
public static ReadOnlySpan<byte> SDL_HINT_OPENGL_ES_DRIVER => "SDL_OPENGL_ES_DRIVER"u8; public static ReadOnlySpan<byte> SDL_HINT_OPENGL_ES_DRIVER => "SDL_OPENGL_ES_DRIVER"u8;
@ -526,6 +577,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_RENDER_DIRECT3D11_DEBUG \"SDL_RENDER_DIRECT3D11_DEBUG\"")] [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; 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\"")] [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; public static ReadOnlySpan<byte> SDL_HINT_RENDER_VULKAN_DEBUG => "SDL_RENDER_VULKAN_DEBUG"u8;
@ -556,6 +610,18 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED \"SDL_ROG_GAMEPAD_MICE_EXCLUDED\"")] [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; 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\"")] [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; public static ReadOnlySpan<byte> SDL_HINT_RPI_VIDEO_LAYER => "SDL_RPI_VIDEO_LAYER"u8;
@ -613,6 +679,15 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES \"SDL_VIDEO_MAC_FULLSCREEN_SPACES\"")] [NativeTypeName("#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES \"SDL_VIDEO_MAC_FULLSCREEN_SPACES\"")]
public static ReadOnlySpan<byte> SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES => "SDL_VIDEO_MAC_FULLSCREEN_SPACES"u8; public static ReadOnlySpan<byte> SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES => "SDL_VIDEO_MAC_FULLSCREEN_SPACES"u8;
[NativeTypeName("#define SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY \"SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY\"")]
public static ReadOnlySpan<byte> SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY => "SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY"u8;
[NativeTypeName("#define SDL_HINT_VIDEO_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;
[NativeTypeName("#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS \"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS\"")] [NativeTypeName("#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS \"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS\"")]
public static ReadOnlySpan<byte> SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS => "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"u8; public static ReadOnlySpan<byte> SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS => "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"u8;
@ -640,6 +715,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_VIDEO_WIN_D3DCOMPILER \"SDL_VIDEO_WIN_D3DCOMPILER\"")] [NativeTypeName("#define SDL_HINT_VIDEO_WIN_D3DCOMPILER \"SDL_VIDEO_WIN_D3DCOMPILER\"")]
public static ReadOnlySpan<byte> SDL_HINT_VIDEO_WIN_D3DCOMPILER => "SDL_VIDEO_WIN_D3DCOMPILER"u8; public static ReadOnlySpan<byte> SDL_HINT_VIDEO_WIN_D3DCOMPILER => "SDL_VIDEO_WIN_D3DCOMPILER"u8;
[NativeTypeName("#define SDL_HINT_VIDEO_X11_EXTERNAL_WINDOW_INPUT \"SDL_VIDEO_X11_EXTERNAL_WINDOW_INPUT\"")]
public static ReadOnlySpan<byte> SDL_HINT_VIDEO_X11_EXTERNAL_WINDOW_INPUT => "SDL_VIDEO_X11_EXTERNAL_WINDOW_INPUT"u8;
[NativeTypeName("#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR \"SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR\"")] [NativeTypeName("#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR \"SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR\"")]
public static ReadOnlySpan<byte> SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR => "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"u8; public static ReadOnlySpan<byte> SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR => "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"u8;
@ -727,6 +805,9 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_WINDOWS_RAW_KEYBOARD \"SDL_WINDOWS_RAW_KEYBOARD\"")] [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; 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\"")] [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; public static ReadOnlySpan<byte> SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL => "SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL"u8;
@ -756,5 +837,11 @@ namespace SDL
[NativeTypeName("#define SDL_HINT_ASSERT \"SDL_ASSERT\"")] [NativeTypeName("#define SDL_HINT_ASSERT \"SDL_ASSERT\"")]
public static ReadOnlySpan<byte> SDL_HINT_ASSERT => "SDL_ASSERT"u8; public static ReadOnlySpan<byte> SDL_HINT_ASSERT => "SDL_ASSERT"u8;
[NativeTypeName("#define SDL_HINT_PEN_MOUSE_EVENTS \"SDL_PEN_MOUSE_EVENTS\"")]
public static ReadOnlySpan<byte> SDL_HINT_PEN_MOUSE_EVENTS => "SDL_PEN_MOUSE_EVENTS"u8;
[NativeTypeName("#define SDL_HINT_PEN_TOUCH_EVENTS \"SDL_PEN_TOUCH_EVENTS\"")]
public static ReadOnlySpan<byte> SDL_HINT_PEN_TOUCH_EVENTS => "SDL_PEN_TOUCH_EVENTS"u8;
} }
} }

View File

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

View File

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

View File

@ -27,7 +27,10 @@ namespace SDL
{ {
public static partial class SDL3 public static partial class SDL3
{ {
[NativeTypeName("#define SDLK_SCANCODE_MASK (1u<<30)")] [NativeTypeName("#define SDLK_EXTENDED_MASK (1u << 29)")]
public const uint SDLK_EXTENDED_MASK = (1U << 29);
[NativeTypeName("#define SDLK_SCANCODE_MASK (1u << 30)")]
public const uint SDLK_SCANCODE_MASK = (1U << 30); public const uint SDLK_SCANCODE_MASK = (1U << 30);
[NativeTypeName("#define SDLK_UNKNOWN 0x00000000u")] [NativeTypeName("#define SDLK_UNKNOWN 0x00000000u")]
@ -777,6 +780,27 @@ namespace SDL
[NativeTypeName("#define SDLK_ENDCALL 0x40000122u")] [NativeTypeName("#define SDLK_ENDCALL 0x40000122u")]
public const uint SDLK_ENDCALL = 0x40000122U; public const uint SDLK_ENDCALL = 0x40000122U;
[NativeTypeName("#define SDLK_LEFT_TAB 0x20000001u")]
public const uint SDLK_LEFT_TAB = 0x20000001U;
[NativeTypeName("#define SDLK_LEVEL5_SHIFT 0x20000002u")]
public const uint SDLK_LEVEL5_SHIFT = 0x20000002U;
[NativeTypeName("#define SDLK_MULTI_KEY_COMPOSE 0x20000003u")]
public const uint SDLK_MULTI_KEY_COMPOSE = 0x20000003U;
[NativeTypeName("#define SDLK_LMETA 0x20000004u")]
public const uint SDLK_LMETA = 0x20000004U;
[NativeTypeName("#define SDLK_RMETA 0x20000005u")]
public const uint SDLK_RMETA = 0x20000005U;
[NativeTypeName("#define SDLK_LHYPER 0x20000006u")]
public const uint SDLK_LHYPER = 0x20000006U;
[NativeTypeName("#define SDLK_RHYPER 0x20000007u")]
public const uint SDLK_RHYPER = 0x20000007U;
[NativeTypeName("#define SDL_KMOD_NONE 0x0000u")] [NativeTypeName("#define SDL_KMOD_NONE 0x0000u")]
public const uint SDL_KMOD_NONE = 0x0000U; public const uint SDL_KMOD_NONE = 0x0000U;
@ -786,6 +810,9 @@ namespace SDL
[NativeTypeName("#define SDL_KMOD_RSHIFT 0x0002u")] [NativeTypeName("#define SDL_KMOD_RSHIFT 0x0002u")]
public const uint SDL_KMOD_RSHIFT = 0x0002U; public const uint SDL_KMOD_RSHIFT = 0x0002U;
[NativeTypeName("#define SDL_KMOD_LEVEL5 0x0004u")]
public const uint SDL_KMOD_LEVEL5 = 0x0004U;
[NativeTypeName("#define SDL_KMOD_LCTRL 0x0040u")] [NativeTypeName("#define SDL_KMOD_LCTRL 0x0040u")]
public const uint SDL_KMOD_LCTRL = 0x0040U; public const uint SDL_KMOD_LCTRL = 0x0040U;

View File

@ -1,37 +0,0 @@
/*
<auto-generated/>
C# bindings for Simple DirectMedia Layer.
Original copyright notice of input files:
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace SDL
{
public static partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[SupportedOSPlatform("Windows")]
public static extern void SDL_GDKSuspendComplete();
}
}

View File

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

View File

@ -23,6 +23,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace SDL namespace SDL
@ -62,6 +63,14 @@ namespace SDL
SDL_MOUSEWHEEL_FLIPPED, SDL_MOUSEWHEEL_FLIPPED,
} }
public unsafe partial struct SDL_CursorFrameInfo
{
public SDL_Surface* surface;
[NativeTypeName("Uint32")]
public uint duration;
}
public static unsafe partial class SDL3 public static unsafe partial class SDL3
{ {
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -94,6 +103,10 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_WarpMouseGlobal(float x, float y); public static extern SDLBool SDL_WarpMouseGlobal(float x, float y);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetRelativeMouseTransform([NativeTypeName("SDL_MouseMotionTransformCallback")] delegate* unmanaged[Cdecl]<IntPtr, ulong, SDL_Window*, SDL_MouseID, float*, float*, void> callback, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetWindowRelativeMouseMode(SDL_Window* window, [NativeTypeName("bool")] SDLBool enabled); public static extern SDLBool SDL_SetWindowRelativeMouseMode(SDL_Window* window, [NativeTypeName("bool")] SDLBool enabled);
@ -112,6 +125,9 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Cursor* SDL_CreateColorCursor(SDL_Surface* surface, int hot_x, int hot_y); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Cursor* SDL_CreateSystemCursor(SDL_SystemCursor id); 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. 3. This notice may not be removed or altered from any source distribution.
*/ */
using System.Runtime.InteropServices;
namespace SDL namespace SDL
{ {
public enum SDL_PenAxis public enum SDL_PenAxis
@ -37,8 +39,19 @@ namespace SDL
SDL_PEN_AXIS_COUNT, 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 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)")] [NativeTypeName("#define SDL_PEN_INPUT_DOWN (1u << 0)")]
public const uint 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)")] [NativeTypeName("#define SDL_PEN_INPUT_ERASER_TIP (1u << 30)")]
public const uint 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

@ -155,6 +155,7 @@ namespace SDL
SDL_PIXELFORMAT_NV21 = 0x3132564eU, SDL_PIXELFORMAT_NV21 = 0x3132564eU,
SDL_PIXELFORMAT_P010 = 0x30313050U, SDL_PIXELFORMAT_P010 = 0x30313050U,
SDL_PIXELFORMAT_EXTERNAL_OES = 0x2053454fU, SDL_PIXELFORMAT_EXTERNAL_OES = 0x2053454fU,
SDL_PIXELFORMAT_MJPG = 0x47504a4dU,
} }
public enum SDL_ColorType public enum SDL_ColorType
@ -253,7 +254,7 @@ namespace SDL
SDL_COLORSPACE_BT2020_LIMITED = 0x21102609U, SDL_COLORSPACE_BT2020_LIMITED = 0x21102609U,
SDL_COLORSPACE_BT2020_FULL = 0x22102609U, SDL_COLORSPACE_BT2020_FULL = 0x22102609U,
SDL_COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_SRGB, 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 public partial struct SDL_Color
@ -386,10 +387,10 @@ namespace SDL
public static extern uint SDL_MapRGBA([NativeTypeName("const SDL_PixelFormatDetails *")] SDL_PixelFormatDetails* format, [NativeTypeName("const SDL_Palette *")] SDL_Palette* palette, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b, [NativeTypeName("Uint8")] byte a); public static extern uint SDL_MapRGBA([NativeTypeName("const SDL_PixelFormatDetails *")] SDL_PixelFormatDetails* format, [NativeTypeName("const SDL_Palette *")] SDL_Palette* palette, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b, [NativeTypeName("Uint8")] byte a);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_GetRGB([NativeTypeName("Uint32")] uint pixel, [NativeTypeName("const SDL_PixelFormatDetails *")] SDL_PixelFormatDetails* format, [NativeTypeName("const SDL_Palette *")] SDL_Palette* palette, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b); public static extern void SDL_GetRGB([NativeTypeName("Uint32")] uint pixelvalue, [NativeTypeName("const SDL_PixelFormatDetails *")] SDL_PixelFormatDetails* format, [NativeTypeName("const SDL_Palette *")] SDL_Palette* palette, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_GetRGBA([NativeTypeName("Uint32")] uint pixel, [NativeTypeName("const SDL_PixelFormatDetails *")] SDL_PixelFormatDetails* format, [NativeTypeName("const SDL_Palette *")] SDL_Palette* palette, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b, [NativeTypeName("Uint8 *")] byte* a); public static extern void SDL_GetRGBA([NativeTypeName("Uint32")] uint pixelvalue, [NativeTypeName("const SDL_PixelFormatDetails *")] SDL_PixelFormatDetails* format, [NativeTypeName("const SDL_Palette *")] SDL_Palette* palette, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b, [NativeTypeName("Uint8 *")] byte* a);
[NativeTypeName("#define SDL_ALPHA_OPAQUE 255")] [NativeTypeName("#define SDL_ALPHA_OPAQUE 255")]
public const int SDL_ALPHA_OPAQUE = 255; public const int SDL_ALPHA_OPAQUE = 255;

View File

@ -78,6 +78,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER \"SDL.process.create.environment\"")] [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER \"SDL.process.create.environment\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER => "SDL.process.create.environment"u8; public static ReadOnlySpan<byte> SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER => "SDL.process.create.environment"u8;
[NativeTypeName("#define SDL_PROP_PROCESS_CREATE_WORKING_DIRECTORY_STRING \"SDL.process.create.working_directory\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_CREATE_WORKING_DIRECTORY_STRING => "SDL.process.create.working_directory"u8;
[NativeTypeName("#define SDL_PROP_PROCESS_CREATE_STDIN_NUMBER \"SDL.process.create.stdin_option\"")] [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_STDIN_NUMBER \"SDL.process.create.stdin_option\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_CREATE_STDIN_NUMBER => "SDL.process.create.stdin_option"u8; public static ReadOnlySpan<byte> SDL_PROP_PROCESS_CREATE_STDIN_NUMBER => "SDL.process.create.stdin_option"u8;
@ -102,6 +105,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN \"SDL.process.create.background\"")] [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN \"SDL.process.create.background\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN => "SDL.process.create.background"u8; public static ReadOnlySpan<byte> SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN => "SDL.process.create.background"u8;
[NativeTypeName("#define SDL_PROP_PROCESS_CREATE_CMDLINE_STRING \"SDL.process.create.cmdline\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_CREATE_CMDLINE_STRING => "SDL.process.create.cmdline"u8;
[NativeTypeName("#define SDL_PROP_PROCESS_PID_NUMBER \"SDL.process.pid\"")] [NativeTypeName("#define SDL_PROP_PROCESS_PID_NUMBER \"SDL.process.pid\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_PID_NUMBER => "SDL.process.pid"u8; public static ReadOnlySpan<byte> SDL_PROP_PROCESS_PID_NUMBER => "SDL.process.pid"u8;

View File

@ -117,5 +117,8 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_DestroyProperties(SDL_PropertiesID props); 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

@ -124,7 +124,7 @@ namespace SDL
} }
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static SDLBool SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, [NativeTypeName("const float")] float epsilon) public static SDLBool SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, float epsilon)
{ {
return ((a) != null && (b) != null && ((a == b) || ((SDL_fabsf(a->x - b->x) <= epsilon) && (SDL_fabsf(a->y - b->y) <= epsilon) && (SDL_fabsf(a->w - b->w) <= epsilon) && (SDL_fabsf(a->h - b->h) <= epsilon)))) ? true : false; return ((a) != null && (b) != null && ((a == b) || ((SDL_fabsf(a->x - b->x) <= epsilon) && (SDL_fabsf(a->y - b->y) <= epsilon) && (SDL_fabsf(a->w - b->w) <= epsilon) && (SDL_fabsf(a->h - b->h) <= epsilon)))) ? true : false;
} }

View File

@ -44,6 +44,14 @@ namespace SDL
SDL_TEXTUREACCESS_TARGET, SDL_TEXTUREACCESS_TARGET,
} }
public enum SDL_TextureAddressMode
{
SDL_TEXTURE_ADDRESS_INVALID = -1,
SDL_TEXTURE_ADDRESS_AUTO,
SDL_TEXTURE_ADDRESS_CLAMP,
SDL_TEXTURE_ADDRESS_WRAP,
}
public enum SDL_RendererLogicalPresentation public enum SDL_RendererLogicalPresentation
{ {
SDL_LOGICAL_PRESENTATION_DISABLED, SDL_LOGICAL_PRESENTATION_DISABLED,
@ -68,6 +76,35 @@ namespace SDL
public int refcount; public int refcount;
} }
public unsafe partial struct SDL_GPURenderStateCreateInfo
{
public SDL_GPUShader* fragment_shader;
[NativeTypeName("Sint32")]
public int num_sampler_bindings;
[NativeTypeName("const SDL_GPUTextureSamplerBinding *")]
public SDL_GPUTextureSamplerBinding* sampler_bindings;
[NativeTypeName("Sint32")]
public int num_storage_textures;
[NativeTypeName("SDL_GPUTexture *const *")]
public SDL_GPUTexture** storage_textures;
[NativeTypeName("Sint32")]
public int num_storage_buffers;
[NativeTypeName("SDL_GPUBuffer *const *")]
public SDL_GPUBuffer** storage_buffers;
public SDL_PropertiesID props;
}
public partial struct SDL_GPURenderState
{
}
public static unsafe partial class SDL3 public static unsafe partial class SDL3
{ {
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -87,6 +124,12 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Renderer* SDL_CreateRendererWithProperties(SDL_PropertiesID props); 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_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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Renderer* SDL_CreateSoftwareRenderer(SDL_Surface* surface); public static extern SDL_Renderer* SDL_CreateSoftwareRenderer(SDL_Surface* surface);
@ -130,6 +173,13 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_GetTextureSize(SDL_Texture* texture, float* w, float* h); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetTextureColorMod(SDL_Texture* texture, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b); public static extern SDLBool SDL_SetTextureColorMod(SDL_Texture* texture, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b);
@ -344,6 +394,10 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_RenderTextureRotated(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect, double angle, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* center, SDL_FlipMode flip); public static extern SDLBool SDL_RenderTextureRotated(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect, double angle, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* center, SDL_FlipMode flip);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_RenderTextureAffine(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* origin, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* right, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* down);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_RenderTextureTiled(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, float scale, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect); public static extern SDLBool SDL_RenderTextureTiled(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, float scale, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect);
@ -352,6 +406,10 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_RenderTexture9Grid(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect); public static extern SDLBool SDL_RenderTexture9Grid(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_RenderTexture9GridTiled(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect, float tileScale);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_RenderGeometry(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_Vertex *")] SDL_Vertex* vertices, int num_vertices, [NativeTypeName("const int *")] int* indices, int num_indices); public static extern SDLBool SDL_RenderGeometry(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_Vertex *")] SDL_Vertex* vertices, int num_vertices, [NativeTypeName("const int *")] int* indices, int num_indices);
@ -360,6 +418,14 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_RenderGeometryRaw(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const float *")] float* xy, int xy_stride, [NativeTypeName("const SDL_FColor *")] SDL_FColor* color, int color_stride, [NativeTypeName("const float *")] float* uv, int uv_stride, int num_vertices, [NativeTypeName("const void *")] IntPtr indices, int num_indices, int size_indices); public static extern SDLBool SDL_RenderGeometryRaw(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const float *")] float* xy, int xy_stride, [NativeTypeName("const SDL_FColor *")] SDL_FColor* color, int color_stride, [NativeTypeName("const float *")] float* uv, int uv_stride, int num_vertices, [NativeTypeName("const void *")] IntPtr indices, int num_indices, int size_indices);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetRenderTextureAddressMode(SDL_Renderer* renderer, SDL_TextureAddressMode u_mode, SDL_TextureAddressMode v_mode);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_GetRenderTextureAddressMode(SDL_Renderer* renderer, SDL_TextureAddressMode* u_mode, SDL_TextureAddressMode* v_mode);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_RenderReadPixels(SDL_Renderer* renderer, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); public static extern SDL_Surface* SDL_RenderReadPixels(SDL_Renderer* renderer, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect);
@ -401,9 +467,38 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_RenderDebugText(SDL_Renderer* renderer, float x, float y, [NativeTypeName("const char *")] byte* str); public static extern SDLBool SDL_RenderDebugText(SDL_Renderer* renderer, float x, float y, [NativeTypeName("const char *")] byte* str);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_RenderDebugTextFormat(SDL_Renderer* renderer, float x, float y, [NativeTypeName("const char *")] byte* fmt, __arglist);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetDefaultTextureScaleMode(SDL_Renderer* renderer, SDL_ScaleMode scale_mode);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
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_GPURenderStateCreateInfo* createinfo);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetGPURenderStateFragmentUniforms(SDL_GPURenderState* state, [NativeTypeName("Uint32")] uint slot_index, [NativeTypeName("const void *")] IntPtr data, [NativeTypeName("Uint32")] uint length);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
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);
[NativeTypeName("#define SDL_SOFTWARE_RENDERER \"software\"")] [NativeTypeName("#define SDL_SOFTWARE_RENDERER \"software\"")]
public static ReadOnlySpan<byte> SDL_SOFTWARE_RENDERER => "software"u8; public static ReadOnlySpan<byte> SDL_SOFTWARE_RENDERER => "software"u8;
[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\"")] [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; public static ReadOnlySpan<byte> SDL_PROP_RENDERER_CREATE_NAME_STRING => "SDL.renderer.create.name"u8;
@ -419,6 +514,18 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER \"SDL.renderer.create.present_vsync\"")] [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; 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;
[NativeTypeName("#define SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN \"SDL.renderer.create.gpu.shaders_dxil\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN => "SDL.renderer.create.gpu.shaders_dxil"u8;
[NativeTypeName("#define SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN \"SDL.renderer.create.gpu.shaders_msl\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN => "SDL.renderer.create.gpu.shaders_msl"u8;
[NativeTypeName("#define SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER \"SDL.renderer.create.vulkan.instance\"")] [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER \"SDL.renderer.create.vulkan.instance\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER => "SDL.renderer.create.vulkan.instance"u8; public static ReadOnlySpan<byte> SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER => "SDL.renderer.create.vulkan.instance"u8;
@ -455,6 +562,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER \"SDL.renderer.texture_formats\"")] [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; 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\"")] [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; public static ReadOnlySpan<byte> SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER => "SDL.renderer.output_colorspace"u8;
@ -506,6 +616,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER \"SDL.renderer.vulkan.swapchain_image_count\"")] [NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER \"SDL.renderer.vulkan.swapchain_image_count\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER => "SDL.renderer.vulkan.swapchain_image_count"u8; public static ReadOnlySpan<byte> SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER => "SDL.renderer.vulkan.swapchain_image_count"u8;
[NativeTypeName("#define SDL_PROP_RENDERER_GPU_DEVICE_POINTER \"SDL.renderer.gpu.device\"")]
public static ReadOnlySpan<byte> SDL_PROP_RENDERER_GPU_DEVICE_POINTER => "SDL.renderer.gpu.device"u8;
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER \"SDL.texture.create.colorspace\"")] [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER \"SDL.texture.create.colorspace\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER => "SDL.texture.create.colorspace"u8; public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER => "SDL.texture.create.colorspace"u8;
@ -521,6 +634,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER \"SDL.texture.create.height\"")] [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; 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\"")] [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; public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT => "SDL.texture.create.SDR_white_point"u8;
@ -575,6 +691,18 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER \"SDL.texture.create.vulkan.texture\"")] [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; 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\"")] [NativeTypeName("#define SDL_PROP_TEXTURE_COLORSPACE_NUMBER \"SDL.texture.colorspace\"")]
public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_COLORSPACE_NUMBER => "SDL.texture.colorspace"u8; public static ReadOnlySpan<byte> SDL_PROP_TEXTURE_COLORSPACE_NUMBER => "SDL.texture.colorspace"u8;
@ -653,6 +781,18 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER \"SDL.texture.vulkan.texture\"")] [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; 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")] [NativeTypeName("#define SDL_RENDERER_VSYNC_DISABLED 0")]
public const int 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_GYRO_L,
SDL_SENSOR_ACCEL_R, SDL_SENSOR_ACCEL_R,
SDL_SENSOR_GYRO_R, SDL_SENSOR_GYRO_R,
SDL_SENSOR_COUNT,
} }
public static unsafe partial class SDL3 public static unsafe partial class SDL3

View File

@ -322,7 +322,7 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strtok_r", ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strtok_r", ExactSpelling = true)]
[return: NativeTypeName("char *")] [return: NativeTypeName("char *")]
public static extern byte* Unsafe_SDL_strtok_r([NativeTypeName("char *")] byte* s1, [NativeTypeName("const char *")] byte* s2, [NativeTypeName("char **")] byte** saveptr); public static extern byte* Unsafe_SDL_strtok_r([NativeTypeName("char *")] byte* str, [NativeTypeName("const char *")] byte* delim, [NativeTypeName("char **")] byte** saveptr);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")] [return: NativeTypeName("size_t")]

View File

@ -30,8 +30,10 @@ namespace SDL
{ {
public enum SDL_ScaleMode public enum SDL_ScaleMode
{ {
SDL_SCALEMODE_INVALID = -1,
SDL_SCALEMODE_NEAREST, SDL_SCALEMODE_NEAREST,
SDL_SCALEMODE_LINEAR, SDL_SCALEMODE_LINEAR,
SDL_SCALEMODE_PIXELART,
} }
public enum SDL_FlipMode public enum SDL_FlipMode
@ -39,6 +41,7 @@ namespace SDL
SDL_FLIP_NONE, SDL_FLIP_NONE,
SDL_FLIP_HORIZONTAL, SDL_FLIP_HORIZONTAL,
SDL_FLIP_VERTICAL, SDL_FLIP_VERTICAL,
SDL_FLIP_HORIZONTAL_AND_VERTICAL = (SDL_FLIP_HORIZONTAL | SDL_FLIP_VERTICAL),
} }
public partial struct SDL_Surface public partial struct SDL_Surface
@ -114,6 +117,12 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_UnlockSurface(SDL_Surface* surface); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_LoadBMP_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio); public static extern SDL_Surface* SDL_LoadBMP_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio);
@ -128,6 +137,20 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_SaveBMP(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetSurfaceRLE(SDL_Surface* surface, [NativeTypeName("bool")] SDLBool enabled); public static extern SDLBool SDL_SetSurfaceRLE(SDL_Surface* surface, [NativeTypeName("bool")] SDLBool enabled);
@ -184,6 +207,9 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_FlipSurface(SDL_Surface* surface, SDL_FlipMode flip); 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)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Surface* SDL_DuplicateSurface(SDL_Surface* surface); public static extern SDL_Surface* SDL_DuplicateSurface(SDL_Surface* surface);
@ -240,6 +266,10 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_BlitSurfaceUncheckedScaled(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect, SDL_ScaleMode scaleMode); public static extern SDLBool SDL_BlitSurfaceUncheckedScaled(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect, SDL_ScaleMode scaleMode);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_StretchSurface(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect, SDL_ScaleMode scaleMode);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_BlitSurfaceTiled(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect); public static extern SDLBool SDL_BlitSurfaceTiled(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect);
@ -296,5 +326,11 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING \"SDL.surface.tonemap\"")] [NativeTypeName("#define SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING \"SDL.surface.tonemap\"")]
public static ReadOnlySpan<byte> SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING => "SDL.surface.tonemap"u8; public static ReadOnlySpan<byte> SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING => "SDL.surface.tonemap"u8;
[NativeTypeName("#define SDL_PROP_SURFACE_HOTSPOT_X_NUMBER \"SDL.surface.hotspot.x\"")]
public static ReadOnlySpan<byte> SDL_PROP_SURFACE_HOTSPOT_X_NUMBER => "SDL.surface.hotspot.x"u8;
[NativeTypeName("#define SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER \"SDL.surface.hotspot.y\"")]
public static ReadOnlySpan<byte> SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER => "SDL.surface.hotspot.y"u8;
} }
} }

View File

@ -40,6 +40,14 @@ namespace SDL
SDL_THREAD_PRIORITY_TIME_CRITICAL, SDL_THREAD_PRIORITY_TIME_CRITICAL,
} }
public enum SDL_ThreadState
{
SDL_THREAD_UNKNOWN,
SDL_THREAD_ALIVE,
SDL_THREAD_DETACHED,
SDL_THREAD_COMPLETE,
}
public static unsafe partial class SDL3 public static unsafe partial class SDL3
{ {
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@ -65,6 +73,9 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_WaitThread(SDL_Thread* thread, int* status); public static extern void SDL_WaitThread(SDL_Thread* thread, int* status);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_ThreadState SDL_GetThreadState(SDL_Thread* thread);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_DetachThread(SDL_Thread* thread); public static extern void SDL_DetachThread(SDL_Thread* thread);

View File

@ -0,0 +1,133 @@
/*
<auto-generated/>
C# bindings for Simple DirectMedia Layer.
Original copyright notice of input files:
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
using System;
using System.Runtime.InteropServices;
namespace SDL
{
public partial struct SDL_Tray
{
}
public partial struct SDL_TrayMenu
{
}
public partial struct SDL_TrayEntry
{
}
public static unsafe partial class SDL3
{
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Tray* SDL_CreateTray(SDL_Surface* icon, [NativeTypeName("const char *")] byte* tooltip);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_SetTrayIcon(SDL_Tray* tray, SDL_Surface* icon);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_SetTrayTooltip(SDL_Tray* tray, [NativeTypeName("const char *")] byte* tooltip);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_TrayMenu* SDL_CreateTrayMenu(SDL_Tray* tray);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_TrayMenu* SDL_CreateTraySubmenu(SDL_TrayEntry* entry);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_TrayMenu* SDL_GetTrayMenu(SDL_Tray* tray);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_TrayMenu* SDL_GetTraySubmenu(SDL_TrayEntry* entry);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const SDL_TrayEntry **")]
public static extern SDL_TrayEntry** SDL_GetTrayEntries(SDL_TrayMenu* menu, int* count);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_RemoveTrayEntry(SDL_TrayEntry* entry);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_TrayEntry* SDL_InsertTrayEntryAt(SDL_TrayMenu* menu, int pos, [NativeTypeName("const char *")] byte* label, SDL_TrayEntryFlags flags);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_SetTrayEntryLabel(SDL_TrayEntry* entry, [NativeTypeName("const char *")] byte* label);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetTrayEntryLabel", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern byte* Unsafe_SDL_GetTrayEntryLabel(SDL_TrayEntry* entry);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_SetTrayEntryChecked(SDL_TrayEntry* entry, [NativeTypeName("bool")] SDLBool @checked);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_GetTrayEntryChecked(SDL_TrayEntry* entry);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_SetTrayEntryEnabled(SDL_TrayEntry* entry, [NativeTypeName("bool")] SDLBool enabled);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_GetTrayEntryEnabled(SDL_TrayEntry* entry);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_SetTrayEntryCallback(SDL_TrayEntry* entry, [NativeTypeName("SDL_TrayCallback")] delegate* unmanaged[Cdecl]<IntPtr, SDL_TrayEntry*, void> callback, [NativeTypeName("void*")] IntPtr userdata);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_ClickTrayEntry(SDL_TrayEntry* entry);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_DestroyTray(SDL_Tray* tray);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_TrayMenu* SDL_GetTrayEntryParent(SDL_TrayEntry* entry);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_TrayEntry* SDL_GetTrayMenuParentEntry(SDL_TrayMenu* menu);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_Tray* SDL_GetTrayMenuParentTray(SDL_TrayMenu* menu);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_UpdateTrays();
[NativeTypeName("#define SDL_TRAYENTRY_BUTTON 0x00000001u")]
public const uint SDL_TRAYENTRY_BUTTON = 0x00000001U;
[NativeTypeName("#define SDL_TRAYENTRY_CHECKBOX 0x00000002u")]
public const uint SDL_TRAYENTRY_CHECKBOX = 0x00000002U;
[NativeTypeName("#define SDL_TRAYENTRY_SUBMENU 0x00000004u")]
public const uint SDL_TRAYENTRY_SUBMENU = 0x00000004U;
[NativeTypeName("#define SDL_TRAYENTRY_DISABLED 0x80000000u")]
public const uint SDL_TRAYENTRY_DISABLED = 0x80000000U;
[NativeTypeName("#define SDL_TRAYENTRY_CHECKED 0x40000000u")]
public const uint SDL_TRAYENTRY_CHECKED = 0x40000000U;
}
}

View File

@ -39,10 +39,13 @@ namespace SDL
[NativeTypeName("#define SDL_MAJOR_VERSION 3")] [NativeTypeName("#define SDL_MAJOR_VERSION 3")]
public const int SDL_MAJOR_VERSION = 3; public const int SDL_MAJOR_VERSION = 3;
[NativeTypeName("#define SDL_MINOR_VERSION 1")] [NativeTypeName("#define SDL_MINOR_VERSION 3")]
public const int SDL_MINOR_VERSION = 1; public const int SDL_MINOR_VERSION = 3;
[NativeTypeName("#define SDL_MICRO_VERSION 7")] [NativeTypeName("#define SDL_MICRO_VERSION 3")]
public const int SDL_MICRO_VERSION = 7; 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

@ -80,6 +80,16 @@ namespace SDL
SDL_FLASH_UNTIL_FOCUSED, SDL_FLASH_UNTIL_FOCUSED,
} }
public enum SDL_ProgressState
{
SDL_PROGRESS_STATE_INVALID = -1,
SDL_PROGRESS_STATE_NONE,
SDL_PROGRESS_STATE_INDETERMINATE,
SDL_PROGRESS_STATE_NORMAL,
SDL_PROGRESS_STATE_PAUSED,
SDL_PROGRESS_STATE_ERROR,
}
public partial struct SDL_GLContextState public partial struct SDL_GLContextState
{ {
} }
@ -445,6 +455,20 @@ namespace SDL
[return: NativeTypeName("bool")] [return: NativeTypeName("bool")]
public static extern SDLBool SDL_FlashWindow(SDL_Window* window, SDL_FlashOperation operation); public static extern SDLBool SDL_FlashWindow(SDL_Window* window, SDL_FlashOperation operation);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetWindowProgressState(SDL_Window* window, SDL_ProgressState state);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_ProgressState SDL_GetWindowProgressState(SDL_Window* window);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("bool")]
public static extern SDLBool SDL_SetWindowProgressValue(SDL_Window* window, float value);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float SDL_GetWindowProgressValue(SDL_Window* window);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_DestroyWindow(SDL_Window* window); public static extern void SDL_DestroyWindow(SDL_Window* window);
@ -665,12 +689,21 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER \"SDL.display.KMSDRM.panel_orientation\"")] [NativeTypeName("#define SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER \"SDL.display.KMSDRM.panel_orientation\"")]
public static ReadOnlySpan<byte> SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER => "SDL.display.KMSDRM.panel_orientation"u8; public static ReadOnlySpan<byte> SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER => "SDL.display.KMSDRM.panel_orientation"u8;
[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\"")] [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; public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN => "SDL.window.create.always_on_top"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN \"SDL.window.create.borderless\"")] [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN \"SDL.window.create.borderless\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN => "SDL.window.create.borderless"u8; public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN => "SDL.window.create.borderless"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN \"SDL.window.create.constrain_popup\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN => "SDL.window.create.constrain_popup"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN \"SDL.window.create.focusable\"")] [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN \"SDL.window.create.focusable\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN => "SDL.window.create.focusable"u8; public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN => "SDL.window.create.focusable"u8;
@ -749,6 +782,9 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER \"SDL.window.create.cocoa.view\"")] [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; 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\"")] [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; public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN => "SDL.window.create.wayland.surface_role_custom"u8;
@ -767,6 +803,15 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER \"SDL.window.create.x11.window\"")] [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER \"SDL.window.create.x11.window\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER => "SDL.window.create.x11.window"u8; public static ReadOnlySpan<byte> SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER => "SDL.window.create.x11.window"u8;
[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;
[NativeTypeName("#define SDL_PROP_WINDOW_SHAPE_POINTER \"SDL.window.shape\"")] [NativeTypeName("#define SDL_PROP_WINDOW_SHAPE_POINTER \"SDL.window.shape\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_SHAPE_POINTER => "SDL.window.shape"u8; public static ReadOnlySpan<byte> SDL_PROP_WINDOW_SHAPE_POINTER => "SDL.window.shape"u8;
@ -815,8 +860,8 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER \"SDL.window.cocoa.metal_view_tag\"")] [NativeTypeName("#define SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER \"SDL.window.cocoa.metal_view_tag\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER => "SDL.window.cocoa.metal_view_tag"u8; public static ReadOnlySpan<byte> SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER => "SDL.window.cocoa.metal_view_tag"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_OPENVR_OVERLAY_ID \"SDL.window.openvr.overlay_id\"")] [NativeTypeName("#define SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER \"SDL.window.openvr.overlay_id\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_OPENVR_OVERLAY_ID => "SDL.window.openvr.overlay_id"u8; public static ReadOnlySpan<byte> SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER => "SDL.window.openvr.overlay_id"u8;
[NativeTypeName("#define SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER \"SDL.window.vivante.display\"")] [NativeTypeName("#define SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER \"SDL.window.vivante.display\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER => "SDL.window.vivante.display"u8; public static ReadOnlySpan<byte> SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER => "SDL.window.vivante.display"u8;
@ -872,6 +917,15 @@ namespace SDL
[NativeTypeName("#define SDL_PROP_WINDOW_X11_WINDOW_NUMBER \"SDL.window.x11.window\"")] [NativeTypeName("#define SDL_PROP_WINDOW_X11_WINDOW_NUMBER \"SDL.window.x11.window\"")]
public static ReadOnlySpan<byte> SDL_PROP_WINDOW_X11_WINDOW_NUMBER => "SDL.window.x11.window"u8; public static ReadOnlySpan<byte> SDL_PROP_WINDOW_X11_WINDOW_NUMBER => "SDL.window.x11.window"u8;
[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;
[NativeTypeName("#define SDL_WINDOW_SURFACE_VSYNC_DISABLED 0")] [NativeTypeName("#define SDL_WINDOW_SURFACE_VSYNC_DISABLED 0")]
public const int SDL_WINDOW_SURFACE_VSYNC_DISABLED = 0; public const int SDL_WINDOW_SURFACE_VSYNC_DISABLED = 0;

View File

@ -8,14 +8,14 @@ namespace SDL
[Macro] [Macro]
public static unsafe SDLBool SDL_Unsupported() 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()); return SDL_SetError(fmt, __arglist());
} }
[Macro] [Macro]
public static unsafe SDLBool SDL_InvalidParamError([NativeTypeName("const char *")] byte* param) 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)); return SDL_SetError(fmt, __arglist(param));
} }
} }

View File

@ -1,6 +1,9 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Text;
namespace SDL namespace SDL
{ {
public partial struct SDL_CommonEvent public partial struct SDL_CommonEvent
@ -63,5 +66,23 @@ namespace SDL
public static void SDL_FlushEvents(SDL_EventType minType, SDL_EventType maxType) => SDL_FlushEvents((uint)minType, (uint)maxType); public static void SDL_FlushEvents(SDL_EventType minType, SDL_EventType maxType) => SDL_FlushEvents((uint)minType, (uint)maxType);
public static void SDL_SetEventEnabled(SDL_EventType type, bool enabled) => SDL_SetEventEnabled((uint)type, enabled); public static void SDL_SetEventEnabled(SDL_EventType type, bool enabled) => SDL_SetEventEnabled((uint)type, enabled);
public static SDLBool SDL_EventEnabled(SDL_EventType type) => SDL_EventEnabled((uint)type); public static SDLBool SDL_EventEnabled(SDL_EventType type) => SDL_EventEnabled((uint)type);
public static string SDL_GetEventDescription(SDL_Event @event)
{
// Buffer size taken from https://github.com/libsdl-org/SDL/blob/7dd5e765df239986f78c9b0016e3f3023d885084/src/events/SDL_events.c#L908-L913.
const int bufferSize = 256;
Span<byte> buf = stackalloc byte[bufferSize];
int bytesWritten;
unsafe
{
fixed (byte* ptr = buf)
bytesWritten = SDL_GetEventDescription(&@event, ptr, bufferSize);
}
int bytesToRead = bytesWritten > bufferSize ? bufferSize : bytesWritten;
return Encoding.UTF8.GetString(buf[..bytesToRead]);
}
} }
} }

View File

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

View File

@ -9,6 +9,39 @@ namespace SDL
[Typedef] [Typedef]
public enum SDL_HapticID : UInt32; public enum SDL_HapticID : UInt32;
[Typedef]
public enum SDL_HapticEffectType : UInt16
{
SDL_HAPTIC_CONSTANT = (UInt16)SDL3.SDL_HAPTIC_CONSTANT,
SDL_HAPTIC_SINE = (UInt16)SDL3.SDL_HAPTIC_SINE,
SDL_HAPTIC_SQUARE = (UInt16)SDL3.SDL_HAPTIC_SQUARE,
SDL_HAPTIC_TRIANGLE = (UInt16)SDL3.SDL_HAPTIC_TRIANGLE,
SDL_HAPTIC_SAWTOOTHUP = (UInt16)SDL3.SDL_HAPTIC_SAWTOOTHUP,
SDL_HAPTIC_SAWTOOTHDOWN = (UInt16)SDL3.SDL_HAPTIC_SAWTOOTHDOWN,
SDL_HAPTIC_RAMP = (UInt16)SDL3.SDL_HAPTIC_RAMP,
SDL_HAPTIC_SPRING = (UInt16)SDL3.SDL_HAPTIC_SPRING,
SDL_HAPTIC_DAMPER = (UInt16)SDL3.SDL_HAPTIC_DAMPER,
SDL_HAPTIC_INERTIA = (UInt16)SDL3.SDL_HAPTIC_INERTIA,
SDL_HAPTIC_FRICTION = (UInt16)SDL3.SDL_HAPTIC_FRICTION,
SDL_HAPTIC_LEFTRIGHT = (UInt16)SDL3.SDL_HAPTIC_LEFTRIGHT,
SDL_HAPTIC_RESERVED1 = (UInt16)SDL3.SDL_HAPTIC_RESERVED1,
SDL_HAPTIC_RESERVED2 = (UInt16)SDL3.SDL_HAPTIC_RESERVED2,
SDL_HAPTIC_RESERVED3 = (UInt16)SDL3.SDL_HAPTIC_RESERVED3,
SDL_HAPTIC_CUSTOM = (UInt16)SDL3.SDL_HAPTIC_CUSTOM,
}
[Typedef]
public enum SDL_HapticDirectionType : byte
{
SDL_HAPTIC_POLAR = SDL3.SDL_HAPTIC_POLAR,
SDL_HAPTIC_CARTESIAN = SDL3.SDL_HAPTIC_CARTESIAN,
SDL_HAPTIC_SPHERICAL = SDL3.SDL_HAPTIC_SPHERICAL,
SDL_HAPTIC_STEERING_AXIS = SDL3.SDL_HAPTIC_STEERING_AXIS,
}
[Typedef]
public enum SDL_HapticEffectID : int;
public static partial class SDL3 public static partial class SDL3
{ {
[MustDisposeResource] [MustDisposeResource]

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); 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

@ -8,6 +8,7 @@ namespace SDL
[Typedef] [Typedef]
public enum SDL_Keycode : UInt32 public enum SDL_Keycode : UInt32
{ {
SDLK_EXTENDED_MASK = SDL3.SDLK_EXTENDED_MASK,
SDLK_SCANCODE_MASK = SDL3.SDLK_SCANCODE_MASK, SDLK_SCANCODE_MASK = SDL3.SDLK_SCANCODE_MASK,
SDLK_UNKNOWN = SDL3.SDLK_UNKNOWN, SDLK_UNKNOWN = SDL3.SDLK_UNKNOWN,
SDLK_RETURN = SDL3.SDLK_RETURN, SDLK_RETURN = SDL3.SDLK_RETURN,
@ -258,6 +259,13 @@ namespace SDL
SDLK_SOFTRIGHT = SDL3.SDLK_SOFTRIGHT, SDLK_SOFTRIGHT = SDL3.SDLK_SOFTRIGHT,
SDLK_CALL = SDL3.SDLK_CALL, SDLK_CALL = SDL3.SDLK_CALL,
SDLK_ENDCALL = SDL3.SDLK_ENDCALL, SDLK_ENDCALL = SDL3.SDLK_ENDCALL,
SDLK_LEFT_TAB = SDL3.SDLK_LEFT_TAB,
SDLK_LEVEL5_SHIFT = SDL3.SDLK_LEVEL5_SHIFT,
SDLK_MULTI_KEY_COMPOSE = SDL3.SDLK_MULTI_KEY_COMPOSE,
SDLK_LMETA = SDL3.SDLK_LMETA,
SDLK_RMETA = SDL3.SDLK_RMETA,
SDLK_LHYPER = SDL3.SDLK_LHYPER,
SDLK_RHYPER = SDL3.SDLK_RHYPER,
} }
[Flags] [Flags]
@ -267,6 +275,7 @@ namespace SDL
SDL_KMOD_NONE = (UInt16)SDL3.SDL_KMOD_NONE, SDL_KMOD_NONE = (UInt16)SDL3.SDL_KMOD_NONE,
SDL_KMOD_LSHIFT = (UInt16)SDL3.SDL_KMOD_LSHIFT, SDL_KMOD_LSHIFT = (UInt16)SDL3.SDL_KMOD_LSHIFT,
SDL_KMOD_RSHIFT = (UInt16)SDL3.SDL_KMOD_RSHIFT, SDL_KMOD_RSHIFT = (UInt16)SDL3.SDL_KMOD_RSHIFT,
SDL_KMOD_LEVEL5 = (UInt16)SDL3.SDL_KMOD_LEVEL5,
SDL_KMOD_LCTRL = (UInt16)SDL3.SDL_KMOD_LCTRL, SDL_KMOD_LCTRL = (UInt16)SDL3.SDL_KMOD_LCTRL,
SDL_KMOD_RCTRL = (UInt16)SDL3.SDL_KMOD_RCTRL, SDL_KMOD_RCTRL = (UInt16)SDL3.SDL_KMOD_RCTRL,
SDL_KMOD_LALT = (UInt16)SDL3.SDL_KMOD_LALT, SDL_KMOD_LALT = (UInt16)SDL3.SDL_KMOD_LALT,

View File

@ -19,5 +19,15 @@ namespace SDL
SDL_PEN_INPUT_BUTTON_4 = SDL3.SDL_PEN_INPUT_BUTTON_4, 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_BUTTON_5 = SDL3.SDL_PEN_INPUT_BUTTON_5,
SDL_PEN_INPUT_ERASER_TIP = SDL3.SDL_PEN_INPUT_ERASER_TIP, SDL_PEN_INPUT_ERASER_TIP = SDL3.SDL_PEN_INPUT_ERASER_TIP,
SDL_PEN_INPUT_IN_PROXIMITY = SDL3.SDL_PEN_INPUT_IN_PROXIMITY,
}
public static partial class SDL3
{
[Constant]
public const SDL_MouseID SDL_PEN_MOUSEID = unchecked((SDL_MouseID)(-2));
[Constant]
public const SDL_TouchID SDL_PEN_TOUCHID = unchecked((SDL_TouchID)(-2));
} }
} }

View File

@ -46,18 +46,20 @@ namespace SDL
[Macro] [Macro]
public static uint SDL_FOURCC(byte A, byte B, byte C, byte D) => (uint)((A << 0) | (B << 8) | (C << 16) | (D << 24)); public static uint SDL_FOURCC(byte A, byte B, byte C, byte D) => (uint)((A << 0) | (B << 8) | (C << 16) | (D << 24));
[Macro] [Obsolete("Do not use.")] // used internally
public static unsafe void SDL_INIT_INTERFACE(out SDL_IOStreamInterface iface) public interface ISDLInterface
{ {
iface = default; internal uint version { set; }
iface.version = (uint)sizeof(SDL_IOStreamInterface);
} }
[Macro] [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 = default;
iface.version = (uint)sizeof(SDL_StorageInterface); iface.version = (uint)sizeof(T);
} }
public static unsafe void SDL_free(void* mem) => SDL_free((IntPtr)mem); public static unsafe void SDL_free(void* mem) => SDL_free((IntPtr)mem);

View File

@ -7,6 +7,13 @@ using JetBrains.Annotations;
namespace SDL 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 public static partial class SDL3
{ {
/// <returns> /// <returns>

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

@ -0,0 +1,28 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
namespace SDL
{
[Flags]
[Typedef]
public enum SDL_TrayEntryFlags : UInt32
{
SDL_TRAYENTRY_BUTTON = SDL3.SDL_TRAYENTRY_BUTTON,
SDL_TRAYENTRY_CHECKBOX = SDL3.SDL_TRAYENTRY_CHECKBOX,
SDL_TRAYENTRY_SUBMENU = SDL3.SDL_TRAYENTRY_SUBMENU,
SDL_TRAYENTRY_DISABLED = SDL3.SDL_TRAYENTRY_DISABLED,
SDL_TRAYENTRY_CHECKED = SDL3.SDL_TRAYENTRY_CHECKED,
}
public static partial class SDL3
{
public static unsafe SDLConstOpaquePointerArray<SDL_TrayEntry>? SDL_GetTrayEntries(SDL_TrayMenu* menu)
{
int count;
var array = SDL_GetTrayEntries(menu, &count);
return SDLArray.CreateConstOpaque(array, count);
}
}
}

View File

@ -18,9 +18,6 @@ namespace SDL
[Macro] [Macro]
public static int SDL_VERSIONNUM_MICRO(int version) => ((version) % 1000); 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] [Macro]
public static bool SDL_VERSION_ATLEAST(int X, int Y, int Z) => SDL_VERSION >= SDL_VERSIONNUM(X, Y, Z); 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_INPUT_FOCUS = SDL3.SDL_WINDOW_INPUT_FOCUS,
SDL_WINDOW_MOUSE_FOCUS = SDL3.SDL_WINDOW_MOUSE_FOCUS, SDL_WINDOW_MOUSE_FOCUS = SDL3.SDL_WINDOW_MOUSE_FOCUS,
SDL_WINDOW_EXTERNAL = SDL3.SDL_WINDOW_EXTERNAL, 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_HIGH_PIXEL_DENSITY = SDL3.SDL_WINDOW_HIGH_PIXEL_DENSITY,
SDL_WINDOW_MOUSE_CAPTURE = SDL3.SDL_WINDOW_MOUSE_CAPTURE, 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_ALWAYS_ON_TOP = SDL3.SDL_WINDOW_ALWAYS_ON_TOP,
SDL_WINDOW_UTILITY = SDL3.SDL_WINDOW_UTILITY, SDL_WINDOW_UTILITY = SDL3.SDL_WINDOW_UTILITY,
SDL_WINDOW_TOOLTIP = SDL3.SDL_WINDOW_TOOLTIP, SDL_WINDOW_TOOLTIP = SDL3.SDL_WINDOW_TOOLTIP,
@ -107,11 +109,11 @@ namespace SDL
} }
[MustDisposeResource] [MustDisposeResource]
public static unsafe SDLPointerArray<SDL_Window>? SDL_GetWindows() public static unsafe SDLOpaquePointerArray<SDL_Window>? SDL_GetWindows()
{ {
int count; int count;
var array = SDL_GetWindows(&count); var array = SDL_GetWindows(&count);
return SDLArray.Create(array, count); return SDLArray.CreateOpaque(array, count);
} }
} }
} }

View File

@ -40,6 +40,24 @@ namespace SDL
SDL3.SDL_free(array); SDL3.SDL_free(array);
} }
public Enumerator GetEnumerator() => new Enumerator(this);
public ref struct Enumerator
{
private readonly SDLArray<T> array;
private int index;
internal Enumerator(SDLArray<T> array)
{
this.array = array;
index = -1;
}
public bool MoveNext() => ++index < array.Count;
public T Current => array[index];
}
} }
internal static unsafe class SDLArray internal static unsafe class SDLArray
@ -63,5 +81,24 @@ namespace SDL
return new SDLPointerArray<T>(array, count); return new SDLPointerArray<T>(array, count);
} }
[MustDisposeResource]
internal static SDLOpaquePointerArray<T>? CreateOpaque<T>(T** array, int count)
where T : unmanaged
{
if (array == null)
return null;
return new SDLOpaquePointerArray<T>(array, count);
}
internal static SDLConstOpaquePointerArray<T>? CreateConstOpaque<T>(T** array, int count)
where T : unmanaged
{
if (array == null)
return null;
return new SDLConstOpaquePointerArray<T>(array, count);
}
} }
} }

View File

@ -0,0 +1,50 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
namespace SDL
{
public sealed unsafe class SDLConstOpaquePointerArray<T>
where T : unmanaged
{
private readonly T** array;
public readonly int Count;
internal SDLConstOpaquePointerArray(T** array, int count)
{
this.array = array;
Count = count;
}
public T* this[int index]
{
get
{
ArgumentOutOfRangeException.ThrowIfNegative(index);
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, Count);
Debug.Assert(array[index] != null);
return array[index];
}
}
public Enumerator GetEnumerator() => new Enumerator(this);
public ref struct Enumerator
{
private readonly SDLConstOpaquePointerArray<T> array;
private int index;
internal Enumerator(SDLConstOpaquePointerArray<T> array)
{
this.array = array;
index = -1;
}
public bool MoveNext() => ++index < array.Count;
public T* Current => array[index];
}
}
}

View File

@ -0,0 +1,64 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
using JetBrains.Annotations;
namespace SDL
{
[MustDisposeResource]
public sealed unsafe class SDLOpaquePointerArray<T> : IDisposable
where T : unmanaged
{
private readonly T** array;
public readonly int Count;
private bool isDisposed;
internal SDLOpaquePointerArray(T** array, int count)
{
this.array = array;
Count = count;
}
public T* this[int index]
{
get
{
ObjectDisposedException.ThrowIf(isDisposed, this);
ArgumentOutOfRangeException.ThrowIfNegative(index);
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, Count);
Debug.Assert(array[index] != null);
return array[index];
}
}
public void Dispose()
{
if (isDisposed)
return;
isDisposed = true;
SDL3.SDL_free(array);
}
public Enumerator GetEnumerator() => new Enumerator(this);
public ref struct Enumerator
{
private readonly SDLOpaquePointerArray<T> array;
private int index;
internal Enumerator(SDLOpaquePointerArray<T> array)
{
this.array = array;
index = -1;
}
public bool MoveNext() => ++index < array.Count;
public T* Current => array[index];
}
}
}

View File

@ -43,5 +43,23 @@ namespace SDL
SDL3.SDL_free(array); SDL3.SDL_free(array);
} }
public Enumerator GetEnumerator() => new Enumerator(this);
public ref struct Enumerator
{
private readonly SDLPointerArray<T> array;
private int index;
internal Enumerator(SDLPointerArray<T> array)
{
this.array = array;
index = -1;
}
public bool MoveNext() => ++index < array.Count;
public T Current => array[index];
}
} }
} }

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