From 7012887e6ff3b7c29b1e6db8a49f4b14a0902323 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Thu, 4 Apr 2024 00:35:56 +0200 Subject: [PATCH 01/37] Add global/base files --- .editorconfig | 140 +++++++++++++++++ .gitattributes | 25 ++++ .gitignore | 338 ++++++++++++++++++++++++++++++++++++++++++ .globalconfig | 53 +++++++ Directory.Build.props | 27 ++++ LICENCE | 19 +++ SDL3-CS.licenseheader | 13 ++ SDL3-CS.sln | 32 ++++ global.json | 7 + 9 files changed, 654 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .globalconfig create mode 100644 Directory.Build.props create mode 100644 LICENCE create mode 100644 SDL3-CS.licenseheader create mode 100644 SDL3-CS.sln create mode 100644 global.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a5f783f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,140 @@ +# EditorConfig is awesome: http://editorconfig.org +root = true + +[*.{csproj,props,targets}] +charset = utf-8-bom +end_of_line = crlf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +[*g.cs] +generated_code = true + +[*.cs] +end_of_line = crlf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +#license header +file_header_template = Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.\nSee the LICENCE file in the repository root for full licence text. + +#Roslyn naming styles +# Disabled as we're mimicking SDL naming + +#Roslyn formating options + +#Formatting - indentation options +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = false +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true + +#Formatting - new line options +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_open_brace = all +#csharp_new_line_before_members_in_anonymous_types = true +#csharp_new_line_before_members_in_object_initializers = true # Currently no effect in VS/dotnet format (16.4), and makes Rider confusing +csharp_new_line_between_query_expression_clauses = true + +#Formatting - organize using options +dotnet_sort_system_directives_first = true + +#Formatting - spacing options +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_parameter_list_parentheses = false + +#Formatting - wrapping options +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +#Roslyn language styles + +#Style - this. qualification +dotnet_style_qualification_for_field = false:warning +dotnet_style_qualification_for_property = false:warning +dotnet_style_qualification_for_method = false:warning +dotnet_style_qualification_for_event = false:warning + +#Style - type names +dotnet_style_predefined_type_for_locals_parameters_members = true:none +dotnet_style_predefined_type_for_member_access = true:none +csharp_style_var_when_type_is_apparent = true:none +csharp_style_var_for_built_in_types = false:warning +csharp_style_var_elsewhere = true:silent + +#Style - modifiers +dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning +csharp_preferred_modifier_order = public,private,protected,internal,new,abstract,virtual,sealed,override,static,readonly,extern,unsafe,volatile,async:warning + +#Style - parentheses +# Skipped because roslyn cannot separate +-*/ with << >> + +#Style - expression bodies +csharp_style_expression_bodied_accessors = true:warning +csharp_style_expression_bodied_constructors = false:none +csharp_style_expression_bodied_indexers = true:warning +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_operators = true:warning +csharp_style_expression_bodied_properties = true:warning +csharp_style_expression_bodied_local_functions = true:silent + +#Style - expression preferences +dotnet_style_object_initializer = true:warning +dotnet_style_collection_initializer = true:warning +dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning +dotnet_style_prefer_auto_properties = true:warning +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_prefer_compound_assignment = true:warning + +#Style - null/type checks +dotnet_style_coalesce_expression = true:warning +dotnet_style_null_propagation = true:warning +csharp_style_pattern_matching_over_is_with_cast_check = true:warning +csharp_style_pattern_matching_over_as_with_null_check = true:warning +csharp_style_throw_expression = true:silent +csharp_style_conditional_delegate_call = true:warning + +#Style - unused +dotnet_style_readonly_field = true:silent +dotnet_code_quality_unused_parameters = non_public:silent +csharp_style_unused_value_expression_statement_preference = discard_variable:silent +csharp_style_unused_value_assignment_preference = discard_variable:warning + +#Style - variable declaration +csharp_style_inlined_variable_declaration = true:warning +csharp_style_deconstructed_variable_declaration = true:warning + +#Style - other C# 7.x features +dotnet_style_prefer_inferred_tuple_names = true:warning +csharp_prefer_simple_default_expression = true:warning +csharp_style_pattern_local_over_anonymous_function = true:warning +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent + +#Style - C# 8 features +csharp_prefer_static_local_function = true:warning +csharp_prefer_simple_using_statement = true:silent +csharp_style_prefer_index_operator = true:warning +csharp_style_prefer_range_operator = true:warning +csharp_style_prefer_switch_expression = false:none + +csharp_style_namespace_declarations = block_scoped:warning + +[*.{yaml,yml}] +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c61ca25 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,25 @@ +# Autodetect text files and ensure that we normalise their +# line endings to lf internally. When checked out they may +# use different line endings. +* text=auto + +# Check out with crlf (Windows) line endings +*.sln text eol=crlf +*.csproj text eol=crlf +*.cs text diff=csharp eol=crlf +*.resx text eol=crlf +*.vsixmanifest text eol=crlf +packages.config text eol=crlf +App.config text eol=crlf +*.bat text eol=crlf +*.cmd text eol=crlf +*.snippet text eol=crlf +*.manifest text eol=crlf +*.licenseheader text eol=crlf + +# Check out with lf (UNIX) line endings +*.sh text eol=lf +.gitignore text eol=lf +.gitattributes text eol=lf +*.md text eol=lf +.travis.yml text eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..04449cd --- /dev/null +++ b/.gitignore @@ -0,0 +1,338 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs +Resource.designer.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake # +/tools/** +/build/tools/** +/build/temp/** + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +.idea/modules.xml +.idea/*.iml +.idea/modules +*.iml +*.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + + +# Common IntelliJ Platform excludes +# Reference: https://github.com/JetBrains/resharper-rider-samples/blob/master/.gitignore + +# User specific +**/.idea/**/workspace.xml +**/.idea/**/tasks.xml +**/.idea/shelf/* +**/.idea/dictionaries +**/.idea/httpRequests/ +**/.idea/**/usage.statistics.xml + +# Sensitive or high-churn files +**/.idea/**/dataSources/ +**/.idea/**/dataSources.ids +**/.idea/**/dataSources.xml +**/.idea/**/dataSources.local.xml +**/.idea/**/sqlDataSources.xml +**/.idea/**/dynamic.xml +**/.idea/**/uiDesigner.xml +**/.idea/**/dbnavigator.xml + +# Rider +# Rider auto-generates .iml files, and contentModel.xml +**/.idea/**/*.iml +**/.idea/**/contentModel.xml +**/.idea/**/modules.xml + +*GeneratedMSBuildEditorConfig* + +# inspectcode +inspectcodereport.xml +inspectcode diff --git a/.globalconfig b/.globalconfig new file mode 100644 index 0000000..0a2727e --- /dev/null +++ b/.globalconfig @@ -0,0 +1,53 @@ +# .NET Code Style +# IDE styles reference: https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ + +# IDE0001: Simplify names +dotnet_diagnostic.IDE0001.severity = warning + +# IDE0002: Simplify member access +dotnet_diagnostic.IDE0002.severity = warning + +# IDE0003: Remove qualification +dotnet_diagnostic.IDE0003.severity = warning + +# IDE0004: Remove unnecessary cast +dotnet_diagnostic.IDE0004.severity = warning + +# IDE0005: Remove unnecessary imports +dotnet_diagnostic.IDE0005.severity = warning + +# IDE0034: Simplify default literal +dotnet_diagnostic.IDE0034.severity = warning + +# IDE0036: Sort modifiers +dotnet_diagnostic.IDE0036.severity = warning + +# IDE0040: Add accessibility modifier +dotnet_diagnostic.IDE0040.severity = warning + +# IDE0049: Use keyword for type name +dotnet_diagnostic.IDE0040.severity = warning + +# IDE0055: Fix formatting +dotnet_diagnostic.IDE0055.severity = warning + +# IDE0051: Private method is unused +dotnet_diagnostic.IDE0051.severity = silent + +# IDE0052: Private member is unused +dotnet_diagnostic.IDE0052.severity = warning + +# IDE0073: File header +dotnet_diagnostic.IDE0073.severity = warning + +# IDE0130: Namespace mismatch with folder +dotnet_diagnostic.IDE0130.severity = warning + +# IDE1006: Naming style +dotnet_diagnostic.IDE1006.severity = warning + +#Disable operator overloads requiring alternate named methods +dotnet_diagnostic.CA2225.severity = none + +# Banned APIs +dotnet_diagnostic.RS0030.severity = error diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..a22ba87 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,27 @@ + + + + 12.0 + true + enable + + + true + $(NoWarn);CS1591 + + + + SDL3-CS.licenseheader + + + + ppy Pty Ltd + ppy Pty Ltd + Copyright (c) 2024 ppy Pty Ltd + SDL3-CS + Automated release. + MIT + https://github.com/ppy/osu-framework + https://github.com/ppy/osu-framework + + diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..679d2f9 --- /dev/null +++ b/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2024 ppy Pty Ltd . + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/SDL3-CS.licenseheader b/SDL3-CS.licenseheader new file mode 100644 index 0000000..19e382b --- /dev/null +++ b/SDL3-CS.licenseheader @@ -0,0 +1,13 @@ +extensions: .cs +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +extensions: .xml .config .xsd + + +extensions: .py .rsp +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. diff --git a/SDL3-CS.sln b/SDL3-CS.sln new file mode 100644 index 0000000..45f3332 --- /dev/null +++ b/SDL3-CS.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{18C20490-AA42-464A-BBC4-7B6CF63B91DE}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + .globalconfig = .globalconfig + Directory.Build.props = Directory.Build.props + global.json = global.json + .config\dotnet-tools.json = .config\dotnet-tools.json + .gitignore = .gitignore + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS", "SDL3-CS\SDL3-CS.csproj", "{3AEE5979-6974-4BD6-9BB1-1409B0BB469B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3AEE5979-6974-4BD6-9BB1-1409B0BB469B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3AEE5979-6974-4BD6-9BB1-1409B0BB469B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3AEE5979-6974-4BD6-9BB1-1409B0BB469B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3AEE5979-6974-4BD6-9BB1-1409B0BB469B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/global.json b/global.json new file mode 100644 index 0000000..789bff3 --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "8.0.100", + "rollForward": "latestFeature", + "allowPrerelease": false + } +} \ No newline at end of file From 1512bef0265ddb280447d6881b2fdd15b33a067a Mon Sep 17 00:00:00 2001 From: Susko3 Date: Fri, 5 Apr 2024 23:59:45 +0200 Subject: [PATCH 02/37] Initial SDL3-CS binding project with ClangSharp The bindings don't yet compile. There are errors in SDL_pixels.g.cs, SDL_stdinc.g.cs and SDL_thread.g.cs, a bunch of warnings about "Function like macro definition records are not supported", and a few "Info: Potential missing remapping". Built on SDL commit: https://github.com/libsdl-org/SDL/commit/6ad390fc5093bcbf785b7ad103484501d11d8c2a --- .config/dotnet-tools.json | 12 + .idea/.idea.SDL3-CS/.idea/.gitignore | 11 + .idea/.idea.SDL3-CS/.idea/encodings.xml | 4 + .idea/.idea.SDL3-CS/.idea/indexLayout.xml | 8 + .idea/.idea.SDL3-CS/.idea/misc.xml | 6 + .idea/.idea.SDL3-CS/.idea/vcs.xml | 6 + SDL3-CS/NativeTypeNameAttribute.cs | 25 + SDL3-CS/SDL.licenseheader | 24 + SDL3-CS/SDL3-CS.csproj | 11 + SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs | 76 ++ SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs | 232 ++++ SDL3-CS/SDL3/ClangSharp/SDL_blendmode.g.cs | 68 ++ SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs | 107 ++ SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs | 67 ++ SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs | 104 ++ SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs | 50 + SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs | 55 + SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs | 1146 +++++++++++++++++++ SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs | 106 ++ SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs | 452 ++++++++ SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs | 51 + SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs | 505 ++++++++ SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs | 157 +++ SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs | 654 +++++++++++ SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs | 61 + SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs | 252 ++++ SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs | 371 ++++++ SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs | 120 ++ SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs | 305 +++++ SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs | 42 + SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs | 44 + SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs | 115 ++ SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs | 53 + SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs | 121 ++ SDL3-CS/SDL3/ClangSharp/SDL_metal.g.cs | 42 + SDL3-CS/SDL3/ClangSharp/SDL_misc.g.cs | 35 + SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs | 171 +++ SDL3-CS/SDL3/ClangSharp/SDL_mutex.g.cs | 130 +++ SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs | 154 +++ SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs | 434 +++++++ SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs | 36 + SDL3-CS/SDL3/ClangSharp/SDL_power.g.cs | 45 + SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs | 111 ++ SDL3-CS/SDL3/ClangSharp/SDL_quit.g.cs | 0 SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs | 148 +++ SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs | 575 ++++++++++ SDL3-CS/SDL3/ClangSharp/SDL_revision.g.cs | 35 + SDL3-CS/SDL3/ClangSharp/SDL_scancode.g.cs | 279 +++++ SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs | 98 ++ SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 666 +++++++++++ SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs | 120 ++ SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs | 239 ++++ SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs | 76 ++ SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs | 90 ++ SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs | 98 ++ SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs | 77 ++ SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs | 75 ++ SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs | 63 + SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs | 768 +++++++++++++ SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs | 62 + SDL3-CS/generate_bindings.py | 144 +++ 61 files changed, 10192 insertions(+) create mode 100644 .config/dotnet-tools.json create mode 100644 .idea/.idea.SDL3-CS/.idea/.gitignore create mode 100644 .idea/.idea.SDL3-CS/.idea/encodings.xml create mode 100644 .idea/.idea.SDL3-CS/.idea/indexLayout.xml create mode 100644 .idea/.idea.SDL3-CS/.idea/misc.xml create mode 100644 .idea/.idea.SDL3-CS/.idea/vcs.xml create mode 100644 SDL3-CS/NativeTypeNameAttribute.cs create mode 100644 SDL3-CS/SDL.licenseheader create mode 100644 SDL3-CS/SDL3-CS.csproj create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_blendmode.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_metal.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_misc.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_mutex.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_power.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_quit.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_revision.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_scancode.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs create mode 100644 SDL3-CS/generate_bindings.py diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..c8398ea --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "clangsharppinvokegenerator": { + "version": "17.0.1", + "commands": [ + "ClangSharpPInvokeGenerator" + ] + } + } +} \ No newline at end of file diff --git a/.idea/.idea.SDL3-CS/.idea/.gitignore b/.idea/.idea.SDL3-CS/.idea/.gitignore new file mode 100644 index 0000000..744eb9c --- /dev/null +++ b/.idea/.idea.SDL3-CS/.idea/.gitignore @@ -0,0 +1,11 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/contentModel.xml +/modules.xml +/projectSettingsUpdater.xml +/.idea.SDL3-CS.iml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.SDL3-CS/.idea/encodings.xml b/.idea/.idea.SDL3-CS/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.SDL3-CS/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.SDL3-CS/.idea/indexLayout.xml b/.idea/.idea.SDL3-CS/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.SDL3-CS/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SDL3-CS/.idea/misc.xml b/.idea/.idea.SDL3-CS/.idea/misc.xml new file mode 100644 index 0000000..cafab9f --- /dev/null +++ b/.idea/.idea.SDL3-CS/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.SDL3-CS/.idea/vcs.xml b/.idea/.idea.SDL3-CS/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/.idea.SDL3-CS/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SDL3-CS/NativeTypeNameAttribute.cs b/SDL3-CS/NativeTypeNameAttribute.cs new file mode 100644 index 0000000..ef21851 --- /dev/null +++ b/SDL3-CS/NativeTypeNameAttribute.cs @@ -0,0 +1,25 @@ +// + +using System; +using System.Diagnostics; + +namespace SDL +{ + /// Defines the type of a member as it was used in the native signature. + [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = true)] + [Conditional("DEBUG")] + internal sealed partial class NativeTypeNameAttribute : Attribute + { + private readonly string _name; + + /// Initializes a new instance of the class. + /// The name of the type that was used in the native signature. + public NativeTypeNameAttribute(string name) + { + _name = name; + } + + /// Gets the name of the type that was used in the native signature. + public string Name => _name; + } +} diff --git a/SDL3-CS/SDL.licenseheader b/SDL3-CS/SDL.licenseheader new file mode 100644 index 0000000..fa92b93 --- /dev/null +++ b/SDL3-CS/SDL.licenseheader @@ -0,0 +1,24 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ diff --git a/SDL3-CS/SDL3-CS.csproj b/SDL3-CS/SDL3-CS.csproj new file mode 100644 index 0000000..6b3d095 --- /dev/null +++ b/SDL3-CS/SDL3-CS.csproj @@ -0,0 +1,11 @@ + + + + net8.0 + SDL + enable + true + $(NoWarn);SYSLIB1054;CA1401 + + + diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs new file mode 100644 index 0000000..35662a2 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs @@ -0,0 +1,76 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_AtomicInt + { + public int value; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_TryLockSpinlock([NativeTypeName("SDL_SpinLock *")] int* @lock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LockSpinlock([NativeTypeName("SDL_SpinLock *")] int* @lock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnlockSpinlock([NativeTypeName("SDL_SpinLock *")] int* @lock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_MemoryBarrierReleaseFunction(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_MemoryBarrierAcquireFunction(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_AtomicCompareAndSwap(SDL_AtomicInt* a, int oldval, int newval); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_AtomicSet(SDL_AtomicInt* a, int v); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_AtomicGet(SDL_AtomicInt* a); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_AtomicAdd(SDL_AtomicInt* a, int v); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_AtomicCompareAndSwapPointer(void** a, void* oldval, void* newval); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_AtomicSetPtr(void** a, void* v); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_AtomicGetPtr(void** a); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs new file mode 100644 index 0000000..54a221f --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -0,0 +1,232 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_AudioSpec + { + [NativeTypeName("SDL_AudioFormat")] + public ushort format; + + public int channels; + + public int freq; + } + + public partial struct SDL_AudioStream + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumAudioDrivers(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetAudioDriver(int index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetCurrentAudioDriver(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_AudioDeviceID *")] + public static extern uint* SDL_GetAudioOutputDevices(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_AudioDeviceID *")] + public static extern uint* SDL_GetAudioCaptureDevices(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_GetAudioDeviceName([NativeTypeName("SDL_AudioDeviceID")] uint devid); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetAudioDeviceFormat([NativeTypeName("SDL_AudioDeviceID")] uint devid, SDL_AudioSpec* spec, int* sample_frames); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_AudioDeviceID")] + public static extern uint SDL_OpenAudioDevice([NativeTypeName("SDL_AudioDeviceID")] uint devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_PauseAudioDevice([NativeTypeName("SDL_AudioDeviceID")] uint dev); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ResumeAudioDevice([NativeTypeName("SDL_AudioDeviceID")] uint dev); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_AudioDevicePaused([NativeTypeName("SDL_AudioDeviceID")] uint dev); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_CloseAudioDevice([NativeTypeName("SDL_AudioDeviceID")] uint devid); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_BindAudioStreams([NativeTypeName("SDL_AudioDeviceID")] uint devid, SDL_AudioStream** streams, int num_streams); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_BindAudioStream([NativeTypeName("SDL_AudioDeviceID")] uint devid, SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnbindAudioStreams(SDL_AudioStream** streams, int num_streams); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnbindAudioStream(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_AudioDeviceID")] + public static extern uint SDL_GetAudioStreamDevice(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_AudioStream* SDL_CreateAudioStream([NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* src_spec, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* dst_spec); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetAudioStreamProperties(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetAudioStreamFormat(SDL_AudioStream* stream, SDL_AudioSpec* src_spec, SDL_AudioSpec* dst_spec); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetAudioStreamFormat(SDL_AudioStream* stream, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* src_spec, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* dst_spec); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_GetAudioStreamFrequencyRatio(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream* stream, float ratio); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_PutAudioStreamData(SDL_AudioStream* stream, [NativeTypeName("const void *")] void* buf, int len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetAudioStreamData(SDL_AudioStream* stream, void* buf, int len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetAudioStreamAvailable(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetAudioStreamQueued(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_FlushAudioStream(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ClearAudioStream(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_LockAudioStream(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_UnlockAudioStream(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetAudioStreamGetCallback(SDL_AudioStream* stream, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetAudioStreamPutCallback(SDL_AudioStream* stream, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyAudioStream(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_AudioStream* SDL_OpenAudioDeviceStream([NativeTypeName("SDL_AudioDeviceID")] uint devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetAudioPostmixCallback([NativeTypeName("SDL_AudioDeviceID")] uint devid, [NativeTypeName("SDL_AudioPostmixCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_LoadWAV_IO(SDL_IOStream* src, [NativeTypeName("SDL_bool")] int closeio, SDL_AudioSpec* spec, [NativeTypeName("Uint8 **")] byte** audio_buf, [NativeTypeName("Uint32 *")] uint* audio_len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_LoadWAV([NativeTypeName("const char *")] sbyte* path, SDL_AudioSpec* spec, [NativeTypeName("Uint8 **")] byte** audio_buf, [NativeTypeName("Uint32 *")] uint* audio_len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_MixAudioFormat([NativeTypeName("Uint8 *")] byte* dst, [NativeTypeName("const Uint8 *")] byte* src, [NativeTypeName("SDL_AudioFormat")] ushort format, [NativeTypeName("Uint32")] uint len, int volume); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ConvertAudioSamples([NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* src_spec, [NativeTypeName("const Uint8 *")] byte* src_data, int src_len, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* dst_spec, [NativeTypeName("Uint8 **")] byte** dst_data, int* dst_len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSilenceValueForFormat([NativeTypeName("SDL_AudioFormat")] ushort format); + + [NativeTypeName("#define SDL_AUDIO_MASK_BITSIZE (0xFF)")] + public const int SDL_AUDIO_MASK_BITSIZE = (0xFF); + + [NativeTypeName("#define SDL_AUDIO_MASK_FLOAT (1<<8)")] + public const int SDL_AUDIO_MASK_FLOAT = (1 << 8); + + [NativeTypeName("#define SDL_AUDIO_MASK_BIG_ENDIAN (1<<12)")] + public const int SDL_AUDIO_MASK_BIG_ENDIAN = (1 << 12); + + [NativeTypeName("#define SDL_AUDIO_MASK_SIGNED (1<<15)")] + public const int SDL_AUDIO_MASK_SIGNED = (1 << 15); + + [NativeTypeName("#define SDL_AUDIO_U8 0x0008")] + public const int SDL_AUDIO_U8 = 0x0008; + + [NativeTypeName("#define SDL_AUDIO_S8 0x8008")] + public const int SDL_AUDIO_S8 = 0x8008; + + [NativeTypeName("#define SDL_AUDIO_S16LE 0x8010")] + public const int SDL_AUDIO_S16LE = 0x8010; + + [NativeTypeName("#define SDL_AUDIO_S16BE 0x9010")] + public const int SDL_AUDIO_S16BE = 0x9010; + + [NativeTypeName("#define SDL_AUDIO_S32LE 0x8020")] + public const int SDL_AUDIO_S32LE = 0x8020; + + [NativeTypeName("#define SDL_AUDIO_S32BE 0x9020")] + public const int SDL_AUDIO_S32BE = 0x9020; + + [NativeTypeName("#define SDL_AUDIO_F32LE 0x8120")] + public const int SDL_AUDIO_F32LE = 0x8120; + + [NativeTypeName("#define SDL_AUDIO_F32BE 0x9120")] + public const int SDL_AUDIO_F32BE = 0x9120; + + [NativeTypeName("#define SDL_AUDIO_S16 SDL_AUDIO_S16LE")] + public const int SDL_AUDIO_S16 = 0x8010; + + [NativeTypeName("#define SDL_AUDIO_S32 SDL_AUDIO_S32LE")] + public const int SDL_AUDIO_S32 = 0x8020; + + [NativeTypeName("#define SDL_AUDIO_F32 SDL_AUDIO_F32LE")] + public const int SDL_AUDIO_F32 = 0x8120; + + [NativeTypeName("#define SDL_AUDIO_DEVICE_DEFAULT_OUTPUT ((SDL_AudioDeviceID) 0xFFFFFFFF)")] + public const uint SDL_AUDIO_DEVICE_DEFAULT_OUTPUT = ((uint)(0xFFFFFFFF)); + + [NativeTypeName("#define SDL_AUDIO_DEVICE_DEFAULT_CAPTURE ((SDL_AudioDeviceID) 0xFFFFFFFE)")] + public const uint SDL_AUDIO_DEVICE_DEFAULT_CAPTURE = ((uint)(0xFFFFFFFE)); + + [NativeTypeName("#define SDL_MIX_MAXVOLUME 128")] + public const int SDL_MIX_MAXVOLUME = 128; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_blendmode.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_blendmode.g.cs new file mode 100644 index 0000000..d9f93dd --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_blendmode.g.cs @@ -0,0 +1,68 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_BlendMode + { + SDL_BLENDMODE_NONE = 0x00000000, + SDL_BLENDMODE_BLEND = 0x00000001, + SDL_BLENDMODE_ADD = 0x00000002, + SDL_BLENDMODE_MOD = 0x00000004, + SDL_BLENDMODE_MUL = 0x00000008, + SDL_BLENDMODE_INVALID = 0x7FFFFFFF, + } + + public enum SDL_BlendOperation + { + SDL_BLENDOPERATION_ADD = 0x1, + SDL_BLENDOPERATION_SUBTRACT = 0x2, + SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, + SDL_BLENDOPERATION_MINIMUM = 0x4, + SDL_BLENDOPERATION_MAXIMUM = 0x5, + } + + public enum SDL_BlendFactor + { + SDL_BLENDFACTOR_ZERO = 0x1, + SDL_BLENDFACTOR_ONE = 0x2, + SDL_BLENDFACTOR_SRC_COLOR = 0x3, + SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, + SDL_BLENDFACTOR_SRC_ALPHA = 0x5, + SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, + SDL_BLENDFACTOR_DST_COLOR = 0x7, + SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, + SDL_BLENDFACTOR_DST_ALPHA = 0x9, + SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA, + } + + public static partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_BlendMode SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, SDL_BlendFactor dstColorFactor, SDL_BlendOperation colorOperation, SDL_BlendFactor srcAlphaFactor, SDL_BlendFactor dstAlphaFactor, SDL_BlendOperation alphaOperation); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs new file mode 100644 index 0000000..1a451f0 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs @@ -0,0 +1,107 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Camera + { + } + + public partial struct SDL_CameraSpec + { + public SDL_PixelFormatEnum format; + + public int width; + + public int height; + + public int interval_numerator; + + public int interval_denominator; + } + + public enum SDL_CameraPosition + { + SDL_CAMERA_POSITION_UNKNOWN, + SDL_CAMERA_POSITION_FRONT_FACING, + SDL_CAMERA_POSITION_BACK_FACING, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumCameraDrivers(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetCameraDriver(int index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetCurrentCameraDriver(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_CameraDeviceID *")] + public static extern uint* SDL_GetCameraDevices(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_CameraSpec* SDL_GetCameraDeviceSupportedFormats([NativeTypeName("SDL_CameraDeviceID")] uint devid, int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_GetCameraDeviceName([NativeTypeName("SDL_CameraDeviceID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_CameraPosition SDL_GetCameraDevicePosition([NativeTypeName("SDL_CameraDeviceID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Camera* SDL_OpenCameraDevice([NativeTypeName("SDL_CameraDeviceID")] uint instance_id, [NativeTypeName("const SDL_CameraSpec *")] SDL_CameraSpec* spec); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetCameraPermissionState(SDL_Camera* camera); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_CameraDeviceID")] + public static extern uint SDL_GetCameraInstanceID(SDL_Camera* camera); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetCameraProperties(SDL_Camera* camera); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetCameraFormat(SDL_Camera* camera, SDL_CameraSpec* spec); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_AcquireCameraFrame(SDL_Camera* camera, [NativeTypeName("Uint64 *")] ulong* timestampNS); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ReleaseCameraFrame(SDL_Camera* camera, SDL_Surface* frame); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_CloseCamera(SDL_Camera* camera); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs new file mode 100644 index 0000000..12ffb25 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs @@ -0,0 +1,67 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetClipboardText([NativeTypeName("const char *")] sbyte* text); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_GetClipboardText(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasClipboardText(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetPrimarySelectionText([NativeTypeName("const char *")] sbyte* text); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_GetPrimarySelectionText(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasPrimarySelectionText(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetClipboardData([NativeTypeName("SDL_ClipboardDataCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("SDL_ClipboardCleanupCallback")] delegate* unmanaged[Cdecl] cleanup, void* userdata, [NativeTypeName("const char **")] sbyte** mime_types, [NativeTypeName("size_t")] nuint num_mime_types); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ClearClipboardData(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_GetClipboardData([NativeTypeName("const char *")] sbyte* mime_type, [NativeTypeName("size_t *")] nuint* size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasClipboardData([NativeTypeName("const char *")] sbyte* mime_type); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs new file mode 100644 index 0000000..e315d56 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs @@ -0,0 +1,104 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public static partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetCPUCount(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetCPUCacheLineSize(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasAltiVec(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasMMX(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasSSE(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasSSE2(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasSSE3(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasSSE41(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasSSE42(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasAVX(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasAVX2(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasAVX512F(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasARMSIMD(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasNEON(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasLSX(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasLASX(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSystemRAM(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_SIMDGetAlignment(); + + [NativeTypeName("#define SDL_CACHELINE_SIZE 128")] + public const int SDL_CACHELINE_SIZE = 128; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs new file mode 100644 index 0000000..9b596bb --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs @@ -0,0 +1,50 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public unsafe partial struct SDL_DialogFileFilter + { + [NativeTypeName("const char *")] + public sbyte* name; + + [NativeTypeName("const char *")] + public sbyte* pattern; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_ShowOpenFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] sbyte* default_location, [NativeTypeName("SDL_bool")] int allow_many); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_ShowSaveFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] sbyte* default_location); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_ShowOpenFolderDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const char *")] sbyte* default_location, [NativeTypeName("SDL_bool")] int allow_many); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs new file mode 100644 index 0000000..4786096 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs @@ -0,0 +1,55 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_errorcode + { + SDL_ENOMEM, + SDL_EFREAD, + SDL_EFWRITE, + SDL_EFSEEK, + SDL_UNSUPPORTED, + SDL_LASTERROR, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetError([NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetError(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_ClearError(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_Error(SDL_errorcode code); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs new file mode 100644 index 0000000..7a7275a --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs @@ -0,0 +1,1146 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_EventType + { + SDL_EVENT_FIRST = 0, + SDL_EVENT_QUIT = 0x100, + SDL_EVENT_TERMINATING, + SDL_EVENT_LOW_MEMORY, + SDL_EVENT_WILL_ENTER_BACKGROUND, + SDL_EVENT_DID_ENTER_BACKGROUND, + SDL_EVENT_WILL_ENTER_FOREGROUND, + SDL_EVENT_DID_ENTER_FOREGROUND, + SDL_EVENT_LOCALE_CHANGED, + SDL_EVENT_SYSTEM_THEME_CHANGED, + SDL_EVENT_DISPLAY_ORIENTATION = 0x151, + SDL_EVENT_DISPLAY_ADDED, + SDL_EVENT_DISPLAY_REMOVED, + SDL_EVENT_DISPLAY_MOVED, + SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED, + SDL_EVENT_DISPLAY_HDR_STATE_CHANGED, + SDL_EVENT_DISPLAY_FIRST = SDL_EVENT_DISPLAY_ORIENTATION, + SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_HDR_STATE_CHANGED, + SDL_EVENT_WINDOW_SHOWN = 0x202, + SDL_EVENT_WINDOW_HIDDEN, + SDL_EVENT_WINDOW_EXPOSED, + SDL_EVENT_WINDOW_MOVED, + SDL_EVENT_WINDOW_RESIZED, + SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED, + SDL_EVENT_WINDOW_MINIMIZED, + SDL_EVENT_WINDOW_MAXIMIZED, + SDL_EVENT_WINDOW_RESTORED, + SDL_EVENT_WINDOW_MOUSE_ENTER, + SDL_EVENT_WINDOW_MOUSE_LEAVE, + SDL_EVENT_WINDOW_FOCUS_GAINED, + SDL_EVENT_WINDOW_FOCUS_LOST, + SDL_EVENT_WINDOW_CLOSE_REQUESTED, + SDL_EVENT_WINDOW_TAKE_FOCUS, + SDL_EVENT_WINDOW_HIT_TEST, + SDL_EVENT_WINDOW_ICCPROF_CHANGED, + SDL_EVENT_WINDOW_DISPLAY_CHANGED, + SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED, + SDL_EVENT_WINDOW_OCCLUDED, + SDL_EVENT_WINDOW_ENTER_FULLSCREEN, + SDL_EVENT_WINDOW_LEAVE_FULLSCREEN, + SDL_EVENT_WINDOW_DESTROYED, + SDL_EVENT_WINDOW_PEN_ENTER, + SDL_EVENT_WINDOW_PEN_LEAVE, + SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN, + SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_PEN_LEAVE, + SDL_EVENT_KEY_DOWN = 0x300, + SDL_EVENT_KEY_UP, + SDL_EVENT_TEXT_EDITING, + SDL_EVENT_TEXT_INPUT, + SDL_EVENT_KEYMAP_CHANGED, + SDL_EVENT_KEYBOARD_ADDED, + SDL_EVENT_KEYBOARD_REMOVED, + SDL_EVENT_MOUSE_MOTION = 0x400, + SDL_EVENT_MOUSE_BUTTON_DOWN, + SDL_EVENT_MOUSE_BUTTON_UP, + SDL_EVENT_MOUSE_WHEEL, + SDL_EVENT_MOUSE_ADDED, + SDL_EVENT_MOUSE_REMOVED, + SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600, + SDL_EVENT_JOYSTICK_BALL_MOTION, + SDL_EVENT_JOYSTICK_HAT_MOTION, + SDL_EVENT_JOYSTICK_BUTTON_DOWN, + SDL_EVENT_JOYSTICK_BUTTON_UP, + SDL_EVENT_JOYSTICK_ADDED, + SDL_EVENT_JOYSTICK_REMOVED, + SDL_EVENT_JOYSTICK_BATTERY_UPDATED, + SDL_EVENT_JOYSTICK_UPDATE_COMPLETE, + SDL_EVENT_GAMEPAD_AXIS_MOTION = 0x650, + SDL_EVENT_GAMEPAD_BUTTON_DOWN, + SDL_EVENT_GAMEPAD_BUTTON_UP, + SDL_EVENT_GAMEPAD_ADDED, + SDL_EVENT_GAMEPAD_REMOVED, + SDL_EVENT_GAMEPAD_REMAPPED, + SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN, + SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION, + SDL_EVENT_GAMEPAD_TOUCHPAD_UP, + SDL_EVENT_GAMEPAD_SENSOR_UPDATE, + SDL_EVENT_GAMEPAD_UPDATE_COMPLETE, + SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED, + SDL_EVENT_FINGER_DOWN = 0x700, + SDL_EVENT_FINGER_UP, + SDL_EVENT_FINGER_MOTION, + SDL_EVENT_CLIPBOARD_UPDATE = 0x900, + SDL_EVENT_DROP_FILE = 0x1000, + SDL_EVENT_DROP_TEXT, + SDL_EVENT_DROP_BEGIN, + SDL_EVENT_DROP_COMPLETE, + SDL_EVENT_DROP_POSITION, + SDL_EVENT_AUDIO_DEVICE_ADDED = 0x1100, + SDL_EVENT_AUDIO_DEVICE_REMOVED, + SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED, + SDL_EVENT_SENSOR_UPDATE = 0x1200, + SDL_EVENT_PEN_DOWN = 0x1300, + SDL_EVENT_PEN_UP, + SDL_EVENT_PEN_MOTION, + SDL_EVENT_PEN_BUTTON_DOWN, + SDL_EVENT_PEN_BUTTON_UP, + SDL_EVENT_CAMERA_DEVICE_ADDED = 0x1400, + SDL_EVENT_CAMERA_DEVICE_REMOVED, + SDL_EVENT_CAMERA_DEVICE_APPROVED, + SDL_EVENT_CAMERA_DEVICE_DENIED, + SDL_EVENT_RENDER_TARGETS_RESET = 0x2000, + SDL_EVENT_RENDER_DEVICE_RESET, + SDL_EVENT_POLL_SENTINEL = 0x7F00, + SDL_EVENT_USER = 0x8000, + SDL_EVENT_LAST = 0xFFFF, + SDL_EVENT_ENUM_PADDING = 0x7FFFFFFF, + } + + public partial struct SDL_CommonEvent + { + [NativeTypeName("Uint32")] + public uint type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + } + + public partial struct SDL_DisplayEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_DisplayID")] + public uint displayID; + + [NativeTypeName("Sint32")] + public int data1; + } + + public partial struct SDL_WindowEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("Sint32")] + public int data1; + + [NativeTypeName("Sint32")] + public int data2; + } + + public partial struct SDL_KeyboardDeviceEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_KeyboardID")] + public uint which; + } + + public partial struct SDL_KeyboardEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("SDL_KeyboardID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte state; + + [NativeTypeName("Uint8")] + public byte repeat; + + [NativeTypeName("Uint8")] + public byte padding2; + + [NativeTypeName("Uint8")] + public byte padding3; + + public SDL_Keysym keysym; + } + + public unsafe partial struct SDL_TextEditingEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("char *")] + public sbyte* text; + + [NativeTypeName("Sint32")] + public int start; + + [NativeTypeName("Sint32")] + public int length; + } + + public unsafe partial struct SDL_TextInputEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("char *")] + public sbyte* text; + } + + public partial struct SDL_MouseDeviceEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_MouseID")] + public uint which; + } + + public partial struct SDL_MouseMotionEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("SDL_MouseID")] + public uint which; + + [NativeTypeName("Uint32")] + public uint state; + + public float x; + + public float y; + + public float xrel; + + public float yrel; + } + + public partial struct SDL_MouseButtonEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("SDL_MouseID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte button; + + [NativeTypeName("Uint8")] + public byte state; + + [NativeTypeName("Uint8")] + public byte clicks; + + [NativeTypeName("Uint8")] + public byte padding; + + public float x; + + public float y; + } + + public partial struct SDL_MouseWheelEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("SDL_MouseID")] + public uint which; + + public float x; + + public float y; + + public SDL_MouseWheelDirection direction; + + public float mouse_x; + + public float mouse_y; + } + + public partial struct SDL_JoyAxisEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte axis; + + [NativeTypeName("Uint8")] + public byte padding1; + + [NativeTypeName("Uint8")] + public byte padding2; + + [NativeTypeName("Uint8")] + public byte padding3; + + [NativeTypeName("Sint16")] + public short value; + + [NativeTypeName("Uint16")] + public ushort padding4; + } + + public partial struct SDL_JoyBallEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte ball; + + [NativeTypeName("Uint8")] + public byte padding1; + + [NativeTypeName("Uint8")] + public byte padding2; + + [NativeTypeName("Uint8")] + public byte padding3; + + [NativeTypeName("Sint16")] + public short xrel; + + [NativeTypeName("Sint16")] + public short yrel; + } + + public partial struct SDL_JoyHatEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte hat; + + [NativeTypeName("Uint8")] + public byte value; + + [NativeTypeName("Uint8")] + public byte padding1; + + [NativeTypeName("Uint8")] + public byte padding2; + } + + public partial struct SDL_JoyButtonEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte button; + + [NativeTypeName("Uint8")] + public byte state; + + [NativeTypeName("Uint8")] + public byte padding1; + + [NativeTypeName("Uint8")] + public byte padding2; + } + + public partial struct SDL_JoyDeviceEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + } + + public partial struct SDL_JoyBatteryEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + + public SDL_PowerState state; + + public int percent; + } + + public partial struct SDL_GamepadAxisEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte axis; + + [NativeTypeName("Uint8")] + public byte padding1; + + [NativeTypeName("Uint8")] + public byte padding2; + + [NativeTypeName("Uint8")] + public byte padding3; + + [NativeTypeName("Sint16")] + public short value; + + [NativeTypeName("Uint16")] + public ushort padding4; + } + + public partial struct SDL_GamepadButtonEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte button; + + [NativeTypeName("Uint8")] + public byte state; + + [NativeTypeName("Uint8")] + public byte padding1; + + [NativeTypeName("Uint8")] + public byte padding2; + } + + public partial struct SDL_GamepadDeviceEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + } + + public partial struct SDL_GamepadTouchpadEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + + [NativeTypeName("Sint32")] + public int touchpad; + + [NativeTypeName("Sint32")] + public int finger; + + public float x; + + public float y; + + public float pressure; + } + + public partial struct SDL_GamepadSensorEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_JoystickID")] + public uint which; + + [NativeTypeName("Sint32")] + public int sensor; + + [NativeTypeName("float[3]")] + public _data_e__FixedBuffer data; + + [NativeTypeName("Uint64")] + public ulong sensor_timestamp; + + [InlineArray(3)] + public partial struct _data_e__FixedBuffer + { + public float e0; + } + } + + public partial struct SDL_AudioDeviceEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_AudioDeviceID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte iscapture; + + [NativeTypeName("Uint8")] + public byte padding1; + + [NativeTypeName("Uint8")] + public byte padding2; + + [NativeTypeName("Uint8")] + public byte padding3; + } + + public partial struct SDL_CameraDeviceEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_CameraDeviceID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte padding1; + + [NativeTypeName("Uint8")] + public byte padding2; + + [NativeTypeName("Uint8")] + public byte padding3; + } + + public partial struct SDL_TouchFingerEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_TouchID")] + public ulong touchID; + + [NativeTypeName("SDL_FingerID")] + public ulong fingerID; + + public float x; + + public float y; + + public float dx; + + public float dy; + + public float pressure; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + } + + public partial struct SDL_PenTipEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("SDL_PenID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte tip; + + [NativeTypeName("Uint8")] + public byte state; + + [NativeTypeName("Uint16")] + public ushort pen_state; + + public float x; + + public float y; + + [NativeTypeName("float[6]")] + public _axes_e__FixedBuffer axes; + + [InlineArray(6)] + public partial struct _axes_e__FixedBuffer + { + public float e0; + } + } + + public partial struct SDL_PenMotionEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("SDL_PenID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte padding1; + + [NativeTypeName("Uint8")] + public byte padding2; + + [NativeTypeName("Uint16")] + public ushort pen_state; + + public float x; + + public float y; + + [NativeTypeName("float[6]")] + public _axes_e__FixedBuffer axes; + + [InlineArray(6)] + public partial struct _axes_e__FixedBuffer + { + public float e0; + } + } + + public partial struct SDL_PenButtonEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("SDL_PenID")] + public uint which; + + [NativeTypeName("Uint8")] + public byte button; + + [NativeTypeName("Uint8")] + public byte state; + + [NativeTypeName("Uint16")] + public ushort pen_state; + + public float x; + + public float y; + + [NativeTypeName("float[6]")] + public _axes_e__FixedBuffer axes; + + [InlineArray(6)] + public partial struct _axes_e__FixedBuffer + { + public float e0; + } + } + + public unsafe partial struct SDL_DropEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + public float x; + + public float y; + + [NativeTypeName("char *")] + public sbyte* source; + + [NativeTypeName("char *")] + public sbyte* data; + } + + public partial struct SDL_ClipboardEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + } + + public partial struct SDL_SensorEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_SensorID")] + public uint which; + + [NativeTypeName("float[6]")] + public _data_e__FixedBuffer data; + + [NativeTypeName("Uint64")] + public ulong sensor_timestamp; + + [InlineArray(6)] + public partial struct _data_e__FixedBuffer + { + public float e0; + } + } + + public partial struct SDL_QuitEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + } + + public unsafe partial struct SDL_UserEvent + { + [NativeTypeName("Uint32")] + public uint type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + [NativeTypeName("SDL_WindowID")] + public uint windowID; + + [NativeTypeName("Sint32")] + public int code; + + public void* data1; + + public void* data2; + } + + [StructLayout(LayoutKind.Explicit)] + public partial struct SDL_Event + { + [FieldOffset(0)] + [NativeTypeName("Uint32")] + public uint type; + + [FieldOffset(0)] + public SDL_CommonEvent common; + + [FieldOffset(0)] + public SDL_DisplayEvent display; + + [FieldOffset(0)] + public SDL_WindowEvent window; + + [FieldOffset(0)] + public SDL_KeyboardDeviceEvent kdevice; + + [FieldOffset(0)] + public SDL_KeyboardEvent key; + + [FieldOffset(0)] + public SDL_TextEditingEvent edit; + + [FieldOffset(0)] + public SDL_TextInputEvent text; + + [FieldOffset(0)] + public SDL_MouseDeviceEvent mdevice; + + [FieldOffset(0)] + public SDL_MouseMotionEvent motion; + + [FieldOffset(0)] + public SDL_MouseButtonEvent button; + + [FieldOffset(0)] + public SDL_MouseWheelEvent wheel; + + [FieldOffset(0)] + public SDL_JoyDeviceEvent jdevice; + + [FieldOffset(0)] + public SDL_JoyAxisEvent jaxis; + + [FieldOffset(0)] + public SDL_JoyBallEvent jball; + + [FieldOffset(0)] + public SDL_JoyHatEvent jhat; + + [FieldOffset(0)] + public SDL_JoyButtonEvent jbutton; + + [FieldOffset(0)] + public SDL_JoyBatteryEvent jbattery; + + [FieldOffset(0)] + public SDL_GamepadDeviceEvent gdevice; + + [FieldOffset(0)] + public SDL_GamepadAxisEvent gaxis; + + [FieldOffset(0)] + public SDL_GamepadButtonEvent gbutton; + + [FieldOffset(0)] + public SDL_GamepadTouchpadEvent gtouchpad; + + [FieldOffset(0)] + public SDL_GamepadSensorEvent gsensor; + + [FieldOffset(0)] + public SDL_AudioDeviceEvent adevice; + + [FieldOffset(0)] + public SDL_CameraDeviceEvent cdevice; + + [FieldOffset(0)] + public SDL_SensorEvent sensor; + + [FieldOffset(0)] + public SDL_QuitEvent quit; + + [FieldOffset(0)] + public SDL_UserEvent user; + + [FieldOffset(0)] + public SDL_TouchFingerEvent tfinger; + + [FieldOffset(0)] + public SDL_PenTipEvent ptip; + + [FieldOffset(0)] + public SDL_PenMotionEvent pmotion; + + [FieldOffset(0)] + public SDL_PenButtonEvent pbutton; + + [FieldOffset(0)] + public SDL_DropEvent drop; + + [FieldOffset(0)] + public SDL_ClipboardEvent clipboard; + + [FieldOffset(0)] + [NativeTypeName("Uint8[128]")] + public _padding_e__FixedBuffer padding; + + [InlineArray(128)] + public partial struct _padding_e__FixedBuffer + { + public byte e0; + } + } + + public enum SDL_eventaction + { + SDL_ADDEVENT, + SDL_PEEKEVENT, + SDL_GETEVENT, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_PumpEvents(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_PeepEvents(SDL_Event* events, int numevents, SDL_eventaction action, [NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasEvent([NativeTypeName("Uint32")] uint type); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasEvents([NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_FlushEvent([NativeTypeName("Uint32")] uint type); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_FlushEvents([NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_PollEvent(SDL_Event* @event); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WaitEvent(SDL_Event* @event); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WaitEventTimeout(SDL_Event* @event, [NativeTypeName("Sint32")] int timeoutMS); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_PushEvent(SDL_Event* @event); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetEventFilter([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetEventFilter([NativeTypeName("SDL_EventFilter *")] delegate* unmanaged[Cdecl]* filter, void** userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_AddEventWatch([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DelEventWatch([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_FilterEvents([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetEventEnabled([NativeTypeName("Uint32")] uint type, [NativeTypeName("SDL_bool")] int enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_EventEnabled([NativeTypeName("Uint32")] uint type); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_RegisterEvents(int numevents); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_AllocateEventMemory([NativeTypeName("size_t")] nuint size); + + [NativeTypeName("#define SDL_RELEASED 0")] + public const int SDL_RELEASED = 0; + + [NativeTypeName("#define SDL_PRESSED 1")] + public const int SDL_PRESSED = 1; + + [NativeTypeName("#define SDL_TEXTEDITINGEVENT_TEXT_SIZE 64")] + public const int SDL_TEXTEDITINGEVENT_TEXT_SIZE = 64; + + [NativeTypeName("#define SDL_DROPEVENT_DATA_SIZE 64")] + public const int SDL_DROPEVENT_DATA_SIZE = 64; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs new file mode 100644 index 0000000..4b63439 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs @@ -0,0 +1,106 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_Folder + { + SDL_FOLDER_HOME, + SDL_FOLDER_DESKTOP, + SDL_FOLDER_DOCUMENTS, + SDL_FOLDER_DOWNLOADS, + SDL_FOLDER_MUSIC, + SDL_FOLDER_PICTURES, + SDL_FOLDER_PUBLICSHARE, + SDL_FOLDER_SAVEDGAMES, + SDL_FOLDER_SCREENSHOTS, + SDL_FOLDER_TEMPLATES, + SDL_FOLDER_VIDEOS, + } + + public enum SDL_PathType + { + SDL_PATHTYPE_NONE, + SDL_PATHTYPE_FILE, + SDL_PATHTYPE_DIRECTORY, + SDL_PATHTYPE_OTHER, + } + + public partial struct SDL_PathInfo + { + public SDL_PathType type; + + [NativeTypeName("Uint64")] + public ulong size; + + [NativeTypeName("SDL_Time")] + public long create_time; + + [NativeTypeName("SDL_Time")] + public long modify_time; + + [NativeTypeName("SDL_Time")] + public long access_time; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_GetBasePath(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_GetPrefPath([NativeTypeName("const char *")] sbyte* org, [NativeTypeName("const char *")] sbyte* app); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_GetUserFolder(SDL_Folder folder); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CreateDirectory([NativeTypeName("const char *")] sbyte* path); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_EnumerateDirectory([NativeTypeName("const char *")] sbyte* path, [NativeTypeName("SDL_EnumerateDirectoryCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RemovePath([NativeTypeName("const char *")] sbyte* path); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenamePath([NativeTypeName("const char *")] sbyte* oldpath, [NativeTypeName("const char *")] sbyte* newpath); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetPathInfo([NativeTypeName("const char *")] sbyte* path, SDL_PathInfo* info); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char **")] + public static extern sbyte** SDL_GlobDirectory([NativeTypeName("const char *")] sbyte* path, [NativeTypeName("const char *")] sbyte* pattern, [NativeTypeName("Uint32")] uint flags, int* count); + + [NativeTypeName("#define SDL_GLOB_CASEINSENSITIVE (1 << 0)")] + public const int SDL_GLOB_CASEINSENSITIVE = (1 << 0); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs new file mode 100644 index 0000000..93282a6 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs @@ -0,0 +1,452 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Gamepad + { + } + + public enum SDL_GamepadType + { + SDL_GAMEPAD_TYPE_UNKNOWN = 0, + SDL_GAMEPAD_TYPE_STANDARD, + SDL_GAMEPAD_TYPE_XBOX360, + SDL_GAMEPAD_TYPE_XBOXONE, + SDL_GAMEPAD_TYPE_PS3, + SDL_GAMEPAD_TYPE_PS4, + SDL_GAMEPAD_TYPE_PS5, + SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO, + SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, + SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, + SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR, + SDL_GAMEPAD_TYPE_MAX, + } + + public enum SDL_GamepadButton + { + SDL_GAMEPAD_BUTTON_INVALID = -1, + SDL_GAMEPAD_BUTTON_SOUTH, + SDL_GAMEPAD_BUTTON_EAST, + SDL_GAMEPAD_BUTTON_WEST, + SDL_GAMEPAD_BUTTON_NORTH, + SDL_GAMEPAD_BUTTON_BACK, + SDL_GAMEPAD_BUTTON_GUIDE, + SDL_GAMEPAD_BUTTON_START, + SDL_GAMEPAD_BUTTON_LEFT_STICK, + SDL_GAMEPAD_BUTTON_RIGHT_STICK, + SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, + SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, + SDL_GAMEPAD_BUTTON_DPAD_UP, + SDL_GAMEPAD_BUTTON_DPAD_DOWN, + SDL_GAMEPAD_BUTTON_DPAD_LEFT, + SDL_GAMEPAD_BUTTON_DPAD_RIGHT, + SDL_GAMEPAD_BUTTON_MISC1, + SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1, + SDL_GAMEPAD_BUTTON_LEFT_PADDLE1, + SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2, + SDL_GAMEPAD_BUTTON_LEFT_PADDLE2, + SDL_GAMEPAD_BUTTON_TOUCHPAD, + SDL_GAMEPAD_BUTTON_MISC2, + SDL_GAMEPAD_BUTTON_MISC3, + SDL_GAMEPAD_BUTTON_MISC4, + SDL_GAMEPAD_BUTTON_MISC5, + SDL_GAMEPAD_BUTTON_MISC6, + SDL_GAMEPAD_BUTTON_MAX, + } + + public enum SDL_GamepadButtonLabel + { + SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN, + SDL_GAMEPAD_BUTTON_LABEL_A, + SDL_GAMEPAD_BUTTON_LABEL_B, + SDL_GAMEPAD_BUTTON_LABEL_X, + SDL_GAMEPAD_BUTTON_LABEL_Y, + SDL_GAMEPAD_BUTTON_LABEL_CROSS, + SDL_GAMEPAD_BUTTON_LABEL_CIRCLE, + SDL_GAMEPAD_BUTTON_LABEL_SQUARE, + SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE, + } + + public enum SDL_GamepadAxis + { + SDL_GAMEPAD_AXIS_INVALID = -1, + SDL_GAMEPAD_AXIS_LEFTX, + SDL_GAMEPAD_AXIS_LEFTY, + SDL_GAMEPAD_AXIS_RIGHTX, + SDL_GAMEPAD_AXIS_RIGHTY, + SDL_GAMEPAD_AXIS_LEFT_TRIGGER, + SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, + SDL_GAMEPAD_AXIS_MAX, + } + + public enum SDL_GamepadBindingType + { + SDL_GAMEPAD_BINDTYPE_NONE = 0, + SDL_GAMEPAD_BINDTYPE_BUTTON, + SDL_GAMEPAD_BINDTYPE_AXIS, + SDL_GAMEPAD_BINDTYPE_HAT, + } + + public partial struct SDL_GamepadBinding + { + public SDL_GamepadBindingType input_type; + + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L184_C5")] + public _input_e__Union input; + + public SDL_GamepadBindingType output_type; + + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L204_C5")] + public _output_e__Union output; + + [StructLayout(LayoutKind.Explicit)] + public partial struct _input_e__Union + { + [FieldOffset(0)] + public int button; + + [FieldOffset(0)] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L188_C9")] + public _axis_e__Struct axis; + + [FieldOffset(0)] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L195_C9")] + public _hat_e__Struct hat; + + public partial struct _axis_e__Struct + { + public int axis; + + public int axis_min; + + public int axis_max; + } + + public partial struct _hat_e__Struct + { + public int hat; + + public int hat_mask; + } + } + + [StructLayout(LayoutKind.Explicit)] + public partial struct _output_e__Union + { + [FieldOffset(0)] + public SDL_GamepadButton button; + + [FieldOffset(0)] + [NativeTypeName("__AnonymousRecord_SDL_gamepad_L208_C9")] + public _axis_e__Struct axis; + + public partial struct _axis_e__Struct + { + public SDL_GamepadAxis axis; + + public int axis_min; + + public int axis_max; + } + } + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_AddGamepadMapping([NativeTypeName("const char *")] sbyte* mapping); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_AddGamepadMappingsFromIO(SDL_IOStream* src, [NativeTypeName("SDL_bool")] int closeio); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_AddGamepadMappingsFromFile([NativeTypeName("const char *")] sbyte* file); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ReloadGamepadMappings(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char **")] + public static extern sbyte** SDL_GetGamepadMappings(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_GetGamepadMappingForGUID([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_GetGamepadMapping(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetGamepadMapping([NativeTypeName("SDL_JoystickID")] uint instance_id, [NativeTypeName("const char *")] sbyte* mapping); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasGamepad(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickID *")] + public static extern uint* SDL_GetGamepads(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_IsGamepad([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetGamepadInstanceName([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetGamepadInstancePath([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetGamepadInstancePlayerIndex([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickGUID")] + public static extern SDL_GUID SDL_GetGamepadInstanceGUID([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetGamepadInstanceVendor([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetGamepadInstanceProduct([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetGamepadInstanceProductVersion([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GamepadType SDL_GetGamepadInstanceType([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GamepadType SDL_GetRealGamepadInstanceType([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_GetGamepadInstanceMapping([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Gamepad* SDL_OpenGamepad([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Gamepad* SDL_GetGamepadFromInstanceID([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Gamepad* SDL_GetGamepadFromPlayerIndex(int player_index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetGamepadProperties(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickID")] + public static extern uint SDL_GetGamepadInstanceID(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetGamepadName(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetGamepadPath(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GamepadType SDL_GetGamepadType(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GamepadType SDL_GetRealGamepadType(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetGamepadPlayerIndex(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetGamepadPlayerIndex(SDL_Gamepad* gamepad, int player_index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetGamepadVendor(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetGamepadProduct(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetGamepadProductVersion(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetGamepadFirmwareVersion(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetGamepadSerial(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint64")] + public static extern ulong SDL_GetGamepadSteamHandle(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_JoystickConnectionState SDL_GetGamepadConnectionState(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PowerState SDL_GetGamepadPowerInfo(SDL_Gamepad* gamepad, int* percent); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GamepadConnected(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Joystick* SDL_GetGamepadJoystick(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetGamepadEventsEnabled([NativeTypeName("SDL_bool")] int enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GamepadEventsEnabled(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GamepadBinding** SDL_GetGamepadBindings(SDL_Gamepad* gamepad, int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UpdateGamepads(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GamepadType SDL_GetGamepadTypeFromString([NativeTypeName("const char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetGamepadStringForType(SDL_GamepadType type); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GamepadAxis SDL_GetGamepadAxisFromString([NativeTypeName("const char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GamepadHasAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Sint16")] + public static extern short SDL_GetGamepadAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GamepadButton SDL_GetGamepadButtonFromString([NativeTypeName("const char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetGamepadStringForButton(SDL_GamepadButton button); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GamepadHasButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint8")] + public static extern byte SDL_GetGamepadButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GamepadButtonLabel SDL_GetGamepadButtonLabelForType(SDL_GamepadType type, SDL_GamepadButton button); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GamepadButtonLabel SDL_GetGamepadButtonLabel(SDL_Gamepad* gamepad, SDL_GamepadButton button); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumGamepadTouchpads(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumGamepadTouchpadFingers(SDL_Gamepad* gamepad, int touchpad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetGamepadTouchpadFinger(SDL_Gamepad* gamepad, int touchpad, int finger, [NativeTypeName("Uint8 *")] byte* state, float* x, float* y, float* pressure); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GamepadHasSensor(SDL_Gamepad* gamepad, SDL_SensorType type); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetGamepadSensorEnabled(SDL_Gamepad* gamepad, SDL_SensorType type, [NativeTypeName("SDL_bool")] int enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GamepadSensorEnabled(SDL_Gamepad* gamepad, SDL_SensorType type); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_GetGamepadSensorDataRate(SDL_Gamepad* gamepad, SDL_SensorType type); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetGamepadSensorData(SDL_Gamepad* gamepad, SDL_SensorType type, float* data, int num_values); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RumbleGamepad(SDL_Gamepad* gamepad, [NativeTypeName("Uint16")] ushort low_frequency_rumble, [NativeTypeName("Uint16")] ushort high_frequency_rumble, [NativeTypeName("Uint32")] uint duration_ms); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RumbleGamepadTriggers(SDL_Gamepad* gamepad, [NativeTypeName("Uint16")] ushort left_rumble, [NativeTypeName("Uint16")] ushort right_rumble, [NativeTypeName("Uint32")] uint duration_ms); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetGamepadLED(SDL_Gamepad* gamepad, [NativeTypeName("Uint8")] byte red, [NativeTypeName("Uint8")] byte green, [NativeTypeName("Uint8")] byte blue); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SendGamepadEffect(SDL_Gamepad* gamepad, [NativeTypeName("const void *")] void* data, int size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_CloseGamepad(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); + + [NativeTypeName("#define SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN")] + public static ReadOnlySpan SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN => "SDL.joystick.cap.mono_led"u8; + + [NativeTypeName("#define SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN")] + public static ReadOnlySpan SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN => "SDL.joystick.cap.rgb_led"u8; + + [NativeTypeName("#define SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN")] + public static ReadOnlySpan SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN => "SDL.joystick.cap.player_led"u8; + + [NativeTypeName("#define SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN")] + public static ReadOnlySpan SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN => "SDL.joystick.cap.rumble"u8; + + [NativeTypeName("#define SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN")] + public static ReadOnlySpan SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN => "SDL.joystick.cap.trigger_rumble"u8; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs new file mode 100644 index 0000000..da14e57 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs @@ -0,0 +1,51 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_GUID + { + [NativeTypeName("Uint8[16]")] + public _data_e__FixedBuffer data; + + [InlineArray(16)] + public partial struct _data_e__FixedBuffer + { + public byte e0; + } + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GUIDToString(SDL_GUID guid, [NativeTypeName("char *")] sbyte* pszGUID, int cbGUID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GUID SDL_GUIDFromString([NativeTypeName("const char *")] sbyte* pchGUID); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs new file mode 100644 index 0000000..dc975be --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs @@ -0,0 +1,505 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Haptic + { + } + + public partial struct SDL_HapticDirection + { + [NativeTypeName("Uint8")] + public byte type; + + [NativeTypeName("Sint32[3]")] + public _dir_e__FixedBuffer dir; + + [InlineArray(3)] + public partial struct _dir_e__FixedBuffer + { + public int e0; + } + } + + public partial struct SDL_HapticConstant + { + [NativeTypeName("Uint16")] + public ushort type; + + public SDL_HapticDirection direction; + + [NativeTypeName("Uint32")] + public uint length; + + [NativeTypeName("Uint16")] + public ushort delay; + + [NativeTypeName("Uint16")] + public ushort button; + + [NativeTypeName("Uint16")] + public ushort interval; + + [NativeTypeName("Sint16")] + public short level; + + [NativeTypeName("Uint16")] + public ushort attack_length; + + [NativeTypeName("Uint16")] + public ushort attack_level; + + [NativeTypeName("Uint16")] + public ushort fade_length; + + [NativeTypeName("Uint16")] + public ushort fade_level; + } + + public partial struct SDL_HapticPeriodic + { + [NativeTypeName("Uint16")] + public ushort type; + + public SDL_HapticDirection direction; + + [NativeTypeName("Uint32")] + public uint length; + + [NativeTypeName("Uint16")] + public ushort delay; + + [NativeTypeName("Uint16")] + public ushort button; + + [NativeTypeName("Uint16")] + public ushort interval; + + [NativeTypeName("Uint16")] + public ushort period; + + [NativeTypeName("Sint16")] + public short magnitude; + + [NativeTypeName("Sint16")] + public short offset; + + [NativeTypeName("Uint16")] + public ushort phase; + + [NativeTypeName("Uint16")] + public ushort attack_length; + + [NativeTypeName("Uint16")] + public ushort attack_level; + + [NativeTypeName("Uint16")] + public ushort fade_length; + + [NativeTypeName("Uint16")] + public ushort fade_level; + } + + public partial struct SDL_HapticCondition + { + [NativeTypeName("Uint16")] + public ushort type; + + public SDL_HapticDirection direction; + + [NativeTypeName("Uint32")] + public uint length; + + [NativeTypeName("Uint16")] + public ushort delay; + + [NativeTypeName("Uint16")] + public ushort button; + + [NativeTypeName("Uint16")] + public ushort interval; + + [NativeTypeName("Uint16[3]")] + public _right_sat_e__FixedBuffer right_sat; + + [NativeTypeName("Uint16[3]")] + public _left_sat_e__FixedBuffer left_sat; + + [NativeTypeName("Sint16[3]")] + public _right_coeff_e__FixedBuffer right_coeff; + + [NativeTypeName("Sint16[3]")] + public _left_coeff_e__FixedBuffer left_coeff; + + [NativeTypeName("Uint16[3]")] + public _deadband_e__FixedBuffer deadband; + + [NativeTypeName("Sint16[3]")] + public _center_e__FixedBuffer center; + + [InlineArray(3)] + public partial struct _right_sat_e__FixedBuffer + { + public ushort e0; + } + + [InlineArray(3)] + public partial struct _left_sat_e__FixedBuffer + { + public ushort e0; + } + + [InlineArray(3)] + public partial struct _right_coeff_e__FixedBuffer + { + public short e0; + } + + [InlineArray(3)] + public partial struct _left_coeff_e__FixedBuffer + { + public short e0; + } + + [InlineArray(3)] + public partial struct _deadband_e__FixedBuffer + { + public ushort e0; + } + + [InlineArray(3)] + public partial struct _center_e__FixedBuffer + { + public short e0; + } + } + + public partial struct SDL_HapticRamp + { + [NativeTypeName("Uint16")] + public ushort type; + + public SDL_HapticDirection direction; + + [NativeTypeName("Uint32")] + public uint length; + + [NativeTypeName("Uint16")] + public ushort delay; + + [NativeTypeName("Uint16")] + public ushort button; + + [NativeTypeName("Uint16")] + public ushort interval; + + [NativeTypeName("Sint16")] + public short start; + + [NativeTypeName("Sint16")] + public short end; + + [NativeTypeName("Uint16")] + public ushort attack_length; + + [NativeTypeName("Uint16")] + public ushort attack_level; + + [NativeTypeName("Uint16")] + public ushort fade_length; + + [NativeTypeName("Uint16")] + public ushort fade_level; + } + + public partial struct SDL_HapticLeftRight + { + [NativeTypeName("Uint16")] + public ushort type; + + [NativeTypeName("Uint32")] + public uint length; + + [NativeTypeName("Uint16")] + public ushort large_magnitude; + + [NativeTypeName("Uint16")] + public ushort small_magnitude; + } + + public unsafe partial struct SDL_HapticCustom + { + [NativeTypeName("Uint16")] + public ushort type; + + public SDL_HapticDirection direction; + + [NativeTypeName("Uint32")] + public uint length; + + [NativeTypeName("Uint16")] + public ushort delay; + + [NativeTypeName("Uint16")] + public ushort button; + + [NativeTypeName("Uint16")] + public ushort interval; + + [NativeTypeName("Uint8")] + public byte channels; + + [NativeTypeName("Uint16")] + public ushort period; + + [NativeTypeName("Uint16")] + public ushort samples; + + [NativeTypeName("Uint16 *")] + public ushort* data; + + [NativeTypeName("Uint16")] + public ushort attack_length; + + [NativeTypeName("Uint16")] + public ushort attack_level; + + [NativeTypeName("Uint16")] + public ushort fade_length; + + [NativeTypeName("Uint16")] + public ushort fade_level; + } + + [StructLayout(LayoutKind.Explicit)] + public partial struct SDL_HapticEffect + { + [FieldOffset(0)] + [NativeTypeName("Uint16")] + public ushort type; + + [FieldOffset(0)] + public SDL_HapticConstant constant; + + [FieldOffset(0)] + public SDL_HapticPeriodic periodic; + + [FieldOffset(0)] + public SDL_HapticCondition condition; + + [FieldOffset(0)] + public SDL_HapticRamp ramp; + + [FieldOffset(0)] + public SDL_HapticLeftRight leftright; + + [FieldOffset(0)] + public SDL_HapticCustom custom; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_HapticID *")] + public static extern uint* SDL_GetHaptics(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetHapticInstanceName([NativeTypeName("SDL_HapticID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Haptic* SDL_OpenHaptic([NativeTypeName("SDL_HapticID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Haptic* SDL_GetHapticFromInstanceID([NativeTypeName("SDL_HapticID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_HapticID")] + public static extern uint SDL_GetHapticInstanceID(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetHapticName(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_IsMouseHaptic(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Haptic* SDL_OpenHapticFromMouse(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_IsJoystickHaptic(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Haptic* SDL_OpenHapticFromJoystick(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_CloseHaptic(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetMaxHapticEffects(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetMaxHapticEffectsPlaying(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_GetHapticFeatures(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumHapticAxes(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HapticEffectSupported(SDL_Haptic* haptic, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* effect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CreateHapticEffect(SDL_Haptic* haptic, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* effect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_UpdateHapticEffect(SDL_Haptic* haptic, int effect, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* data); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RunHapticEffect(SDL_Haptic* haptic, int effect, [NativeTypeName("Uint32")] uint iterations); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_StopHapticEffect(SDL_Haptic* haptic, int effect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyHapticEffect(SDL_Haptic* haptic, int effect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetHapticEffectStatus(SDL_Haptic* haptic, int effect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetHapticGain(SDL_Haptic* haptic, int gain); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetHapticAutocenter(SDL_Haptic* haptic, int autocenter); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_PauseHaptic(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ResumeHaptic(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_StopHapticEffects(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HapticRumbleSupported(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_InitHapticRumble(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_PlayHapticRumble(SDL_Haptic* haptic, float strength, [NativeTypeName("Uint32")] uint length); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_StopHapticRumble(SDL_Haptic* haptic); + + [NativeTypeName("#define SDL_HAPTIC_CONSTANT (1u<<0)")] + public const uint SDL_HAPTIC_CONSTANT = (1U << 0); + + [NativeTypeName("#define SDL_HAPTIC_SINE (1u<<1)")] + public const uint SDL_HAPTIC_SINE = (1U << 1); + + [NativeTypeName("#define SDL_HAPTIC_SQUARE (1<<2)")] + public const int SDL_HAPTIC_SQUARE = (1 << 2); + + [NativeTypeName("#define SDL_HAPTIC_TRIANGLE (1u<<3)")] + public const uint SDL_HAPTIC_TRIANGLE = (1U << 3); + + [NativeTypeName("#define SDL_HAPTIC_SAWTOOTHUP (1u<<4)")] + public const uint SDL_HAPTIC_SAWTOOTHUP = (1U << 4); + + [NativeTypeName("#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5)")] + public const uint SDL_HAPTIC_SAWTOOTHDOWN = (1U << 5); + + [NativeTypeName("#define SDL_HAPTIC_RAMP (1u<<6)")] + public const uint SDL_HAPTIC_RAMP = (1U << 6); + + [NativeTypeName("#define SDL_HAPTIC_SPRING (1u<<7)")] + public const uint SDL_HAPTIC_SPRING = (1U << 7); + + [NativeTypeName("#define SDL_HAPTIC_DAMPER (1u<<8)")] + public const uint SDL_HAPTIC_DAMPER = (1U << 8); + + [NativeTypeName("#define SDL_HAPTIC_INERTIA (1u<<9)")] + public const uint SDL_HAPTIC_INERTIA = (1U << 9); + + [NativeTypeName("#define SDL_HAPTIC_FRICTION (1u<<10)")] + public const uint SDL_HAPTIC_FRICTION = (1U << 10); + + [NativeTypeName("#define SDL_HAPTIC_LEFTRIGHT (1u<<11)")] + public const uint SDL_HAPTIC_LEFTRIGHT = (1U << 11); + + [NativeTypeName("#define SDL_HAPTIC_RESERVED1 (1u<<12)")] + public const uint SDL_HAPTIC_RESERVED1 = (1U << 12); + + [NativeTypeName("#define SDL_HAPTIC_RESERVED2 (1u<<13)")] + public const uint SDL_HAPTIC_RESERVED2 = (1U << 13); + + [NativeTypeName("#define SDL_HAPTIC_RESERVED3 (1u<<14)")] + public const uint SDL_HAPTIC_RESERVED3 = (1U << 14); + + [NativeTypeName("#define SDL_HAPTIC_CUSTOM (1u<<15)")] + public const uint SDL_HAPTIC_CUSTOM = (1U << 15); + + [NativeTypeName("#define SDL_HAPTIC_GAIN (1u<<16)")] + public const uint SDL_HAPTIC_GAIN = (1U << 16); + + [NativeTypeName("#define SDL_HAPTIC_AUTOCENTER (1u<<17)")] + public const uint SDL_HAPTIC_AUTOCENTER = (1U << 17); + + [NativeTypeName("#define SDL_HAPTIC_STATUS (1u<<18)")] + public const uint SDL_HAPTIC_STATUS = (1U << 18); + + [NativeTypeName("#define SDL_HAPTIC_PAUSE (1u<<19)")] + public const uint SDL_HAPTIC_PAUSE = (1U << 19); + + [NativeTypeName("#define SDL_HAPTIC_POLAR 0")] + public const int SDL_HAPTIC_POLAR = 0; + + [NativeTypeName("#define SDL_HAPTIC_CARTESIAN 1")] + public const int SDL_HAPTIC_CARTESIAN = 1; + + [NativeTypeName("#define SDL_HAPTIC_SPHERICAL 2")] + public const int SDL_HAPTIC_SPHERICAL = 2; + + [NativeTypeName("#define 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; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs new file mode 100644 index 0000000..e687254 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs @@ -0,0 +1,157 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_hid_device_ + { + } + + public enum SDL_hid_bus_type + { + SDL_HID_API_BUS_UNKNOWN = 0x00, + SDL_HID_API_BUS_USB = 0x01, + SDL_HID_API_BUS_BLUETOOTH = 0x02, + SDL_HID_API_BUS_I2C = 0x03, + SDL_HID_API_BUS_SPI = 0x04, + } + + public unsafe partial struct SDL_hid_device_info + { + [NativeTypeName("char *")] + public sbyte* path; + + [NativeTypeName("unsigned short")] + public ushort vendor_id; + + [NativeTypeName("unsigned short")] + public ushort product_id; + + [NativeTypeName("wchar_t *")] + public ushort* serial_number; + + [NativeTypeName("unsigned short")] + public ushort release_number; + + [NativeTypeName("wchar_t *")] + public ushort* manufacturer_string; + + [NativeTypeName("wchar_t *")] + public ushort* product_string; + + [NativeTypeName("unsigned short")] + public ushort usage_page; + + [NativeTypeName("unsigned short")] + public ushort usage; + + public int interface_number; + + public int interface_class; + + public int interface_subclass; + + public int interface_protocol; + + public SDL_hid_bus_type bus_type; + + [NativeTypeName("struct SDL_hid_device_info *")] + public SDL_hid_device_info* next; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_init(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_exit(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_hid_device_change_count(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_hid_device_info* SDL_hid_enumerate([NativeTypeName("unsigned short")] ushort vendor_id, [NativeTypeName("unsigned short")] ushort product_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_hid_free_enumeration(SDL_hid_device_info* devs); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_hid_device *")] + public static extern SDL_hid_device_* SDL_hid_open([NativeTypeName("unsigned short")] ushort vendor_id, [NativeTypeName("unsigned short")] ushort product_id, [NativeTypeName("const wchar_t *")] ushort* serial_number); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_hid_device *")] + public static extern SDL_hid_device_* SDL_hid_open_path([NativeTypeName("const char *")] sbyte* path); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_write([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("const unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_read_timeout([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length, int milliseconds); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_read([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_set_nonblocking([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, int nonblock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_send_feature_report([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("const unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_get_feature_report([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_get_input_report([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_close([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_get_manufacturer_string([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_get_product_string([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_get_serial_number_string([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_get_indexed_string([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, int string_index, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_hid_device_info* SDL_hid_get_device_info([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_hid_get_report_descriptor([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* buf, [NativeTypeName("size_t")] nuint buf_size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_hid_ble_scan([NativeTypeName("SDL_bool")] int active); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs new file mode 100644 index 0000000..9d0f2dc --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs @@ -0,0 +1,654 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_HintPriority + { + SDL_HINT_DEFAULT, + SDL_HINT_NORMAL, + SDL_HINT_OVERRIDE, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_SetHintWithPriority([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* value, SDL_HintPriority priority); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_SetHint([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ResetHint([NativeTypeName("const char *")] sbyte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_ResetHints(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetHint([NativeTypeName("const char *")] sbyte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetHintBoolean([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("SDL_bool")] int default_value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_AddHintCallback([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DelHintCallback([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [NativeTypeName("#define SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED \"SDL_ALLOW_ALT_TAB_WHILE_GRABBED\"")] + public static ReadOnlySpan SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED => "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"u8; + + [NativeTypeName("#define SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY \"SDL_ANDROID_ALLOW_RECREATE_ACTIVITY\"")] + public static ReadOnlySpan SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY => "SDL_ANDROID_ALLOW_RECREATE_ACTIVITY"u8; + + [NativeTypeName("#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE \"SDL_ANDROID_BLOCK_ON_PAUSE\"")] + public static ReadOnlySpan SDL_HINT_ANDROID_BLOCK_ON_PAUSE => "SDL_ANDROID_BLOCK_ON_PAUSE"u8; + + [NativeTypeName("#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO \"SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO\"")] + public static ReadOnlySpan SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO => "SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO"u8; + + [NativeTypeName("#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON \"SDL_ANDROID_TRAP_BACK_BUTTON\"")] + public static ReadOnlySpan SDL_HINT_ANDROID_TRAP_BACK_BUTTON => "SDL_ANDROID_TRAP_BACK_BUTTON"u8; + + [NativeTypeName("#define SDL_HINT_APP_ID \"SDL_APP_ID\"")] + public static ReadOnlySpan SDL_HINT_APP_ID => "SDL_APP_ID"u8; + + [NativeTypeName("#define SDL_HINT_APP_NAME \"SDL_APP_NAME\"")] + public static ReadOnlySpan SDL_HINT_APP_NAME => "SDL_APP_NAME"u8; + + [NativeTypeName("#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS \"SDL_APPLE_TV_CONTROLLER_UI_EVENTS\"")] + public static ReadOnlySpan SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS => "SDL_APPLE_TV_CONTROLLER_UI_EVENTS"u8; + + [NativeTypeName("#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION \"SDL_APPLE_TV_REMOTE_ALLOW_ROTATION\"")] + public static ReadOnlySpan SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION => "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"u8; + + [NativeTypeName("#define SDL_HINT_AUDIO_CATEGORY \"SDL_AUDIO_CATEGORY\"")] + public static ReadOnlySpan SDL_HINT_AUDIO_CATEGORY => "SDL_AUDIO_CATEGORY"u8; + + [NativeTypeName("#define SDL_HINT_AUDIO_DEVICE_APP_NAME \"SDL_AUDIO_DEVICE_APP_NAME\"")] + public static ReadOnlySpan SDL_HINT_AUDIO_DEVICE_APP_NAME => "SDL_AUDIO_DEVICE_APP_NAME"u8; + + [NativeTypeName("#define SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES \"SDL_AUDIO_DEVICE_SAMPLE_FRAMES\"")] + public static ReadOnlySpan SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES => "SDL_AUDIO_DEVICE_SAMPLE_FRAMES"u8; + + [NativeTypeName("#define SDL_HINT_AUDIO_DEVICE_STREAM_NAME \"SDL_AUDIO_DEVICE_STREAM_NAME\"")] + public static ReadOnlySpan SDL_HINT_AUDIO_DEVICE_STREAM_NAME => "SDL_AUDIO_DEVICE_STREAM_NAME"u8; + + [NativeTypeName("#define SDL_HINT_AUDIO_DEVICE_STREAM_ROLE \"SDL_AUDIO_DEVICE_STREAM_ROLE\"")] + public static ReadOnlySpan SDL_HINT_AUDIO_DEVICE_STREAM_ROLE => "SDL_AUDIO_DEVICE_STREAM_ROLE"u8; + + [NativeTypeName("#define SDL_HINT_AUDIO_DRIVER \"SDL_AUDIO_DRIVER\"")] + public static ReadOnlySpan SDL_HINT_AUDIO_DRIVER => "SDL_AUDIO_DRIVER"u8; + + [NativeTypeName("#define SDL_HINT_AUDIO_INCLUDE_MONITORS \"SDL_AUDIO_INCLUDE_MONITORS\"")] + public static ReadOnlySpan SDL_HINT_AUDIO_INCLUDE_MONITORS => "SDL_AUDIO_INCLUDE_MONITORS"u8; + + [NativeTypeName("#define SDL_HINT_AUTO_UPDATE_JOYSTICKS \"SDL_AUTO_UPDATE_JOYSTICKS\"")] + public static ReadOnlySpan SDL_HINT_AUTO_UPDATE_JOYSTICKS => "SDL_AUTO_UPDATE_JOYSTICKS"u8; + + [NativeTypeName("#define SDL_HINT_AUTO_UPDATE_SENSORS \"SDL_AUTO_UPDATE_SENSORS\"")] + public static ReadOnlySpan SDL_HINT_AUTO_UPDATE_SENSORS => "SDL_AUTO_UPDATE_SENSORS"u8; + + [NativeTypeName("#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT \"SDL_BMP_SAVE_LEGACY_FORMAT\"")] + public static ReadOnlySpan SDL_HINT_BMP_SAVE_LEGACY_FORMAT => "SDL_BMP_SAVE_LEGACY_FORMAT"u8; + + [NativeTypeName("#define SDL_HINT_CAMERA_DRIVER \"SDL_CAMERA_DRIVER\"")] + public static ReadOnlySpan SDL_HINT_CAMERA_DRIVER => "SDL_CAMERA_DRIVER"u8; + + [NativeTypeName("#define SDL_HINT_CPU_FEATURE_MASK \"SDL_CPU_FEATURE_MASK\"")] + public static ReadOnlySpan SDL_HINT_CPU_FEATURE_MASK => "SDL_CPU_FEATURE_MASK"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_DIRECTINPUT \"SDL_JOYSTICK_DIRECTINPUT\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_DIRECTINPUT => "SDL_JOYSTICK_DIRECTINPUT"u8; + + [NativeTypeName("#define SDL_HINT_FILE_DIALOG_DRIVER \"SDL_FILE_DIALOG_DRIVER\"")] + public static ReadOnlySpan SDL_HINT_FILE_DIALOG_DRIVER => "SDL_FILE_DIALOG_DRIVER"u8; + + [NativeTypeName("#define SDL_HINT_DISPLAY_USABLE_BOUNDS \"SDL_DISPLAY_USABLE_BOUNDS\"")] + public static ReadOnlySpan SDL_HINT_DISPLAY_USABLE_BOUNDS => "SDL_DISPLAY_USABLE_BOUNDS"u8; + + [NativeTypeName("#define SDL_HINT_EMSCRIPTEN_ASYNCIFY \"SDL_EMSCRIPTEN_ASYNCIFY\"")] + public static ReadOnlySpan SDL_HINT_EMSCRIPTEN_ASYNCIFY => "SDL_EMSCRIPTEN_ASYNCIFY"u8; + + [NativeTypeName("#define SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR \"SDL_EMSCRIPTEN_CANVAS_SELECTOR\"")] + public static ReadOnlySpan SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR => "SDL_EMSCRIPTEN_CANVAS_SELECTOR"u8; + + [NativeTypeName("#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT \"SDL_EMSCRIPTEN_KEYBOARD_ELEMENT\"")] + public static ReadOnlySpan SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT => "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"u8; + + [NativeTypeName("#define SDL_HINT_ENABLE_SCREEN_KEYBOARD \"SDL_ENABLE_SCREEN_KEYBOARD\"")] + public static ReadOnlySpan SDL_HINT_ENABLE_SCREEN_KEYBOARD => "SDL_ENABLE_SCREEN_KEYBOARD"u8; + + [NativeTypeName("#define SDL_HINT_EVENT_LOGGING \"SDL_EVENT_LOGGING\"")] + public static ReadOnlySpan SDL_HINT_EVENT_LOGGING => "SDL_EVENT_LOGGING"u8; + + [NativeTypeName("#define SDL_HINT_FORCE_RAISEWINDOW \"SDL_FORCE_RAISEWINDOW\"")] + public static ReadOnlySpan SDL_HINT_FORCE_RAISEWINDOW => "SDL_FORCE_RAISEWINDOW"u8; + + [NativeTypeName("#define SDL_HINT_FRAMEBUFFER_ACCELERATION \"SDL_FRAMEBUFFER_ACCELERATION\"")] + public static ReadOnlySpan SDL_HINT_FRAMEBUFFER_ACCELERATION => "SDL_FRAMEBUFFER_ACCELERATION"u8; + + [NativeTypeName("#define SDL_HINT_GAMECONTROLLERCONFIG \"SDL_GAMECONTROLLERCONFIG\"")] + public static ReadOnlySpan SDL_HINT_GAMECONTROLLERCONFIG => "SDL_GAMECONTROLLERCONFIG"u8; + + [NativeTypeName("#define SDL_HINT_GAMECONTROLLERCONFIG_FILE \"SDL_GAMECONTROLLERCONFIG_FILE\"")] + public static ReadOnlySpan SDL_HINT_GAMECONTROLLERCONFIG_FILE => "SDL_GAMECONTROLLERCONFIG_FILE"u8; + + [NativeTypeName("#define SDL_HINT_GAMECONTROLLERTYPE \"SDL_GAMECONTROLLERTYPE\"")] + public static ReadOnlySpan SDL_HINT_GAMECONTROLLERTYPE => "SDL_GAMECONTROLLERTYPE"u8; + + [NativeTypeName("#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES \"SDL_GAMECONTROLLER_IGNORE_DEVICES\"")] + public static ReadOnlySpan SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES => "SDL_GAMECONTROLLER_IGNORE_DEVICES"u8; + + [NativeTypeName("#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT \"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT\"")] + public static ReadOnlySpan SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT => "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"u8; + + [NativeTypeName("#define SDL_HINT_GAMECONTROLLER_SENSOR_FUSION \"SDL_GAMECONTROLLER_SENSOR_FUSION\"")] + public static ReadOnlySpan SDL_HINT_GAMECONTROLLER_SENSOR_FUSION => "SDL_GAMECONTROLLER_SENSOR_FUSION"u8; + + [NativeTypeName("#define SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT \"SDL_GDK_TEXTINPUT_DEFAULT_TEXT\"")] + public static ReadOnlySpan SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT => "SDL_GDK_TEXTINPUT_DEFAULT_TEXT"u8; + + [NativeTypeName("#define SDL_HINT_GDK_TEXTINPUT_DESCRIPTION \"SDL_GDK_TEXTINPUT_DESCRIPTION\"")] + public static ReadOnlySpan SDL_HINT_GDK_TEXTINPUT_DESCRIPTION => "SDL_GDK_TEXTINPUT_DESCRIPTION"u8; + + [NativeTypeName("#define SDL_HINT_GDK_TEXTINPUT_MAX_LENGTH \"SDL_GDK_TEXTINPUT_MAX_LENGTH\"")] + public static ReadOnlySpan SDL_HINT_GDK_TEXTINPUT_MAX_LENGTH => "SDL_GDK_TEXTINPUT_MAX_LENGTH"u8; + + [NativeTypeName("#define SDL_HINT_GDK_TEXTINPUT_SCOPE \"SDL_GDK_TEXTINPUT_SCOPE\"")] + public static ReadOnlySpan SDL_HINT_GDK_TEXTINPUT_SCOPE => "SDL_GDK_TEXTINPUT_SCOPE"u8; + + [NativeTypeName("#define SDL_HINT_GDK_TEXTINPUT_TITLE \"SDL_GDK_TEXTINPUT_TITLE\"")] + public static ReadOnlySpan SDL_HINT_GDK_TEXTINPUT_TITLE => "SDL_GDK_TEXTINPUT_TITLE"u8; + + [NativeTypeName("#define SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS \"SDL_HIDAPI_ENUMERATE_ONLY_CONTROLLERS\"")] + public static ReadOnlySpan SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS => "SDL_HIDAPI_ENUMERATE_ONLY_CONTROLLERS"u8; + + [NativeTypeName("#define SDL_HINT_HIDAPI_IGNORE_DEVICES \"SDL_HIDAPI_IGNORE_DEVICES\"")] + public static ReadOnlySpan SDL_HINT_HIDAPI_IGNORE_DEVICES => "SDL_HIDAPI_IGNORE_DEVICES"u8; + + [NativeTypeName("#define SDL_HINT_IME_INTERNAL_EDITING \"SDL_IME_INTERNAL_EDITING\"")] + public static ReadOnlySpan SDL_HINT_IME_INTERNAL_EDITING => "SDL_IME_INTERNAL_EDITING"u8; + + [NativeTypeName("#define SDL_HINT_IME_SHOW_UI \"SDL_IME_SHOW_UI\"")] + public static ReadOnlySpan SDL_HINT_IME_SHOW_UI => "SDL_IME_SHOW_UI"u8; + + [NativeTypeName("#define SDL_HINT_IOS_HIDE_HOME_INDICATOR \"SDL_IOS_HIDE_HOME_INDICATOR\"")] + public static ReadOnlySpan SDL_HINT_IOS_HIDE_HOME_INDICATOR => "SDL_IOS_HIDE_HOME_INDICATOR"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS \"SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS => "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES \"SDL_JOYSTICK_ARCADESTICK_DEVICES\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES => "SDL_JOYSTICK_ARCADESTICK_DEVICES"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED \"SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED => "SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES \"SDL_JOYSTICK_BLACKLIST_DEVICES\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_BLACKLIST_DEVICES => "SDL_JOYSTICK_BLACKLIST_DEVICES"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED \"SDL_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED => "SDL_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_DEVICE \"SDL_JOYSTICK_DEVICE\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_DEVICE => "SDL_JOYSTICK_DEVICE"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES \"SDL_JOYSTICK_FLIGHTSTICK_DEVICES\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES => "SDL_JOYSTICK_FLIGHTSTICK_DEVICES"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED \"SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED => "SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES \"SDL_JOYSTICK_GAMECUBE_DEVICES\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_GAMECUBE_DEVICES => "SDL_JOYSTICK_GAMECUBE_DEVICES"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED \"SDL_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED => "SDL_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI \"SDL_JOYSTICK_HIDAPI\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI => "SDL_JOYSTICK_HIDAPI"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS \"SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS => "SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE \"SDL_JOYSTICK_HIDAPI_GAMECUBE\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE => "SDL_JOYSTICK_HIDAPI_GAMECUBE"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE \"SDL_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE => "SDL_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS \"SDL_JOYSTICK_HIDAPI_JOY_CONS\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS => "SDL_JOYSTICK_HIDAPI_JOY_CONS"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED \"SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED => "SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_LUNA \"SDL_JOYSTICK_HIDAPI_LUNA\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_LUNA => "SDL_JOYSTICK_HIDAPI_LUNA"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC \"SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC => "SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS3 \"SDL_JOYSTICK_HIDAPI_PS3\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS3 => "SDL_JOYSTICK_HIDAPI_PS3"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER \"SDL_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER => "SDL_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4 \"SDL_JOYSTICK_HIDAPI_PS4\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS4 => "SDL_JOYSTICK_HIDAPI_PS4"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE \"SDL_JOYSTICK_HIDAPI_PS4_RUMBLE\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE => "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5 \"SDL_JOYSTICK_HIDAPI_PS5\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS5 => "SDL_JOYSTICK_HIDAPI_PS5"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED \"SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED => "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE \"SDL_JOYSTICK_HIDAPI_PS5_RUMBLE\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE => "SDL_JOYSTICK_HIDAPI_PS5_RUMBLE"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SHIELD \"SDL_JOYSTICK_HIDAPI_SHIELD\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_SHIELD => "SDL_JOYSTICK_HIDAPI_SHIELD"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STADIA \"SDL_JOYSTICK_HIDAPI_STADIA\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_STADIA => "SDL_JOYSTICK_HIDAPI_STADIA"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAM \"SDL_JOYSTICK_HIDAPI_STEAM\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_STEAM => "SDL_JOYSTICK_HIDAPI_STEAM"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK \"SDL_JOYSTICK_HIDAPI_STEAMDECK\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK => "SDL_JOYSTICK_HIDAPI_STEAMDECK"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH \"SDL_JOYSTICK_HIDAPI_SWITCH\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_SWITCH => "SDL_JOYSTICK_HIDAPI_SWITCH"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED \"SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED => "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED \"SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED => "SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS \"SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS => "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_WII \"SDL_JOYSTICK_HIDAPI_WII\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_WII => "SDL_JOYSTICK_HIDAPI_WII"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED \"SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED => "SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_XBOX \"SDL_JOYSTICK_HIDAPI_XBOX\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_XBOX => "SDL_JOYSTICK_HIDAPI_XBOX"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 \"SDL_JOYSTICK_HIDAPI_XBOX_360\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 => "SDL_JOYSTICK_HIDAPI_XBOX_360"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED \"SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED => "SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS \"SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS => "SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE \"SDL_JOYSTICK_HIDAPI_XBOX_ONE\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE => "SDL_JOYSTICK_HIDAPI_XBOX_ONE"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED \"SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED => "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_IOKIT \"SDL_JOYSTICK_IOKIT\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_IOKIT => "SDL_JOYSTICK_IOKIT"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_LINUX_CLASSIC \"SDL_JOYSTICK_LINUX_CLASSIC\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_LINUX_CLASSIC => "SDL_JOYSTICK_LINUX_CLASSIC"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_LINUX_DEADZONES \"SDL_JOYSTICK_LINUX_DEADZONES\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_LINUX_DEADZONES => "SDL_JOYSTICK_LINUX_DEADZONES"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS \"SDL_JOYSTICK_LINUX_DIGITAL_HATS\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS => "SDL_JOYSTICK_LINUX_DIGITAL_HATS"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES \"SDL_JOYSTICK_LINUX_HAT_DEADZONES\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES => "SDL_JOYSTICK_LINUX_HAT_DEADZONES"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_MFI \"SDL_JOYSTICK_MFI\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_MFI => "SDL_JOYSTICK_MFI"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_RAWINPUT \"SDL_JOYSTICK_RAWINPUT\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_RAWINPUT => "SDL_JOYSTICK_RAWINPUT"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT \"SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT => "SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_ROG_CHAKRAM \"SDL_JOYSTICK_ROG_CHAKRAM\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_ROG_CHAKRAM => "SDL_JOYSTICK_ROG_CHAKRAM"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_THREAD \"SDL_JOYSTICK_THREAD\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_THREAD => "SDL_JOYSTICK_THREAD"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_THROTTLE_DEVICES \"SDL_JOYSTICK_THROTTLE_DEVICES\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_THROTTLE_DEVICES => "SDL_JOYSTICK_THROTTLE_DEVICES"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED \"SDL_JOYSTICK_THROTTLE_DEVICES_EXCLUDED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED => "SDL_JOYSTICK_THROTTLE_DEVICES_EXCLUDED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_WGI \"SDL_JOYSTICK_WGI\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_WGI => "SDL_JOYSTICK_WGI"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_WHEEL_DEVICES \"SDL_JOYSTICK_WHEEL_DEVICES\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_WHEEL_DEVICES => "SDL_JOYSTICK_WHEEL_DEVICES"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED \"SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED => "SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED"u8; + + [NativeTypeName("#define SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES \"SDL_JOYSTICK_ZERO_CENTERED_DEVICES\"")] + public static ReadOnlySpan SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES => "SDL_JOYSTICK_ZERO_CENTERED_DEVICES"u8; + + [NativeTypeName("#define SDL_HINT_KMSDRM_DEVICE_INDEX \"SDL_KMSDRM_DEVICE_INDEX\"")] + public static ReadOnlySpan SDL_HINT_KMSDRM_DEVICE_INDEX => "SDL_KMSDRM_DEVICE_INDEX"u8; + + [NativeTypeName("#define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER \"SDL_KMSDRM_REQUIRE_DRM_MASTER\"")] + public static ReadOnlySpan SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER => "SDL_KMSDRM_REQUIRE_DRM_MASTER"u8; + + [NativeTypeName("#define SDL_HINT_LOGGING \"SDL_LOGGING\"")] + public static ReadOnlySpan SDL_HINT_LOGGING => "SDL_LOGGING"u8; + + [NativeTypeName("#define SDL_HINT_MAC_BACKGROUND_APP \"SDL_MAC_BACKGROUND_APP\"")] + public static ReadOnlySpan SDL_HINT_MAC_BACKGROUND_APP => "SDL_MAC_BACKGROUND_APP"u8; + + [NativeTypeName("#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK \"SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK\"")] + public static ReadOnlySpan SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK => "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"u8; + + [NativeTypeName("#define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH \"SDL_MAC_OPENGL_ASYNC_DISPATCH\"")] + public static ReadOnlySpan SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH => "SDL_MAC_OPENGL_ASYNC_DISPATCH"u8; + + [NativeTypeName("#define SDL_HINT_MAIN_CALLBACK_RATE \"SDL_MAIN_CALLBACK_RATE\"")] + public static ReadOnlySpan SDL_HINT_MAIN_CALLBACK_RATE => "SDL_MAIN_CALLBACK_RATE"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_AUTO_CAPTURE \"SDL_MOUSE_AUTO_CAPTURE\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_AUTO_CAPTURE => "SDL_MOUSE_AUTO_CAPTURE"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS \"SDL_MOUSE_DOUBLE_CLICK_RADIUS\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS => "SDL_MOUSE_DOUBLE_CLICK_RADIUS"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME \"SDL_MOUSE_DOUBLE_CLICK_TIME\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_DOUBLE_CLICK_TIME => "SDL_MOUSE_DOUBLE_CLICK_TIME"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH \"SDL_MOUSE_FOCUS_CLICKTHROUGH\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH => "SDL_MOUSE_FOCUS_CLICKTHROUGH"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE \"SDL_MOUSE_NORMAL_SPEED_SCALE\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_NORMAL_SPEED_SCALE => "SDL_MOUSE_NORMAL_SPEED_SCALE"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_MODE_CENTER \"SDL_MOUSE_RELATIVE_MODE_CENTER\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_RELATIVE_MODE_CENTER => "SDL_MOUSE_RELATIVE_MODE_CENTER"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP \"SDL_MOUSE_RELATIVE_MODE_WARP\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_RELATIVE_MODE_WARP => "SDL_MOUSE_RELATIVE_MODE_WARP"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE \"SDL_MOUSE_RELATIVE_SPEED_SCALE\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE => "SDL_MOUSE_RELATIVE_SPEED_SCALE"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE \"SDL_MOUSE_RELATIVE_SYSTEM_SCALE\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE => "SDL_MOUSE_RELATIVE_SYSTEM_SCALE"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_RELATIVE_WARP_MOTION \"SDL_MOUSE_RELATIVE_WARP_MOTION\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_RELATIVE_WARP_MOTION => "SDL_MOUSE_RELATIVE_WARP_MOTION"u8; + + [NativeTypeName("#define SDL_HINT_MOUSE_TOUCH_EVENTS \"SDL_MOUSE_TOUCH_EVENTS\"")] + public static ReadOnlySpan SDL_HINT_MOUSE_TOUCH_EVENTS => "SDL_MOUSE_TOUCH_EVENTS"u8; + + [NativeTypeName("#define SDL_HINT_NO_SIGNAL_HANDLERS \"SDL_NO_SIGNAL_HANDLERS\"")] + public static ReadOnlySpan SDL_HINT_NO_SIGNAL_HANDLERS => "SDL_NO_SIGNAL_HANDLERS"u8; + + [NativeTypeName("#define SDL_HINT_OPENGL_ES_DRIVER \"SDL_OPENGL_ES_DRIVER\"")] + public static ReadOnlySpan SDL_HINT_OPENGL_ES_DRIVER => "SDL_OPENGL_ES_DRIVER"u8; + + [NativeTypeName("#define SDL_HINT_ORIENTATIONS \"SDL_IOS_ORIENTATIONS\"")] + public static ReadOnlySpan SDL_HINT_ORIENTATIONS => "SDL_IOS_ORIENTATIONS"u8; + + [NativeTypeName("#define SDL_HINT_PEN_DELAY_MOUSE_BUTTON \"SDL_PEN_DELAY_MOUSE_BUTTON\"")] + public static ReadOnlySpan SDL_HINT_PEN_DELAY_MOUSE_BUTTON => "SDL_PEN_DELAY_MOUSE_BUTTON"u8; + + [NativeTypeName("#define SDL_HINT_PEN_NOT_MOUSE \"SDL_PEN_NOT_MOUSE\"")] + public static ReadOnlySpan SDL_HINT_PEN_NOT_MOUSE => "SDL_PEN_NOT_MOUSE"u8; + + [NativeTypeName("#define SDL_HINT_POLL_SENTINEL \"SDL_POLL_SENTINEL\"")] + public static ReadOnlySpan SDL_HINT_POLL_SENTINEL => "SDL_POLL_SENTINEL"u8; + + [NativeTypeName("#define SDL_HINT_PREFERRED_LOCALES \"SDL_PREFERRED_LOCALES\"")] + public static ReadOnlySpan SDL_HINT_PREFERRED_LOCALES => "SDL_PREFERRED_LOCALES"u8; + + [NativeTypeName("#define SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE \"SDL_QUIT_ON_LAST_WINDOW_CLOSE\"")] + public static ReadOnlySpan SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE => "SDL_QUIT_ON_LAST_WINDOW_CLOSE"u8; + + [NativeTypeName("#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE \"SDL_RENDER_DIRECT3D_THREADSAFE\"")] + public static ReadOnlySpan SDL_HINT_RENDER_DIRECT3D_THREADSAFE => "SDL_RENDER_DIRECT3D_THREADSAFE"u8; + + [NativeTypeName("#define SDL_HINT_RENDER_DIRECT3D11_DEBUG \"SDL_RENDER_DIRECT3D11_DEBUG\"")] + public static ReadOnlySpan SDL_HINT_RENDER_DIRECT3D11_DEBUG => "SDL_RENDER_DIRECT3D11_DEBUG"u8; + + [NativeTypeName("#define SDL_HINT_RENDER_VULKAN_DEBUG \"SDL_RENDER_VULKAN_DEBUG\"")] + public static ReadOnlySpan SDL_HINT_RENDER_VULKAN_DEBUG => "SDL_RENDER_VULKAN_DEBUG"u8; + + [NativeTypeName("#define SDL_HINT_RENDER_DRIVER \"SDL_RENDER_DRIVER\"")] + public static ReadOnlySpan SDL_HINT_RENDER_DRIVER => "SDL_RENDER_DRIVER"u8; + + [NativeTypeName("#define SDL_HINT_RENDER_LINE_METHOD \"SDL_RENDER_LINE_METHOD\"")] + public static ReadOnlySpan SDL_HINT_RENDER_LINE_METHOD => "SDL_RENDER_LINE_METHOD"u8; + + [NativeTypeName("#define SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE \"SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE\"")] + public static ReadOnlySpan SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE => "SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE"u8; + + [NativeTypeName("#define SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC \"SDL_RENDER_PS2_DYNAMIC_VSYNC\"")] + public static ReadOnlySpan SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC => "SDL_RENDER_PS2_DYNAMIC_VSYNC"u8; + + [NativeTypeName("#define SDL_HINT_RENDER_VSYNC \"SDL_RENDER_VSYNC\"")] + public static ReadOnlySpan SDL_HINT_RENDER_VSYNC => "SDL_RENDER_VSYNC"u8; + + [NativeTypeName("#define SDL_HINT_RETURN_KEY_HIDES_IME \"SDL_RETURN_KEY_HIDES_IME\"")] + public static ReadOnlySpan SDL_HINT_RETURN_KEY_HIDES_IME => "SDL_RETURN_KEY_HIDES_IME"u8; + + [NativeTypeName("#define SDL_HINT_ROG_GAMEPAD_MICE \"SDL_ROG_GAMEPAD_MICE\"")] + public static ReadOnlySpan SDL_HINT_ROG_GAMEPAD_MICE => "SDL_ROG_GAMEPAD_MICE"u8; + + [NativeTypeName("#define SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED \"SDL_ROG_GAMEPAD_MICE_EXCLUDED\"")] + public static ReadOnlySpan SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED => "SDL_ROG_GAMEPAD_MICE_EXCLUDED"u8; + + [NativeTypeName("#define SDL_HINT_RPI_VIDEO_LAYER \"SDL_RPI_VIDEO_LAYER\"")] + public static ReadOnlySpan SDL_HINT_RPI_VIDEO_LAYER => "SDL_RPI_VIDEO_LAYER"u8; + + [NativeTypeName("#define SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME \"SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME\"")] + public static ReadOnlySpan SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME => "SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME"u8; + + [NativeTypeName("#define SDL_HINT_SHUTDOWN_DBUS_ON_QUIT \"SDL_SHUTDOWN_DBUS_ON_QUIT\"")] + public static ReadOnlySpan SDL_HINT_SHUTDOWN_DBUS_ON_QUIT => "SDL_SHUTDOWN_DBUS_ON_QUIT"u8; + + [NativeTypeName("#define SDL_HINT_STORAGE_TITLE_DRIVER \"SDL_STORAGE_TITLE_DRIVER\"")] + public static ReadOnlySpan SDL_HINT_STORAGE_TITLE_DRIVER => "SDL_STORAGE_TITLE_DRIVER"u8; + + [NativeTypeName("#define SDL_HINT_STORAGE_USER_DRIVER \"SDL_STORAGE_USER_DRIVER\"")] + public static ReadOnlySpan SDL_HINT_STORAGE_USER_DRIVER => "SDL_STORAGE_USER_DRIVER"u8; + + [NativeTypeName("#define SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL \"SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL\"")] + public static ReadOnlySpan SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL => "SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL"u8; + + [NativeTypeName("#define SDL_HINT_THREAD_PRIORITY_POLICY \"SDL_THREAD_PRIORITY_POLICY\"")] + public static ReadOnlySpan SDL_HINT_THREAD_PRIORITY_POLICY => "SDL_THREAD_PRIORITY_POLICY"u8; + + [NativeTypeName("#define SDL_HINT_TIMER_RESOLUTION \"SDL_TIMER_RESOLUTION\"")] + public static ReadOnlySpan SDL_HINT_TIMER_RESOLUTION => "SDL_TIMER_RESOLUTION"u8; + + [NativeTypeName("#define SDL_HINT_TOUCH_MOUSE_EVENTS \"SDL_TOUCH_MOUSE_EVENTS\"")] + public static ReadOnlySpan SDL_HINT_TOUCH_MOUSE_EVENTS => "SDL_TOUCH_MOUSE_EVENTS"u8; + + [NativeTypeName("#define SDL_HINT_TRACKPAD_IS_TOUCH_ONLY \"SDL_TRACKPAD_IS_TOUCH_ONLY\"")] + public static ReadOnlySpan SDL_HINT_TRACKPAD_IS_TOUCH_ONLY => "SDL_TRACKPAD_IS_TOUCH_ONLY"u8; + + [NativeTypeName("#define SDL_HINT_TV_REMOTE_AS_JOYSTICK \"SDL_TV_REMOTE_AS_JOYSTICK\"")] + public static ReadOnlySpan SDL_HINT_TV_REMOTE_AS_JOYSTICK => "SDL_TV_REMOTE_AS_JOYSTICK"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER \"SDL_VIDEO_ALLOW_SCREENSAVER\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_ALLOW_SCREENSAVER => "SDL_VIDEO_ALLOW_SCREENSAVER"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_DOUBLE_BUFFER \"SDL_VIDEO_DOUBLE_BUFFER\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_DOUBLE_BUFFER => "SDL_VIDEO_DOUBLE_BUFFER"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_DRIVER \"SDL_VIDEO_DRIVER\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_DRIVER => "SDL_VIDEO_DRIVER"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK \"SDL_VIDEO_EGL_GETDISPLAY_FALLBACK\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK => "SDL_VIDEO_EGL_GETDISPLAY_FALLBACK"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_FORCE_EGL \"SDL_VIDEO_FORCE_EGL\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_FORCE_EGL => "SDL_VIDEO_FORCE_EGL"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES \"SDL_VIDEO_MAC_FULLSCREEN_SPACES\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES => "SDL_VIDEO_MAC_FULLSCREEN_SPACES"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS \"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS => "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS \"SDL_VIDEO_SYNC_WINDOW_OPERATIONS\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS => "SDL_VIDEO_SYNC_WINDOW_OPERATIONS"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR \"SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR => "SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP \"SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP => "SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION \"SDL_VIDEO_WAYLAND_MODE_EMULATION\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION => "SDL_VIDEO_WAYLAND_MODE_EMULATION"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_WAYLAND_MODE_SCALING \"SDL_VIDEO_WAYLAND_MODE_SCALING\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_WAYLAND_MODE_SCALING => "SDL_VIDEO_WAYLAND_MODE_SCALING"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR \"SDL_VIDEO_WAYLAND_PREFER_LIBDECOR\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR => "SDL_VIDEO_WAYLAND_PREFER_LIBDECOR"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY \"SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY => "SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_WIN_D3DCOMPILER \"SDL_VIDEO_WIN_D3DCOMPILER\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_WIN_D3DCOMPILER => "SDL_VIDEO_WIN_D3DCOMPILER"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR \"SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR => "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_X11_NET_WM_PING \"SDL_VIDEO_X11_NET_WM_PING\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_X11_NET_WM_PING => "SDL_VIDEO_X11_NET_WM_PING"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_X11_SCALING_FACTOR \"SDL_VIDEO_X11_SCALING_FACTOR\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_X11_SCALING_FACTOR => "SDL_VIDEO_X11_SCALING_FACTOR"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_X11_WINDOW_VISUALID \"SDL_VIDEO_X11_WINDOW_VISUALID\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_X11_WINDOW_VISUALID => "SDL_VIDEO_X11_WINDOW_VISUALID"u8; + + [NativeTypeName("#define SDL_HINT_VIDEO_X11_XRANDR \"SDL_VIDEO_X11_XRANDR\"")] + public static ReadOnlySpan SDL_HINT_VIDEO_X11_XRANDR => "SDL_VIDEO_X11_XRANDR"u8; + + [NativeTypeName("#define SDL_HINT_VITA_TOUCH_MOUSE_DEVICE \"SDL_VITA_TOUCH_MOUSE_DEVICE\"")] + public static ReadOnlySpan SDL_HINT_VITA_TOUCH_MOUSE_DEVICE => "SDL_VITA_TOUCH_MOUSE_DEVICE"u8; + + [NativeTypeName("#define SDL_HINT_WAVE_FACT_CHUNK \"SDL_WAVE_FACT_CHUNK\"")] + public static ReadOnlySpan SDL_HINT_WAVE_FACT_CHUNK => "SDL_WAVE_FACT_CHUNK"u8; + + [NativeTypeName("#define SDL_HINT_WAVE_RIFF_CHUNK_SIZE \"SDL_WAVE_RIFF_CHUNK_SIZE\"")] + public static ReadOnlySpan SDL_HINT_WAVE_RIFF_CHUNK_SIZE => "SDL_WAVE_RIFF_CHUNK_SIZE"u8; + + [NativeTypeName("#define SDL_HINT_WAVE_TRUNCATION \"SDL_WAVE_TRUNCATION\"")] + public static ReadOnlySpan SDL_HINT_WAVE_TRUNCATION => "SDL_WAVE_TRUNCATION"u8; + + [NativeTypeName("#define SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED \"SDL_WINDOW_ACTIVATE_WHEN_RAISED\"")] + public static ReadOnlySpan SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED => "SDL_WINDOW_ACTIVATE_WHEN_RAISED"u8; + + [NativeTypeName("#define SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN \"SDL_WINDOW_ACTIVATE_WHEN_SHOWN\"")] + public static ReadOnlySpan SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN => "SDL_WINDOW_ACTIVATE_WHEN_SHOWN"u8; + + [NativeTypeName("#define SDL_HINT_WINDOW_ALLOW_TOPMOST \"SDL_WINDOW_ALLOW_TOPMOST\"")] + public static ReadOnlySpan SDL_HINT_WINDOW_ALLOW_TOPMOST => "SDL_WINDOW_ALLOW_TOPMOST"u8; + + [NativeTypeName("#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN \"SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN\"")] + public static ReadOnlySpan SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN => "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"u8; + + [NativeTypeName("#define SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4 \"SDL_WINDOWS_CLOSE_ON_ALT_F4\"")] + public static ReadOnlySpan SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4 => "SDL_WINDOWS_CLOSE_ON_ALT_F4"u8; + + [NativeTypeName("#define SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS \"SDL_WINDOWS_ENABLE_MENU_MNEMONICS\"")] + public static ReadOnlySpan SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS => "SDL_WINDOWS_ENABLE_MENU_MNEMONICS"u8; + + [NativeTypeName("#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP \"SDL_WINDOWS_ENABLE_MESSAGELOOP\"")] + public static ReadOnlySpan SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP => "SDL_WINDOWS_ENABLE_MESSAGELOOP"u8; + + [NativeTypeName("#define SDL_HINT_WINDOWS_RAW_KEYBOARD \"SDL_WINDOWS_RAW_KEYBOARD\"")] + public static ReadOnlySpan SDL_HINT_WINDOWS_RAW_KEYBOARD => "SDL_WINDOWS_RAW_KEYBOARD"u8; + + [NativeTypeName("#define SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS \"SDL_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS\"")] + public static ReadOnlySpan SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS => "SDL_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS"u8; + + [NativeTypeName("#define SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL \"SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL\"")] + public static ReadOnlySpan SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL => "SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL"u8; + + [NativeTypeName("#define SDL_HINT_WINDOWS_INTRESOURCE_ICON \"SDL_WINDOWS_INTRESOURCE_ICON\"")] + public static ReadOnlySpan SDL_HINT_WINDOWS_INTRESOURCE_ICON => "SDL_WINDOWS_INTRESOURCE_ICON"u8; + + [NativeTypeName("#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL \"SDL_WINDOWS_INTRESOURCE_ICON_SMALL\"")] + public static ReadOnlySpan SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL => "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"u8; + + [NativeTypeName("#define SDL_HINT_WINDOWS_USE_D3D9EX \"SDL_WINDOWS_USE_D3D9EX\"")] + public static ReadOnlySpan SDL_HINT_WINDOWS_USE_D3D9EX => "SDL_WINDOWS_USE_D3D9EX"u8; + + [NativeTypeName("#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON \"SDL_WINRT_HANDLE_BACK_BUTTON\"")] + public static ReadOnlySpan SDL_HINT_WINRT_HANDLE_BACK_BUTTON => "SDL_WINRT_HANDLE_BACK_BUTTON"u8; + + [NativeTypeName("#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL \"SDL_WINRT_PRIVACY_POLICY_LABEL\"")] + public static ReadOnlySpan SDL_HINT_WINRT_PRIVACY_POLICY_LABEL => "SDL_WINRT_PRIVACY_POLICY_LABEL"u8; + + [NativeTypeName("#define SDL_HINT_WINRT_PRIVACY_POLICY_URL \"SDL_WINRT_PRIVACY_POLICY_URL\"")] + public static ReadOnlySpan SDL_HINT_WINRT_PRIVACY_POLICY_URL => "SDL_WINRT_PRIVACY_POLICY_URL"u8; + + [NativeTypeName("#define SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT \"SDL_X11_FORCE_OVERRIDE_REDIRECT\"")] + public static ReadOnlySpan SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT => "SDL_X11_FORCE_OVERRIDE_REDIRECT"u8; + + [NativeTypeName("#define SDL_HINT_X11_WINDOW_TYPE \"SDL_X11_WINDOW_TYPE\"")] + public static ReadOnlySpan SDL_HINT_X11_WINDOW_TYPE => "SDL_X11_WINDOW_TYPE"u8; + + [NativeTypeName("#define SDL_HINT_XINPUT_ENABLED \"SDL_XINPUT_ENABLED\"")] + public static ReadOnlySpan SDL_HINT_XINPUT_ENABLED => "SDL_XINPUT_ENABLED"u8; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs new file mode 100644 index 0000000..5076d55 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs @@ -0,0 +1,61 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_InitFlags + { + SDL_INIT_TIMER = 0x00000001, + SDL_INIT_AUDIO = 0x00000010, + SDL_INIT_VIDEO = 0x00000020, + SDL_INIT_JOYSTICK = 0x00000200, + SDL_INIT_HAPTIC = 0x00001000, + SDL_INIT_GAMEPAD = 0x00002000, + SDL_INIT_EVENTS = 0x00004000, + SDL_INIT_SENSOR = 0x00008000, + SDL_INIT_CAMERA = 0x00010000, + } + + public static partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_Init([NativeTypeName("Uint32")] uint flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_InitSubSystem([NativeTypeName("Uint32")] uint flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_QuitSubSystem([NativeTypeName("Uint32")] uint flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_WasInit([NativeTypeName("Uint32")] uint flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_Quit(); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs new file mode 100644 index 0000000..ba7b2f9 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs @@ -0,0 +1,252 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_IOStatus + { + SDL_IO_STATUS_READY, + SDL_IO_STATUS_ERROR, + SDL_IO_STATUS_EOF, + SDL_IO_STATUS_NOT_READY, + SDL_IO_STATUS_READONLY, + SDL_IO_STATUS_WRITEONLY, + } + + public unsafe partial struct SDL_IOStreamInterface + { + [NativeTypeName("Sint64 (*)(void *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] size; + + [NativeTypeName("Sint64 (*)(void *, Sint64, int) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] seek; + + [NativeTypeName("size_t (*)(void *, void *, size_t, SDL_IOStatus *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] read; + + [NativeTypeName("size_t (*)(void *, const void *, size_t, SDL_IOStatus *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] write; + + [NativeTypeName("int (*)(void *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] close; + } + + public partial struct SDL_IOStream + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_IOStream* SDL_IOFromFile([NativeTypeName("const char *")] sbyte* file, [NativeTypeName("const char *")] sbyte* mode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_IOStream* SDL_IOFromMem(void* mem, [NativeTypeName("size_t")] nuint size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_IOStream* SDL_IOFromConstMem([NativeTypeName("const void *")] void* mem, [NativeTypeName("size_t")] nuint size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_IOStream* SDL_IOFromDynamicMem(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_IOStream* SDL_OpenIO([NativeTypeName("const SDL_IOStreamInterface *")] SDL_IOStreamInterface* iface, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CloseIO(SDL_IOStream* context); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetIOProperties(SDL_IOStream* context); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_IOStatus SDL_GetIOStatus(SDL_IOStream* context); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Sint64")] + public static extern long SDL_GetIOSize(SDL_IOStream* context); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Sint64")] + public static extern long SDL_SeekIO(SDL_IOStream* context, [NativeTypeName("Sint64")] long offset, int whence); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Sint64")] + public static extern long SDL_TellIO(SDL_IOStream* context); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_ReadIO(SDL_IOStream* context, void* ptr, [NativeTypeName("size_t")] nuint size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_WriteIO(SDL_IOStream* context, [NativeTypeName("const void *")] void* ptr, [NativeTypeName("size_t")] nuint size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_IOprintf(SDL_IOStream* context, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_IOvprintf(SDL_IOStream* context, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_LoadFile_IO(SDL_IOStream* src, [NativeTypeName("size_t *")] nuint* datasize, [NativeTypeName("SDL_bool")] int closeio); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_LoadFile([NativeTypeName("const char *")] sbyte* file, [NativeTypeName("size_t *")] nuint* datasize); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadU8(SDL_IOStream* src, [NativeTypeName("Uint8 *")] byte* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadU16LE(SDL_IOStream* src, [NativeTypeName("Uint16 *")] ushort* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadS16LE(SDL_IOStream* src, [NativeTypeName("Sint16 *")] short* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadU16BE(SDL_IOStream* src, [NativeTypeName("Uint16 *")] ushort* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadS16BE(SDL_IOStream* src, [NativeTypeName("Sint16 *")] short* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadU32LE(SDL_IOStream* src, [NativeTypeName("Uint32 *")] uint* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadS32LE(SDL_IOStream* src, [NativeTypeName("Sint32 *")] int* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadU32BE(SDL_IOStream* src, [NativeTypeName("Uint32 *")] uint* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadS32BE(SDL_IOStream* src, [NativeTypeName("Sint32 *")] int* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadU64LE(SDL_IOStream* src, [NativeTypeName("Uint64 *")] ulong* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadS64LE(SDL_IOStream* src, [NativeTypeName("Sint64 *")] long* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadU64BE(SDL_IOStream* src, [NativeTypeName("Uint64 *")] ulong* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ReadS64BE(SDL_IOStream* src, [NativeTypeName("Sint64 *")] long* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteU8(SDL_IOStream* dst, [NativeTypeName("Uint8")] byte value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteU16LE(SDL_IOStream* dst, [NativeTypeName("Uint16")] ushort value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteS16LE(SDL_IOStream* dst, [NativeTypeName("Sint16")] short value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteU16BE(SDL_IOStream* dst, [NativeTypeName("Uint16")] ushort value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteS16BE(SDL_IOStream* dst, [NativeTypeName("Sint16")] short value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteU32LE(SDL_IOStream* dst, [NativeTypeName("Uint32")] uint value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteS32LE(SDL_IOStream* dst, [NativeTypeName("Sint32")] int value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteU32BE(SDL_IOStream* dst, [NativeTypeName("Uint32")] uint value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteS32BE(SDL_IOStream* dst, [NativeTypeName("Sint32")] int value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteU64LE(SDL_IOStream* dst, [NativeTypeName("Uint64")] ulong value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteS64LE(SDL_IOStream* dst, [NativeTypeName("Sint64")] long value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteU64BE(SDL_IOStream* dst, [NativeTypeName("Uint64")] ulong value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WriteS64BE(SDL_IOStream* dst, [NativeTypeName("Sint64")] long value); + + [NativeTypeName("#define SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER \"SDL.iostream.windows.handle\"")] + public static ReadOnlySpan SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER => "SDL.iostream.windows.handle"u8; + + [NativeTypeName("#define SDL_PROP_IOSTREAM_STDIO_FILE_POINTER \"SDL.iostream.stdio.file\"")] + public static ReadOnlySpan SDL_PROP_IOSTREAM_STDIO_FILE_POINTER => "SDL.iostream.stdio.file"u8; + + [NativeTypeName("#define SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER \"SDL.iostream.android.aasset\"")] + public static ReadOnlySpan SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER => "SDL.iostream.android.aasset"u8; + + [NativeTypeName("#define SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER \"SDL.iostream.dynamic.memory\"")] + public static ReadOnlySpan SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER => "SDL.iostream.dynamic.memory"u8; + + [NativeTypeName("#define SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER \"SDL.iostream.dynamic.chunksize\"")] + public static ReadOnlySpan SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER => "SDL.iostream.dynamic.chunksize"u8; + + [NativeTypeName("#define SDL_IO_SEEK_SET 0")] + public const int SDL_IO_SEEK_SET = 0; + + [NativeTypeName("#define SDL_IO_SEEK_CUR 1")] + public const int SDL_IO_SEEK_CUR = 1; + + [NativeTypeName("#define SDL_IO_SEEK_END 2")] + public const int SDL_IO_SEEK_END = 2; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs new file mode 100644 index 0000000..fc646fb --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs @@ -0,0 +1,371 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Joystick + { + } + + public enum SDL_JoystickType + { + SDL_JOYSTICK_TYPE_UNKNOWN, + SDL_JOYSTICK_TYPE_GAMEPAD, + SDL_JOYSTICK_TYPE_WHEEL, + SDL_JOYSTICK_TYPE_ARCADE_STICK, + SDL_JOYSTICK_TYPE_FLIGHT_STICK, + SDL_JOYSTICK_TYPE_DANCE_PAD, + SDL_JOYSTICK_TYPE_GUITAR, + SDL_JOYSTICK_TYPE_DRUM_KIT, + SDL_JOYSTICK_TYPE_ARCADE_PAD, + SDL_JOYSTICK_TYPE_THROTTLE, + } + + public enum SDL_JoystickConnectionState + { + SDL_JOYSTICK_CONNECTION_INVALID = -1, + SDL_JOYSTICK_CONNECTION_UNKNOWN, + SDL_JOYSTICK_CONNECTION_WIRED, + SDL_JOYSTICK_CONNECTION_WIRELESS, + } + + public unsafe partial struct SDL_VirtualJoystickDesc + { + [NativeTypeName("Uint16")] + public ushort version; + + [NativeTypeName("Uint16")] + public ushort type; + + [NativeTypeName("Uint16")] + public ushort naxes; + + [NativeTypeName("Uint16")] + public ushort nbuttons; + + [NativeTypeName("Uint16")] + public ushort nhats; + + [NativeTypeName("Uint16")] + public ushort vendor_id; + + [NativeTypeName("Uint16")] + public ushort product_id; + + [NativeTypeName("Uint16")] + public ushort padding; + + [NativeTypeName("Uint32")] + public uint button_mask; + + [NativeTypeName("Uint32")] + public uint axis_mask; + + [NativeTypeName("const char *")] + public sbyte* name; + + public void* userdata; + + [NativeTypeName("void (*)(void *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] Update; + + [NativeTypeName("void (*)(void *, int) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] SetPlayerIndex; + + [NativeTypeName("int (*)(void *, Uint16, Uint16) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] Rumble; + + [NativeTypeName("int (*)(void *, Uint16, Uint16) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] RumbleTriggers; + + [NativeTypeName("int (*)(void *, Uint8, Uint8, Uint8) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] SetLED; + + [NativeTypeName("int (*)(void *, const void *, int) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] SendEffect; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LockJoysticks(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnlockJoysticks(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasJoystick(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickID *")] + public static extern uint* SDL_GetJoysticks(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetJoystickInstanceName([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetJoystickInstancePath([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetJoystickInstancePlayerIndex([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickGUID")] + public static extern SDL_GUID SDL_GetJoystickInstanceGUID([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetJoystickInstanceVendor([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetJoystickInstanceProduct([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetJoystickInstanceProductVersion([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_JoystickType SDL_GetJoystickInstanceType([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Joystick* SDL_OpenJoystick([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Joystick* SDL_GetJoystickFromInstanceID([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Joystick* SDL_GetJoystickFromPlayerIndex(int player_index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickID")] + public static extern uint SDL_AttachVirtualJoystick(SDL_JoystickType type, int naxes, int nbuttons, int nhats); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickID")] + public static extern uint SDL_AttachVirtualJoystickEx([NativeTypeName("const SDL_VirtualJoystickDesc *")] SDL_VirtualJoystickDesc* desc); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_DetachVirtualJoystick([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_IsJoystickVirtual([NativeTypeName("SDL_JoystickID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetJoystickVirtualAxis(SDL_Joystick* joystick, int axis, [NativeTypeName("Sint16")] short value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetJoystickVirtualButton(SDL_Joystick* joystick, int button, [NativeTypeName("Uint8")] byte value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetJoystickVirtualHat(SDL_Joystick* joystick, int hat, [NativeTypeName("Uint8")] byte value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetJoystickProperties(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetJoystickName(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetJoystickPath(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetJoystickPlayerIndex(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetJoystickPlayerIndex(SDL_Joystick* joystick, int player_index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickGUID")] + public static extern SDL_GUID SDL_GetJoystickGUID(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetJoystickVendor(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetJoystickProduct(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetJoystickProductVersion(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_GetJoystickFirmwareVersion(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetJoystickSerial(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_JoystickType SDL_GetJoystickType(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetJoystickGUIDString([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid, [NativeTypeName("char *")] sbyte* pszGUID, int cbGUID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickGUID")] + public static extern SDL_GUID SDL_GetJoystickGUIDFromString([NativeTypeName("const char *")] sbyte* pchGUID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_GetJoystickGUIDInfo([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid, [NativeTypeName("Uint16 *")] ushort* vendor, [NativeTypeName("Uint16 *")] ushort* product, [NativeTypeName("Uint16 *")] ushort* version, [NativeTypeName("Uint16 *")] ushort* crc16); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_JoystickConnected(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickID")] + public static extern uint SDL_GetJoystickInstanceID(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumJoystickAxes(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumJoystickBalls(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumJoystickHats(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumJoystickButtons(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetJoystickEventsEnabled([NativeTypeName("SDL_bool")] int enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_JoystickEventsEnabled(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UpdateJoysticks(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Sint16")] + public static extern short SDL_GetJoystickAxis(SDL_Joystick* joystick, int axis); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetJoystickAxisInitialState(SDL_Joystick* joystick, int axis, [NativeTypeName("Sint16 *")] short* state); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetJoystickBall(SDL_Joystick* joystick, int ball, int* dx, int* dy); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint8")] + public static extern byte SDL_GetJoystickHat(SDL_Joystick* joystick, int hat); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint8")] + public static extern byte SDL_GetJoystickButton(SDL_Joystick* joystick, int button); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RumbleJoystick(SDL_Joystick* joystick, [NativeTypeName("Uint16")] ushort low_frequency_rumble, [NativeTypeName("Uint16")] ushort high_frequency_rumble, [NativeTypeName("Uint32")] uint duration_ms); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RumbleJoystickTriggers(SDL_Joystick* joystick, [NativeTypeName("Uint16")] ushort left_rumble, [NativeTypeName("Uint16")] ushort right_rumble, [NativeTypeName("Uint32")] uint duration_ms); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetJoystickLED(SDL_Joystick* joystick, [NativeTypeName("Uint8")] byte red, [NativeTypeName("Uint8")] byte green, [NativeTypeName("Uint8")] byte blue); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SendJoystickEffect(SDL_Joystick* joystick, [NativeTypeName("const void *")] void* data, int size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_CloseJoystick(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_JoystickConnectionState SDL_GetJoystickConnectionState(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PowerState SDL_GetJoystickPowerInfo(SDL_Joystick* joystick, int* percent); + + [NativeTypeName("#define SDL_JOYSTICK_AXIS_MAX 32767")] + public const int SDL_JOYSTICK_AXIS_MAX = 32767; + + [NativeTypeName("#define SDL_JOYSTICK_AXIS_MIN -32768")] + public const int SDL_JOYSTICK_AXIS_MIN = -32768; + + [NativeTypeName("#define SDL_IPHONE_MAX_GFORCE 5.0")] + public const double SDL_IPHONE_MAX_GFORCE = 5.0; + + [NativeTypeName("#define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1")] + public const int SDL_VIRTUAL_JOYSTICK_DESC_VERSION = 1; + + [NativeTypeName("#define SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN \"SDL.joystick.cap.mono_led\"")] + public static ReadOnlySpan SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN => "SDL.joystick.cap.mono_led"u8; + + [NativeTypeName("#define SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN \"SDL.joystick.cap.rgb_led\"")] + public static ReadOnlySpan SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN => "SDL.joystick.cap.rgb_led"u8; + + [NativeTypeName("#define SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN \"SDL.joystick.cap.player_led\"")] + public static ReadOnlySpan SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN => "SDL.joystick.cap.player_led"u8; + + [NativeTypeName("#define SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN \"SDL.joystick.cap.rumble\"")] + public static ReadOnlySpan SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN => "SDL.joystick.cap.rumble"u8; + + [NativeTypeName("#define SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN \"SDL.joystick.cap.trigger_rumble\"")] + public static ReadOnlySpan SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN => "SDL.joystick.cap.trigger_rumble"u8; + + [NativeTypeName("#define SDL_HAT_CENTERED 0x00")] + public const int SDL_HAT_CENTERED = 0x00; + + [NativeTypeName("#define SDL_HAT_UP 0x01")] + public const int SDL_HAT_UP = 0x01; + + [NativeTypeName("#define SDL_HAT_RIGHT 0x02")] + public const int SDL_HAT_RIGHT = 0x02; + + [NativeTypeName("#define SDL_HAT_DOWN 0x04")] + public const int SDL_HAT_DOWN = 0x04; + + [NativeTypeName("#define SDL_HAT_LEFT 0x08")] + public const int SDL_HAT_LEFT = 0x08; + + [NativeTypeName("#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)")] + public const int SDL_HAT_RIGHTUP = (0x02 | 0x01); + + [NativeTypeName("#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)")] + public const int SDL_HAT_RIGHTDOWN = (0x02 | 0x04); + + [NativeTypeName("#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)")] + public const int SDL_HAT_LEFTUP = (0x08 | 0x01); + + [NativeTypeName("#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)")] + public const int SDL_HAT_LEFTDOWN = (0x08 | 0x04); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs new file mode 100644 index 0000000..cf6960f --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs @@ -0,0 +1,120 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Keysym + { + public SDL_Scancode scancode; + + [NativeTypeName("SDL_Keycode")] + public int sym; + + [NativeTypeName("Uint16")] + public ushort mod; + + [NativeTypeName("Uint32")] + public uint unused; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasKeyboard(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_KeyboardID *")] + public static extern uint* SDL_GetKeyboards(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetKeyboardInstanceName([NativeTypeName("SDL_KeyboardID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_GetKeyboardFocus(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const Uint8 *")] + public static extern byte* SDL_GetKeyboardState(int* numkeys); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_ResetKeyboard(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Keymod SDL_GetModState(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetModState(SDL_Keymod modstate); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_Keycode")] + public static extern int SDL_GetKeyFromScancode(SDL_Scancode scancode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Scancode SDL_GetScancodeFromKey([NativeTypeName("SDL_Keycode")] int key); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetScancodeName(SDL_Scancode scancode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Scancode SDL_GetScancodeFromName([NativeTypeName("const char *")] sbyte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetKeyName([NativeTypeName("SDL_Keycode")] int key); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_Keycode")] + public static extern int SDL_GetKeyFromName([NativeTypeName("const char *")] sbyte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_StartTextInput(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_TextInputActive(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_StopTextInput(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_ClearComposition(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetTextInputRect([NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasScreenKeyboardSupport(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ScreenKeyboardShown(SDL_Window* window); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs new file mode 100644 index 0000000..570563f --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs @@ -0,0 +1,305 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using static SDL.SDL_Scancode; + +namespace SDL +{ + public enum SDL_KeyCode + { + SDLK_UNKNOWN = 0, + SDLK_RETURN = '\r', + SDLK_ESCAPE = '', + SDLK_BACKSPACE = '', + SDLK_TAB = '\t', + SDLK_SPACE = ' ', + SDLK_EXCLAIM = '!', + SDLK_QUOTEDBL = '"', + SDLK_HASH = '#', + SDLK_PERCENT = '%', + SDLK_DOLLAR = '$', + SDLK_AMPERSAND = '&', + SDLK_QUOTE = '\'', + SDLK_LEFTPAREN = '(', + SDLK_RIGHTPAREN = ')', + SDLK_ASTERISK = '*', + SDLK_PLUS = '+', + SDLK_COMMA = ',', + SDLK_MINUS = '-', + SDLK_PERIOD = '.', + SDLK_SLASH = '/', + SDLK_0 = '0', + SDLK_1 = '1', + SDLK_2 = '2', + SDLK_3 = '3', + SDLK_4 = '4', + SDLK_5 = '5', + SDLK_6 = '6', + SDLK_7 = '7', + SDLK_8 = '8', + SDLK_9 = '9', + SDLK_COLON = ':', + SDLK_SEMICOLON = ';', + SDLK_LESS = '<', + SDLK_EQUALS = '=', + SDLK_GREATER = '>', + SDLK_QUESTION = '?', + SDLK_AT = '@', + SDLK_LEFTBRACKET = '[', + SDLK_BACKSLASH = '\\', + SDLK_RIGHTBRACKET = ']', + SDLK_CARET = '^', + SDLK_UNDERSCORE = '_', + SDLK_BACKQUOTE = '`', + SDLK_a = 'a', + SDLK_b = 'b', + SDLK_c = 'c', + SDLK_d = 'd', + SDLK_e = 'e', + SDLK_f = 'f', + SDLK_g = 'g', + SDLK_h = 'h', + SDLK_i = 'i', + SDLK_j = 'j', + SDLK_k = 'k', + SDLK_l = 'l', + SDLK_m = 'm', + SDLK_n = 'n', + SDLK_o = 'o', + SDLK_p = 'p', + SDLK_q = 'q', + SDLK_r = 'r', + SDLK_s = 's', + SDLK_t = 't', + SDLK_u = 'u', + SDLK_v = 'v', + SDLK_w = 'w', + SDLK_x = 'x', + SDLK_y = 'y', + SDLK_z = 'z', + SDLK_CAPSLOCK = (SDL_SCANCODE_CAPSLOCK | (1 << 30)), + SDLK_F1 = (SDL_SCANCODE_F1 | (1 << 30)), + SDLK_F2 = (SDL_SCANCODE_F2 | (1 << 30)), + SDLK_F3 = (SDL_SCANCODE_F3 | (1 << 30)), + SDLK_F4 = (SDL_SCANCODE_F4 | (1 << 30)), + SDLK_F5 = (SDL_SCANCODE_F5 | (1 << 30)), + SDLK_F6 = (SDL_SCANCODE_F6 | (1 << 30)), + SDLK_F7 = (SDL_SCANCODE_F7 | (1 << 30)), + SDLK_F8 = (SDL_SCANCODE_F8 | (1 << 30)), + SDLK_F9 = (SDL_SCANCODE_F9 | (1 << 30)), + SDLK_F10 = (SDL_SCANCODE_F10 | (1 << 30)), + SDLK_F11 = (SDL_SCANCODE_F11 | (1 << 30)), + SDLK_F12 = (SDL_SCANCODE_F12 | (1 << 30)), + SDLK_PRINTSCREEN = (SDL_SCANCODE_PRINTSCREEN | (1 << 30)), + SDLK_SCROLLLOCK = (SDL_SCANCODE_SCROLLLOCK | (1 << 30)), + SDLK_PAUSE = (SDL_SCANCODE_PAUSE | (1 << 30)), + SDLK_INSERT = (SDL_SCANCODE_INSERT | (1 << 30)), + SDLK_HOME = (SDL_SCANCODE_HOME | (1 << 30)), + SDLK_PAGEUP = (SDL_SCANCODE_PAGEUP | (1 << 30)), + SDLK_DELETE = '', + SDLK_END = (SDL_SCANCODE_END | (1 << 30)), + SDLK_PAGEDOWN = (SDL_SCANCODE_PAGEDOWN | (1 << 30)), + SDLK_RIGHT = (SDL_SCANCODE_RIGHT | (1 << 30)), + SDLK_LEFT = (SDL_SCANCODE_LEFT | (1 << 30)), + SDLK_DOWN = (SDL_SCANCODE_DOWN | (1 << 30)), + SDLK_UP = (SDL_SCANCODE_UP | (1 << 30)), + SDLK_NUMLOCKCLEAR = (SDL_SCANCODE_NUMLOCKCLEAR | (1 << 30)), + SDLK_KP_DIVIDE = (SDL_SCANCODE_KP_DIVIDE | (1 << 30)), + SDLK_KP_MULTIPLY = (SDL_SCANCODE_KP_MULTIPLY | (1 << 30)), + SDLK_KP_MINUS = (SDL_SCANCODE_KP_MINUS | (1 << 30)), + SDLK_KP_PLUS = (SDL_SCANCODE_KP_PLUS | (1 << 30)), + SDLK_KP_ENTER = (SDL_SCANCODE_KP_ENTER | (1 << 30)), + SDLK_KP_1 = (SDL_SCANCODE_KP_1 | (1 << 30)), + SDLK_KP_2 = (SDL_SCANCODE_KP_2 | (1 << 30)), + SDLK_KP_3 = (SDL_SCANCODE_KP_3 | (1 << 30)), + SDLK_KP_4 = (SDL_SCANCODE_KP_4 | (1 << 30)), + SDLK_KP_5 = (SDL_SCANCODE_KP_5 | (1 << 30)), + SDLK_KP_6 = (SDL_SCANCODE_KP_6 | (1 << 30)), + SDLK_KP_7 = (SDL_SCANCODE_KP_7 | (1 << 30)), + SDLK_KP_8 = (SDL_SCANCODE_KP_8 | (1 << 30)), + SDLK_KP_9 = (SDL_SCANCODE_KP_9 | (1 << 30)), + SDLK_KP_0 = (SDL_SCANCODE_KP_0 | (1 << 30)), + SDLK_KP_PERIOD = (SDL_SCANCODE_KP_PERIOD | (1 << 30)), + SDLK_APPLICATION = (SDL_SCANCODE_APPLICATION | (1 << 30)), + SDLK_POWER = (SDL_SCANCODE_POWER | (1 << 30)), + SDLK_KP_EQUALS = (SDL_SCANCODE_KP_EQUALS | (1 << 30)), + SDLK_F13 = (SDL_SCANCODE_F13 | (1 << 30)), + SDLK_F14 = (SDL_SCANCODE_F14 | (1 << 30)), + SDLK_F15 = (SDL_SCANCODE_F15 | (1 << 30)), + SDLK_F16 = (SDL_SCANCODE_F16 | (1 << 30)), + SDLK_F17 = (SDL_SCANCODE_F17 | (1 << 30)), + SDLK_F18 = (SDL_SCANCODE_F18 | (1 << 30)), + SDLK_F19 = (SDL_SCANCODE_F19 | (1 << 30)), + SDLK_F20 = (SDL_SCANCODE_F20 | (1 << 30)), + SDLK_F21 = (SDL_SCANCODE_F21 | (1 << 30)), + SDLK_F22 = (SDL_SCANCODE_F22 | (1 << 30)), + SDLK_F23 = (SDL_SCANCODE_F23 | (1 << 30)), + SDLK_F24 = (SDL_SCANCODE_F24 | (1 << 30)), + SDLK_EXECUTE = (SDL_SCANCODE_EXECUTE | (1 << 30)), + SDLK_HELP = (SDL_SCANCODE_HELP | (1 << 30)), + SDLK_MENU = (SDL_SCANCODE_MENU | (1 << 30)), + SDLK_SELECT = (SDL_SCANCODE_SELECT | (1 << 30)), + SDLK_STOP = (SDL_SCANCODE_STOP | (1 << 30)), + SDLK_AGAIN = (SDL_SCANCODE_AGAIN | (1 << 30)), + SDLK_UNDO = (SDL_SCANCODE_UNDO | (1 << 30)), + SDLK_CUT = (SDL_SCANCODE_CUT | (1 << 30)), + SDLK_COPY = (SDL_SCANCODE_COPY | (1 << 30)), + SDLK_PASTE = (SDL_SCANCODE_PASTE | (1 << 30)), + SDLK_FIND = (SDL_SCANCODE_FIND | (1 << 30)), + SDLK_MUTE = (SDL_SCANCODE_MUTE | (1 << 30)), + SDLK_VOLUMEUP = (SDL_SCANCODE_VOLUMEUP | (1 << 30)), + SDLK_VOLUMEDOWN = (SDL_SCANCODE_VOLUMEDOWN | (1 << 30)), + SDLK_KP_COMMA = (SDL_SCANCODE_KP_COMMA | (1 << 30)), + SDLK_KP_EQUALSAS400 = (SDL_SCANCODE_KP_EQUALSAS400 | (1 << 30)), + SDLK_ALTERASE = (SDL_SCANCODE_ALTERASE | (1 << 30)), + SDLK_SYSREQ = (SDL_SCANCODE_SYSREQ | (1 << 30)), + SDLK_CANCEL = (SDL_SCANCODE_CANCEL | (1 << 30)), + SDLK_CLEAR = (SDL_SCANCODE_CLEAR | (1 << 30)), + SDLK_PRIOR = (SDL_SCANCODE_PRIOR | (1 << 30)), + SDLK_RETURN2 = (SDL_SCANCODE_RETURN2 | (1 << 30)), + SDLK_SEPARATOR = (SDL_SCANCODE_SEPARATOR | (1 << 30)), + SDLK_OUT = (SDL_SCANCODE_OUT | (1 << 30)), + SDLK_OPER = (SDL_SCANCODE_OPER | (1 << 30)), + SDLK_CLEARAGAIN = (SDL_SCANCODE_CLEARAGAIN | (1 << 30)), + SDLK_CRSEL = (SDL_SCANCODE_CRSEL | (1 << 30)), + SDLK_EXSEL = (SDL_SCANCODE_EXSEL | (1 << 30)), + SDLK_KP_00 = (SDL_SCANCODE_KP_00 | (1 << 30)), + SDLK_KP_000 = (SDL_SCANCODE_KP_000 | (1 << 30)), + SDLK_THOUSANDSSEPARATOR = (SDL_SCANCODE_THOUSANDSSEPARATOR | (1 << 30)), + SDLK_DECIMALSEPARATOR = (SDL_SCANCODE_DECIMALSEPARATOR | (1 << 30)), + SDLK_CURRENCYUNIT = (SDL_SCANCODE_CURRENCYUNIT | (1 << 30)), + SDLK_CURRENCYSUBUNIT = (SDL_SCANCODE_CURRENCYSUBUNIT | (1 << 30)), + SDLK_KP_LEFTPAREN = (SDL_SCANCODE_KP_LEFTPAREN | (1 << 30)), + SDLK_KP_RIGHTPAREN = (SDL_SCANCODE_KP_RIGHTPAREN | (1 << 30)), + SDLK_KP_LEFTBRACE = (SDL_SCANCODE_KP_LEFTBRACE | (1 << 30)), + SDLK_KP_RIGHTBRACE = (SDL_SCANCODE_KP_RIGHTBRACE | (1 << 30)), + SDLK_KP_TAB = (SDL_SCANCODE_KP_TAB | (1 << 30)), + SDLK_KP_BACKSPACE = (SDL_SCANCODE_KP_BACKSPACE | (1 << 30)), + SDLK_KP_A = (SDL_SCANCODE_KP_A | (1 << 30)), + SDLK_KP_B = (SDL_SCANCODE_KP_B | (1 << 30)), + SDLK_KP_C = (SDL_SCANCODE_KP_C | (1 << 30)), + SDLK_KP_D = (SDL_SCANCODE_KP_D | (1 << 30)), + SDLK_KP_E = (SDL_SCANCODE_KP_E | (1 << 30)), + SDLK_KP_F = (SDL_SCANCODE_KP_F | (1 << 30)), + SDLK_KP_XOR = (SDL_SCANCODE_KP_XOR | (1 << 30)), + SDLK_KP_POWER = (SDL_SCANCODE_KP_POWER | (1 << 30)), + SDLK_KP_PERCENT = (SDL_SCANCODE_KP_PERCENT | (1 << 30)), + SDLK_KP_LESS = (SDL_SCANCODE_KP_LESS | (1 << 30)), + SDLK_KP_GREATER = (SDL_SCANCODE_KP_GREATER | (1 << 30)), + SDLK_KP_AMPERSAND = (SDL_SCANCODE_KP_AMPERSAND | (1 << 30)), + SDLK_KP_DBLAMPERSAND = (SDL_SCANCODE_KP_DBLAMPERSAND | (1 << 30)), + SDLK_KP_VERTICALBAR = (SDL_SCANCODE_KP_VERTICALBAR | (1 << 30)), + SDLK_KP_DBLVERTICALBAR = (SDL_SCANCODE_KP_DBLVERTICALBAR | (1 << 30)), + SDLK_KP_COLON = (SDL_SCANCODE_KP_COLON | (1 << 30)), + SDLK_KP_HASH = (SDL_SCANCODE_KP_HASH | (1 << 30)), + SDLK_KP_SPACE = (SDL_SCANCODE_KP_SPACE | (1 << 30)), + SDLK_KP_AT = (SDL_SCANCODE_KP_AT | (1 << 30)), + SDLK_KP_EXCLAM = (SDL_SCANCODE_KP_EXCLAM | (1 << 30)), + SDLK_KP_MEMSTORE = (SDL_SCANCODE_KP_MEMSTORE | (1 << 30)), + SDLK_KP_MEMRECALL = (SDL_SCANCODE_KP_MEMRECALL | (1 << 30)), + SDLK_KP_MEMCLEAR = (SDL_SCANCODE_KP_MEMCLEAR | (1 << 30)), + SDLK_KP_MEMADD = (SDL_SCANCODE_KP_MEMADD | (1 << 30)), + SDLK_KP_MEMSUBTRACT = (SDL_SCANCODE_KP_MEMSUBTRACT | (1 << 30)), + SDLK_KP_MEMMULTIPLY = (SDL_SCANCODE_KP_MEMMULTIPLY | (1 << 30)), + SDLK_KP_MEMDIVIDE = (SDL_SCANCODE_KP_MEMDIVIDE | (1 << 30)), + SDLK_KP_PLUSMINUS = (SDL_SCANCODE_KP_PLUSMINUS | (1 << 30)), + SDLK_KP_CLEAR = (SDL_SCANCODE_KP_CLEAR | (1 << 30)), + SDLK_KP_CLEARENTRY = (SDL_SCANCODE_KP_CLEARENTRY | (1 << 30)), + SDLK_KP_BINARY = (SDL_SCANCODE_KP_BINARY | (1 << 30)), + SDLK_KP_OCTAL = (SDL_SCANCODE_KP_OCTAL | (1 << 30)), + SDLK_KP_DECIMAL = (SDL_SCANCODE_KP_DECIMAL | (1 << 30)), + SDLK_KP_HEXADECIMAL = (SDL_SCANCODE_KP_HEXADECIMAL | (1 << 30)), + SDLK_LCTRL = (SDL_SCANCODE_LCTRL | (1 << 30)), + SDLK_LSHIFT = (SDL_SCANCODE_LSHIFT | (1 << 30)), + SDLK_LALT = (SDL_SCANCODE_LALT | (1 << 30)), + SDLK_LGUI = (SDL_SCANCODE_LGUI | (1 << 30)), + SDLK_RCTRL = (SDL_SCANCODE_RCTRL | (1 << 30)), + SDLK_RSHIFT = (SDL_SCANCODE_RSHIFT | (1 << 30)), + SDLK_RALT = (SDL_SCANCODE_RALT | (1 << 30)), + SDLK_RGUI = (SDL_SCANCODE_RGUI | (1 << 30)), + SDLK_MODE = (SDL_SCANCODE_MODE | (1 << 30)), + SDLK_AUDIONEXT = (SDL_SCANCODE_AUDIONEXT | (1 << 30)), + SDLK_AUDIOPREV = (SDL_SCANCODE_AUDIOPREV | (1 << 30)), + SDLK_AUDIOSTOP = (SDL_SCANCODE_AUDIOSTOP | (1 << 30)), + SDLK_AUDIOPLAY = (SDL_SCANCODE_AUDIOPLAY | (1 << 30)), + SDLK_AUDIOMUTE = (SDL_SCANCODE_AUDIOMUTE | (1 << 30)), + SDLK_MEDIASELECT = (SDL_SCANCODE_MEDIASELECT | (1 << 30)), + SDLK_WWW = (SDL_SCANCODE_WWW | (1 << 30)), + SDLK_MAIL = (SDL_SCANCODE_MAIL | (1 << 30)), + SDLK_CALCULATOR = (SDL_SCANCODE_CALCULATOR | (1 << 30)), + SDLK_COMPUTER = (SDL_SCANCODE_COMPUTER | (1 << 30)), + SDLK_AC_SEARCH = (SDL_SCANCODE_AC_SEARCH | (1 << 30)), + SDLK_AC_HOME = (SDL_SCANCODE_AC_HOME | (1 << 30)), + SDLK_AC_BACK = (SDL_SCANCODE_AC_BACK | (1 << 30)), + SDLK_AC_FORWARD = (SDL_SCANCODE_AC_FORWARD | (1 << 30)), + SDLK_AC_STOP = (SDL_SCANCODE_AC_STOP | (1 << 30)), + SDLK_AC_REFRESH = (SDL_SCANCODE_AC_REFRESH | (1 << 30)), + SDLK_AC_BOOKMARKS = (SDL_SCANCODE_AC_BOOKMARKS | (1 << 30)), + SDLK_BRIGHTNESSDOWN = (SDL_SCANCODE_BRIGHTNESSDOWN | (1 << 30)), + SDLK_BRIGHTNESSUP = (SDL_SCANCODE_BRIGHTNESSUP | (1 << 30)), + SDLK_DISPLAYSWITCH = (SDL_SCANCODE_DISPLAYSWITCH | (1 << 30)), + SDLK_KBDILLUMTOGGLE = (SDL_SCANCODE_KBDILLUMTOGGLE | (1 << 30)), + SDLK_KBDILLUMDOWN = (SDL_SCANCODE_KBDILLUMDOWN | (1 << 30)), + SDLK_KBDILLUMUP = (SDL_SCANCODE_KBDILLUMUP | (1 << 30)), + SDLK_EJECT = (SDL_SCANCODE_EJECT | (1 << 30)), + SDLK_SLEEP = (SDL_SCANCODE_SLEEP | (1 << 30)), + SDLK_APP1 = (SDL_SCANCODE_APP1 | (1 << 30)), + SDLK_APP2 = (SDL_SCANCODE_APP2 | (1 << 30)), + SDLK_AUDIOREWIND = (SDL_SCANCODE_AUDIOREWIND | (1 << 30)), + SDLK_AUDIOFASTFORWARD = (SDL_SCANCODE_AUDIOFASTFORWARD | (1 << 30)), + SDLK_SOFTLEFT = (SDL_SCANCODE_SOFTLEFT | (1 << 30)), + SDLK_SOFTRIGHT = (SDL_SCANCODE_SOFTRIGHT | (1 << 30)), + SDLK_CALL = (SDL_SCANCODE_CALL | (1 << 30)), + SDLK_ENDCALL = (SDL_SCANCODE_ENDCALL | (1 << 30)), + } + + public enum SDL_Keymod + { + SDL_KMOD_NONE = 0x0000, + SDL_KMOD_LSHIFT = 0x0001, + SDL_KMOD_RSHIFT = 0x0002, + SDL_KMOD_LCTRL = 0x0040, + SDL_KMOD_RCTRL = 0x0080, + SDL_KMOD_LALT = 0x0100, + SDL_KMOD_RALT = 0x0200, + SDL_KMOD_LGUI = 0x0400, + SDL_KMOD_RGUI = 0x0800, + SDL_KMOD_NUM = 0x1000, + SDL_KMOD_CAPS = 0x2000, + SDL_KMOD_MODE = 0x4000, + SDL_KMOD_SCROLL = 0x8000, + SDL_KMOD_CTRL = SDL_KMOD_LCTRL | SDL_KMOD_RCTRL, + SDL_KMOD_SHIFT = SDL_KMOD_LSHIFT | SDL_KMOD_RSHIFT, + SDL_KMOD_ALT = SDL_KMOD_LALT | SDL_KMOD_RALT, + SDL_KMOD_GUI = SDL_KMOD_LGUI | SDL_KMOD_RGUI, + SDL_KMOD_RESERVED = SDL_KMOD_SCROLL, + } + + public static partial class SDL3 + { + [NativeTypeName("#define SDLK_SCANCODE_MASK (1<<30)")] + public const int SDLK_SCANCODE_MASK = (1 << 30); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs new file mode 100644 index 0000000..28cb0c4 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs @@ -0,0 +1,42 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_LoadObject([NativeTypeName("const char *")] sbyte* sofile); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_FunctionPointer")] + public static extern delegate* unmanaged[Cdecl] SDL_LoadFunction(void* handle, [NativeTypeName("const char *")] sbyte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnloadObject(void* handle); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs new file mode 100644 index 0000000..47d6d69 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs @@ -0,0 +1,44 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public unsafe partial struct SDL_Locale + { + [NativeTypeName("const char *")] + public sbyte* language; + + [NativeTypeName("const char *")] + public sbyte* country; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Locale* SDL_GetPreferredLocales(); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs new file mode 100644 index 0000000..847444e --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs @@ -0,0 +1,115 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_LogCategory + { + SDL_LOG_CATEGORY_APPLICATION, + SDL_LOG_CATEGORY_ERROR, + SDL_LOG_CATEGORY_ASSERT, + SDL_LOG_CATEGORY_SYSTEM, + SDL_LOG_CATEGORY_AUDIO, + SDL_LOG_CATEGORY_VIDEO, + SDL_LOG_CATEGORY_RENDER, + SDL_LOG_CATEGORY_INPUT, + SDL_LOG_CATEGORY_TEST, + SDL_LOG_CATEGORY_RESERVED1, + SDL_LOG_CATEGORY_RESERVED2, + SDL_LOG_CATEGORY_RESERVED3, + SDL_LOG_CATEGORY_RESERVED4, + SDL_LOG_CATEGORY_RESERVED5, + SDL_LOG_CATEGORY_RESERVED6, + SDL_LOG_CATEGORY_RESERVED7, + SDL_LOG_CATEGORY_RESERVED8, + SDL_LOG_CATEGORY_RESERVED9, + SDL_LOG_CATEGORY_RESERVED10, + SDL_LOG_CATEGORY_CUSTOM, + } + + public enum SDL_LogPriority + { + SDL_LOG_PRIORITY_VERBOSE = 1, + SDL_LOG_PRIORITY_DEBUG, + SDL_LOG_PRIORITY_INFO, + SDL_LOG_PRIORITY_WARN, + SDL_LOG_PRIORITY_ERROR, + SDL_LOG_PRIORITY_CRITICAL, + SDL_NUM_LOG_PRIORITIES, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogSetAllPriority(SDL_LogPriority priority); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogSetPriority(int category, SDL_LogPriority priority); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_LogPriority SDL_LogGetPriority(int category); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogResetPriorities(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_Log([NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogVerbose(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogDebug(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogInfo(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogWarn(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogError(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogCritical(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogMessage(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LogMessageV(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_GetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction *")] delegate* unmanaged[Cdecl]* callback, void** userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [NativeTypeName("#define SDL_MAX_LOG_MESSAGE 4096")] + public const int SDL_MAX_LOG_MESSAGE = 4096; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs new file mode 100644 index 0000000..b2ee8e4 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs @@ -0,0 +1,53 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_main(int argc, [NativeTypeName("char *[]")] sbyte** argv); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetMainReady(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RunApp(int argc, [NativeTypeName("char *[]")] sbyte** argv, [NativeTypeName("SDL_main_func")] delegate* unmanaged[Cdecl] mainFunction, void* reserved); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_EnterAppMainCallbacks(int argc, [NativeTypeName("char *[]")] sbyte** argv, [NativeTypeName("SDL_AppInit_func")] delegate* unmanaged[Cdecl] appinit, [NativeTypeName("SDL_AppIterate_func")] delegate* unmanaged[Cdecl] appiter, [NativeTypeName("SDL_AppEvent_func")] delegate* unmanaged[Cdecl] appevent, [NativeTypeName("SDL_AppQuit_func")] delegate* unmanaged[Cdecl] appquit); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RegisterApp([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("Uint32")] uint style, void* hInst); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnregisterApp(); + + [NativeTypeName("#define main SDL_main")] + public static readonly delegate* main = &SDL_main; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs new file mode 100644 index 0000000..a09bccb --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs @@ -0,0 +1,121 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_MessageBoxFlags + { + SDL_MESSAGEBOX_ERROR = 0x00000010, + SDL_MESSAGEBOX_WARNING = 0x00000020, + SDL_MESSAGEBOX_INFORMATION = 0x00000040, + SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, + SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100, + } + + public enum SDL_MessageBoxButtonFlags + { + SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, + SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002, + } + + public unsafe partial struct SDL_MessageBoxButtonData + { + [NativeTypeName("Uint32")] + public uint flags; + + public int buttonID; + + [NativeTypeName("const char *")] + public sbyte* text; + } + + public partial struct SDL_MessageBoxColor + { + [NativeTypeName("Uint8")] + public byte r; + + [NativeTypeName("Uint8")] + public byte g; + + [NativeTypeName("Uint8")] + public byte b; + } + + public enum SDL_MessageBoxColorType + { + SDL_MESSAGEBOX_COLOR_BACKGROUND, + SDL_MESSAGEBOX_COLOR_TEXT, + SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, + SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, + SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, + SDL_MESSAGEBOX_COLOR_MAX, + } + + public partial struct SDL_MessageBoxColorScheme + { + [NativeTypeName("SDL_MessageBoxColor[5]")] + public _colors_e__FixedBuffer colors; + + [InlineArray(5)] + public partial struct _colors_e__FixedBuffer + { + public SDL_MessageBoxColor e0; + } + } + + public unsafe partial struct SDL_MessageBoxData + { + [NativeTypeName("Uint32")] + public uint flags; + + public SDL_Window* window; + + [NativeTypeName("const char *")] + public sbyte* title; + + [NativeTypeName("const char *")] + public sbyte* message; + + public int numbuttons; + + [NativeTypeName("const SDL_MessageBoxButtonData *")] + public SDL_MessageBoxButtonData* buttons; + + [NativeTypeName("const SDL_MessageBoxColorScheme *")] + public SDL_MessageBoxColorScheme* colorScheme; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ShowMessageBox([NativeTypeName("const SDL_MessageBoxData *")] SDL_MessageBoxData* messageboxdata, int* buttonid); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ShowSimpleMessageBox([NativeTypeName("Uint32")] uint flags, [NativeTypeName("const char *")] sbyte* title, [NativeTypeName("const char *")] sbyte* message, SDL_Window* window); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_metal.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_metal.g.cs new file mode 100644 index 0000000..f90f44c --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_metal.g.cs @@ -0,0 +1,42 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_MetalView")] + public static extern void* SDL_Metal_CreateView(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_Metal_DestroyView([NativeTypeName("SDL_MetalView")] void* view); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_Metal_GetLayer([NativeTypeName("SDL_MetalView")] void* view); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_misc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_misc.g.cs new file mode 100644 index 0000000..ce86c00 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_misc.g.cs @@ -0,0 +1,35 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_OpenURL([NativeTypeName("const char *")] sbyte* url); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs new file mode 100644 index 0000000..483c3bb --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs @@ -0,0 +1,171 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Cursor + { + } + + public enum SDL_SystemCursor + { + SDL_SYSTEM_CURSOR_ARROW, + SDL_SYSTEM_CURSOR_IBEAM, + SDL_SYSTEM_CURSOR_WAIT, + SDL_SYSTEM_CURSOR_CROSSHAIR, + SDL_SYSTEM_CURSOR_WAITARROW, + SDL_SYSTEM_CURSOR_SIZENWSE, + SDL_SYSTEM_CURSOR_SIZENESW, + SDL_SYSTEM_CURSOR_SIZEWE, + SDL_SYSTEM_CURSOR_SIZENS, + SDL_SYSTEM_CURSOR_SIZEALL, + SDL_SYSTEM_CURSOR_NO, + SDL_SYSTEM_CURSOR_HAND, + SDL_SYSTEM_CURSOR_WINDOW_TOPLEFT, + SDL_SYSTEM_CURSOR_WINDOW_TOP, + SDL_SYSTEM_CURSOR_WINDOW_TOPRIGHT, + SDL_SYSTEM_CURSOR_WINDOW_RIGHT, + SDL_SYSTEM_CURSOR_WINDOW_BOTTOMRIGHT, + SDL_SYSTEM_CURSOR_WINDOW_BOTTOM, + SDL_SYSTEM_CURSOR_WINDOW_BOTTOMLEFT, + SDL_SYSTEM_CURSOR_WINDOW_LEFT, + SDL_NUM_SYSTEM_CURSORS, + } + + public enum SDL_MouseWheelDirection + { + SDL_MOUSEWHEEL_NORMAL, + SDL_MOUSEWHEEL_FLIPPED, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasMouse(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_MouseID *")] + public static extern uint* SDL_GetMice(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetMouseInstanceName([NativeTypeName("SDL_MouseID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_GetMouseFocus(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_GetMouseState(float* x, float* y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_GetGlobalMouseState(float* x, float* y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_GetRelativeMouseState(float* x, float* y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_WarpMouseInWindow(SDL_Window* window, float x, float y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_WarpMouseGlobal(float x, float y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRelativeMouseMode([NativeTypeName("SDL_bool")] int enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CaptureMouse([NativeTypeName("SDL_bool")] int enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetRelativeMouseMode(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Cursor* SDL_CreateCursor([NativeTypeName("const Uint8 *")] byte* data, [NativeTypeName("const Uint8 *")] byte* mask, int w, int h, int hot_x, int hot_y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Cursor* SDL_CreateColorCursor(SDL_Surface* surface, int hot_x, int hot_y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Cursor* SDL_CreateSystemCursor(SDL_SystemCursor id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetCursor(SDL_Cursor* cursor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Cursor* SDL_GetCursor(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Cursor* SDL_GetDefaultCursor(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyCursor(SDL_Cursor* cursor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ShowCursor(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_HideCursor(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_CursorVisible(); + + [NativeTypeName("#define SDL_BUTTON_LEFT 1")] + public const int SDL_BUTTON_LEFT = 1; + + [NativeTypeName("#define SDL_BUTTON_MIDDLE 2")] + public const int SDL_BUTTON_MIDDLE = 2; + + [NativeTypeName("#define SDL_BUTTON_RIGHT 3")] + public const int SDL_BUTTON_RIGHT = 3; + + [NativeTypeName("#define SDL_BUTTON_X1 4")] + public const int SDL_BUTTON_X1 = 4; + + [NativeTypeName("#define SDL_BUTTON_X2 5")] + public const int SDL_BUTTON_X2 = 5; + + [NativeTypeName("#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)")] + public const int SDL_BUTTON_LMASK = (1 << ((1) - 1)); + + [NativeTypeName("#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)")] + public const int SDL_BUTTON_MMASK = (1 << ((2) - 1)); + + [NativeTypeName("#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)")] + public const int SDL_BUTTON_RMASK = (1 << ((3) - 1)); + + [NativeTypeName("#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)")] + public const int SDL_BUTTON_X1MASK = (1 << ((4) - 1)); + + [NativeTypeName("#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)")] + public const int SDL_BUTTON_X2MASK = (1 << ((5) - 1)); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_mutex.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_mutex.g.cs new file mode 100644 index 0000000..49ccd52 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_mutex.g.cs @@ -0,0 +1,130 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Mutex + { + } + + public partial struct SDL_RWLock + { + } + + public partial struct SDL_Semaphore + { + } + + public partial struct SDL_Condition + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Mutex* SDL_CreateMutex(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LockMutex(SDL_Mutex* mutex); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_TryLockMutex(SDL_Mutex* mutex); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnlockMutex(SDL_Mutex* mutex); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyMutex(SDL_Mutex* mutex); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_RWLock* SDL_CreateRWLock(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LockRWLockForReading(SDL_RWLock* rwlock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_LockRWLockForWriting(SDL_RWLock* rwlock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_TryLockRWLockForReading(SDL_RWLock* rwlock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_TryLockRWLockForWriting(SDL_RWLock* rwlock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnlockRWLock(SDL_RWLock* rwlock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyRWLock(SDL_RWLock* rwlock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Semaphore* SDL_CreateSemaphore([NativeTypeName("Uint32")] uint initial_value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroySemaphore(SDL_Semaphore* sem); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_WaitSemaphore(SDL_Semaphore* sem); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_TryWaitSemaphore(SDL_Semaphore* sem); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_WaitSemaphoreTimeout(SDL_Semaphore* sem, [NativeTypeName("Sint32")] int timeoutMS); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_PostSemaphore(SDL_Semaphore* sem); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_GetSemaphoreValue(SDL_Semaphore* sem); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Condition* SDL_CreateCondition(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyCondition(SDL_Condition* cond); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SignalCondition(SDL_Condition* cond); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_BroadcastCondition(SDL_Condition* cond); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_WaitCondition(SDL_Condition* cond, SDL_Mutex* mutex); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_WaitConditionTimeout(SDL_Condition* cond, SDL_Mutex* mutex, [NativeTypeName("Sint32")] int timeoutMS); + + [NativeTypeName("#define SDL_MUTEX_TIMEDOUT 1")] + public const int SDL_MUTEX_TIMEDOUT = 1; + + [NativeTypeName("#define SDL_RWLOCK_TIMEDOUT SDL_MUTEX_TIMEDOUT")] + public const int SDL_RWLOCK_TIMEDOUT = 1; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs new file mode 100644 index 0000000..bf1eb9d --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs @@ -0,0 +1,154 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; +using static SDL.SDL_PenAxis; + +namespace SDL +{ + public enum SDL_PenAxis + { + SDL_PEN_AXIS_PRESSURE = 0, + SDL_PEN_AXIS_XTILT, + SDL_PEN_AXIS_YTILT, + SDL_PEN_AXIS_DISTANCE, + SDL_PEN_AXIS_ROTATION, + SDL_PEN_AXIS_SLIDER, + SDL_PEN_NUM_AXES, + SDL_PEN_AXIS_LAST = SDL_PEN_NUM_AXES - 1, + } + + public enum SDL_PenSubtype + { + SDL_PEN_TYPE_UNKNOWN = 0, + SDL_PEN_TYPE_ERASER = 1, + SDL_PEN_TYPE_PEN, + SDL_PEN_TYPE_PENCIL, + SDL_PEN_TYPE_BRUSH, + SDL_PEN_TYPE_AIRBRUSH, + SDL_PEN_TYPE_LAST = SDL_PEN_TYPE_AIRBRUSH, + } + + public partial struct SDL_PenCapabilityInfo + { + public float max_tilt; + + [NativeTypeName("Uint32")] + public uint wacom_id; + + [NativeTypeName("Sint8")] + public sbyte num_buttons; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PenID *")] + public static extern uint* SDL_GetPens(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_GetPenStatus([NativeTypeName("SDL_PenID")] uint instance_id, float* x, float* y, float* axes, [NativeTypeName("size_t")] nuint num_axes); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PenID")] + public static extern uint SDL_GetPenFromGUID(SDL_GUID guid); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GUID SDL_GetPenGUID([NativeTypeName("SDL_PenID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_PenConnected([NativeTypeName("SDL_PenID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetPenName([NativeTypeName("SDL_PenID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_GetPenCapabilities([NativeTypeName("SDL_PenID")] uint instance_id, SDL_PenCapabilityInfo* capabilities); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PenSubtype SDL_GetPenType([NativeTypeName("SDL_PenID")] uint instance_id); + + [NativeTypeName("#define SDL_PEN_INVALID ((SDL_PenID)0)")] + public const uint SDL_PEN_INVALID = ((uint)(0)); + + [NativeTypeName("#define SDL_PEN_MOUSEID ((SDL_MouseID)-2)")] + public const uint SDL_PEN_MOUSEID = unchecked((uint)(-2)); + + [NativeTypeName("#define SDL_PEN_INFO_UNKNOWN (-1)")] + public const int SDL_PEN_INFO_UNKNOWN = (-1); + + [NativeTypeName("#define SDL_PEN_FLAG_DOWN_BIT_INDEX 13")] + public const int SDL_PEN_FLAG_DOWN_BIT_INDEX = 13; + + [NativeTypeName("#define SDL_PEN_FLAG_INK_BIT_INDEX 14")] + public const int SDL_PEN_FLAG_INK_BIT_INDEX = 14; + + [NativeTypeName("#define SDL_PEN_FLAG_ERASER_BIT_INDEX 15")] + public const int SDL_PEN_FLAG_ERASER_BIT_INDEX = 15; + + [NativeTypeName("#define SDL_PEN_FLAG_AXIS_BIT_OFFSET 16")] + public const int SDL_PEN_FLAG_AXIS_BIT_OFFSET = 16; + + [NativeTypeName("#define SDL_PEN_TIP_INK SDL_PEN_FLAG_INK_BIT_INDEX")] + public const int SDL_PEN_TIP_INK = 14; + + [NativeTypeName("#define SDL_PEN_TIP_ERASER SDL_PEN_FLAG_ERASER_BIT_INDEX")] + public const int SDL_PEN_TIP_ERASER = 15; + + [NativeTypeName("#define SDL_PEN_DOWN_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_DOWN_BIT_INDEX)")] + public const uint SDL_PEN_DOWN_MASK = (1U << (13)); + + [NativeTypeName("#define SDL_PEN_INK_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_INK_BIT_INDEX)")] + public const uint SDL_PEN_INK_MASK = (1U << (14)); + + [NativeTypeName("#define SDL_PEN_ERASER_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_ERASER_BIT_INDEX)")] + public const uint SDL_PEN_ERASER_MASK = (1U << (15)); + + [NativeTypeName("#define SDL_PEN_AXIS_PRESSURE_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_PRESSURE)")] + public const uint SDL_PEN_AXIS_PRESSURE_MASK = (1U << ((int)(SDL_PEN_AXIS_PRESSURE) + 16)); + + [NativeTypeName("#define SDL_PEN_AXIS_XTILT_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_XTILT)")] + public const uint SDL_PEN_AXIS_XTILT_MASK = (1U << ((int)(SDL_PEN_AXIS_XTILT) + 16)); + + [NativeTypeName("#define SDL_PEN_AXIS_YTILT_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_YTILT)")] + public const uint SDL_PEN_AXIS_YTILT_MASK = (1U << ((int)(SDL_PEN_AXIS_YTILT) + 16)); + + [NativeTypeName("#define SDL_PEN_AXIS_DISTANCE_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_DISTANCE)")] + public const uint SDL_PEN_AXIS_DISTANCE_MASK = (1U << ((int)(SDL_PEN_AXIS_DISTANCE) + 16)); + + [NativeTypeName("#define SDL_PEN_AXIS_ROTATION_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_ROTATION)")] + public const uint SDL_PEN_AXIS_ROTATION_MASK = (1U << ((int)(SDL_PEN_AXIS_ROTATION) + 16)); + + [NativeTypeName("#define SDL_PEN_AXIS_SLIDER_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_SLIDER)")] + public const uint SDL_PEN_AXIS_SLIDER_MASK = (1U << ((int)(SDL_PEN_AXIS_SLIDER) + 16)); + + [NativeTypeName("#define SDL_PEN_AXIS_BIDIRECTIONAL_MASKS (SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK)")] + public const uint SDL_PEN_AXIS_BIDIRECTIONAL_MASKS = ((1U << ((int)(SDL_PEN_AXIS_XTILT) + 16)) | (1U << ((int)(SDL_PEN_AXIS_YTILT) + 16))); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs new file mode 100644 index 0000000..54913e7 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs @@ -0,0 +1,434 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using static SDL.SDL_ArrayOrder; +using static SDL.SDL_BitmapOrder; +using static SDL.SDL_ChromaLocation; +using static SDL.SDL_ColorPrimaries; +using static SDL.SDL_ColorRange; +using static SDL.SDL_ColorType; +using static SDL.SDL_MatrixCoefficients; +using static SDL.SDL_PackedLayout; +using static SDL.SDL_PackedOrder; +using static SDL.SDL_PixelType; +using static SDL.SDL_TransferCharacteristics; + +namespace SDL +{ + public enum SDL_PixelType + { + SDL_PIXELTYPE_UNKNOWN, + SDL_PIXELTYPE_INDEX1, + SDL_PIXELTYPE_INDEX4, + SDL_PIXELTYPE_INDEX8, + SDL_PIXELTYPE_PACKED8, + SDL_PIXELTYPE_PACKED16, + SDL_PIXELTYPE_PACKED32, + SDL_PIXELTYPE_ARRAYU8, + SDL_PIXELTYPE_ARRAYU16, + SDL_PIXELTYPE_ARRAYU32, + SDL_PIXELTYPE_ARRAYF16, + SDL_PIXELTYPE_ARRAYF32, + SDL_PIXELTYPE_INDEX2, + } + + public enum SDL_BitmapOrder + { + SDL_BITMAPORDER_NONE, + SDL_BITMAPORDER_4321, + SDL_BITMAPORDER_1234, + } + + public enum SDL_PackedOrder + { + SDL_PACKEDORDER_NONE, + SDL_PACKEDORDER_XRGB, + SDL_PACKEDORDER_RGBX, + SDL_PACKEDORDER_ARGB, + SDL_PACKEDORDER_RGBA, + SDL_PACKEDORDER_XBGR, + SDL_PACKEDORDER_BGRX, + SDL_PACKEDORDER_ABGR, + SDL_PACKEDORDER_BGRA, + } + + public enum SDL_ArrayOrder + { + SDL_ARRAYORDER_NONE, + SDL_ARRAYORDER_RGB, + SDL_ARRAYORDER_RGBA, + SDL_ARRAYORDER_ARGB, + SDL_ARRAYORDER_BGR, + SDL_ARRAYORDER_BGRA, + SDL_ARRAYORDER_ABGR, + } + + public enum SDL_PackedLayout + { + SDL_PACKEDLAYOUT_NONE, + SDL_PACKEDLAYOUT_332, + SDL_PACKEDLAYOUT_4444, + SDL_PACKEDLAYOUT_1555, + SDL_PACKEDLAYOUT_5551, + SDL_PACKEDLAYOUT_565, + SDL_PACKEDLAYOUT_8888, + SDL_PACKEDLAYOUT_2101010, + SDL_PACKEDLAYOUT_1010102, + } + + public enum SDL_PixelFormatEnum + { + SDL_PIXELFORMAT_UNKNOWN, + SDL_PIXELFORMAT_INDEX1LSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX1) << 24) | ((SDL_BITMAPORDER_4321) << 20) | ((0) << 16) | ((1) << 8) | ((0) << 0)), + SDL_PIXELFORMAT_INDEX1MSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX1) << 24) | ((SDL_BITMAPORDER_1234) << 20) | ((0) << 16) | ((1) << 8) | ((0) << 0)), + SDL_PIXELFORMAT_INDEX2LSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX2) << 24) | ((SDL_BITMAPORDER_4321) << 20) | ((0) << 16) | ((2) << 8) | ((0) << 0)), + SDL_PIXELFORMAT_INDEX2MSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX2) << 24) | ((SDL_BITMAPORDER_1234) << 20) | ((0) << 16) | ((2) << 8) | ((0) << 0)), + SDL_PIXELFORMAT_INDEX4LSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX4) << 24) | ((SDL_BITMAPORDER_4321) << 20) | ((0) << 16) | ((4) << 8) | ((0) << 0)), + SDL_PIXELFORMAT_INDEX4MSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX4) << 24) | ((SDL_BITMAPORDER_1234) << 20) | ((0) << 16) | ((4) << 8) | ((0) << 0)), + SDL_PIXELFORMAT_INDEX8 = ((1 << 28) | ((SDL_PIXELTYPE_INDEX8) << 24) | ((0) << 20) | ((0) << 16) | ((8) << 8) | ((1) << 0)), + SDL_PIXELFORMAT_RGB332 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED8) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_332) << 16) | ((8) << 8) | ((1) << 0)), + SDL_PIXELFORMAT_XRGB4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((12) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444, + SDL_PIXELFORMAT_XBGR4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XBGR) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((12) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444, + SDL_PIXELFORMAT_XRGB1555 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_1555) << 16) | ((15) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555, + SDL_PIXELFORMAT_XBGR1555 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XBGR) << 20) | ((SDL_PACKEDLAYOUT_1555) << 16) | ((15) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555, + SDL_PIXELFORMAT_ARGB4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_ARGB) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((16) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_RGBA4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_RGBA) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((16) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_ABGR4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_ABGR) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((16) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_BGRA4444 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_BGRA) << 20) | ((SDL_PACKEDLAYOUT_4444) << 16) | ((16) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_ARGB1555 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_ARGB) << 20) | ((SDL_PACKEDLAYOUT_1555) << 16) | ((16) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_RGBA5551 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_RGBA) << 20) | ((SDL_PACKEDLAYOUT_5551) << 16) | ((16) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_ABGR1555 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_ABGR) << 20) | ((SDL_PACKEDLAYOUT_1555) << 16) | ((16) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_BGRA5551 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_BGRA) << 20) | ((SDL_PACKEDLAYOUT_5551) << 16) | ((16) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_RGB565 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_565) << 16) | ((16) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_BGR565 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED16) << 24) | ((SDL_PACKEDORDER_XBGR) << 20) | ((SDL_PACKEDLAYOUT_565) << 16) | ((16) << 8) | ((2) << 0)), + SDL_PIXELFORMAT_RGB24 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU8) << 24) | ((SDL_ARRAYORDER_RGB) << 20) | ((0) << 16) | ((24) << 8) | ((3) << 0)), + SDL_PIXELFORMAT_BGR24 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU8) << 24) | ((SDL_ARRAYORDER_BGR) << 20) | ((0) << 16) | ((24) << 8) | ((3) << 0)), + SDL_PIXELFORMAT_XRGB8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((24) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_RGBX8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_RGBX) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((24) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_XBGR8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_XBGR) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((24) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_BGRX8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_BGRX) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((24) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_ARGB8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_ARGB) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((32) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_RGBA8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_RGBA) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((32) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_ABGR8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_ABGR) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((32) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_BGRA8888 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_BGRA) << 20) | ((SDL_PACKEDLAYOUT_8888) << 16) | ((32) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_XRGB2101010 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_XRGB) << 20) | ((SDL_PACKEDLAYOUT_2101010) << 16) | ((32) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_XBGR2101010 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_XBGR) << 20) | ((SDL_PACKEDLAYOUT_2101010) << 16) | ((32) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_ARGB2101010 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_ARGB) << 20) | ((SDL_PACKEDLAYOUT_2101010) << 16) | ((32) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_ABGR2101010 = ((1 << 28) | ((SDL_PIXELTYPE_PACKED32) << 24) | ((SDL_PACKEDORDER_ABGR) << 20) | ((SDL_PACKEDLAYOUT_2101010) << 16) | ((32) << 8) | ((4) << 0)), + SDL_PIXELFORMAT_RGB48 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_RGB) << 20) | ((0) << 16) | ((48) << 8) | ((6) << 0)), + SDL_PIXELFORMAT_BGR48 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_BGR) << 20) | ((0) << 16) | ((48) << 8) | ((6) << 0)), + SDL_PIXELFORMAT_RGBA64 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_RGBA) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)), + SDL_PIXELFORMAT_ARGB64 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_ARGB) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)), + SDL_PIXELFORMAT_BGRA64 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_BGRA) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)), + SDL_PIXELFORMAT_ABGR64 = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYU16) << 24) | ((SDL_ARRAYORDER_ABGR) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)), + SDL_PIXELFORMAT_RGB48_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_RGB) << 20) | ((0) << 16) | ((48) << 8) | ((6) << 0)), + SDL_PIXELFORMAT_BGR48_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_BGR) << 20) | ((0) << 16) | ((48) << 8) | ((6) << 0)), + SDL_PIXELFORMAT_RGBA64_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_RGBA) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)), + SDL_PIXELFORMAT_ARGB64_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_ARGB) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)), + SDL_PIXELFORMAT_BGRA64_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_BGRA) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)), + SDL_PIXELFORMAT_ABGR64_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF16) << 24) | ((SDL_ARRAYORDER_ABGR) << 20) | ((0) << 16) | ((64) << 8) | ((8) << 0)), + SDL_PIXELFORMAT_RGB96_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_RGB) << 20) | ((0) << 16) | ((96) << 8) | ((12) << 0)), + SDL_PIXELFORMAT_BGR96_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_BGR) << 20) | ((0) << 16) | ((96) << 8) | ((12) << 0)), + SDL_PIXELFORMAT_RGBA128_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_RGBA) << 20) | ((0) << 16) | ((128) << 8) | ((16) << 0)), + SDL_PIXELFORMAT_ARGB128_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_ARGB) << 20) | ((0) << 16) | ((128) << 8) | ((16) << 0)), + SDL_PIXELFORMAT_BGRA128_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_BGRA) << 20) | ((0) << 16) | ((128) << 8) | ((16) << 0)), + SDL_PIXELFORMAT_ABGR128_FLOAT = ((1 << 28) | ((SDL_PIXELTYPE_ARRAYF32) << 24) | ((SDL_ARRAYORDER_ABGR) << 20) | ((0) << 16) | ((128) << 8) | ((16) << 0)), + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888, + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888, + SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_XBGR8888, + SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_BGRX8888, + SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_XRGB8888, + SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_RGBX8888, + SDL_PIXELFORMAT_YV12 = unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('2')) << 24)), + SDL_PIXELFORMAT_IYUV = unchecked(((uint)((byte)('I')) << 0) | ((uint)((byte)('Y')) << 8) | ((uint)((byte)('U')) << 16) | ((uint)((byte)('V')) << 24)), + SDL_PIXELFORMAT_YUY2 = unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('U')) << 8) | ((uint)((byte)('Y')) << 16) | ((uint)((byte)('2')) << 24)), + SDL_PIXELFORMAT_UYVY = unchecked(((uint)((byte)('U')) << 0) | ((uint)((byte)('Y')) << 8) | ((uint)((byte)('V')) << 16) | ((uint)((byte)('Y')) << 24)), + SDL_PIXELFORMAT_YVYU = unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('Y')) << 16) | ((uint)((byte)('U')) << 24)), + SDL_PIXELFORMAT_NV12 = unchecked(((uint)((byte)('N')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('2')) << 24)), + SDL_PIXELFORMAT_NV21 = unchecked(((uint)((byte)('N')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('2')) << 16) | ((uint)((byte)('1')) << 24)), + SDL_PIXELFORMAT_P010 = unchecked(((uint)((byte)('P')) << 0) | ((uint)((byte)('0')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('0')) << 24)), + SDL_PIXELFORMAT_EXTERNAL_OES = unchecked(((uint)((byte)('O')) << 0) | ((uint)((byte)('E')) << 8) | ((uint)((byte)('S')) << 16) | ((uint)((byte)(' ')) << 24)), + } + + public enum SDL_ColorType + { + SDL_COLOR_TYPE_UNKNOWN = 0, + SDL_COLOR_TYPE_RGB = 1, + SDL_COLOR_TYPE_YCBCR = 2, + } + + public enum SDL_ColorRange + { + SDL_COLOR_RANGE_UNKNOWN = 0, + SDL_COLOR_RANGE_LIMITED = 1, + SDL_COLOR_RANGE_FULL = 2, + } + + public enum SDL_ColorPrimaries + { + SDL_COLOR_PRIMARIES_UNKNOWN = 0, + SDL_COLOR_PRIMARIES_BT709 = 1, + SDL_COLOR_PRIMARIES_UNSPECIFIED = 2, + SDL_COLOR_PRIMARIES_BT470M = 4, + SDL_COLOR_PRIMARIES_BT470BG = 5, + SDL_COLOR_PRIMARIES_BT601 = 6, + SDL_COLOR_PRIMARIES_SMPTE240 = 7, + SDL_COLOR_PRIMARIES_GENERIC_FILM = 8, + SDL_COLOR_PRIMARIES_BT2020 = 9, + SDL_COLOR_PRIMARIES_XYZ = 10, + SDL_COLOR_PRIMARIES_SMPTE431 = 11, + SDL_COLOR_PRIMARIES_SMPTE432 = 12, + SDL_COLOR_PRIMARIES_EBU3213 = 22, + SDL_COLOR_PRIMARIES_CUSTOM = 31, + } + + public enum SDL_TransferCharacteristics + { + SDL_TRANSFER_CHARACTERISTICS_UNKNOWN = 0, + SDL_TRANSFER_CHARACTERISTICS_BT709 = 1, + SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED = 2, + SDL_TRANSFER_CHARACTERISTICS_GAMMA22 = 4, + SDL_TRANSFER_CHARACTERISTICS_GAMMA28 = 5, + SDL_TRANSFER_CHARACTERISTICS_BT601 = 6, + SDL_TRANSFER_CHARACTERISTICS_SMPTE240 = 7, + SDL_TRANSFER_CHARACTERISTICS_LINEAR = 8, + SDL_TRANSFER_CHARACTERISTICS_LOG100 = 9, + SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10 = 10, + SDL_TRANSFER_CHARACTERISTICS_IEC61966 = 11, + SDL_TRANSFER_CHARACTERISTICS_BT1361 = 12, + SDL_TRANSFER_CHARACTERISTICS_SRGB = 13, + SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT = 14, + SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT = 15, + SDL_TRANSFER_CHARACTERISTICS_PQ = 16, + SDL_TRANSFER_CHARACTERISTICS_SMPTE428 = 17, + SDL_TRANSFER_CHARACTERISTICS_HLG = 18, + SDL_TRANSFER_CHARACTERISTICS_CUSTOM = 31, + } + + public enum SDL_MatrixCoefficients + { + SDL_MATRIX_COEFFICIENTS_IDENTITY = 0, + SDL_MATRIX_COEFFICIENTS_BT709 = 1, + SDL_MATRIX_COEFFICIENTS_UNSPECIFIED = 2, + SDL_MATRIX_COEFFICIENTS_FCC = 4, + SDL_MATRIX_COEFFICIENTS_BT470BG = 5, + SDL_MATRIX_COEFFICIENTS_BT601 = 6, + SDL_MATRIX_COEFFICIENTS_SMPTE240 = 7, + SDL_MATRIX_COEFFICIENTS_YCGCO = 8, + SDL_MATRIX_COEFFICIENTS_BT2020_NCL = 9, + SDL_MATRIX_COEFFICIENTS_BT2020_CL = 10, + SDL_MATRIX_COEFFICIENTS_SMPTE2085 = 11, + SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL = 12, + SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL = 13, + SDL_MATRIX_COEFFICIENTS_ICTCP = 14, + SDL_MATRIX_COEFFICIENTS_CUSTOM = 31, + } + + public enum SDL_ChromaLocation + { + SDL_CHROMA_LOCATION_NONE = 0, + SDL_CHROMA_LOCATION_LEFT = 1, + SDL_CHROMA_LOCATION_CENTER = 2, + SDL_CHROMA_LOCATION_TOPLEFT = 3, + } + + public enum SDL_Colorspace + { + SDL_COLORSPACE_UNKNOWN, + SDL_COLORSPACE_SRGB = unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_SRGB) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0)), + SDL_COLORSPACE_SRGB_LINEAR = unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_LINEAR) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0)), + SDL_COLORSPACE_HDR10 = unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0)), + SDL_COLORSPACE_JPEG = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0)), + SDL_COLORSPACE_BT601_LIMITED = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT601) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0)), + SDL_COLORSPACE_BT601_FULL = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT601) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0)), + SDL_COLORSPACE_BT709_LIMITED = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT709) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT709) << 0)), + SDL_COLORSPACE_BT709_FULL = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT709) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT709) << 0)), + SDL_COLORSPACE_BT2020_LIMITED = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT2020_NCL) << 0)), + SDL_COLORSPACE_BT2020_FULL = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT2020_NCL) << 0)), + SDL_COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_SRGB, + SDL_COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_JPEG, + } + + public partial struct SDL_Color + { + [NativeTypeName("Uint8")] + public byte r; + + [NativeTypeName("Uint8")] + public byte g; + + [NativeTypeName("Uint8")] + public byte b; + + [NativeTypeName("Uint8")] + public byte a; + } + + public partial struct SDL_FColor + { + public float r; + + public float g; + + public float b; + + public float a; + } + + public unsafe partial struct SDL_Palette + { + public int ncolors; + + public SDL_Color* colors; + + [NativeTypeName("Uint32")] + public uint version; + + public int refcount; + } + + public unsafe partial struct SDL_PixelFormat + { + public SDL_PixelFormatEnum format; + + public SDL_Palette* palette; + + [NativeTypeName("Uint8")] + public byte bits_per_pixel; + + [NativeTypeName("Uint8")] + public byte bytes_per_pixel; + + [NativeTypeName("Uint8[2]")] + public _padding_e__FixedBuffer padding; + + [NativeTypeName("Uint32")] + public uint Rmask; + + [NativeTypeName("Uint32")] + public uint Gmask; + + [NativeTypeName("Uint32")] + public uint Bmask; + + [NativeTypeName("Uint32")] + public uint Amask; + + [NativeTypeName("Uint8")] + public byte Rloss; + + [NativeTypeName("Uint8")] + public byte Gloss; + + [NativeTypeName("Uint8")] + public byte Bloss; + + [NativeTypeName("Uint8")] + public byte Aloss; + + [NativeTypeName("Uint8")] + public byte Rshift; + + [NativeTypeName("Uint8")] + public byte Gshift; + + [NativeTypeName("Uint8")] + public byte Bshift; + + [NativeTypeName("Uint8")] + public byte Ashift; + + public int refcount; + + [NativeTypeName("struct SDL_PixelFormat *")] + public SDL_PixelFormat* next; + + [InlineArray(2)] + public partial struct _padding_e__FixedBuffer + { + public byte e0; + } + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetPixelFormatName(SDL_PixelFormatEnum format); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetMasksForPixelFormatEnum(SDL_PixelFormatEnum format, int* bpp, [NativeTypeName("Uint32 *")] uint* Rmask, [NativeTypeName("Uint32 *")] uint* Gmask, [NativeTypeName("Uint32 *")] uint* Bmask, [NativeTypeName("Uint32 *")] uint* Amask); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PixelFormatEnum SDL_GetPixelFormatEnumForMasks(int bpp, [NativeTypeName("Uint32")] uint Rmask, [NativeTypeName("Uint32")] uint Gmask, [NativeTypeName("Uint32")] uint Bmask, [NativeTypeName("Uint32")] uint Amask); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PixelFormat* SDL_CreatePixelFormat(SDL_PixelFormatEnum pixel_format); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyPixelFormat(SDL_PixelFormat* format); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Palette* SDL_CreatePalette(int ncolors); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetPixelFormatPalette(SDL_PixelFormat* format, SDL_Palette* palette); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetPaletteColors(SDL_Palette* palette, [NativeTypeName("const SDL_Color *")] SDL_Color* colors, int firstcolor, int ncolors); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyPalette(SDL_Palette* palette); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_MapRGB([NativeTypeName("const SDL_PixelFormat *")] SDL_PixelFormat* format, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_MapRGBA([NativeTypeName("const SDL_PixelFormat *")] SDL_PixelFormat* format, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b, [NativeTypeName("Uint8")] byte a); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_GetRGB([NativeTypeName("Uint32")] uint pixel, [NativeTypeName("const SDL_PixelFormat *")] SDL_PixelFormat* format, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_GetRGBA([NativeTypeName("Uint32")] uint pixel, [NativeTypeName("const SDL_PixelFormat *")] SDL_PixelFormat* format, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b, [NativeTypeName("Uint8 *")] byte* a); + + [NativeTypeName("#define SDL_ALPHA_OPAQUE 255")] + public const int SDL_ALPHA_OPAQUE = 255; + + [NativeTypeName("#define SDL_ALPHA_TRANSPARENT 0")] + public const int SDL_ALPHA_TRANSPARENT = 0; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs new file mode 100644 index 0000000..5b559d7 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs @@ -0,0 +1,36 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetPlatform(); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_power.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_power.g.cs new file mode 100644 index 0000000..72beb61 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_power.g.cs @@ -0,0 +1,45 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_PowerState + { + SDL_POWERSTATE_ERROR = -1, + SDL_POWERSTATE_UNKNOWN, + SDL_POWERSTATE_ON_BATTERY, + SDL_POWERSTATE_NO_BATTERY, + SDL_POWERSTATE_CHARGING, + SDL_POWERSTATE_CHARGED, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PowerState SDL_GetPowerInfo(int* seconds, int* percent); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs new file mode 100644 index 0000000..744c198 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs @@ -0,0 +1,111 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_PropertyType + { + SDL_PROPERTY_TYPE_INVALID, + SDL_PROPERTY_TYPE_POINTER, + SDL_PROPERTY_TYPE_STRING, + SDL_PROPERTY_TYPE_NUMBER, + SDL_PROPERTY_TYPE_FLOAT, + SDL_PROPERTY_TYPE_BOOLEAN, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetGlobalProperties(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_CreateProperties(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CopyProperties([NativeTypeName("SDL_PropertiesID")] uint src, [NativeTypeName("SDL_PropertiesID")] uint dst); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_LockProperties([NativeTypeName("SDL_PropertiesID")] uint props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnlockProperties([NativeTypeName("SDL_PropertiesID")] uint props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetPropertyWithCleanup([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, void* value, [NativeTypeName("void (*)(void *, void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] cleanup, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, void* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetStringProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetNumberProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("Sint64")] long value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetFloatProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, float value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetBooleanProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("SDL_bool")] int value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PropertyType SDL_GetPropertyType([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_GetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, void* default_value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetStringProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* default_value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Sint64")] + public static extern long SDL_GetNumberProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("Sint64")] long default_value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_GetFloatProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, float default_value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetBooleanProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("SDL_bool")] int default_value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ClearProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_EnumerateProperties([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("SDL_EnumeratePropertiesCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyProperties([NativeTypeName("SDL_PropertiesID")] uint props); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_quit.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_quit.g.cs new file mode 100644 index 0000000..e69de29 diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs new file mode 100644 index 0000000..013ed3f --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs @@ -0,0 +1,148 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Point + { + public int x; + + public int y; + } + + public partial struct SDL_FPoint + { + public float x; + + public float y; + } + + public partial struct SDL_Rect + { + public int x; + + public int y; + + public int w; + + public int h; + } + + public partial struct SDL_FRect + { + public float x; + + public float y; + + public float w; + + public float h; + } + + public static unsafe partial class SDL3 + { + [return: NativeTypeName("SDL_bool")] + public static int SDL_PointInRect([NativeTypeName("const SDL_Point *")] SDL_Point* p, [NativeTypeName("const SDL_Rect *")] SDL_Rect* r) + { + return ((p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? 1 : 0; + } + + [return: NativeTypeName("SDL_bool")] + public static int SDL_RectEmpty([NativeTypeName("const SDL_Rect *")] SDL_Rect* r) + { + return ((r == null) || (r->w <= 0) || (r->h <= 0)) ? 1 : 0; + } + + [return: NativeTypeName("SDL_bool")] + public static int SDL_RectsEqual([NativeTypeName("const SDL_Rect *")] SDL_Rect* a, [NativeTypeName("const SDL_Rect *")] SDL_Rect* b) + { + return ((a) != null && (b) != null && (a->x == b->x) && (a->y == b->y) && (a->w == b->w) && (a->h == b->h)) ? 1 : 0; + } + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasRectIntersection([NativeTypeName("const SDL_Rect *")] SDL_Rect* A, [NativeTypeName("const SDL_Rect *")] SDL_Rect* B); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetRectIntersection([NativeTypeName("const SDL_Rect *")] SDL_Rect* A, [NativeTypeName("const SDL_Rect *")] SDL_Rect* B, SDL_Rect* result); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRectUnion([NativeTypeName("const SDL_Rect *")] SDL_Rect* A, [NativeTypeName("const SDL_Rect *")] SDL_Rect* B, SDL_Rect* result); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetRectEnclosingPoints([NativeTypeName("const SDL_Point *")] SDL_Point* points, int count, [NativeTypeName("const SDL_Rect *")] SDL_Rect* clip, SDL_Rect* result); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetRectAndLineIntersection([NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, int* X1, int* Y1, int* X2, int* Y2); + + [return: NativeTypeName("SDL_bool")] + public static int SDL_PointInRectFloat([NativeTypeName("const SDL_FPoint *")] SDL_FPoint* p, [NativeTypeName("const SDL_FRect *")] SDL_FRect* r) + { + return ((p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? 1 : 0; + } + + [return: NativeTypeName("SDL_bool")] + public static int SDL_RectEmptyFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* r) + { + return ((r == null) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? 1 : 0; + } + + [return: NativeTypeName("SDL_bool")] + public static int SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, [NativeTypeName("const float")] 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)))) ? 1 : 0; + } + + [return: NativeTypeName("SDL_bool")] + public static int SDL_RectsEqualFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b) + { + return SDL_RectsEqualEpsilon(a, b, 1.1920928955078125e-07F); + } + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_HasRectIntersectionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* A, [NativeTypeName("const SDL_FRect *")] SDL_FRect* B); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetRectIntersectionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* A, [NativeTypeName("const SDL_FRect *")] SDL_FRect* B, SDL_FRect* result); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRectUnionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* A, [NativeTypeName("const SDL_FRect *")] SDL_FRect* B, SDL_FRect* result); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetRectEnclosingPointsFloat([NativeTypeName("const SDL_FPoint *")] SDL_FPoint* points, int count, [NativeTypeName("const SDL_FRect *")] SDL_FRect* clip, SDL_FRect* result); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetRectAndLineIntersectionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* rect, float* X1, float* Y1, float* X2, float* Y2); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs new file mode 100644 index 0000000..faf90c1 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs @@ -0,0 +1,575 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_RendererFlags + { + SDL_RENDERER_PRESENTVSYNC = 0x00000004, + } + + public unsafe partial struct SDL_RendererInfo + { + [NativeTypeName("const char *")] + public sbyte* name; + + [NativeTypeName("Uint32")] + public uint flags; + + public int num_texture_formats; + + [NativeTypeName("SDL_PixelFormatEnum[16]")] + public _texture_formats_e__FixedBuffer texture_formats; + + public int max_texture_width; + + public int max_texture_height; + + [InlineArray(16)] + public partial struct _texture_formats_e__FixedBuffer + { + public SDL_PixelFormatEnum e0; + } + } + + public partial struct SDL_Vertex + { + public SDL_FPoint position; + + public SDL_FColor color; + + public SDL_FPoint tex_coord; + } + + public enum SDL_TextureAccess + { + SDL_TEXTUREACCESS_STATIC, + SDL_TEXTUREACCESS_STREAMING, + SDL_TEXTUREACCESS_TARGET, + } + + public enum SDL_RendererLogicalPresentation + { + SDL_LOGICAL_PRESENTATION_DISABLED, + SDL_LOGICAL_PRESENTATION_STRETCH, + SDL_LOGICAL_PRESENTATION_LETTERBOX, + SDL_LOGICAL_PRESENTATION_OVERSCAN, + SDL_LOGICAL_PRESENTATION_INTEGER_SCALE, + } + + public partial struct SDL_Renderer + { + } + + public partial struct SDL_Texture + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumRenderDrivers(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetRenderDriver(int index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CreateWindowAndRenderer(int width, int height, [NativeTypeName("SDL_WindowFlags")] uint window_flags, SDL_Window** window, SDL_Renderer** renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("Uint32")] uint flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Renderer* SDL_CreateRendererWithProperties([NativeTypeName("SDL_PropertiesID")] uint props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Renderer* SDL_CreateSoftwareRenderer(SDL_Surface* surface); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Renderer* SDL_GetRenderer(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_GetRenderWindow(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRendererInfo(SDL_Renderer* renderer, SDL_RendererInfo* info); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetRendererProperties(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRenderOutputSize(SDL_Renderer* renderer, int* w, int* h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetCurrentRenderOutputSize(SDL_Renderer* renderer, int* w, int* h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Texture* SDL_CreateTexture(SDL_Renderer* renderer, SDL_PixelFormatEnum format, int access, int w, int h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Texture* SDL_CreateTextureFromSurface(SDL_Renderer* renderer, SDL_Surface* surface); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Texture* SDL_CreateTextureWithProperties(SDL_Renderer* renderer, [NativeTypeName("SDL_PropertiesID")] uint props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetTextureProperties(SDL_Texture* texture); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Renderer* SDL_GetRendererFromTexture(SDL_Texture* texture); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_QueryTexture(SDL_Texture* texture, SDL_PixelFormatEnum* format, int* access, int* w, int* h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetTextureColorMod(SDL_Texture* texture, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetTextureColorModFloat(SDL_Texture* texture, float r, float g, float b); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetTextureColorMod(SDL_Texture* texture, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetTextureColorModFloat(SDL_Texture* texture, float* r, float* g, float* b); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetTextureAlphaMod(SDL_Texture* texture, [NativeTypeName("Uint8")] byte alpha); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetTextureAlphaModFloat(SDL_Texture* texture, float alpha); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetTextureAlphaMod(SDL_Texture* texture, [NativeTypeName("Uint8 *")] byte* alpha); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetTextureAlphaModFloat(SDL_Texture* texture, float* alpha); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetTextureBlendMode(SDL_Texture* texture, SDL_BlendMode blendMode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetTextureBlendMode(SDL_Texture* texture, SDL_BlendMode* blendMode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetTextureScaleMode(SDL_Texture* texture, SDL_ScaleMode scaleMode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetTextureScaleMode(SDL_Texture* texture, SDL_ScaleMode* scaleMode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_UpdateTexture(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("const void *")] void* pixels, int pitch); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_UpdateYUVTexture(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("const Uint8 *")] byte* Yplane, int Ypitch, [NativeTypeName("const Uint8 *")] byte* Uplane, int Upitch, [NativeTypeName("const Uint8 *")] byte* Vplane, int Vpitch); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_UpdateNVTexture(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("const Uint8 *")] byte* Yplane, int Ypitch, [NativeTypeName("const Uint8 *")] byte* UVplane, int UVpitch); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_LockTexture(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, void** pixels, int* pitch); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_LockTextureToSurface(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, SDL_Surface** surface); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnlockTexture(SDL_Texture* texture); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRenderTarget(SDL_Renderer* renderer, SDL_Texture* texture); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Texture* SDL_GetRenderTarget(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRenderLogicalPresentation(SDL_Renderer* renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRenderLogicalPresentation(SDL_Renderer* renderer, int* w, int* h, SDL_RendererLogicalPresentation* mode, SDL_ScaleMode* scale_mode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderCoordinatesFromWindow(SDL_Renderer* renderer, float window_x, float window_y, float* x, float* y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderCoordinatesToWindow(SDL_Renderer* renderer, float x, float y, float* window_x, float* window_y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ConvertEventToRenderCoordinates(SDL_Renderer* renderer, SDL_Event* @event); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRenderViewport(SDL_Renderer* renderer, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRenderViewport(SDL_Renderer* renderer, SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_RenderViewportSet(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRenderClipRect(SDL_Renderer* renderer, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRenderClipRect(SDL_Renderer* renderer, SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_RenderClipEnabled(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRenderScale(SDL_Renderer* renderer, float scaleX, float scaleY); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRenderScale(SDL_Renderer* renderer, float* scaleX, float* scaleY); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRenderDrawColor(SDL_Renderer* renderer, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b, [NativeTypeName("Uint8")] byte a); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRenderDrawColorFloat(SDL_Renderer* renderer, float r, float g, float b, float a); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRenderDrawColor(SDL_Renderer* renderer, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b, [NativeTypeName("Uint8 *")] byte* a); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRenderDrawColorFloat(SDL_Renderer* renderer, float* r, float* g, float* b, float* a); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRenderColorScale(SDL_Renderer* renderer, float scale); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRenderColorScale(SDL_Renderer* renderer, float* scale); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRenderDrawBlendMode(SDL_Renderer* renderer, SDL_BlendMode blendMode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRenderDrawBlendMode(SDL_Renderer* renderer, SDL_BlendMode* blendMode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderClear(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderPoint(SDL_Renderer* renderer, float x, float y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderPoints(SDL_Renderer* renderer, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* points, int count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderLine(SDL_Renderer* renderer, float x1, float y1, float x2, float y2); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderLines(SDL_Renderer* renderer, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* points, int count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderRect(SDL_Renderer* renderer, [NativeTypeName("const SDL_FRect *")] SDL_FRect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderRects(SDL_Renderer* renderer, [NativeTypeName("const SDL_FRect *")] SDL_FRect* rects, int count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderFillRect(SDL_Renderer* renderer, [NativeTypeName("const SDL_FRect *")] SDL_FRect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderFillRects(SDL_Renderer* renderer, [NativeTypeName("const SDL_FRect *")] SDL_FRect* rects, int count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderTexture(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderTextureRotated(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const SDL_FRect *")] SDL_FRect* srcrect, [NativeTypeName("const SDL_FRect *")] SDL_FRect* dstrect, [NativeTypeName("const double")] double angle, [NativeTypeName("const SDL_FPoint *")] SDL_FPoint* center, [NativeTypeName("const SDL_FlipMode")] SDL_FlipMode flip); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderGeometryRaw(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const float *")] float* xy, int xy_stride, [NativeTypeName("const SDL_Color *")] SDL_Color* color, int color_stride, [NativeTypeName("const float *")] float* uv, int uv_stride, int num_vertices, [NativeTypeName("const void *")] void* indices, int num_indices, int size_indices); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderGeometryRawFloat(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 *")] void* indices, int num_indices, int size_indices); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_RenderReadPixels(SDL_Renderer* renderer, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenderPresent(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyTexture(SDL_Texture* texture); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyRenderer(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_FlushRenderer(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_GetRenderMetalLayer(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_GetRenderMetalCommandEncoder(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_AddVulkanRenderSemaphores(SDL_Renderer* renderer, [NativeTypeName("Uint32")] uint wait_stage_mask, [NativeTypeName("Sint64")] long wait_semaphore, [NativeTypeName("Sint64")] long signal_semaphore); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetRenderVSync(SDL_Renderer* renderer, int vsync); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetRenderVSync(SDL_Renderer* renderer, int* vsync); + + [NativeTypeName("#define SDL_SOFTWARE_RENDERER \"software\"")] + public static ReadOnlySpan SDL_SOFTWARE_RENDERER => "software"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_NAME_STRING \"name\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_NAME_STRING => "name"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_WINDOW_POINTER \"window\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_WINDOW_POINTER => "window"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_SURFACE_POINTER \"surface\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_SURFACE_POINTER => "surface"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER \"output_colorspace\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER => "output_colorspace"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN \"present_vsync\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN => "present_vsync"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER \"vulkan.instance\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER => "vulkan.instance"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER \"vulkan.surface\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER => "vulkan.surface"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER \"vulkan.physical_device\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER => "vulkan.physical_device"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER \"vulkan.device\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER => "vulkan.device"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER \"vulkan.graphics_queue_family_index\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER => "vulkan.graphics_queue_family_index"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER \"vulkan.present_queue_family_index\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER => "vulkan.present_queue_family_index"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_NAME_STRING \"SDL.renderer.name\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_NAME_STRING => "SDL.renderer.name"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_WINDOW_POINTER \"SDL.renderer.window\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_WINDOW_POINTER => "SDL.renderer.window"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_SURFACE_POINTER \"SDL.renderer.surface\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_SURFACE_POINTER => "SDL.renderer.surface"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER \"SDL.renderer.output_colorspace\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER => "SDL.renderer.output_colorspace"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN \"SDL.renderer.HDR_enabled\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN => "SDL.renderer.HDR_enabled"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT \"SDL.renderer.SDR_white_point\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT => "SDL.renderer.SDR_white_point"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT \"SDL.renderer.HDR_headroom\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT => "SDL.renderer.HDR_headroom"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_D3D9_DEVICE_POINTER \"SDL.renderer.d3d9.device\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_D3D9_DEVICE_POINTER => "SDL.renderer.d3d9.device"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_D3D11_DEVICE_POINTER \"SDL.renderer.d3d11.device\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_D3D11_DEVICE_POINTER => "SDL.renderer.d3d11.device"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_D3D12_DEVICE_POINTER \"SDL.renderer.d3d12.device\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_D3D12_DEVICE_POINTER => "SDL.renderer.d3d12.device"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER \"SDL.renderer.d3d12.command_queue\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER => "SDL.renderer.d3d12.command_queue"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER \"SDL.renderer.vulkan.instance\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER => "SDL.renderer.vulkan.instance"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER \"SDL.renderer.vulkan.surface\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER => "SDL.renderer.vulkan.surface"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER \"SDL.renderer.vulkan.physical_device\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER => "SDL.renderer.vulkan.physical_device"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER \"SDL.renderer.vulkan.device\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER => "SDL.renderer.vulkan.device"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER \"SDL.renderer.vulkan.graphics_queue_family_index\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER => "SDL.renderer.vulkan.graphics_queue_family_index"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER \"SDL.renderer.vulkan.present_queue_family_index\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER => "SDL.renderer.vulkan.present_queue_family_index"u8; + + [NativeTypeName("#define SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER \"SDL.renderer.vulkan.swapchain_image_count\"")] + public static ReadOnlySpan SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER => "SDL.renderer.vulkan.swapchain_image_count"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER \"colorspace\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER => "colorspace"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER \"format\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER => "format"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER \"access\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER => "access"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER \"width\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER => "width"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER \"height\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER => "height"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT \"SDR_white_point\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT => "SDR_white_point"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT \"HDR_headroom\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT => "HDR_headroom"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER \"d3d11.texture\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER => "d3d11.texture"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER \"d3d11.texture_u\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER => "d3d11.texture_u"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER \"d3d11.texture_v\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER => "d3d11.texture_v"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER \"d3d12.texture\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER => "d3d12.texture"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER \"d3d12.texture_u\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER => "d3d12.texture_u"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER \"d3d12.texture_v\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER => "d3d12.texture_v"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER \"metal.pixelbuffer\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER => "metal.pixelbuffer"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER \"opengl.texture\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER => "opengl.texture"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER \"opengl.texture_uv\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER => "opengl.texture_uv"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER \"opengl.texture_u\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER => "opengl.texture_u"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER \"opengl.texture_v\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER => "opengl.texture_v"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER \"opengles2.texture\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER => "opengles2.texture"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER \"opengles2.texture_uv\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER => "opengles2.texture_uv"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER \"opengles2.texture_u\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER => "opengles2.texture_u"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER \"opengles2.texture_v\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER => "opengles2.texture_v"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER \"vulkan.texture\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER => "vulkan.texture"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_COLORSPACE_NUMBER \"SDL.texture.colorspace\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_COLORSPACE_NUMBER => "SDL.texture.colorspace"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT \"SDL.texture.SDR_white_point\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT => "SDL.texture.SDR_white_point"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT \"SDL.texture.HDR_headroom\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT => "SDL.texture.HDR_headroom"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER \"SDL.texture.d3d11.texture\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER => "SDL.texture.d3d11.texture"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER \"SDL.texture.d3d11.texture_u\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER => "SDL.texture.d3d11.texture_u"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER \"SDL.texture.d3d11.texture_v\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER => "SDL.texture.d3d11.texture_v"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER \"SDL.texture.d3d12.texture\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER => "SDL.texture.d3d12.texture"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER \"SDL.texture.d3d12.texture_u\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER => "SDL.texture.d3d12.texture_u"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER \"SDL.texture.d3d12.texture_v\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER => "SDL.texture.d3d12.texture_v"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER \"SDL.texture.opengl.texture\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER => "SDL.texture.opengl.texture"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER \"SDL.texture.opengl.texture_uv\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER => "SDL.texture.opengl.texture_uv"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER \"SDL.texture.opengl.texture_u\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER => "SDL.texture.opengl.texture_u"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER \"SDL.texture.opengl.texture_v\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER => "SDL.texture.opengl.texture_v"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER \"SDL.texture.opengl.target\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER => "SDL.texture.opengl.target"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT \"SDL.texture.opengl.tex_w\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT => "SDL.texture.opengl.tex_w"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT \"SDL.texture.opengl.tex_h\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT => "SDL.texture.opengl.tex_h"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER \"SDL.texture.opengles2.texture\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER => "SDL.texture.opengles2.texture"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER \"SDL.texture.opengles2.texture_uv\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER => "SDL.texture.opengles2.texture_uv"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER \"SDL.texture.opengles2.texture_u\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER => "SDL.texture.opengles2.texture_u"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER \"SDL.texture.opengles2.texture_v\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER => "SDL.texture.opengles2.texture_v"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER \"SDL.texture.opengles2.target\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER => "SDL.texture.opengles2.target"u8; + + [NativeTypeName("#define SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER \"SDL.texture.vulkan.texture\"")] + public static ReadOnlySpan SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER => "SDL.texture.vulkan.texture"u8; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_revision.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_revision.g.cs new file mode 100644 index 0000000..49575d0 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_revision.g.cs @@ -0,0 +1,35 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; + +namespace SDL +{ + public static partial class SDL3 + { + [NativeTypeName("#define SDL_REVISION \"\"")] + public static ReadOnlySpan SDL_REVISION => ""u8; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_scancode.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_scancode.g.cs new file mode 100644 index 0000000..76b414c --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_scancode.g.cs @@ -0,0 +1,279 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +namespace SDL +{ + public enum SDL_Scancode + { + SDL_SCANCODE_UNKNOWN = 0, + SDL_SCANCODE_A = 4, + SDL_SCANCODE_B = 5, + SDL_SCANCODE_C = 6, + SDL_SCANCODE_D = 7, + SDL_SCANCODE_E = 8, + SDL_SCANCODE_F = 9, + SDL_SCANCODE_G = 10, + SDL_SCANCODE_H = 11, + SDL_SCANCODE_I = 12, + SDL_SCANCODE_J = 13, + SDL_SCANCODE_K = 14, + SDL_SCANCODE_L = 15, + SDL_SCANCODE_M = 16, + SDL_SCANCODE_N = 17, + SDL_SCANCODE_O = 18, + SDL_SCANCODE_P = 19, + SDL_SCANCODE_Q = 20, + SDL_SCANCODE_R = 21, + SDL_SCANCODE_S = 22, + SDL_SCANCODE_T = 23, + SDL_SCANCODE_U = 24, + SDL_SCANCODE_V = 25, + SDL_SCANCODE_W = 26, + SDL_SCANCODE_X = 27, + SDL_SCANCODE_Y = 28, + SDL_SCANCODE_Z = 29, + SDL_SCANCODE_1 = 30, + SDL_SCANCODE_2 = 31, + SDL_SCANCODE_3 = 32, + SDL_SCANCODE_4 = 33, + SDL_SCANCODE_5 = 34, + SDL_SCANCODE_6 = 35, + SDL_SCANCODE_7 = 36, + SDL_SCANCODE_8 = 37, + SDL_SCANCODE_9 = 38, + SDL_SCANCODE_0 = 39, + SDL_SCANCODE_RETURN = 40, + SDL_SCANCODE_ESCAPE = 41, + SDL_SCANCODE_BACKSPACE = 42, + SDL_SCANCODE_TAB = 43, + SDL_SCANCODE_SPACE = 44, + SDL_SCANCODE_MINUS = 45, + SDL_SCANCODE_EQUALS = 46, + SDL_SCANCODE_LEFTBRACKET = 47, + SDL_SCANCODE_RIGHTBRACKET = 48, + SDL_SCANCODE_BACKSLASH = 49, + SDL_SCANCODE_NONUSHASH = 50, + SDL_SCANCODE_SEMICOLON = 51, + SDL_SCANCODE_APOSTROPHE = 52, + SDL_SCANCODE_GRAVE = 53, + SDL_SCANCODE_COMMA = 54, + SDL_SCANCODE_PERIOD = 55, + SDL_SCANCODE_SLASH = 56, + SDL_SCANCODE_CAPSLOCK = 57, + SDL_SCANCODE_F1 = 58, + SDL_SCANCODE_F2 = 59, + SDL_SCANCODE_F3 = 60, + SDL_SCANCODE_F4 = 61, + SDL_SCANCODE_F5 = 62, + SDL_SCANCODE_F6 = 63, + SDL_SCANCODE_F7 = 64, + SDL_SCANCODE_F8 = 65, + SDL_SCANCODE_F9 = 66, + SDL_SCANCODE_F10 = 67, + SDL_SCANCODE_F11 = 68, + SDL_SCANCODE_F12 = 69, + SDL_SCANCODE_PRINTSCREEN = 70, + SDL_SCANCODE_SCROLLLOCK = 71, + SDL_SCANCODE_PAUSE = 72, + SDL_SCANCODE_INSERT = 73, + SDL_SCANCODE_HOME = 74, + SDL_SCANCODE_PAGEUP = 75, + SDL_SCANCODE_DELETE = 76, + SDL_SCANCODE_END = 77, + SDL_SCANCODE_PAGEDOWN = 78, + SDL_SCANCODE_RIGHT = 79, + SDL_SCANCODE_LEFT = 80, + SDL_SCANCODE_DOWN = 81, + SDL_SCANCODE_UP = 82, + SDL_SCANCODE_NUMLOCKCLEAR = 83, + SDL_SCANCODE_KP_DIVIDE = 84, + SDL_SCANCODE_KP_MULTIPLY = 85, + SDL_SCANCODE_KP_MINUS = 86, + SDL_SCANCODE_KP_PLUS = 87, + SDL_SCANCODE_KP_ENTER = 88, + SDL_SCANCODE_KP_1 = 89, + SDL_SCANCODE_KP_2 = 90, + SDL_SCANCODE_KP_3 = 91, + SDL_SCANCODE_KP_4 = 92, + SDL_SCANCODE_KP_5 = 93, + SDL_SCANCODE_KP_6 = 94, + SDL_SCANCODE_KP_7 = 95, + SDL_SCANCODE_KP_8 = 96, + SDL_SCANCODE_KP_9 = 97, + SDL_SCANCODE_KP_0 = 98, + SDL_SCANCODE_KP_PERIOD = 99, + SDL_SCANCODE_NONUSBACKSLASH = 100, + SDL_SCANCODE_APPLICATION = 101, + SDL_SCANCODE_POWER = 102, + SDL_SCANCODE_KP_EQUALS = 103, + SDL_SCANCODE_F13 = 104, + SDL_SCANCODE_F14 = 105, + SDL_SCANCODE_F15 = 106, + SDL_SCANCODE_F16 = 107, + SDL_SCANCODE_F17 = 108, + SDL_SCANCODE_F18 = 109, + SDL_SCANCODE_F19 = 110, + SDL_SCANCODE_F20 = 111, + SDL_SCANCODE_F21 = 112, + SDL_SCANCODE_F22 = 113, + SDL_SCANCODE_F23 = 114, + SDL_SCANCODE_F24 = 115, + SDL_SCANCODE_EXECUTE = 116, + SDL_SCANCODE_HELP = 117, + SDL_SCANCODE_MENU = 118, + SDL_SCANCODE_SELECT = 119, + SDL_SCANCODE_STOP = 120, + SDL_SCANCODE_AGAIN = 121, + SDL_SCANCODE_UNDO = 122, + SDL_SCANCODE_CUT = 123, + SDL_SCANCODE_COPY = 124, + SDL_SCANCODE_PASTE = 125, + SDL_SCANCODE_FIND = 126, + SDL_SCANCODE_MUTE = 127, + SDL_SCANCODE_VOLUMEUP = 128, + SDL_SCANCODE_VOLUMEDOWN = 129, + SDL_SCANCODE_KP_COMMA = 133, + SDL_SCANCODE_KP_EQUALSAS400 = 134, + SDL_SCANCODE_INTERNATIONAL1 = 135, + SDL_SCANCODE_INTERNATIONAL2 = 136, + SDL_SCANCODE_INTERNATIONAL3 = 137, + SDL_SCANCODE_INTERNATIONAL4 = 138, + SDL_SCANCODE_INTERNATIONAL5 = 139, + SDL_SCANCODE_INTERNATIONAL6 = 140, + SDL_SCANCODE_INTERNATIONAL7 = 141, + SDL_SCANCODE_INTERNATIONAL8 = 142, + SDL_SCANCODE_INTERNATIONAL9 = 143, + SDL_SCANCODE_LANG1 = 144, + SDL_SCANCODE_LANG2 = 145, + SDL_SCANCODE_LANG3 = 146, + SDL_SCANCODE_LANG4 = 147, + SDL_SCANCODE_LANG5 = 148, + SDL_SCANCODE_LANG6 = 149, + SDL_SCANCODE_LANG7 = 150, + SDL_SCANCODE_LANG8 = 151, + SDL_SCANCODE_LANG9 = 152, + SDL_SCANCODE_ALTERASE = 153, + SDL_SCANCODE_SYSREQ = 154, + SDL_SCANCODE_CANCEL = 155, + SDL_SCANCODE_CLEAR = 156, + SDL_SCANCODE_PRIOR = 157, + SDL_SCANCODE_RETURN2 = 158, + SDL_SCANCODE_SEPARATOR = 159, + SDL_SCANCODE_OUT = 160, + SDL_SCANCODE_OPER = 161, + SDL_SCANCODE_CLEARAGAIN = 162, + SDL_SCANCODE_CRSEL = 163, + SDL_SCANCODE_EXSEL = 164, + SDL_SCANCODE_KP_00 = 176, + SDL_SCANCODE_KP_000 = 177, + SDL_SCANCODE_THOUSANDSSEPARATOR = 178, + SDL_SCANCODE_DECIMALSEPARATOR = 179, + SDL_SCANCODE_CURRENCYUNIT = 180, + SDL_SCANCODE_CURRENCYSUBUNIT = 181, + SDL_SCANCODE_KP_LEFTPAREN = 182, + SDL_SCANCODE_KP_RIGHTPAREN = 183, + SDL_SCANCODE_KP_LEFTBRACE = 184, + SDL_SCANCODE_KP_RIGHTBRACE = 185, + SDL_SCANCODE_KP_TAB = 186, + SDL_SCANCODE_KP_BACKSPACE = 187, + SDL_SCANCODE_KP_A = 188, + SDL_SCANCODE_KP_B = 189, + SDL_SCANCODE_KP_C = 190, + SDL_SCANCODE_KP_D = 191, + SDL_SCANCODE_KP_E = 192, + SDL_SCANCODE_KP_F = 193, + SDL_SCANCODE_KP_XOR = 194, + SDL_SCANCODE_KP_POWER = 195, + SDL_SCANCODE_KP_PERCENT = 196, + SDL_SCANCODE_KP_LESS = 197, + SDL_SCANCODE_KP_GREATER = 198, + SDL_SCANCODE_KP_AMPERSAND = 199, + SDL_SCANCODE_KP_DBLAMPERSAND = 200, + SDL_SCANCODE_KP_VERTICALBAR = 201, + SDL_SCANCODE_KP_DBLVERTICALBAR = 202, + SDL_SCANCODE_KP_COLON = 203, + SDL_SCANCODE_KP_HASH = 204, + SDL_SCANCODE_KP_SPACE = 205, + SDL_SCANCODE_KP_AT = 206, + SDL_SCANCODE_KP_EXCLAM = 207, + SDL_SCANCODE_KP_MEMSTORE = 208, + SDL_SCANCODE_KP_MEMRECALL = 209, + SDL_SCANCODE_KP_MEMCLEAR = 210, + SDL_SCANCODE_KP_MEMADD = 211, + SDL_SCANCODE_KP_MEMSUBTRACT = 212, + SDL_SCANCODE_KP_MEMMULTIPLY = 213, + SDL_SCANCODE_KP_MEMDIVIDE = 214, + SDL_SCANCODE_KP_PLUSMINUS = 215, + SDL_SCANCODE_KP_CLEAR = 216, + SDL_SCANCODE_KP_CLEARENTRY = 217, + SDL_SCANCODE_KP_BINARY = 218, + SDL_SCANCODE_KP_OCTAL = 219, + SDL_SCANCODE_KP_DECIMAL = 220, + SDL_SCANCODE_KP_HEXADECIMAL = 221, + SDL_SCANCODE_LCTRL = 224, + SDL_SCANCODE_LSHIFT = 225, + SDL_SCANCODE_LALT = 226, + SDL_SCANCODE_LGUI = 227, + SDL_SCANCODE_RCTRL = 228, + SDL_SCANCODE_RSHIFT = 229, + SDL_SCANCODE_RALT = 230, + SDL_SCANCODE_RGUI = 231, + SDL_SCANCODE_MODE = 257, + SDL_SCANCODE_AUDIONEXT = 258, + SDL_SCANCODE_AUDIOPREV = 259, + SDL_SCANCODE_AUDIOSTOP = 260, + SDL_SCANCODE_AUDIOPLAY = 261, + SDL_SCANCODE_AUDIOMUTE = 262, + SDL_SCANCODE_MEDIASELECT = 263, + SDL_SCANCODE_WWW = 264, + SDL_SCANCODE_MAIL = 265, + SDL_SCANCODE_CALCULATOR = 266, + SDL_SCANCODE_COMPUTER = 267, + SDL_SCANCODE_AC_SEARCH = 268, + SDL_SCANCODE_AC_HOME = 269, + SDL_SCANCODE_AC_BACK = 270, + SDL_SCANCODE_AC_FORWARD = 271, + SDL_SCANCODE_AC_STOP = 272, + SDL_SCANCODE_AC_REFRESH = 273, + SDL_SCANCODE_AC_BOOKMARKS = 274, + SDL_SCANCODE_BRIGHTNESSDOWN = 275, + SDL_SCANCODE_BRIGHTNESSUP = 276, + SDL_SCANCODE_DISPLAYSWITCH = 277, + SDL_SCANCODE_KBDILLUMTOGGLE = 278, + SDL_SCANCODE_KBDILLUMDOWN = 279, + SDL_SCANCODE_KBDILLUMUP = 280, + SDL_SCANCODE_EJECT = 281, + SDL_SCANCODE_SLEEP = 282, + SDL_SCANCODE_APP1 = 283, + SDL_SCANCODE_APP2 = 284, + SDL_SCANCODE_AUDIOREWIND = 285, + SDL_SCANCODE_AUDIOFASTFORWARD = 286, + SDL_SCANCODE_SOFTLEFT = 287, + SDL_SCANCODE_SOFTRIGHT = 288, + SDL_SCANCODE_CALL = 289, + SDL_SCANCODE_ENDCALL = 290, + SDL_NUM_SCANCODES = 512, + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs new file mode 100644 index 0000000..f5a59f5 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs @@ -0,0 +1,98 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Sensor + { + } + + public enum SDL_SensorType + { + SDL_SENSOR_INVALID = -1, + SDL_SENSOR_UNKNOWN, + SDL_SENSOR_ACCEL, + SDL_SENSOR_GYRO, + SDL_SENSOR_ACCEL_L, + SDL_SENSOR_GYRO_L, + SDL_SENSOR_ACCEL_R, + SDL_SENSOR_GYRO_R, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_SensorID *")] + public static extern uint* SDL_GetSensors(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetSensorInstanceName([NativeTypeName("SDL_SensorID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_SensorType SDL_GetSensorInstanceType([NativeTypeName("SDL_SensorID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSensorInstanceNonPortableType([NativeTypeName("SDL_SensorID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Sensor* SDL_OpenSensor([NativeTypeName("SDL_SensorID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Sensor* SDL_GetSensorFromInstanceID([NativeTypeName("SDL_SensorID")] uint instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetSensorProperties(SDL_Sensor* sensor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetSensorName(SDL_Sensor* sensor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_SensorType SDL_GetSensorType(SDL_Sensor* sensor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSensorNonPortableType(SDL_Sensor* sensor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_SensorID")] + public static extern uint SDL_GetSensorInstanceID(SDL_Sensor* sensor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSensorData(SDL_Sensor* sensor, float* data, int num_values); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_CloseSensor(SDL_Sensor* sensor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UpdateSensors(); + + [NativeTypeName("#define SDL_STANDARD_GRAVITY 9.80665f")] + public const float SDL_STANDARD_GRAVITY = 9.80665f; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs new file mode 100644 index 0000000..1aa064b --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -0,0 +1,666 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_DUMMY_ENUM + { + DUMMY_ENUM_VALUE, + } + + public partial struct SDL_iconv_data_t + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_malloc([NativeTypeName("size_t")] nuint size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_calloc([NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_realloc(void* mem, [NativeTypeName("size_t")] nuint size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_free(void* mem); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_GetOriginalMemoryFunctions([NativeTypeName("SDL_malloc_func *")] delegate* unmanaged[Cdecl]* malloc_func, [NativeTypeName("SDL_calloc_func *")] delegate* unmanaged[Cdecl]* calloc_func, [NativeTypeName("SDL_realloc_func *")] delegate* unmanaged[Cdecl]* realloc_func, [NativeTypeName("SDL_free_func *")] delegate* unmanaged[Cdecl]* free_func); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_GetMemoryFunctions([NativeTypeName("SDL_malloc_func *")] delegate* unmanaged[Cdecl]* malloc_func, [NativeTypeName("SDL_calloc_func *")] delegate* unmanaged[Cdecl]* calloc_func, [NativeTypeName("SDL_realloc_func *")] delegate* unmanaged[Cdecl]* realloc_func, [NativeTypeName("SDL_free_func *")] delegate* unmanaged[Cdecl]* free_func); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetMemoryFunctions([NativeTypeName("SDL_malloc_func")] delegate* unmanaged[Cdecl] malloc_func, [NativeTypeName("SDL_calloc_func")] delegate* unmanaged[Cdecl] calloc_func, [NativeTypeName("SDL_realloc_func")] delegate* unmanaged[Cdecl] realloc_func, [NativeTypeName("SDL_free_func")] delegate* unmanaged[Cdecl] free_func); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_aligned_alloc([NativeTypeName("size_t")] nuint alignment, [NativeTypeName("size_t")] nuint size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_aligned_free(void* mem); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumAllocations(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_getenv([NativeTypeName("const char *")] sbyte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_setenv([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* value, int overwrite); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_qsort(void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] compare); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_bsearch([NativeTypeName("const void *")] void* key, [NativeTypeName("const void *")] void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] compare); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_qsort_r(void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(void *, const void *, const void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] compare, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_bsearch_r([NativeTypeName("const void *")] void* key, [NativeTypeName("const void *")] void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(void *, const void *, const void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] compare, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_abs(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_isalpha(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_isalnum(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_isblank(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_iscntrl(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_isdigit(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_isxdigit(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ispunct(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_isspace(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_isupper(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_islower(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_isprint(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_isgraph(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_toupper(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_tolower(int x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + public static extern ushort SDL_crc16([NativeTypeName("Uint16")] ushort crc, [NativeTypeName("const void *")] void* data, [NativeTypeName("size_t")] nuint len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_crc32([NativeTypeName("Uint32")] uint crc, [NativeTypeName("const void *")] void* data, [NativeTypeName("size_t")] nuint len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_memcpy(void* dst, [NativeTypeName("const void *")] void* src, [NativeTypeName("size_t")] nuint len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_memmove(void* dst, [NativeTypeName("const void *")] void* src, [NativeTypeName("size_t")] nuint len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_memset(void* dst, int c, [NativeTypeName("size_t")] nuint len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_memset4(void* dst, [NativeTypeName("Uint32")] uint val, [NativeTypeName("size_t")] nuint dwords); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_memcmp([NativeTypeName("const void *")] void* s1, [NativeTypeName("const void *")] void* s2, [NativeTypeName("size_t")] nuint len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_wcslen([NativeTypeName("const wchar_t *")] ushort* wstr); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_wcsnlen([NativeTypeName("const wchar_t *")] ushort* wstr, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_wcslcpy([NativeTypeName("wchar_t *")] ushort* dst, [NativeTypeName("const wchar_t *")] ushort* src, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_wcslcat([NativeTypeName("wchar_t *")] ushort* dst, [NativeTypeName("const wchar_t *")] ushort* src, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("wchar_t *")] + public static extern ushort* SDL_wcsdup([NativeTypeName("const wchar_t *")] ushort* wstr); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("wchar_t *")] + public static extern ushort* SDL_wcsstr([NativeTypeName("const wchar_t *")] ushort* haystack, [NativeTypeName("const wchar_t *")] ushort* needle); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("wchar_t *")] + public static extern ushort* SDL_wcsnstr([NativeTypeName("const wchar_t *")] ushort* haystack, [NativeTypeName("const wchar_t *")] ushort* needle, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_wcscmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_wcsncmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_wcscasecmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_wcsncasecmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("long")] + public static extern int SDL_wcstol([NativeTypeName("const wchar_t *")] ushort* str, [NativeTypeName("wchar_t **")] ushort** endp, int @base); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_strlen([NativeTypeName("const char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_strnlen([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_strlcpy([NativeTypeName("char *")] sbyte* dst, [NativeTypeName("const char *")] sbyte* src, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_utf8strlcpy([NativeTypeName("char *")] sbyte* dst, [NativeTypeName("const char *")] sbyte* src, [NativeTypeName("size_t")] nuint dst_bytes); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_strlcat([NativeTypeName("char *")] sbyte* dst, [NativeTypeName("const char *")] sbyte* src, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strdup([NativeTypeName("const char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strndup([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strrev([NativeTypeName("char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strupr([NativeTypeName("char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strlwr([NativeTypeName("char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strchr([NativeTypeName("const char *")] sbyte* str, int c); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strrchr([NativeTypeName("const char *")] sbyte* str, int c); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strstr([NativeTypeName("const char *")] sbyte* haystack, [NativeTypeName("const char *")] sbyte* needle); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strnstr([NativeTypeName("const char *")] sbyte* haystack, [NativeTypeName("const char *")] sbyte* needle, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strcasestr([NativeTypeName("const char *")] sbyte* haystack, [NativeTypeName("const char *")] sbyte* needle); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_strtok_r([NativeTypeName("char *")] sbyte* s1, [NativeTypeName("const char *")] sbyte* s2, [NativeTypeName("char **")] sbyte** saveptr); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_utf8strlen([NativeTypeName("const char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_utf8strnlen([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("size_t")] nuint bytes); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_itoa(int value, [NativeTypeName("char *")] sbyte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_uitoa([NativeTypeName("unsigned int")] uint value, [NativeTypeName("char *")] sbyte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_ltoa([NativeTypeName("long")] int value, [NativeTypeName("char *")] sbyte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_ultoa([NativeTypeName("unsigned long")] uint value, [NativeTypeName("char *")] sbyte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_lltoa([NativeTypeName("Sint64")] long value, [NativeTypeName("char *")] sbyte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_ulltoa([NativeTypeName("Uint64")] ulong value, [NativeTypeName("char *")] sbyte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_atoi([NativeTypeName("const char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_atof([NativeTypeName("const char *")] sbyte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("long")] + public static extern int SDL_strtol([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("char **")] sbyte** endp, int @base); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("unsigned long")] + public static extern uint SDL_strtoul([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("char **")] sbyte** endp, int @base); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Sint64")] + public static extern long SDL_strtoll([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("char **")] sbyte** endp, int @base); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint64")] + public static extern ulong SDL_strtoull([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("char **")] sbyte** endp, int @base); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_strtod([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("char **")] sbyte** endp); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_strcmp([NativeTypeName("const char *")] sbyte* str1, [NativeTypeName("const char *")] sbyte* str2); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_strncmp([NativeTypeName("const char *")] sbyte* str1, [NativeTypeName("const char *")] sbyte* str2, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_strcasecmp([NativeTypeName("const char *")] sbyte* str1, [NativeTypeName("const char *")] sbyte* str2); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_strncasecmp([NativeTypeName("const char *")] sbyte* str1, [NativeTypeName("const char *")] sbyte* str2, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_sscanf([NativeTypeName("const char *")] sbyte* text, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_vsscanf([NativeTypeName("const char *")] sbyte* text, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_snprintf([NativeTypeName("char *")] sbyte* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_swprintf([NativeTypeName("wchar_t *")] ushort* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] ushort* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_vsnprintf([NativeTypeName("char *")] sbyte* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_vswprintf([NativeTypeName("wchar_t *")] ushort* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] ushort* fmt, [NativeTypeName("va_list")] sbyte* ap); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_asprintf([NativeTypeName("char **")] sbyte** strp, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_vasprintf([NativeTypeName("char **")] sbyte** strp, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_acos(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_acosf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_asin(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_asinf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_atan(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_atanf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_atan2(double y, double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_atan2f(float y, float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_ceil(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_ceilf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_copysign(double x, double y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_copysignf(float x, float y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_cos(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_cosf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_exp(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_expf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_fabs(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_fabsf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_floor(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_floorf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_trunc(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_truncf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_fmod(double x, double y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_fmodf(float x, float y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_log(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_logf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_log10(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_log10f(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_modf(double x, double* y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_modff(float x, float* y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_pow(double x, double y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_powf(float x, float y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_round(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_roundf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("long")] + public static extern int SDL_lround(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("long")] + public static extern int SDL_lroundf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_scalbn(double x, int n); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_scalbnf(float x, int n); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_sin(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_sinf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_sqrt(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_sqrtf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double SDL_tan(double x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_tanf(float x); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_iconv_t")] + public static extern SDL_iconv_data_t* SDL_iconv_open([NativeTypeName("const char *")] sbyte* tocode, [NativeTypeName("const char *")] sbyte* fromcode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_iconv_close([NativeTypeName("SDL_iconv_t")] SDL_iconv_data_t* cd); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint SDL_iconv([NativeTypeName("SDL_iconv_t")] SDL_iconv_data_t* cd, [NativeTypeName("const char **")] sbyte** inbuf, [NativeTypeName("size_t *")] nuint* inbytesleft, [NativeTypeName("char **")] sbyte** outbuf, [NativeTypeName("size_t *")] nuint* outbytesleft); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* SDL_iconv_string([NativeTypeName("const char *")] sbyte* tocode, [NativeTypeName("const char *")] sbyte* fromcode, [NativeTypeName("const char *")] sbyte* inbuf, [NativeTypeName("size_t")] nuint inbytesleft); + + public static int SDL_size_mul_overflow([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret) + { + if (a != 0 && b > 0xffffffffffffffffUL / a) + { + return -1; + } + + *ret = a * b; + return 0; + } + + public static int SDL_size_mul_overflow_builtin([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret) + { + return (__builtin_mul_overflow(a, b, ret)) ? 1 : 0 == 0 ? 0 : -1; + } + + public static int SDL_size_add_overflow([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret) + { + if (b > 0xffffffffffffffffUL - a) + { + return -1; + } + + *ret = a + b; + return 0; + } + + public static int SDL_size_add_overflow_builtin([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret) + { + return (__builtin_add_overflow(a, b, ret)) ? 1 : 0 == 0 ? 0 : -1; + } + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern byte __builtin_mul_overflow(__arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern byte __builtin_add_overflow(__arglist); + + [NativeTypeName("#define SDL_SIZE_MAX SIZE_MAX")] + public const ulong SDL_SIZE_MAX = 0xffffffffffffffffUL; + + [NativeTypeName("#define SDL_FALSE 0")] + public const int SDL_FALSE = 0; + + [NativeTypeName("#define SDL_TRUE 1")] + public const int SDL_TRUE = 1; + + [NativeTypeName("#define SDL_MAX_SINT8 ((Sint8)0x7F)")] + public const sbyte SDL_MAX_SINT8 = ((sbyte)(0x7F)); + + [NativeTypeName("#define SDL_MIN_SINT8 ((Sint8)(~0x7F))")] + public const sbyte SDL_MIN_SINT8 = ((sbyte)(~0x7F)); + + [NativeTypeName("#define SDL_MAX_UINT8 ((Uint8)0xFF)")] + public const byte SDL_MAX_UINT8 = ((byte)(0xFF)); + + [NativeTypeName("#define SDL_MIN_UINT8 ((Uint8)0x00)")] + public const byte SDL_MIN_UINT8 = ((byte)(0x00)); + + [NativeTypeName("#define SDL_MAX_SINT16 ((Sint16)0x7FFF)")] + public const short SDL_MAX_SINT16 = ((short)(0x7FFF)); + + [NativeTypeName("#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF))")] + public const short SDL_MIN_SINT16 = ((short)(~0x7FFF)); + + [NativeTypeName("#define SDL_MAX_UINT16 ((Uint16)0xFFFF)")] + public const ushort SDL_MAX_UINT16 = ((ushort)(0xFFFF)); + + [NativeTypeName("#define SDL_MIN_UINT16 ((Uint16)0x0000)")] + public const ushort SDL_MIN_UINT16 = ((ushort)(0x0000)); + + [NativeTypeName("#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF)")] + public const int SDL_MAX_SINT32 = ((int)(0x7FFFFFFF)); + + [NativeTypeName("#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF))")] + public const int SDL_MIN_SINT32 = ((int)(~0x7FFFFFFF)); + + [NativeTypeName("#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu)")] + public const uint SDL_MAX_UINT32 = ((uint)(0xFFFFFFFFU)); + + [NativeTypeName("#define SDL_MIN_UINT32 ((Uint32)0x00000000)")] + public const uint SDL_MIN_UINT32 = ((uint)(0x00000000)); + + [NativeTypeName("#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll)")] + public const long SDL_MAX_SINT64 = ((long)(0x7FFFFFFFFFFFFFFFL)); + + [NativeTypeName("#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll))")] + public const long SDL_MIN_SINT64 = ((long)(~0x7FFFFFFFFFFFFFFFL)); + + [NativeTypeName("#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull)")] + public const ulong SDL_MAX_UINT64 = ((ulong)(0xFFFFFFFFFFFFFFFFUL)); + + [NativeTypeName("#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull))")] + public const ulong SDL_MIN_UINT64 = ((ulong)(0x0000000000000000UL)); + + [NativeTypeName("#define SDL_MAX_TIME SDL_MAX_SINT64")] + public const long SDL_MAX_TIME = ((long)(0x7FFFFFFFFFFFFFFFL)); + + [NativeTypeName("#define SDL_MIN_TIME SDL_MIN_SINT64")] + public const long SDL_MIN_TIME = ((long)(~0x7FFFFFFFFFFFFFFFL)); + + [NativeTypeName("#define SDL_FLT_EPSILON 1.1920928955078125e-07F")] + public const float SDL_FLT_EPSILON = 1.1920928955078125e-07F; + + [NativeTypeName("#define SDL_PRIs64 \"I64d\"")] + public static ReadOnlySpan SDL_PRIs64 => "I64d"u8; + + [NativeTypeName("#define SDL_PRIu64 \"I64u\"")] + public static ReadOnlySpan SDL_PRIu64 => "I64u"u8; + + [NativeTypeName("#define SDL_PRIx64 \"I64x\"")] + public static ReadOnlySpan SDL_PRIx64 => "I64x"u8; + + [NativeTypeName("#define SDL_PRIX64 \"I64X\"")] + public static ReadOnlySpan SDL_PRIX64 => "I64X"u8; + + [NativeTypeName("#define SDL_PRIs32 \"d\"")] + public static ReadOnlySpan SDL_PRIs32 => "d"u8; + + [NativeTypeName("#define SDL_PRIu32 \"u\"")] + public static ReadOnlySpan SDL_PRIu32 => "u"u8; + + [NativeTypeName("#define SDL_PRIx32 \"x\"")] + public static ReadOnlySpan SDL_PRIx32 => "x"u8; + + [NativeTypeName("#define SDL_PRIX32 \"X\"")] + public static ReadOnlySpan SDL_PRIX32 => "X"u8; + + [NativeTypeName("#define SDL_memcpy memcpy")] + public static readonly delegate* SDL_memcpy = &memcpy; + + [NativeTypeName("#define SDL_memmove memmove")] + public static readonly delegate* SDL_memmove = &memmove; + + [NativeTypeName("#define SDL_memset memset")] + public static readonly delegate* SDL_memset = &memset; + + [NativeTypeName("#define SDL_PI_D 3.141592653589793238462643383279502884")] + public const double SDL_PI_D = 3.141592653589793238462643383279502884; + + [NativeTypeName("#define SDL_PI_F 3.141592653589793238462643383279502884F")] + public const float SDL_PI_F = 3.141592653589793238462643383279502884F; + + [NativeTypeName("#define SDL_ICONV_ERROR (size_t)-1")] + public static readonly nuint SDL_ICONV_ERROR = unchecked((nuint)(-1)); + + [NativeTypeName("#define SDL_ICONV_E2BIG (size_t)-2")] + public static readonly nuint SDL_ICONV_E2BIG = unchecked((nuint)(-2)); + + [NativeTypeName("#define SDL_ICONV_EILSEQ (size_t)-3")] + public static readonly nuint SDL_ICONV_EILSEQ = unchecked((nuint)(-3)); + + [NativeTypeName("#define SDL_ICONV_EINVAL (size_t)-4")] + public static readonly nuint SDL_ICONV_EINVAL = unchecked((nuint)(-4)); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs new file mode 100644 index 0000000..67af419 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs @@ -0,0 +1,120 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public unsafe partial struct SDL_StorageInterface + { + [NativeTypeName("int (*)(void *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] close; + + [NativeTypeName("SDL_bool (*)(void *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] ready; + + [NativeTypeName("int (*)(void *, const char *, SDL_EnumerateDirectoryCallback, void *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl], void*, int> enumerate; + + [NativeTypeName("int (*)(void *, const char *, SDL_PathInfo *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] info; + + [NativeTypeName("int (*)(void *, const char *, void *, Uint64) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] read_file; + + [NativeTypeName("int (*)(void *, const char *, const void *, Uint64) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] write_file; + + [NativeTypeName("int (*)(void *, const char *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] mkdir; + + [NativeTypeName("int (*)(void *, const char *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] remove; + + [NativeTypeName("int (*)(void *, const char *, const char *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] rename; + + [NativeTypeName("Uint64 (*)(void *) __attribute__((cdecl))")] + public delegate* unmanaged[Cdecl] space_remaining; + } + + public partial struct SDL_Storage + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Storage* SDL_OpenTitleStorage([NativeTypeName("const char *")] sbyte* @override, [NativeTypeName("SDL_PropertiesID")] uint props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Storage* SDL_OpenUserStorage([NativeTypeName("const char *")] sbyte* org, [NativeTypeName("const char *")] sbyte* app, [NativeTypeName("SDL_PropertiesID")] uint props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Storage* SDL_OpenFileStorage([NativeTypeName("const char *")] sbyte* path); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Storage* SDL_OpenStorage([NativeTypeName("const SDL_StorageInterface *")] SDL_StorageInterface* iface, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CloseStorage(SDL_Storage* storage); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_StorageReady(SDL_Storage* storage); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetStorageFileSize(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, [NativeTypeName("Uint64 *")] ulong* length); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ReadStorageFile(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, void* destination, [NativeTypeName("Uint64")] ulong length); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_WriteStorageFile(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, [NativeTypeName("const void *")] void* source, [NativeTypeName("Uint64")] ulong length); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CreateStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_EnumerateStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, [NativeTypeName("SDL_EnumerateDirectoryCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RemoveStoragePath(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RenameStoragePath(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* oldpath, [NativeTypeName("const char *")] sbyte* newpath); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetStoragePathInfo(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, SDL_PathInfo* info); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint64")] + public static extern ulong SDL_GetStorageSpaceRemaining(SDL_Storage* storage); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char **")] + public static extern sbyte** SDL_GlobStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, [NativeTypeName("const char *")] sbyte* pattern, [NativeTypeName("Uint32")] uint flags, int* count); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs new file mode 100644 index 0000000..90cbefb --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs @@ -0,0 +1,239 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_BlitMap + { + } + + public enum SDL_ScaleMode + { + SDL_SCALEMODE_NEAREST, + SDL_SCALEMODE_LINEAR, + SDL_SCALEMODE_BEST, + } + + public enum SDL_FlipMode + { + SDL_FLIP_NONE, + SDL_FLIP_HORIZONTAL, + SDL_FLIP_VERTICAL, + } + + public unsafe partial struct SDL_Surface + { + [NativeTypeName("Uint32")] + public uint flags; + + public SDL_PixelFormat* format; + + public int w; + + public int h; + + public int pitch; + + public void* pixels; + + public void* reserved; + + public int locked; + + public void* list_blitmap; + + public SDL_Rect clip_rect; + + public SDL_BlitMap* map; + + public int refcount; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_CreateSurface(int width, int height, SDL_PixelFormatEnum format); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_CreateSurfaceFrom(void* pixels, int width, int height, int pitch, SDL_PixelFormatEnum format); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroySurface(SDL_Surface* surface); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetSurfaceProperties(SDL_Surface* surface); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetSurfaceColorspace(SDL_Surface* surface, SDL_Colorspace colorspace); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSurfaceColorspace(SDL_Surface* surface, SDL_Colorspace* colorspace); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetSurfacePalette(SDL_Surface* surface, SDL_Palette* palette); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_LockSurface(SDL_Surface* surface); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnlockSurface(SDL_Surface* surface); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_LoadBMP_IO(SDL_IOStream* src, [NativeTypeName("SDL_bool")] int closeio); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_LoadBMP([NativeTypeName("const char *")] sbyte* file); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SaveBMP_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("SDL_bool")] int closeio); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SaveBMP(SDL_Surface* surface, [NativeTypeName("const char *")] sbyte* file); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetSurfaceRLE(SDL_Surface* surface, int flag); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_SurfaceHasRLE(SDL_Surface* surface); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetSurfaceColorKey(SDL_Surface* surface, int flag, [NativeTypeName("Uint32")] uint key); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_SurfaceHasColorKey(SDL_Surface* surface); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSurfaceColorKey(SDL_Surface* surface, [NativeTypeName("Uint32 *")] uint* key); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetSurfaceColorMod(SDL_Surface* surface, [NativeTypeName("Uint8")] byte r, [NativeTypeName("Uint8")] byte g, [NativeTypeName("Uint8")] byte b); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSurfaceColorMod(SDL_Surface* surface, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetSurfaceAlphaMod(SDL_Surface* surface, [NativeTypeName("Uint8")] byte alpha); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSurfaceAlphaMod(SDL_Surface* surface, [NativeTypeName("Uint8 *")] byte* alpha); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetSurfaceBlendMode(SDL_Surface* surface, SDL_BlendMode blendMode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSurfaceBlendMode(SDL_Surface* surface, SDL_BlendMode* blendMode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_SetSurfaceClipRect(SDL_Surface* surface, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSurfaceClipRect(SDL_Surface* surface, SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_FlipSurface(SDL_Surface* surface, SDL_FlipMode flip); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_DuplicateSurface(SDL_Surface* surface); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_ConvertSurface(SDL_Surface* surface, [NativeTypeName("const SDL_PixelFormat *")] SDL_PixelFormat* format); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_ConvertSurfaceFormat(SDL_Surface* surface, SDL_PixelFormatEnum pixel_format); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_ConvertSurfaceFormatAndColorspace(SDL_Surface* surface, SDL_PixelFormatEnum pixel_format, SDL_Colorspace colorspace, [NativeTypeName("SDL_PropertiesID")] uint props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ConvertPixels(int width, int height, SDL_PixelFormatEnum src_format, [NativeTypeName("const void *")] void* src, int src_pitch, SDL_PixelFormatEnum dst_format, void* dst, int dst_pitch); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormatEnum src_format, SDL_Colorspace src_colorspace, [NativeTypeName("SDL_PropertiesID")] uint src_properties, [NativeTypeName("const void *")] void* src, int src_pitch, SDL_PixelFormatEnum dst_format, SDL_Colorspace dst_colorspace, [NativeTypeName("SDL_PropertiesID")] uint dst_properties, void* dst, int dst_pitch); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormatEnum src_format, [NativeTypeName("const void *")] void* src, int src_pitch, SDL_PixelFormatEnum dst_format, void* dst, int dst_pitch); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_FillSurfaceRect(SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("Uint32")] uint color); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_FillSurfaceRects(SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rects, int count, [NativeTypeName("Uint32")] uint color); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_BlitSurface(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_BlitSurfaceUnchecked(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* dstrect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SoftStretch(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)] + public static extern int SDL_BlitSurfaceScaled(SDL_Surface* src, [NativeTypeName("const SDL_Rect *")] SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect, SDL_ScaleMode scaleMode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int 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)] + public static extern int SDL_ReadSurfacePixel(SDL_Surface* surface, int x, int y, [NativeTypeName("Uint8 *")] byte* r, [NativeTypeName("Uint8 *")] byte* g, [NativeTypeName("Uint8 *")] byte* b, [NativeTypeName("Uint8 *")] byte* a); + + [NativeTypeName("#define SDL_SWSURFACE 0")] + public const int SDL_SWSURFACE = 0; + + [NativeTypeName("#define SDL_PREALLOC 0x00000001")] + public const int SDL_PREALLOC = 0x00000001; + + [NativeTypeName("#define SDL_RLEACCEL 0x00000002")] + public const int SDL_RLEACCEL = 0x00000002; + + [NativeTypeName("#define SDL_DONTFREE 0x00000004")] + public const int SDL_DONTFREE = 0x00000004; + + [NativeTypeName("#define SDL_SIMD_ALIGNED 0x00000008")] + public const int SDL_SIMD_ALIGNED = 0x00000008; + + [NativeTypeName("#define SDL_SURFACE_USES_PROPERTIES 0x00000010")] + public const int SDL_SURFACE_USES_PROPERTIES = 0x00000010; + + [NativeTypeName("#define SDL_PROP_SURFACE_COLORSPACE_NUMBER \"SDL.surface.colorspace\"")] + public static ReadOnlySpan SDL_PROP_SURFACE_COLORSPACE_NUMBER => "SDL.surface.colorspace"u8; + + [NativeTypeName("#define SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT \"SDL.surface.SDR_white_point\"")] + public static ReadOnlySpan SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT => "SDL.surface.SDR_white_point"u8; + + [NativeTypeName("#define SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT \"SDL.surface.HDR_headroom\"")] + public static ReadOnlySpan SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT => "SDL.surface.HDR_headroom"u8; + + [NativeTypeName("#define SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING \"SDL.surface.tonemap\"")] + public static ReadOnlySpan SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING => "SDL.surface.tonemap"u8; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs new file mode 100644 index 0000000..f077d73 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs @@ -0,0 +1,76 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct tagMSG + { + } + + [StructLayout(LayoutKind.Explicit)] + public partial struct _XEvent + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_Direct3D9GetAdapterIndex([NativeTypeName("SDL_DisplayID")] uint displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_DXGIGetOutputInfo([NativeTypeName("SDL_DisplayID")] uint displayID, int* adapterIndex, int* outputIndex); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetX11EventHook([NativeTypeName("SDL_X11EventHook")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_IsTablet(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_OnApplicationWillTerminate(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_OnApplicationDidReceiveMemoryWarning(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_OnApplicationWillResignActive(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_OnApplicationDidEnterBackground(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_OnApplicationWillEnterForeground(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_OnApplicationDidBecomeActive(); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs new file mode 100644 index 0000000..a0fecc7 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs @@ -0,0 +1,90 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Thread + { + } + + public enum SDL_ThreadPriority + { + SDL_THREAD_PRIORITY_LOW, + SDL_THREAD_PRIORITY_NORMAL, + SDL_THREAD_PRIORITY_HIGH, + SDL_THREAD_PRIORITY_TIME_CRITICAL, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Thread* SDL_CreateThread([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] sbyte* name, void* data, [NativeTypeName("pfnSDL_CurrentBeginThread")] delegate* unmanaged[Cdecl], void*, uint, uint*, nuint> pfnBeginThread, [NativeTypeName("pfnSDL_CurrentEndThread")] delegate* unmanaged[Cdecl] pfnEndThread); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Thread* SDL_CreateThreadWithStackSize([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const size_t")] nuint stacksize, void* data, [NativeTypeName("pfnSDL_CurrentBeginThread")] delegate* unmanaged[Cdecl], void*, uint, uint*, nuint> pfnBeginThread, [NativeTypeName("pfnSDL_CurrentEndThread")] delegate* unmanaged[Cdecl] pfnEndThread); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetThreadName(SDL_Thread* thread); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_ThreadID")] + public static extern ulong SDL_GetCurrentThreadID(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_ThreadID")] + public static extern ulong SDL_GetThreadID(SDL_Thread* thread); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetThreadPriority(SDL_ThreadPriority priority); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_WaitThread(SDL_Thread* thread, int* status); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DetachThread(SDL_Thread* thread); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_TLSID")] + public static extern uint SDL_CreateTLS(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_GetTLS([NativeTypeName("SDL_TLSID")] uint id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetTLS([NativeTypeName("SDL_TLSID")] uint id, [NativeTypeName("const void *")] void* value, [NativeTypeName("void (*)(void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] destructor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_CleanupTLS(); + + [NativeTypeName("#define SDL_beginthread _beginthreadex")] + public static readonly delegate*, void*, uint, uint*, nuint> SDL_beginthread = &_beginthreadex; + + [NativeTypeName("#define SDL_endthread _endthreadex")] + public static readonly delegate* SDL_endthread = &_endthreadex; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs new file mode 100644 index 0000000..1994f7d --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs @@ -0,0 +1,98 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_DateTime + { + public int year; + + public int month; + + public int day; + + public int hour; + + public int minute; + + public int second; + + public int nanosecond; + + public int day_of_week; + + public int utc_offset; + } + + public enum SDL_DATE_FORMAT + { + SDL_DATE_FORMAT_YYYYMMDD = 0, + SDL_DATE_FORMAT_DDMMYYYY = 1, + SDL_DATE_FORMAT_MMDDYYYY = 2, + } + + public enum SDL_TIME_FORMAT + { + SDL_TIME_FORMAT_24HR = 0, + SDL_TIME_FORMAT_12HR = 1, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetCurrentTime([NativeTypeName("SDL_Time *")] long* ticks); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_TimeToDateTime([NativeTypeName("SDL_Time")] long ticks, SDL_DateTime* dt, [NativeTypeName("SDL_bool")] int localTime); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_DateTimeToTime([NativeTypeName("const SDL_DateTime *")] SDL_DateTime* dt, [NativeTypeName("SDL_Time *")] long* ticks); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_TimeToWindows([NativeTypeName("SDL_Time")] long ticks, [NativeTypeName("Uint32 *")] uint* dwLowDateTime, [NativeTypeName("Uint32 *")] uint* dwHighDateTime); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_Time")] + public static extern long SDL_TimeFromWindows([NativeTypeName("Uint32")] uint dwLowDateTime, [NativeTypeName("Uint32")] uint dwHighDateTime); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetDaysInMonth(int year, int month); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetDayOfYear(int year, int month, int day); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetDayOfWeek(int year, int month, int day); + + [NativeTypeName("#define SDL_PROP_GLOBAL_SYSTEM_DATE_FORMAT_NUMBER \"SDL.time.date_format\"")] + public static ReadOnlySpan SDL_PROP_GLOBAL_SYSTEM_DATE_FORMAT_NUMBER => "SDL.time.date_format"u8; + + [NativeTypeName("#define SDL_PROP_GLOBAL_SYSTEM_TIME_FORMAT_NUMBER \"SDL.time.time_format\"")] + public static ReadOnlySpan SDL_PROP_GLOBAL_SYSTEM_TIME_FORMAT_NUMBER => "SDL.time.time_format"u8; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs new file mode 100644 index 0000000..d5f9c93 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs @@ -0,0 +1,77 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint64")] + public static extern ulong SDL_GetTicks(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint64")] + public static extern ulong SDL_GetTicksNS(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint64")] + public static extern ulong SDL_GetPerformanceCounter(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint64")] + public static extern ulong SDL_GetPerformanceFrequency(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_Delay([NativeTypeName("Uint32")] uint ms); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DelayNS([NativeTypeName("Uint64")] ulong ns); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_TimerID")] + public static extern uint SDL_AddTimer([NativeTypeName("Uint32")] uint interval, [NativeTypeName("SDL_TimerCallback")] delegate* unmanaged[Cdecl] callback, void* param2); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_RemoveTimer([NativeTypeName("SDL_TimerID")] uint id); + + [NativeTypeName("#define SDL_MS_PER_SECOND 1000")] + public const int SDL_MS_PER_SECOND = 1000; + + [NativeTypeName("#define SDL_US_PER_SECOND 1000000")] + public const int SDL_US_PER_SECOND = 1000000; + + [NativeTypeName("#define SDL_NS_PER_SECOND 1000000000LL")] + public const long SDL_NS_PER_SECOND = 1000000000L; + + [NativeTypeName("#define SDL_NS_PER_MS 1000000")] + public const int SDL_NS_PER_MS = 1000000; + + [NativeTypeName("#define SDL_NS_PER_US 1000")] + public const int SDL_NS_PER_US = 1000; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs new file mode 100644 index 0000000..2c88a23 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs @@ -0,0 +1,75 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_TouchDeviceType + { + SDL_TOUCH_DEVICE_INVALID = -1, + SDL_TOUCH_DEVICE_DIRECT, + SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, + SDL_TOUCH_DEVICE_INDIRECT_RELATIVE, + } + + public partial struct SDL_Finger + { + [NativeTypeName("SDL_FingerID")] + public ulong id; + + public float x; + + public float y; + + public float pressure; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_TouchID *")] + public static extern ulong* SDL_GetTouchDevices(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetTouchDeviceName([NativeTypeName("SDL_TouchID")] ulong touchID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_TouchDeviceType SDL_GetTouchDeviceType([NativeTypeName("SDL_TouchID")] ulong touchID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumTouchFingers([NativeTypeName("SDL_TouchID")] ulong touchID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Finger* SDL_GetTouchFinger([NativeTypeName("SDL_TouchID")] ulong touchID, int index); + + [NativeTypeName("#define SDL_TOUCH_MOUSEID ((SDL_MouseID)-1)")] + public const uint SDL_TOUCH_MOUSEID = unchecked((uint)(-1)); + + [NativeTypeName("#define SDL_MOUSE_TOUCHID ((SDL_TouchID)-1)")] + public const ulong SDL_MOUSE_TOUCHID = unchecked((ulong)(-1)); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs new file mode 100644 index 0000000..9eab83e --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs @@ -0,0 +1,63 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct SDL_Version + { + [NativeTypeName("Uint8")] + public byte major; + + [NativeTypeName("Uint8")] + public byte minor; + + [NativeTypeName("Uint8")] + public byte patch; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetVersion(SDL_Version* ver); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetRevision(); + + [NativeTypeName("#define SDL_MAJOR_VERSION 3")] + public const int SDL_MAJOR_VERSION = 3; + + [NativeTypeName("#define SDL_MINOR_VERSION 1")] + public const int SDL_MINOR_VERSION = 1; + + [NativeTypeName("#define SDL_PATCHLEVEL 1")] + public const int SDL_PATCHLEVEL = 1; + + [NativeTypeName("#define SDL_COMPILEDVERSION SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)")] + public const int SDL_COMPILEDVERSION = ((3) << 24 | (1) << 8 | (1) << 0); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs new file mode 100644 index 0000000..e32850e --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs @@ -0,0 +1,768 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_SystemTheme + { + SDL_SYSTEM_THEME_UNKNOWN, + SDL_SYSTEM_THEME_LIGHT, + SDL_SYSTEM_THEME_DARK, + } + + public unsafe partial struct SDL_DisplayMode + { + [NativeTypeName("SDL_DisplayID")] + public uint displayID; + + public SDL_PixelFormatEnum format; + + public int w; + + public int h; + + public float pixel_density; + + public float refresh_rate; + + public void* driverdata; + } + + public enum SDL_DisplayOrientation + { + SDL_ORIENTATION_UNKNOWN, + SDL_ORIENTATION_LANDSCAPE, + SDL_ORIENTATION_LANDSCAPE_FLIPPED, + SDL_ORIENTATION_PORTRAIT, + SDL_ORIENTATION_PORTRAIT_FLIPPED, + } + + public partial struct SDL_Window + { + } + + public enum SDL_FlashOperation + { + SDL_FLASH_CANCEL, + SDL_FLASH_BRIEFLY, + SDL_FLASH_UNTIL_FOCUSED, + } + + public enum SDL_GLattr + { + SDL_GL_RED_SIZE, + SDL_GL_GREEN_SIZE, + SDL_GL_BLUE_SIZE, + SDL_GL_ALPHA_SIZE, + SDL_GL_BUFFER_SIZE, + SDL_GL_DOUBLEBUFFER, + SDL_GL_DEPTH_SIZE, + SDL_GL_STENCIL_SIZE, + SDL_GL_ACCUM_RED_SIZE, + SDL_GL_ACCUM_GREEN_SIZE, + SDL_GL_ACCUM_BLUE_SIZE, + SDL_GL_ACCUM_ALPHA_SIZE, + SDL_GL_STEREO, + SDL_GL_MULTISAMPLEBUFFERS, + SDL_GL_MULTISAMPLESAMPLES, + SDL_GL_ACCELERATED_VISUAL, + SDL_GL_RETAINED_BACKING, + SDL_GL_CONTEXT_MAJOR_VERSION, + SDL_GL_CONTEXT_MINOR_VERSION, + SDL_GL_CONTEXT_FLAGS, + SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_SHARE_WITH_CURRENT_CONTEXT, + SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, + SDL_GL_CONTEXT_RELEASE_BEHAVIOR, + SDL_GL_CONTEXT_RESET_NOTIFICATION, + SDL_GL_CONTEXT_NO_ERROR, + SDL_GL_FLOATBUFFERS, + SDL_GL_EGL_PLATFORM, + } + + public enum SDL_GLprofile + { + SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, + SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, + SDL_GL_CONTEXT_PROFILE_ES = 0x0004, + } + + public enum SDL_GLcontextFlag + { + SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, + SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, + SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004, + SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008, + } + + public enum SDL_GLcontextReleaseFlag + { + SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000, + SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001, + } + + public enum SDL_GLContextResetNotification + { + SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000, + SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001, + } + + public enum SDL_HitTestResult + { + SDL_HITTEST_NORMAL, + SDL_HITTEST_DRAGGABLE, + SDL_HITTEST_RESIZE_TOPLEFT, + SDL_HITTEST_RESIZE_TOP, + SDL_HITTEST_RESIZE_TOPRIGHT, + SDL_HITTEST_RESIZE_RIGHT, + SDL_HITTEST_RESIZE_BOTTOMRIGHT, + SDL_HITTEST_RESIZE_BOTTOM, + SDL_HITTEST_RESIZE_BOTTOMLEFT, + SDL_HITTEST_RESIZE_LEFT, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumVideoDrivers(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetVideoDriver(int index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetCurrentVideoDriver(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_SystemTheme SDL_GetSystemTheme(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_DisplayID *")] + public static extern uint* SDL_GetDisplays(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_DisplayID")] + public static extern uint SDL_GetPrimaryDisplay(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetDisplayProperties([NativeTypeName("SDL_DisplayID")] uint displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetDisplayName([NativeTypeName("SDL_DisplayID")] uint displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetDisplayBounds([NativeTypeName("SDL_DisplayID")] uint displayID, SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetDisplayUsableBounds([NativeTypeName("SDL_DisplayID")] uint displayID, SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_DisplayOrientation SDL_GetNaturalDisplayOrientation([NativeTypeName("SDL_DisplayID")] uint displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_DisplayOrientation SDL_GetCurrentDisplayOrientation([NativeTypeName("SDL_DisplayID")] uint displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_GetDisplayContentScale([NativeTypeName("SDL_DisplayID")] uint displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const SDL_DisplayMode **")] + public static extern SDL_DisplayMode** SDL_GetFullscreenDisplayModes([NativeTypeName("SDL_DisplayID")] uint displayID, int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const SDL_DisplayMode *")] + public static extern SDL_DisplayMode* SDL_GetClosestFullscreenDisplayMode([NativeTypeName("SDL_DisplayID")] uint displayID, int w, int h, float refresh_rate, [NativeTypeName("SDL_bool")] int include_high_density_modes); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const SDL_DisplayMode *")] + public static extern SDL_DisplayMode* SDL_GetDesktopDisplayMode([NativeTypeName("SDL_DisplayID")] uint displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const SDL_DisplayMode *")] + public static extern SDL_DisplayMode* SDL_GetCurrentDisplayMode([NativeTypeName("SDL_DisplayID")] uint displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_DisplayID")] + public static extern uint SDL_GetDisplayForPoint([NativeTypeName("const SDL_Point *")] SDL_Point* point); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_DisplayID")] + public static extern uint SDL_GetDisplayForRect([NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_DisplayID")] + public static extern uint SDL_GetDisplayForWindow(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_GetWindowPixelDensity(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern float SDL_GetWindowDisplayScale(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowFullscreenMode(SDL_Window* window, [NativeTypeName("const SDL_DisplayMode *")] SDL_DisplayMode* mode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const SDL_DisplayMode *")] + public static extern SDL_DisplayMode* SDL_GetWindowFullscreenMode(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* SDL_GetWindowICCProfile(SDL_Window* window, [NativeTypeName("size_t *")] nuint* size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + public static extern uint SDL_GetWindowPixelFormat(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_CreateWindow([NativeTypeName("const char *")] sbyte* title, int w, int h, [NativeTypeName("SDL_WindowFlags")] uint flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_CreatePopupWindow(SDL_Window* parent, int offset_x, int offset_y, int w, int h, [NativeTypeName("SDL_WindowFlags")] uint flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_CreateWindowWithProperties([NativeTypeName("SDL_PropertiesID")] uint props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_WindowID")] + public static extern uint SDL_GetWindowID(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_GetWindowFromID([NativeTypeName("SDL_WindowID")] uint id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_GetWindowParent(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_PropertiesID")] + public static extern uint SDL_GetWindowProperties(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_WindowFlags")] + public static extern uint SDL_GetWindowFlags(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowTitle(SDL_Window* window, [NativeTypeName("const char *")] sbyte* title); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* SDL_GetWindowTitle(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowIcon(SDL_Window* window, SDL_Surface* icon); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowPosition(SDL_Window* window, int x, int y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetWindowPosition(SDL_Window* window, int* x, int* y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowSize(SDL_Window* window, int w, int h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetWindowSize(SDL_Window* window, int* w, int* h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetWindowBordersSize(SDL_Window* window, int* top, int* left, int* bottom, int* right); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetWindowSizeInPixels(SDL_Window* window, int* w, int* h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowMinimumSize(SDL_Window* window, int min_w, int min_h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetWindowMinimumSize(SDL_Window* window, int* w, int* h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowMaximumSize(SDL_Window* window, int max_w, int max_h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetWindowMaximumSize(SDL_Window* window, int* w, int* h); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowBordered(SDL_Window* window, [NativeTypeName("SDL_bool")] int bordered); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowResizable(SDL_Window* window, [NativeTypeName("SDL_bool")] int resizable); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowAlwaysOnTop(SDL_Window* window, [NativeTypeName("SDL_bool")] int on_top); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ShowWindow(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_HideWindow(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RaiseWindow(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_MaximizeWindow(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_MinimizeWindow(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_RestoreWindow(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowFullscreen(SDL_Window* window, [NativeTypeName("SDL_bool")] int fullscreen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SyncWindow(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_WindowHasSurface(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Surface* SDL_GetWindowSurface(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_UpdateWindowSurface(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_UpdateWindowSurfaceRects(SDL_Window* window, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rects, int numrects); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_DestroyWindowSurface(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowKeyboardGrab(SDL_Window* window, [NativeTypeName("SDL_bool")] int grabbed); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowMouseGrab(SDL_Window* window, [NativeTypeName("SDL_bool")] int grabbed); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetWindowKeyboardGrab(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GetWindowMouseGrab(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_GetGrabbedWindow(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowMouseRect(SDL_Window* window, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const SDL_Rect *")] + public static extern SDL_Rect* SDL_GetWindowMouseRect(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowOpacity(SDL_Window* window, float opacity); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetWindowOpacity(SDL_Window* window, float* out_opacity); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowModalFor(SDL_Window* modal_window, SDL_Window* parent_window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowInputFocus(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowFocusable(SDL_Window* window, [NativeTypeName("SDL_bool")] int focusable); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ShowWindowSystemMenu(SDL_Window* window, int x, int y); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowHitTest(SDL_Window* window, [NativeTypeName("SDL_HitTest")] delegate* unmanaged[Cdecl] callback, void* callback_data); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowShape(SDL_Window* window, SDL_Surface* shape); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_FlashWindow(SDL_Window* window, SDL_FlashOperation operation); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_DestroyWindow(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_ScreenSaverEnabled(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_EnableScreenSaver(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_DisableScreenSaver(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GL_LoadLibrary([NativeTypeName("const char *")] sbyte* path); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_FunctionPointer")] + public static extern delegate* unmanaged[Cdecl] SDL_GL_GetProcAddress([NativeTypeName("const char *")] sbyte* proc); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_FunctionPointer")] + public static extern delegate* unmanaged[Cdecl] SDL_EGL_GetProcAddress([NativeTypeName("const char *")] sbyte* proc); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_GL_UnloadLibrary(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_GL_ExtensionSupported([NativeTypeName("const char *")] sbyte* extension); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_GL_ResetAttributes(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GL_SetAttribute(SDL_GLattr attr, int value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GL_GetAttribute(SDL_GLattr attr, int* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_GLContext")] + public static extern void* SDL_GL_CreateContext(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GL_MakeCurrent(SDL_Window* window, [NativeTypeName("SDL_GLContext")] void* context); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_GL_GetCurrentWindow(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_GLContext")] + public static extern void* SDL_GL_GetCurrentContext(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_EGLDisplay")] + public static extern void* SDL_EGL_GetCurrentEGLDisplay(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_EGLConfig")] + public static extern void* SDL_EGL_GetCurrentEGLConfig(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_EGLSurface")] + public static extern void* SDL_EGL_GetWindowEGLSurface(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_EGL_SetEGLAttributeCallbacks([NativeTypeName("SDL_EGLAttribArrayCallback")] delegate* unmanaged[Cdecl] platformAttribCallback, [NativeTypeName("SDL_EGLIntArrayCallback")] delegate* unmanaged[Cdecl] surfaceAttribCallback, [NativeTypeName("SDL_EGLIntArrayCallback")] delegate* unmanaged[Cdecl] contextAttribCallback); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GL_SetSwapInterval(int interval); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GL_GetSwapInterval(int* interval); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GL_SwapWindow(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GL_DeleteContext([NativeTypeName("SDL_GLContext")] void* context); + + [NativeTypeName("#define SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER \"SDL.video.wayland.wl_display\"")] + public static ReadOnlySpan SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER => "SDL.video.wayland.wl_display"u8; + + [NativeTypeName("#define SDL_WINDOW_FULLSCREEN 0x00000001U")] + public const uint SDL_WINDOW_FULLSCREEN = 0x00000001U; + + [NativeTypeName("#define SDL_WINDOW_OPENGL 0x00000002U")] + public const uint SDL_WINDOW_OPENGL = 0x00000002U; + + [NativeTypeName("#define SDL_WINDOW_OCCLUDED 0x00000004U")] + public const uint SDL_WINDOW_OCCLUDED = 0x00000004U; + + [NativeTypeName("#define SDL_WINDOW_HIDDEN 0x00000008U")] + public const uint SDL_WINDOW_HIDDEN = 0x00000008U; + + [NativeTypeName("#define SDL_WINDOW_BORDERLESS 0x00000010U")] + public const uint SDL_WINDOW_BORDERLESS = 0x00000010U; + + [NativeTypeName("#define SDL_WINDOW_RESIZABLE 0x00000020U")] + public const uint SDL_WINDOW_RESIZABLE = 0x00000020U; + + [NativeTypeName("#define SDL_WINDOW_MINIMIZED 0x00000040U")] + public const uint SDL_WINDOW_MINIMIZED = 0x00000040U; + + [NativeTypeName("#define SDL_WINDOW_MAXIMIZED 0x00000080U")] + public const uint SDL_WINDOW_MAXIMIZED = 0x00000080U; + + [NativeTypeName("#define SDL_WINDOW_MOUSE_GRABBED 0x00000100U")] + public const uint SDL_WINDOW_MOUSE_GRABBED = 0x00000100U; + + [NativeTypeName("#define SDL_WINDOW_INPUT_FOCUS 0x00000200U")] + public const uint SDL_WINDOW_INPUT_FOCUS = 0x00000200U; + + [NativeTypeName("#define SDL_WINDOW_MOUSE_FOCUS 0x00000400U")] + public const uint SDL_WINDOW_MOUSE_FOCUS = 0x00000400U; + + [NativeTypeName("#define SDL_WINDOW_EXTERNAL 0x00000800U")] + public const uint SDL_WINDOW_EXTERNAL = 0x00000800U; + + [NativeTypeName("#define SDL_WINDOW_HIGH_PIXEL_DENSITY 0x00002000U")] + public const uint SDL_WINDOW_HIGH_PIXEL_DENSITY = 0x00002000U; + + [NativeTypeName("#define SDL_WINDOW_MOUSE_CAPTURE 0x00004000U")] + public const uint SDL_WINDOW_MOUSE_CAPTURE = 0x00004000U; + + [NativeTypeName("#define SDL_WINDOW_ALWAYS_ON_TOP 0x00008000U")] + public const uint SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000U; + + [NativeTypeName("#define SDL_WINDOW_UTILITY 0x00020000U")] + public const uint SDL_WINDOW_UTILITY = 0x00020000U; + + [NativeTypeName("#define SDL_WINDOW_TOOLTIP 0x00040000U")] + public const uint SDL_WINDOW_TOOLTIP = 0x00040000U; + + [NativeTypeName("#define SDL_WINDOW_POPUP_MENU 0x00080000U")] + public const uint SDL_WINDOW_POPUP_MENU = 0x00080000U; + + [NativeTypeName("#define SDL_WINDOW_KEYBOARD_GRABBED 0x00100000U")] + public const uint SDL_WINDOW_KEYBOARD_GRABBED = 0x00100000U; + + [NativeTypeName("#define SDL_WINDOW_VULKAN 0x10000000U")] + public const uint SDL_WINDOW_VULKAN = 0x10000000U; + + [NativeTypeName("#define SDL_WINDOW_METAL 0x20000000U")] + public const uint SDL_WINDOW_METAL = 0x20000000U; + + [NativeTypeName("#define SDL_WINDOW_TRANSPARENT 0x40000000U")] + public const uint SDL_WINDOW_TRANSPARENT = 0x40000000U; + + [NativeTypeName("#define SDL_WINDOW_NOT_FOCUSABLE 0x80000000U")] + public const uint SDL_WINDOW_NOT_FOCUSABLE = 0x80000000U; + + [NativeTypeName("#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u")] + public const uint SDL_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000U; + + [NativeTypeName("#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)")] + public const uint SDL_WINDOWPOS_UNDEFINED = (0x1FFF0000U | (0)); + + [NativeTypeName("#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u")] + public const uint SDL_WINDOWPOS_CENTERED_MASK = 0x2FFF0000U; + + [NativeTypeName("#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)")] + public const uint SDL_WINDOWPOS_CENTERED = (0x2FFF0000U | (0)); + + [NativeTypeName("#define SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN \"SDL.display.HDR_enabled\"")] + public static ReadOnlySpan SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN => "SDL.display.HDR_enabled"u8; + + [NativeTypeName("#define SDL_PROP_DISPLAY_SDR_WHITE_POINT_FLOAT \"SDL.display.SDR_white_point\"")] + public static ReadOnlySpan SDL_PROP_DISPLAY_SDR_WHITE_POINT_FLOAT => "SDL.display.SDR_white_point"u8; + + [NativeTypeName("#define SDL_PROP_DISPLAY_HDR_HEADROOM_FLOAT \"SDL.display.HDR_headroom\"")] + public static ReadOnlySpan SDL_PROP_DISPLAY_HDR_HEADROOM_FLOAT => "SDL.display.HDR_headroom"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN \"always_on_top\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN => "always_on_top"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN \"borderless\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN => "borderless"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN \"focusable\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN => "focusable"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN \"external_graphics_context\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN => "external_graphics_context"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN \"fullscreen\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN => "fullscreen"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER \"height\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER => "height"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN \"hidden\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN => "hidden"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN \"high_pixel_density\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN => "high_pixel_density"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN \"maximized\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN => "maximized"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN \"menu\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN => "menu"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN \"metal\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN => "metal"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN \"minimized\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN => "minimized"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN \"mouse_grabbed\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN => "mouse_grabbed"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN \"opengl\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN => "opengl"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_PARENT_POINTER \"parent\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_PARENT_POINTER => "parent"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN \"resizable\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN => "resizable"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_TITLE_STRING \"title\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_TITLE_STRING => "title"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN \"transparent\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN => "transparent"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN \"tooltip\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN => "tooltip"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN \"utility\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN => "utility"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN \"vulkan\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN => "vulkan"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER \"width\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER => "width"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_X_NUMBER \"x\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_X_NUMBER => "x"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_Y_NUMBER \"y\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_Y_NUMBER => "y"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER \"cocoa.window\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER => "cocoa.window"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER \"cocoa.view\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER => "cocoa.view"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_WAYLAND_SCALE_TO_DISPLAY_BOOLEAN \"wayland.scale_to_display\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_WAYLAND_SCALE_TO_DISPLAY_BOOLEAN => "wayland.scale_to_display"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN \"wayland.surface_role_custom\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN => "wayland.surface_role_custom"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN \"wayland.create_egl_window\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN => "wayland.create_egl_window"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER \"wayland.wl_surface\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER => "wayland.wl_surface"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER \"win32.hwnd\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER => "win32.hwnd"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER \"win32.pixel_format_hwnd\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER => "win32.pixel_format_hwnd"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER \"x11.window\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER => "x11.window"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_SHAPE_POINTER \"SDL.window.shape\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_SHAPE_POINTER => "SDL.window.shape"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER \"SDL.window.android.window\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER => "SDL.window.android.window"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER \"SDL.window.android.surface\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER => "SDL.window.android.surface"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER \"SDL.window.uikit.window\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER => "SDL.window.uikit.window"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER \"SDL.window.uikit.metal_view_tag\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER => "SDL.window.uikit.metal_view_tag"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER \"SDL.window.kmsdrm.dev_index\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER => "SDL.window.kmsdrm.dev_index"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER \"SDL.window.kmsdrm.drm_fd\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER => "SDL.window.kmsdrm.drm_fd"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER \"SDL.window.kmsdrm.gbm_dev\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER => "SDL.window.kmsdrm.gbm_dev"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_COCOA_WINDOW_POINTER \"SDL.window.cocoa.window\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_COCOA_WINDOW_POINTER => "SDL.window.cocoa.window"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER \"SDL.window.cocoa.metal_view_tag\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER => "SDL.window.cocoa.metal_view_tag"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER \"SDL.window.vivante.display\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER => "SDL.window.vivante.display"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER \"SDL.window.vivante.window\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER => "SDL.window.vivante.window"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER \"SDL.window.vivante.surface\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER => "SDL.window.vivante.surface"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WINRT_WINDOW_POINTER \"SDL.window.winrt.window\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WINRT_WINDOW_POINTER => "SDL.window.winrt.window"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WIN32_HWND_POINTER \"SDL.window.win32.hwnd\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WIN32_HWND_POINTER => "SDL.window.win32.hwnd"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WIN32_HDC_POINTER \"SDL.window.win32.hdc\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WIN32_HDC_POINTER => "SDL.window.win32.hdc"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER \"SDL.window.win32.instance\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER => "SDL.window.win32.instance"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER \"SDL.window.wayland.display\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER => "SDL.window.wayland.display"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER \"SDL.window.wayland.surface\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER => "SDL.window.wayland.surface"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER \"SDL.window.wayland.egl_window\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER => "SDL.window.wayland.egl_window"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER \"SDL.window.wayland.xdg_surface\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER => "SDL.window.wayland.xdg_surface"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER \"SDL.window.wayland.xdg_toplevel\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER => "SDL.window.wayland.xdg_toplevel"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING \"SDL.window.wayland.xdg_toplevel_export_handle\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING => "SDL.window.wayland.xdg_toplevel_export_handle"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER \"SDL.window.wayland.xdg_popup\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER => "SDL.window.wayland.xdg_popup"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER \"SDL.window.wayland.xdg_positioner\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER => "SDL.window.wayland.xdg_positioner"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_X11_DISPLAY_POINTER \"SDL.window.x11.display\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_X11_DISPLAY_POINTER => "SDL.window.x11.display"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_X11_SCREEN_NUMBER \"SDL.window.x11.screen\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_X11_SCREEN_NUMBER => "SDL.window.x11.screen"u8; + + [NativeTypeName("#define SDL_PROP_WINDOW_X11_WINDOW_NUMBER \"SDL.window.x11.window\"")] + public static ReadOnlySpan SDL_PROP_WINDOW_X11_WINDOW_NUMBER => "SDL.window.x11.window"u8; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs new file mode 100644 index 0000000..7966c07 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs @@ -0,0 +1,62 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; + +namespace SDL +{ + public partial struct VkInstance_T + { + } + + public partial struct VkSurfaceKHR_T + { + } + + public partial struct VkAllocationCallbacks + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_Vulkan_LoadLibrary([NativeTypeName("const char *")] sbyte* path); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_FunctionPointer")] + public static extern delegate* unmanaged[Cdecl] SDL_Vulkan_GetVkGetInstanceProcAddr(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_Vulkan_UnloadLibrary(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *const *")] + public static extern sbyte** SDL_Vulkan_GetInstanceExtensions([NativeTypeName("Uint32 *")] uint* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + public static extern int SDL_Vulkan_CreateSurface(SDL_Window* window, [NativeTypeName("VkInstance")] VkInstance_T* instance, [NativeTypeName("const struct VkAllocationCallbacks *")] VkAllocationCallbacks* allocator, [NativeTypeName("VkSurfaceKHR *")] VkSurfaceKHR_T** surface); + } +} diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py new file mode 100644 index 0000000..f2107b3 --- /dev/null +++ b/SDL3-CS/generate_bindings.py @@ -0,0 +1,144 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +""" +Generates C# bindings for SDL3 using ClangSharp. + +Prerequisites: +- run `dotnet tool restore` (to install ClangSharpPInvokeGenerator) +- https://github.com/libsdl-org/SDL checked out alongside this repository + +This script should be run manually. +""" + +import pathlib +import subprocess + +SDL_root = pathlib.Path("../../SDL") +SDL_include_root = SDL_root / "include" +SDL3_header_base = "SDL3" # base folder of header files + +csproj_root = pathlib.Path(".") + + +class Header: + """Represents a SDL header file that is used in ClangSharp generation.""" + + def __init__(self, base: str, name: str): + assert base == SDL3_header_base + assert name.startswith("SDL") + assert not name.endswith(".h") + self.base = base + self.name = name + + def __str__(self): + return self.input_file() + + def sdl_api_name(self): + """Header name in sdl.json API dump.""" + return f"{self.name}.h" + + def input_file(self): + """Input header file relative to SDL_include_root.""" + return f"{self.base}/{self.name}.h" + + def output_file(self): + """Location of generated C# file.""" + return csproj_root / f"{self.base}/ClangSharp/{self.name}.g.cs" + + +def add(s: str): + base, name = s.split("/") + assert s.endswith(".h") + name = name.replace(".h", "") + return Header(base, name) + + +headers = [ + add("SDL3/SDL_atomic.h"), + add("SDL3/SDL_audio.h"), + add("SDL3/SDL_blendmode.h"), + add("SDL3/SDL_camera.h"), + add("SDL3/SDL_clipboard.h"), + add("SDL3/SDL_cpuinfo.h"), + add("SDL3/SDL_dialog.h"), + add("SDL3/SDL_error.h"), + add("SDL3/SDL_events.h"), + add("SDL3/SDL_filesystem.h"), + add("SDL3/SDL_gamepad.h"), + add("SDL3/SDL_guid.h"), + add("SDL3/SDL_haptic.h"), + add("SDL3/SDL_hidapi.h"), + add("SDL3/SDL_hints.h"), + add("SDL3/SDL_init.h"), + add("SDL3/SDL_iostream.h"), + add("SDL3/SDL_joystick.h"), + add("SDL3/SDL_keyboard.h"), + add("SDL3/SDL_keycode.h"), + add("SDL3/SDL_loadso.h"), + add("SDL3/SDL_locale.h"), + add("SDL3/SDL_log.h"), + add("SDL3/SDL_main.h"), + add("SDL3/SDL_messagebox.h"), + add("SDL3/SDL_metal.h"), + add("SDL3/SDL_misc.h"), + add("SDL3/SDL_mouse.h"), + add("SDL3/SDL_mutex.h"), + add("SDL3/SDL_pen.h"), + add("SDL3/SDL_pixels.h"), + add("SDL3/SDL_platform.h"), + add("SDL3/SDL_power.h"), + add("SDL3/SDL_properties.h"), + add("SDL3/SDL_quit.h"), + add("SDL3/SDL_rect.h"), + add("SDL3/SDL_render.h"), + add("SDL3/SDL_revision.h"), + add("SDL3/SDL_scancode.h"), + add("SDL3/SDL_sensor.h"), + add("SDL3/SDL_stdinc.h"), + add("SDL3/SDL_storage.h"), + add("SDL3/SDL_surface.h"), + add("SDL3/SDL_system.h"), + add("SDL3/SDL_thread.h"), + add("SDL3/SDL_time.h"), + add("SDL3/SDL_timer.h"), + add("SDL3/SDL_touch.h"), + add("SDL3/SDL_version.h"), + add("SDL3/SDL_video.h"), + add("SDL3/SDL_vulkan.h"), +] + +base_command = [ + "dotnet", "tool", "run", "ClangSharpPInvokeGenerator", + "--headerFile", csproj_root / "SDL.licenseheader", + + "--config", + "latest-codegen", + "windows-types", + "generate-macro-bindings", + "log-potential-typedef-remappings", + + "--file-directory", SDL_include_root, + "--include-directory", SDL_include_root, + "--libraryPath", "SDL3", + "--methodClassName", "SDL3", + "--namespace", "SDL", +] + + +def run_clangsharp(command, header: Header): + cmd = command + [ + "--file", header.input_file(), + "--output", header.output_file(), + ] + + subprocess.run(cmd) + + +def main(): + for header in headers: + run_clangsharp(base_command, header) + + +if __name__ == "__main__": + main() From 72353a8ab9cb447879daad5e9cff8986581296de Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 00:12:39 +0200 Subject: [PATCH 03/37] Undefine _WIN32 to generate only platform-agnostic APIs Probably needs similar undefines on Linux and macOS. Notice that the signatures of `SDL_CreateThread` and `SDL_CreateThreadWithStackSize` have changed. --- SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs | 10 ++++----- SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs | 12 +++++------ SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs | 9 -------- SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 24 ++++++++++----------- SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs | 20 ++++++++--------- SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs | 14 ------------ SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs | 12 +++-------- SDL3-CS/generate_bindings.py | 3 +++ 9 files changed, 40 insertions(+), 66 deletions(-) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs index ba7b2f9..91172e0 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs @@ -40,19 +40,19 @@ public enum SDL_IOStatus public unsafe partial struct SDL_IOStreamInterface { - [NativeTypeName("Sint64 (*)(void *) __attribute__((cdecl))")] + [NativeTypeName("Sint64 (*)(void *)")] public delegate* unmanaged[Cdecl] size; - [NativeTypeName("Sint64 (*)(void *, Sint64, int) __attribute__((cdecl))")] + [NativeTypeName("Sint64 (*)(void *, Sint64, int)")] public delegate* unmanaged[Cdecl] seek; - [NativeTypeName("size_t (*)(void *, void *, size_t, SDL_IOStatus *) __attribute__((cdecl))")] + [NativeTypeName("size_t (*)(void *, void *, size_t, SDL_IOStatus *)")] public delegate* unmanaged[Cdecl] read; - [NativeTypeName("size_t (*)(void *, const void *, size_t, SDL_IOStatus *) __attribute__((cdecl))")] + [NativeTypeName("size_t (*)(void *, const void *, size_t, SDL_IOStatus *)")] public delegate* unmanaged[Cdecl] write; - [NativeTypeName("int (*)(void *) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *)")] public delegate* unmanaged[Cdecl] close; } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs index fc646fb..229c0bb 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs @@ -91,22 +91,22 @@ public unsafe partial struct SDL_VirtualJoystickDesc public void* userdata; - [NativeTypeName("void (*)(void *) __attribute__((cdecl))")] + [NativeTypeName("void (*)(void *)")] public delegate* unmanaged[Cdecl] Update; - [NativeTypeName("void (*)(void *, int) __attribute__((cdecl))")] + [NativeTypeName("void (*)(void *, int)")] public delegate* unmanaged[Cdecl] SetPlayerIndex; - [NativeTypeName("int (*)(void *, Uint16, Uint16) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, Uint16, Uint16)")] public delegate* unmanaged[Cdecl] Rumble; - [NativeTypeName("int (*)(void *, Uint16, Uint16) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, Uint16, Uint16)")] public delegate* unmanaged[Cdecl] RumbleTriggers; - [NativeTypeName("int (*)(void *, Uint8, Uint8, Uint8) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, Uint8, Uint8, Uint8)")] public delegate* unmanaged[Cdecl] SetLED; - [NativeTypeName("int (*)(void *, const void *, int) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, const void *, int)")] public delegate* unmanaged[Cdecl] SendEffect; } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs index b2ee8e4..cfa292a 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs @@ -40,14 +40,5 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_EnterAppMainCallbacks(int argc, [NativeTypeName("char *[]")] sbyte** argv, [NativeTypeName("SDL_AppInit_func")] delegate* unmanaged[Cdecl] appinit, [NativeTypeName("SDL_AppIterate_func")] delegate* unmanaged[Cdecl] appiter, [NativeTypeName("SDL_AppEvent_func")] delegate* unmanaged[Cdecl] appevent, [NativeTypeName("SDL_AppQuit_func")] delegate* unmanaged[Cdecl] appquit); - - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_RegisterApp([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("Uint32")] uint style, void* hInst); - - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_UnregisterApp(); - - [NativeTypeName("#define main SDL_main")] - public static readonly delegate* main = &SDL_main; } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs index 744c198..21b85b1 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs @@ -57,7 +57,7 @@ public static unsafe partial class SDL3 public static extern void SDL_UnlockProperties([NativeTypeName("SDL_PropertiesID")] uint props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetPropertyWithCleanup([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, void* value, [NativeTypeName("void (*)(void *, void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] cleanup, void* userdata); + public static extern int SDL_SetPropertyWithCleanup([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, void* value, [NativeTypeName("void (*)(void *, void *)")] delegate* unmanaged[Cdecl] cleanup, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, void* value); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index 1aa064b..0582c1e 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -77,16 +77,16 @@ public static unsafe partial class SDL3 public static extern int SDL_setenv([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* value, int overwrite); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_qsort(void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] compare); + public static extern void SDL_qsort(void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *)")] delegate* unmanaged[Cdecl] compare); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_bsearch([NativeTypeName("const void *")] void* key, [NativeTypeName("const void *")] void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] compare); + public static extern void* SDL_bsearch([NativeTypeName("const void *")] void* key, [NativeTypeName("const void *")] void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *)")] delegate* unmanaged[Cdecl] compare); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_qsort_r(void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(void *, const void *, const void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] compare, void* userdata); + public static extern void SDL_qsort_r(void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(void *, const void *, const void *)")] delegate* unmanaged[Cdecl] compare, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_bsearch_r([NativeTypeName("const void *")] void* key, [NativeTypeName("const void *")] void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(void *, const void *, const void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] compare, void* userdata); + public static extern void* SDL_bsearch_r([NativeTypeName("const void *")] void* key, [NativeTypeName("const void *")] void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(void *, const void *, const void *)")] delegate* unmanaged[Cdecl] compare, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_abs(int x); @@ -612,17 +612,17 @@ public static int SDL_size_add_overflow_builtin([NativeTypeName("size_t")] nuint [NativeTypeName("#define SDL_FLT_EPSILON 1.1920928955078125e-07F")] public const float SDL_FLT_EPSILON = 1.1920928955078125e-07F; - [NativeTypeName("#define SDL_PRIs64 \"I64d\"")] - public static ReadOnlySpan SDL_PRIs64 => "I64d"u8; + [NativeTypeName("#define SDL_PRIs64 \"lld\"")] + public static ReadOnlySpan SDL_PRIs64 => "lld"u8; - [NativeTypeName("#define SDL_PRIu64 \"I64u\"")] - public static ReadOnlySpan SDL_PRIu64 => "I64u"u8; + [NativeTypeName("#define SDL_PRIu64 \"llu\"")] + public static ReadOnlySpan SDL_PRIu64 => "llu"u8; - [NativeTypeName("#define SDL_PRIx64 \"I64x\"")] - public static ReadOnlySpan SDL_PRIx64 => "I64x"u8; + [NativeTypeName("#define SDL_PRIx64 \"llx\"")] + public static ReadOnlySpan SDL_PRIx64 => "llx"u8; - [NativeTypeName("#define SDL_PRIX64 \"I64X\"")] - public static ReadOnlySpan SDL_PRIX64 => "I64X"u8; + [NativeTypeName("#define SDL_PRIX64 \"llX\"")] + public static ReadOnlySpan SDL_PRIX64 => "llX"u8; [NativeTypeName("#define SDL_PRIs32 \"d\"")] public static ReadOnlySpan SDL_PRIs32 => "d"u8; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs index 67af419..845189b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs @@ -29,34 +29,34 @@ namespace SDL { public unsafe partial struct SDL_StorageInterface { - [NativeTypeName("int (*)(void *) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *)")] public delegate* unmanaged[Cdecl] close; - [NativeTypeName("SDL_bool (*)(void *) __attribute__((cdecl))")] + [NativeTypeName("SDL_bool (*)(void *)")] public delegate* unmanaged[Cdecl] ready; - [NativeTypeName("int (*)(void *, const char *, SDL_EnumerateDirectoryCallback, void *) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, const char *, SDL_EnumerateDirectoryCallback, void *)")] public delegate* unmanaged[Cdecl], void*, int> enumerate; - [NativeTypeName("int (*)(void *, const char *, SDL_PathInfo *) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, const char *, SDL_PathInfo *)")] public delegate* unmanaged[Cdecl] info; - [NativeTypeName("int (*)(void *, const char *, void *, Uint64) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, const char *, void *, Uint64)")] public delegate* unmanaged[Cdecl] read_file; - [NativeTypeName("int (*)(void *, const char *, const void *, Uint64) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, const char *, const void *, Uint64)")] public delegate* unmanaged[Cdecl] write_file; - [NativeTypeName("int (*)(void *, const char *) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, const char *)")] public delegate* unmanaged[Cdecl] mkdir; - [NativeTypeName("int (*)(void *, const char *) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, const char *)")] public delegate* unmanaged[Cdecl] remove; - [NativeTypeName("int (*)(void *, const char *, const char *) __attribute__((cdecl))")] + [NativeTypeName("int (*)(void *, const char *, const char *)")] public delegate* unmanaged[Cdecl] rename; - [NativeTypeName("Uint64 (*)(void *) __attribute__((cdecl))")] + [NativeTypeName("Uint64 (*)(void *)")] public delegate* unmanaged[Cdecl] space_remaining; } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs index f077d73..c16946f 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs @@ -27,10 +27,6 @@ 3. This notice may not be removed or altered from any source distribution. namespace SDL { - public partial struct tagMSG - { - } - [StructLayout(LayoutKind.Explicit)] public partial struct _XEvent { @@ -38,16 +34,6 @@ public partial struct _XEvent public static unsafe partial class SDL3 { - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl] callback, void* userdata); - - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_Direct3D9GetAdapterIndex([NativeTypeName("SDL_DisplayID")] uint displayID); - - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_DXGIGetOutputInfo([NativeTypeName("SDL_DisplayID")] uint displayID, int* adapterIndex, int* outputIndex); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_SetX11EventHook([NativeTypeName("SDL_X11EventHook")] delegate* unmanaged[Cdecl] callback, void* userdata); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs index a0fecc7..94d428b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs @@ -42,10 +42,10 @@ public enum SDL_ThreadPriority public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Thread* SDL_CreateThread([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] sbyte* name, void* data, [NativeTypeName("pfnSDL_CurrentBeginThread")] delegate* unmanaged[Cdecl], void*, uint, uint*, nuint> pfnBeginThread, [NativeTypeName("pfnSDL_CurrentEndThread")] delegate* unmanaged[Cdecl] pfnEndThread); + public static extern SDL_Thread* SDL_CreateThread([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] sbyte* name, void* data); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Thread* SDL_CreateThreadWithStackSize([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const size_t")] nuint stacksize, void* data, [NativeTypeName("pfnSDL_CurrentBeginThread")] delegate* unmanaged[Cdecl], void*, uint, uint*, nuint> pfnBeginThread, [NativeTypeName("pfnSDL_CurrentEndThread")] delegate* unmanaged[Cdecl] pfnEndThread); + public static extern SDL_Thread* SDL_CreateThreadWithStackSize([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const size_t")] nuint stacksize, void* data); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] @@ -76,15 +76,9 @@ public static unsafe partial class SDL3 public static extern void* SDL_GetTLS([NativeTypeName("SDL_TLSID")] uint id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetTLS([NativeTypeName("SDL_TLSID")] uint id, [NativeTypeName("const void *")] void* value, [NativeTypeName("void (*)(void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl] destructor); + public static extern int SDL_SetTLS([NativeTypeName("SDL_TLSID")] uint id, [NativeTypeName("const void *")] void* value, [NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] destructor); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_CleanupTLS(); - - [NativeTypeName("#define SDL_beginthread _beginthreadex")] - public static readonly delegate*, void*, uint, uint*, nuint> SDL_beginthread = &_beginthreadex; - - [NativeTypeName("#define SDL_endthread _endthreadex")] - public static readonly delegate* SDL_endthread = &_endthreadex; } } diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index f2107b3..aebde99 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -123,6 +123,9 @@ def add(s: str): "--libraryPath", "SDL3", "--methodClassName", "SDL3", "--namespace", "SDL", + + "--additional", + "--undefine-macro=_WIN32", ] From efc9422f7cff235f2f305de599c5a5d360ca8134 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 00:30:02 +0200 Subject: [PATCH 04/37] Fix errors in `SDL_pixels.g.cs` by specifying enum types --- .gitignore | 1 - SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs | 44 +++++++++++++------------ SDL3-CS/SDL3/SDL_pixels.rsp | 7 ++++ SDL3-CS/generate_bindings.py | 8 +++++ 4 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 SDL3-CS/SDL3/SDL_pixels.rsp diff --git a/.gitignore b/.gitignore index 04449cd..1034323 100644 --- a/.gitignore +++ b/.gitignore @@ -53,7 +53,6 @@ artifacts/ *.pdb *.pgc *.pgd -*.rsp *.sbr *.tlb *.tli diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs index 54913e7..4d3542e 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs @@ -100,7 +100,8 @@ public enum SDL_PackedLayout SDL_PACKEDLAYOUT_1010102, } - public enum SDL_PixelFormatEnum + [NativeTypeName("int")] + public enum SDL_PixelFormatEnum : uint { SDL_PIXELFORMAT_UNKNOWN, SDL_PIXELFORMAT_INDEX1LSB = ((1 << 28) | ((SDL_PIXELTYPE_INDEX1) << 24) | ((SDL_BITMAPORDER_4321) << 20) | ((0) << 16) | ((1) << 8) | ((0) << 0)), @@ -169,15 +170,15 @@ public enum SDL_PixelFormatEnum SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_BGRX8888, SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_RGBX8888, - SDL_PIXELFORMAT_YV12 = unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('2')) << 24)), - SDL_PIXELFORMAT_IYUV = unchecked(((uint)((byte)('I')) << 0) | ((uint)((byte)('Y')) << 8) | ((uint)((byte)('U')) << 16) | ((uint)((byte)('V')) << 24)), - SDL_PIXELFORMAT_YUY2 = unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('U')) << 8) | ((uint)((byte)('Y')) << 16) | ((uint)((byte)('2')) << 24)), - SDL_PIXELFORMAT_UYVY = unchecked(((uint)((byte)('U')) << 0) | ((uint)((byte)('Y')) << 8) | ((uint)((byte)('V')) << 16) | ((uint)((byte)('Y')) << 24)), - SDL_PIXELFORMAT_YVYU = unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('Y')) << 16) | ((uint)((byte)('U')) << 24)), - SDL_PIXELFORMAT_NV12 = unchecked(((uint)((byte)('N')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('2')) << 24)), - SDL_PIXELFORMAT_NV21 = unchecked(((uint)((byte)('N')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('2')) << 16) | ((uint)((byte)('1')) << 24)), - SDL_PIXELFORMAT_P010 = unchecked(((uint)((byte)('P')) << 0) | ((uint)((byte)('0')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('0')) << 24)), - SDL_PIXELFORMAT_EXTERNAL_OES = unchecked(((uint)((byte)('O')) << 0) | ((uint)((byte)('E')) << 8) | ((uint)((byte)('S')) << 16) | ((uint)((byte)(' ')) << 24)), + SDL_PIXELFORMAT_YV12 = (unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('2')) << 24))), + SDL_PIXELFORMAT_IYUV = (unchecked(((uint)((byte)('I')) << 0) | ((uint)((byte)('Y')) << 8) | ((uint)((byte)('U')) << 16) | ((uint)((byte)('V')) << 24))), + SDL_PIXELFORMAT_YUY2 = (unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('U')) << 8) | ((uint)((byte)('Y')) << 16) | ((uint)((byte)('2')) << 24))), + SDL_PIXELFORMAT_UYVY = (unchecked(((uint)((byte)('U')) << 0) | ((uint)((byte)('Y')) << 8) | ((uint)((byte)('V')) << 16) | ((uint)((byte)('Y')) << 24))), + SDL_PIXELFORMAT_YVYU = (unchecked(((uint)((byte)('Y')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('Y')) << 16) | ((uint)((byte)('U')) << 24))), + SDL_PIXELFORMAT_NV12 = (unchecked(((uint)((byte)('N')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('2')) << 24))), + SDL_PIXELFORMAT_NV21 = (unchecked(((uint)((byte)('N')) << 0) | ((uint)((byte)('V')) << 8) | ((uint)((byte)('2')) << 16) | ((uint)((byte)('1')) << 24))), + SDL_PIXELFORMAT_P010 = (unchecked(((uint)((byte)('P')) << 0) | ((uint)((byte)('0')) << 8) | ((uint)((byte)('1')) << 16) | ((uint)((byte)('0')) << 24))), + SDL_PIXELFORMAT_EXTERNAL_OES = (unchecked(((uint)((byte)('O')) << 0) | ((uint)((byte)('E')) << 8) | ((uint)((byte)('S')) << 16) | ((uint)((byte)(' ')) << 24))), } public enum SDL_ColorType @@ -262,19 +263,20 @@ public enum SDL_ChromaLocation SDL_CHROMA_LOCATION_TOPLEFT = 3, } - public enum SDL_Colorspace + [NativeTypeName("int")] + public enum SDL_Colorspace : uint { SDL_COLORSPACE_UNKNOWN, - SDL_COLORSPACE_SRGB = unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_SRGB) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0)), - SDL_COLORSPACE_SRGB_LINEAR = unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_LINEAR) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0)), - SDL_COLORSPACE_HDR10 = unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0)), - SDL_COLORSPACE_JPEG = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0)), - SDL_COLORSPACE_BT601_LIMITED = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT601) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0)), - SDL_COLORSPACE_BT601_FULL = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT601) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0)), - SDL_COLORSPACE_BT709_LIMITED = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT709) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT709) << 0)), - SDL_COLORSPACE_BT709_FULL = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT709) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT709) << 0)), - SDL_COLORSPACE_BT2020_LIMITED = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT2020_NCL) << 0)), - SDL_COLORSPACE_BT2020_FULL = unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT2020_NCL) << 0)), + SDL_COLORSPACE_SRGB = (unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_SRGB) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0))), + SDL_COLORSPACE_SRGB_LINEAR = (unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_LINEAR) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0))), + SDL_COLORSPACE_HDR10 = (unchecked(((uint)(SDL_COLOR_TYPE_RGB) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_IDENTITY) << 0))), + SDL_COLORSPACE_JPEG = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_NONE) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0))), + SDL_COLORSPACE_BT601_LIMITED = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT601) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0))), + SDL_COLORSPACE_BT601_FULL = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT601) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT601) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT601) << 0))), + SDL_COLORSPACE_BT709_LIMITED = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT709) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT709) << 0))), + SDL_COLORSPACE_BT709_FULL = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT709) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_BT709) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT709) << 0))), + SDL_COLORSPACE_BT2020_LIMITED = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_LIMITED) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT2020_NCL) << 0))), + SDL_COLORSPACE_BT2020_FULL = (unchecked(((uint)(SDL_COLOR_TYPE_YCBCR) << 28) | ((uint)(SDL_COLOR_RANGE_FULL) << 24) | ((uint)(SDL_CHROMA_LOCATION_LEFT) << 20) | ((uint)(SDL_COLOR_PRIMARIES_BT2020) << 10) | ((uint)(SDL_TRANSFER_CHARACTERISTICS_PQ) << 5) | ((uint)(SDL_MATRIX_COEFFICIENTS_BT2020_NCL) << 0))), SDL_COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_SRGB, SDL_COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_JPEG, } diff --git a/SDL3-CS/SDL3/SDL_pixels.rsp b/SDL3-CS/SDL3/SDL_pixels.rsp new file mode 100644 index 0000000..cb9544c --- /dev/null +++ b/SDL3-CS/SDL3/SDL_pixels.rsp @@ -0,0 +1,7 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +# Fix errors with uint -> int conversion +--with-type +SDL_Colorspace=uint +SDL_PixelFormatEnum=uint diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index aebde99..bc67bbf 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -46,6 +46,10 @@ def output_file(self): """Location of generated C# file.""" return csproj_root / f"{self.base}/ClangSharp/{self.name}.g.cs" + def rsp_files(self): + """Location of ClangSharp response files.""" + yield csproj_root / f"{self.base}/{self.name}.rsp" + def add(s: str): base, name = s.split("/") @@ -135,6 +139,10 @@ def run_clangsharp(command, header: Header): "--output", header.output_file(), ] + for rsp in header.rsp_files(): + if rsp.is_file(): + cmd.append(f"@{rsp}") + subprocess.run(cmd) From 4fbe435cbe94c57fa333671560cd9024708f2bba Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 00:30:30 +0200 Subject: [PATCH 05/37] Fix errors in `SDL_stdinc.g.cs` with define magic --- SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 27 ------------------------- SDL3-CS/SDL3/SDL_stdinc.rsp | 12 +++++++++++ 2 files changed, 12 insertions(+), 27 deletions(-) create mode 100644 SDL3-CS/SDL3/SDL_stdinc.rsp diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index 0582c1e..0ee5e82 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -517,11 +517,6 @@ public static int SDL_size_mul_overflow([NativeTypeName("size_t")] nuint a, [Nat return 0; } - public static int SDL_size_mul_overflow_builtin([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret) - { - return (__builtin_mul_overflow(a, b, ret)) ? 1 : 0 == 0 ? 0 : -1; - } - public static int SDL_size_add_overflow([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret) { if (b > 0xffffffffffffffffUL - a) @@ -533,19 +528,6 @@ public static int SDL_size_add_overflow([NativeTypeName("size_t")] nuint a, [Nat return 0; } - public static int SDL_size_add_overflow_builtin([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret) - { - return (__builtin_add_overflow(a, b, ret)) ? 1 : 0 == 0 ? 0 : -1; - } - - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("bool")] - public static extern byte __builtin_mul_overflow(__arglist); - - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("bool")] - public static extern byte __builtin_add_overflow(__arglist); - [NativeTypeName("#define SDL_SIZE_MAX SIZE_MAX")] public const ulong SDL_SIZE_MAX = 0xffffffffffffffffUL; @@ -636,15 +618,6 @@ public static int SDL_size_add_overflow_builtin([NativeTypeName("size_t")] nuint [NativeTypeName("#define SDL_PRIX32 \"X\"")] public static ReadOnlySpan SDL_PRIX32 => "X"u8; - [NativeTypeName("#define SDL_memcpy memcpy")] - public static readonly delegate* SDL_memcpy = &memcpy; - - [NativeTypeName("#define SDL_memmove memmove")] - public static readonly delegate* SDL_memmove = &memmove; - - [NativeTypeName("#define SDL_memset memset")] - public static readonly delegate* SDL_memset = &memset; - [NativeTypeName("#define SDL_PI_D 3.141592653589793238462643383279502884")] public const double SDL_PI_D = 3.141592653589793238462643383279502884; diff --git a/SDL3-CS/SDL3/SDL_stdinc.rsp b/SDL3-CS/SDL3/SDL_stdinc.rsp new file mode 100644 index 0000000..375011b --- /dev/null +++ b/SDL3-CS/SDL3/SDL_stdinc.rsp @@ -0,0 +1,12 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +# Prevent SDL memory functions from being defined to compiler intrinsic ones +--define-macro +SDL_SLOW_MEMCPY +SDL_SLOW_MEMMOVE +SDL_SLOW_MEMSET + +# Prevent SDL from using compiler intrinsics __builtin_mul_overflow and __builtin_add_overflow. +--additional +--undefine-macro=__has_builtin From 0fc701a1d983f16732f3fdd90c442d55476f2758 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 01:16:21 +0200 Subject: [PATCH 06/37] Add simple check for generated functions There are warnings for platform-specific functions. --- .gitignore | 2 ++ SDL3-CS/generate_bindings.py | 57 ++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1034323..2e2f897 100644 --- a/.gitignore +++ b/.gitignore @@ -335,3 +335,5 @@ fabric.properties # inspectcode inspectcodereport.xml inspectcode + +sdl.json diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index bc67bbf..577855d 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -11,8 +11,10 @@ This script should be run manually. """ +import json import pathlib import subprocess +import sys SDL_root = pathlib.Path("../../SDL") SDL_include_root = SDL_root / "include" @@ -24,12 +26,13 @@ class Header: """Represents a SDL header file that is used in ClangSharp generation.""" - def __init__(self, base: str, name: str): + def __init__(self, base: str, name: str, output_suffix=None): assert base == SDL3_header_base assert name.startswith("SDL") assert not name.endswith(".h") self.base = base self.name = name + self.output_suffix = output_suffix def __str__(self): return self.input_file() @@ -44,11 +47,16 @@ def input_file(self): def output_file(self): """Location of generated C# file.""" - return csproj_root / f"{self.base}/ClangSharp/{self.name}.g.cs" + if self.output_suffix is None: + return csproj_root / f"{self.base}/ClangSharp/{self.name}.g.cs" + else: + return csproj_root / f"{self.base}/ClangSharp/{self.name}.{self.output_suffix}.g.cs" def rsp_files(self): """Location of ClangSharp response files.""" yield csproj_root / f"{self.base}/{self.name}.rsp" + if self.output_suffix is not None: + yield csproj_root / f"{self.base}/{self.name}.{self.output_suffix}.rsp" def add(s: str): @@ -112,6 +120,45 @@ def add(s: str): add("SDL3/SDL_vulkan.h"), ] + +def get_sdl_api_dump(): + subprocess.run([ + sys.executable, + SDL_root / "src" / "dynapi" / "gendynapi.py", + "--dump" + ]) + + with open("sdl.json", "r", encoding="utf-8") as f: + return json.load(f) + + +def all_funcs_from_header(sdl_api, header): + for f in sdl_api: + if f["header"] == header.sdl_api_name(): + yield f + + +def get_text(file_paths): + text = "" + for path in file_paths: + with open(path, "r", encoding="utf-8") as f: + text += f.read() + + return text + + +def check_generated_functions(sdl_api, header, generated_file_paths): + """Checks that the generated C# files contain the expected function definitions.""" + all_files_text = get_text(generated_file_paths) + + for func in all_funcs_from_header(sdl_api, header): + name = func["name"] + found = f"{name}(" in all_files_text + + if not found: + print(f"[⚠️ Warning] Function {name} not found in generated files:", *generated_file_paths) + + base_command = [ "dotnet", "tool", "run", "ClangSharpPInvokeGenerator", "--headerFile", csproj_root / "SDL.licenseheader", @@ -144,11 +191,15 @@ def run_clangsharp(command, header: Header): cmd.append(f"@{rsp}") subprocess.run(cmd) + return header.output_file() def main(): + sdl_api = get_sdl_api_dump() + for header in headers: - run_clangsharp(base_command, header) + output_file = run_clangsharp(base_command, header) + check_generated_functions(sdl_api, header, [output_file]) if __name__ == "__main__": From 2ccdcb04b34df18526d88f3e3f5119f05699ca4b Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 01:31:08 +0200 Subject: [PATCH 07/37] Add platform specific generation for `SDL_main.h` and `SDL_system.h` Doesn't compile because of duplicate `_XEvent` definitions. Linux fails crossgen on Windows due to missing `endian.h` --- SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs | 48 +++++++++ .../SDL3/ClangSharp/SDL_system.Android.g.cs | 101 ++++++++++++++++++ SDL3-CS/SDL3/ClangSharp/SDL_system.Linux.g.cs | 0 SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs | 68 ++++++++++++ .../SDL3/ClangSharp/SDL_system.Windows.g.cs | 71 ++++++++++++ SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs | 50 +++++++++ SDL3-CS/generate_bindings.py | 53 ++++++++- 7 files changed, 389 insertions(+), 2 deletions(-) create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_system.Linux.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs new file mode 100644 index 0000000..c7cd868 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs @@ -0,0 +1,48 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern int SDL_RegisterApp([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("Uint32")] uint style, void* hInst); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern void SDL_UnregisterApp(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern void SDL_GDKSuspendComplete(); + + [NativeTypeName("#define main SDL_main")] + public static readonly delegate* main = &SDL_main; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs new file mode 100644 index 0000000..b28f7a1 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs @@ -0,0 +1,101 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace SDL +{ + [StructLayout(LayoutKind.Explicit)] + public partial struct _XEvent + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern void* SDL_AndroidGetJNIEnv(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern void* SDL_AndroidGetActivity(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern int SDL_GetAndroidSDKVersion(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + [SupportedOSPlatform("Android")] + public static extern int SDL_IsAndroidTV(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + [SupportedOSPlatform("Android")] + public static extern int SDL_IsChromebook(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + [SupportedOSPlatform("Android")] + public static extern int SDL_IsDeXMode(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern void SDL_AndroidBackButton(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + [SupportedOSPlatform("Android")] + public static extern sbyte* SDL_AndroidGetInternalStoragePath(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern int SDL_AndroidGetExternalStorageState([NativeTypeName("Uint32 *")] uint* state); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + [SupportedOSPlatform("Android")] + public static extern sbyte* SDL_AndroidGetExternalStoragePath(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern int SDL_AndroidRequestPermission([NativeTypeName("const char *")] sbyte* permission, [NativeTypeName("SDL_AndroidRequestPermissionCallback")] delegate* unmanaged[Cdecl] cb, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern int SDL_AndroidShowToast([NativeTypeName("const char *")] sbyte* message, int duration, int gravity, int xoffset, int yoffset); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern int SDL_AndroidSendMessage([NativeTypeName("Uint32")] uint command, int param1); + + [NativeTypeName("#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01")] + public const int SDL_ANDROID_EXTERNAL_STORAGE_READ = 0x01; + + [NativeTypeName("#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02")] + public const int SDL_ANDROID_EXTERNAL_STORAGE_WRITE = 0x02; + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Linux.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Linux.g.cs new file mode 100644 index 0000000..e69de29 diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs new file mode 100644 index 0000000..1d1e376 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs @@ -0,0 +1,68 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace SDL +{ + [StructLayout(LayoutKind.Explicit)] + public partial struct _XEvent + { + } + + public enum SDL_WinRT_Path + { + SDL_WINRT_PATH_INSTALLED_LOCATION, + SDL_WINRT_PATH_LOCAL_FOLDER, + SDL_WINRT_PATH_ROAMING_FOLDER, + SDL_WINRT_PATH_TEMP_FOLDER, + } + + public enum SDL_WinRT_DeviceFamily + { + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + SDL_WINRT_DEVICEFAMILY_DESKTOP, + SDL_WINRT_DEVICEFAMILY_MOBILE, + SDL_WINRT_DEVICEFAMILY_XBOX, + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const wchar_t *")] + [SupportedOSPlatform("Windows")] + public static extern ushort* SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + [SupportedOSPlatform("Windows")] + public static extern sbyte* SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern SDL_WinRT_DeviceFamily SDL_WinRTGetDeviceFamily(); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs new file mode 100644 index 0000000..4808a2a --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs @@ -0,0 +1,71 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace SDL +{ + public partial struct tagMSG + { + } + + [StructLayout(LayoutKind.Explicit)] + public partial struct _XEvent + { + } + + public partial struct XTaskQueueObject + { + } + + public partial struct XUser + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl] callback, void* userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern int SDL_Direct3D9GetAdapterIndex([NativeTypeName("SDL_DisplayID")] uint displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_bool")] + [SupportedOSPlatform("Windows")] + public static extern int SDL_DXGIGetOutputInfo([NativeTypeName("SDL_DisplayID")] uint displayID, int* adapterIndex, int* outputIndex); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern int SDL_GDKGetTaskQueue([NativeTypeName("XTaskQueueHandle *")] XTaskQueueObject** outTaskQueue); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern int SDL_GDKGetDefaultUser([NativeTypeName("XUserHandle *")] XUser** outUserHandle); + } +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs new file mode 100644 index 0000000..f031f25 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs @@ -0,0 +1,50 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace SDL +{ + [StructLayout(LayoutKind.Explicit)] + public partial struct _XEvent + { + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("iOS")] + public static extern int SDL_iPhoneSetAnimationCallback(SDL_Window* window, int interval, [NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] callback, void* callbackParam); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("iOS")] + public static extern void SDL_iPhoneSetEventPump([NativeTypeName("SDL_bool")] int enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("iOS")] + public static extern void SDL_OnApplicationDidChangeStatusBarOrientation(); + } +} diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 577855d..ec09944 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -13,6 +13,7 @@ import json import pathlib +import re import subprocess import sys @@ -90,7 +91,6 @@ def add(s: str): add("SDL3/SDL_loadso.h"), add("SDL3/SDL_locale.h"), add("SDL3/SDL_log.h"), - add("SDL3/SDL_main.h"), add("SDL3/SDL_messagebox.h"), add("SDL3/SDL_metal.h"), add("SDL3/SDL_misc.h"), @@ -110,7 +110,6 @@ def add(s: str): add("SDL3/SDL_stdinc.h"), add("SDL3/SDL_storage.h"), add("SDL3/SDL_surface.h"), - add("SDL3/SDL_system.h"), add("SDL3/SDL_thread.h"), add("SDL3/SDL_time.h"), add("SDL3/SDL_timer.h"), @@ -194,6 +193,43 @@ def run_clangsharp(command, header: Header): return header.output_file() +# regex for ClangSharp-generated SDL functions +generated_function_regex = re.compile(r"public static extern \w+\** (SDL_\w+)\(") + + +def get_generated_functions(file): + with open(file, "r", encoding="utf-8") as f: + for match in generated_function_regex.finditer(f.read()): + yield match.group(1) + + +def generate_platform_specific_headers(sdl_api, header: Header, platforms): + all_functions = list(all_funcs_from_header(sdl_api, header)) + + print(f"💠 {header} platform agnostic") + platform_agnostic_cs = run_clangsharp(base_command, header) + platform_agnostic_functions = list(get_generated_functions(platform_agnostic_cs)) + output_files = [platform_agnostic_cs] + + for (defines, suffix, platform_name) in platforms: + command = base_command + ["--define-macro"] + defines + + if platform_agnostic_functions: + command.append("--exclude") + command.extend(platform_agnostic_functions) + + if all_functions: + command.append("--with-attribute") + for f in all_functions: + command.append(f'{f["name"]}=SupportedOSPlatform("{platform_name}")') + + print(f"💠 {header} for {suffix}") + header.output_suffix = suffix + output_files.append(run_clangsharp(command, header)) + + check_generated_functions(sdl_api, header, output_files) + + def main(): sdl_api = get_sdl_api_dump() @@ -201,6 +237,19 @@ def main(): output_file = run_clangsharp(base_command, header) check_generated_functions(sdl_api, header, [output_file]) + generate_platform_specific_headers(sdl_api, add("SDL3/SDL_main.h"), [ + (["SDL_PLATFORM_WIN32", "SDL_PLATFORM_WINGDK"], "Windows", "Windows"), + ]) + + generate_platform_specific_headers(sdl_api, add("SDL3/SDL_system.h"), [ + # define macro, output_suffix, [SupportedOSPlatform] + (["SDL_PLATFORM_ANDROID"], "Android", "Android"), + (["SDL_PLATFORM_IOS"], "iOS", "iOS"), + (["SDL_PLATFORM_LINUX"], "Linux", "Linux"), + (["SDL_PLATFORM_WIN32", "SDL_PLATFORM_WINGDK"], "Windows", "Windows"), + (["SDL_PLATFORM_WINRT"], "WinRT", "Windows"), + ]) + if __name__ == "__main__": main() From cef2e24326d9d350e2db2783deac9b6d56490120 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 01:34:10 +0200 Subject: [PATCH 08/37] Fix duplicate `XEvent` struct definitions --- SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs | 5 ----- SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs | 5 ----- SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs | 5 ----- SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs | 8 ++------ SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs | 5 ----- SDL3-CS/SDL3/SDL_system.rsp | 10 ++++++++++ 6 files changed, 12 insertions(+), 26 deletions(-) create mode 100644 SDL3-CS/SDL3/SDL_system.rsp diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs index b28f7a1..a59ad8e 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs @@ -28,11 +28,6 @@ 3. This notice may not be removed or altered from any source distribution. namespace SDL { - [StructLayout(LayoutKind.Explicit)] - public partial struct _XEvent - { - } - public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs index 1d1e376..70842c3 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs @@ -28,11 +28,6 @@ 3. This notice may not be removed or altered from any source distribution. namespace SDL { - [StructLayout(LayoutKind.Explicit)] - public partial struct _XEvent - { - } - public enum SDL_WinRT_Path { SDL_WINRT_PATH_INSTALLED_LOCATION, diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs index 4808a2a..46b36af 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs @@ -32,11 +32,6 @@ public partial struct tagMSG { } - [StructLayout(LayoutKind.Explicit)] - public partial struct _XEvent - { - } - public partial struct XTaskQueueObject { } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs index c16946f..6664394 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs @@ -23,19 +23,15 @@ 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 { - [StructLayout(LayoutKind.Explicit)] - public partial struct _XEvent - { - } - public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetX11EventHook([NativeTypeName("SDL_X11EventHook")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern void SDL_SetX11EventHook([NativeTypeName("SDL_X11EventHook")] delegate* unmanaged[Cdecl] callback, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs index f031f25..3d9f7f5 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs @@ -28,11 +28,6 @@ 3. This notice may not be removed or altered from any source distribution. namespace SDL { - [StructLayout(LayoutKind.Explicit)] - public partial struct _XEvent - { - } - public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/SDL_system.rsp b/SDL3-CS/SDL3/SDL_system.rsp new file mode 100644 index 0000000..7dee284 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_system.rsp @@ -0,0 +1,10 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +# Exclude struct forward declaration +--exclude +_XEvent + +# Remap removed struct pointer to generic pointer +--remap +_XEvent*=IntPtr From ba561098e704af54b06710f90017f15478c2533b Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 01:37:05 +0200 Subject: [PATCH 09/37] Fix missing when cross-compiling on windows This works because SDL checks iff SDL_BYTEORDER isn't defined. https://github.com/libsdl-org/SDL/blob/6ad390fc5093bcbf785b7ad103484501d11d8c2a/include/SDL3/SDL_endian.h#L58-L60 --- SDL3-CS/SDL3/ClangSharp/SDL_system.Linux.g.cs | 41 +++++++++++++++++++ SDL3-CS/SDL3/SDL_system.Linux.rsp | 6 +++ 2 files changed, 47 insertions(+) create mode 100644 SDL3-CS/SDL3/SDL_system.Linux.rsp diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Linux.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Linux.g.cs index e69de29..b2c9e9e 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Linux.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Linux.g.cs @@ -0,0 +1,41 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace SDL +{ + public static partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Linux")] + public static extern int SDL_LinuxSetThreadPriority([NativeTypeName("Sint64")] long threadID, int priority); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Linux")] + public static extern int SDL_LinuxSetThreadPriorityAndPolicy([NativeTypeName("Sint64")] long threadID, int sdlPriority, int schedPolicy); + } +} diff --git a/SDL3-CS/SDL3/SDL_system.Linux.rsp b/SDL3-CS/SDL3/SDL_system.Linux.rsp new file mode 100644 index 0000000..dba8a0f --- /dev/null +++ b/SDL3-CS/SDL3/SDL_system.Linux.rsp @@ -0,0 +1,6 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +# Fix missing when cross-compiling on windows +--define-macro +SDL_BYTEORDER=SDL_LIL_ENDIAN From 52d13f29729b5c3b545227d141610d450f34c493 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 01:42:45 +0200 Subject: [PATCH 10/37] Add custom definition for win32 MSG struct The win32 types are kinda cursed, but it makes it easy to copy&paste and check. --- .../SDL3/ClangSharp/SDL_system.Windows.g.cs | 6 +--- SDL3-CS/SDL3/SDL_system.Windows.cs | 34 +++++++++++++++++++ SDL3-CS/SDL3/SDL_system.Windows.rsp | 10 ++++++ 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 SDL3-CS/SDL3/SDL_system.Windows.cs create mode 100644 SDL3-CS/SDL3/SDL_system.Windows.rsp diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs index 46b36af..b61aac4 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs @@ -28,10 +28,6 @@ 3. This notice may not be removed or altered from any source distribution. namespace SDL { - public partial struct tagMSG - { - } - public partial struct XTaskQueueObject { } @@ -44,7 +40,7 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] - public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl] callback, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] diff --git a/SDL3-CS/SDL3/SDL_system.Windows.cs b/SDL3-CS/SDL3/SDL_system.Windows.cs new file mode 100644 index 0000000..9f43b51 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_system.Windows.cs @@ -0,0 +1,34 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + // https://learn.microsoft.com/en-us/dotnet/standard/native-interop/best-practices#common-windows-data-types + using LONG = int; + using DWORD = uint; + using UINT = uint; + using HWND = IntPtr; + using WPARAM = UIntPtr; + using LPARAM = IntPtr; + + // https://learn.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point + public struct POINT + { + public LONG x; + public LONG y; + } + + // https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-msg + public struct MSG + { + public HWND hwnd; + public UINT message; + public WPARAM wParam; + public LPARAM lParam; + public DWORD time; + public POINT pt; + public DWORD lPrivate; + } +} diff --git a/SDL3-CS/SDL3/SDL_system.Windows.rsp b/SDL3-CS/SDL3/SDL_system.Windows.rsp new file mode 100644 index 0000000..1e5a359 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_system.Windows.rsp @@ -0,0 +1,10 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +# Exclude struct forward declaration +--exclude +tagMSG + +# ClangSharp recommended remapping +--remap +tagMSG=MSG From 4ed850c6f3adf3ede9ba4927a276ec669757e62b Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 01:59:38 +0200 Subject: [PATCH 11/37] Exclude `SDL_main()` from DllImport as it isn't exported by SDL3.dll --- SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs | 3 --- SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs | 3 --- SDL3-CS/SDL3/SDL_main.rsp | 7 +++++++ 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 SDL3-CS/SDL3/SDL_main.rsp diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs index c7cd868..4ae3a7e 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs @@ -41,8 +41,5 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] public static extern void SDL_GDKSuspendComplete(); - - [NativeTypeName("#define main SDL_main")] - public static readonly delegate* main = &SDL_main; } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs index cfa292a..182b503 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs @@ -29,9 +29,6 @@ namespace SDL { public static unsafe partial class SDL3 { - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_main(int argc, [NativeTypeName("char *[]")] sbyte** argv); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_SetMainReady(); diff --git a/SDL3-CS/SDL3/SDL_main.rsp b/SDL3-CS/SDL3/SDL_main.rsp new file mode 100644 index 0000000..7980895 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_main.rsp @@ -0,0 +1,7 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +# Exclude definition that are only useful when building C applications. +--exclude +SDL_main +main From a2178e0022ab829a2fef91c828c5c224775d69ff Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 12:22:50 +0200 Subject: [PATCH 12/37] Add recommended remapping for `SDL_hidapi.h` --- SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs | 36 ++++++++++++------------- SDL3-CS/SDL3/SDL_hidapi.rsp | 6 +++++ 2 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 SDL3-CS/SDL3/SDL_hidapi.rsp diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs index e687254..d762869 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs @@ -27,7 +27,7 @@ 3. This notice may not be removed or altered from any source distribution. namespace SDL { - public partial struct SDL_hid_device_ + public partial struct SDL_hid_device { } @@ -102,54 +102,52 @@ public static unsafe partial class SDL3 public static extern void SDL_hid_free_enumeration(SDL_hid_device_info* devs); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_hid_device *")] - public static extern SDL_hid_device_* SDL_hid_open([NativeTypeName("unsigned short")] ushort vendor_id, [NativeTypeName("unsigned short")] ushort product_id, [NativeTypeName("const wchar_t *")] ushort* serial_number); + public static extern SDL_hid_device* SDL_hid_open([NativeTypeName("unsigned short")] ushort vendor_id, [NativeTypeName("unsigned short")] ushort product_id, [NativeTypeName("const wchar_t *")] ushort* serial_number); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_hid_device *")] - public static extern SDL_hid_device_* SDL_hid_open_path([NativeTypeName("const char *")] sbyte* path); + public static extern SDL_hid_device* SDL_hid_open_path([NativeTypeName("const char *")] sbyte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_write([NativeTypeName("SDL_hid_device *")] 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); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_read_timeout([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length, int milliseconds); + public static extern int SDL_hid_read_timeout(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length, int milliseconds); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_read([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); + public static extern int SDL_hid_read(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_set_nonblocking([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, int nonblock); + public static extern int SDL_hid_set_nonblocking(SDL_hid_device* dev, int nonblock); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_send_feature_report([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("const unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); + public static extern int SDL_hid_send_feature_report(SDL_hid_device* dev, [NativeTypeName("const unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_feature_report([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); + public static extern int SDL_hid_get_feature_report(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_input_report([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); + public static extern int SDL_hid_get_input_report(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_close([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev); + public static extern int SDL_hid_close(SDL_hid_device* dev); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_manufacturer_string([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_hid_get_manufacturer_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_product_string([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_hid_get_product_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_serial_number_string([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_hid_get_serial_number_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_indexed_string([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, int string_index, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_hid_get_indexed_string(SDL_hid_device* dev, int string_index, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_hid_device_info* SDL_hid_get_device_info([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev); + public static extern SDL_hid_device_info* SDL_hid_get_device_info(SDL_hid_device* dev); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_report_descriptor([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* buf, [NativeTypeName("size_t")] nuint buf_size); + public static extern int SDL_hid_get_report_descriptor(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* buf, [NativeTypeName("size_t")] nuint buf_size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_hid_ble_scan([NativeTypeName("SDL_bool")] int active); diff --git a/SDL3-CS/SDL3/SDL_hidapi.rsp b/SDL3-CS/SDL3/SDL_hidapi.rsp new file mode 100644 index 0000000..8672c6a --- /dev/null +++ b/SDL3-CS/SDL3/SDL_hidapi.rsp @@ -0,0 +1,6 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +# ClangSharp recommended remapping +--remap +SDL_hid_device_=SDL_hid_device From 13b34fe88b1d9464a0104c00dc802afb1d8aa444 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 12:28:16 +0200 Subject: [PATCH 13/37] Remap `wchar_t *` to `IntPtr` These map to 16-bit `ushort` on windows, but are 32-bit on Unix. --- SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs | 17 +++++------ SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 28 +++++++++---------- SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs | 3 +- SDL3-CS/generate_bindings.py | 3 ++ 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs index d762869..a2e105f 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs @@ -23,6 +23,7 @@ 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 @@ -52,16 +53,16 @@ public unsafe partial struct SDL_hid_device_info public ushort product_id; [NativeTypeName("wchar_t *")] - public ushort* serial_number; + public IntPtr serial_number; [NativeTypeName("unsigned short")] public ushort release_number; [NativeTypeName("wchar_t *")] - public ushort* manufacturer_string; + public IntPtr manufacturer_string; [NativeTypeName("wchar_t *")] - public ushort* product_string; + public IntPtr product_string; [NativeTypeName("unsigned short")] public ushort usage_page; @@ -102,7 +103,7 @@ public static unsafe partial class SDL3 public static extern void SDL_hid_free_enumeration(SDL_hid_device_info* devs); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_hid_device* SDL_hid_open([NativeTypeName("unsigned short")] ushort vendor_id, [NativeTypeName("unsigned short")] ushort product_id, [NativeTypeName("const wchar_t *")] ushort* serial_number); + public static extern SDL_hid_device* SDL_hid_open([NativeTypeName("unsigned short")] ushort vendor_id, [NativeTypeName("unsigned short")] ushort product_id, [NativeTypeName("const wchar_t *")] IntPtr serial_number); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_hid_device* SDL_hid_open_path([NativeTypeName("const char *")] sbyte* path); @@ -132,16 +133,16 @@ public static unsafe partial class SDL3 public static extern int SDL_hid_close(SDL_hid_device* dev); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_manufacturer_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_hid_get_manufacturer_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] IntPtr @string, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_product_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_hid_get_product_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] IntPtr @string, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_serial_number_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_hid_get_serial_number_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] IntPtr @string, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_hid_get_indexed_string(SDL_hid_device* dev, int string_index, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_hid_get_indexed_string(SDL_hid_device* dev, int string_index, [NativeTypeName("wchar_t *")] IntPtr @string, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_hid_device_info* SDL_hid_get_device_info(SDL_hid_device* dev); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index 0ee5e82..c52c4e1 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -158,47 +158,47 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_wcslen([NativeTypeName("const wchar_t *")] ushort* wstr); + public static extern nuint SDL_wcslen([NativeTypeName("const wchar_t *")] IntPtr wstr); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_wcsnlen([NativeTypeName("const wchar_t *")] ushort* wstr, [NativeTypeName("size_t")] nuint maxlen); + public static extern nuint SDL_wcsnlen([NativeTypeName("const wchar_t *")] IntPtr wstr, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_wcslcpy([NativeTypeName("wchar_t *")] ushort* dst, [NativeTypeName("const wchar_t *")] ushort* src, [NativeTypeName("size_t")] nuint maxlen); + public static extern nuint SDL_wcslcpy([NativeTypeName("wchar_t *")] IntPtr dst, [NativeTypeName("const wchar_t *")] IntPtr src, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_wcslcat([NativeTypeName("wchar_t *")] ushort* dst, [NativeTypeName("const wchar_t *")] ushort* src, [NativeTypeName("size_t")] nuint maxlen); + public static extern nuint SDL_wcslcat([NativeTypeName("wchar_t *")] IntPtr dst, [NativeTypeName("const wchar_t *")] IntPtr src, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("wchar_t *")] - public static extern ushort* SDL_wcsdup([NativeTypeName("const wchar_t *")] ushort* wstr); + public static extern IntPtr SDL_wcsdup([NativeTypeName("const wchar_t *")] IntPtr wstr); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("wchar_t *")] - public static extern ushort* SDL_wcsstr([NativeTypeName("const wchar_t *")] ushort* haystack, [NativeTypeName("const wchar_t *")] ushort* needle); + public static extern IntPtr SDL_wcsstr([NativeTypeName("const wchar_t *")] IntPtr haystack, [NativeTypeName("const wchar_t *")] IntPtr needle); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("wchar_t *")] - public static extern ushort* SDL_wcsnstr([NativeTypeName("const wchar_t *")] ushort* haystack, [NativeTypeName("const wchar_t *")] ushort* needle, [NativeTypeName("size_t")] nuint maxlen); + public static extern IntPtr SDL_wcsnstr([NativeTypeName("const wchar_t *")] IntPtr haystack, [NativeTypeName("const wchar_t *")] IntPtr needle, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_wcscmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2); + public static extern int SDL_wcscmp([NativeTypeName("const wchar_t *")] IntPtr str1, [NativeTypeName("const wchar_t *")] IntPtr str2); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_wcsncmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_wcsncmp([NativeTypeName("const wchar_t *")] IntPtr str1, [NativeTypeName("const wchar_t *")] IntPtr str2, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_wcscasecmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2); + public static extern int SDL_wcscasecmp([NativeTypeName("const wchar_t *")] IntPtr str1, [NativeTypeName("const wchar_t *")] IntPtr str2); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_wcsncasecmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_wcsncasecmp([NativeTypeName("const wchar_t *")] IntPtr str1, [NativeTypeName("const wchar_t *")] IntPtr str2, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("long")] - public static extern int SDL_wcstol([NativeTypeName("const wchar_t *")] ushort* str, [NativeTypeName("wchar_t **")] ushort** endp, int @base); + public static extern int SDL_wcstol([NativeTypeName("const wchar_t *")] IntPtr str, [NativeTypeName("wchar_t **")] IntPtr* endp, int @base); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -343,13 +343,13 @@ public static unsafe partial class SDL3 public static extern int SDL_snprintf([NativeTypeName("char *")] sbyte* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const char *")] sbyte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_swprintf([NativeTypeName("wchar_t *")] ushort* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] ushort* fmt, __arglist); + public static extern int SDL_swprintf([NativeTypeName("wchar_t *")] IntPtr text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] IntPtr fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_vsnprintf([NativeTypeName("char *")] sbyte* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_vswprintf([NativeTypeName("wchar_t *")] ushort* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] ushort* fmt, [NativeTypeName("va_list")] sbyte* ap); + public static extern int SDL_vswprintf([NativeTypeName("wchar_t *")] IntPtr text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] IntPtr fmt, [NativeTypeName("va_list")] sbyte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_asprintf([NativeTypeName("char **")] sbyte** strp, [NativeTypeName("const char *")] sbyte* fmt, __arglist); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs index 70842c3..7774175 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs @@ -23,6 +23,7 @@ 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; using System.Runtime.Versioning; @@ -49,7 +50,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const wchar_t *")] [SupportedOSPlatform("Windows")] - public static extern ushort* SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType); + public static extern IntPtr SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index ec09944..2fd6dbb 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -174,6 +174,9 @@ def check_generated_functions(sdl_api, header, generated_file_paths): "--methodClassName", "SDL3", "--namespace", "SDL", + "--remap", + "wchar_t *=IntPtr", # wchar_t has a platform-defined size + "--additional", "--undefine-macro=_WIN32", ] From 53f98fece12838873b00665280d156b3a6d4ead9 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 12:31:32 +0200 Subject: [PATCH 14/37] Map C `char` to C# `byte` instead of `sbyte` This matches .NET's UTF-8 `ReadOnlySpan` (see `SDL_hints.g.cs`). --- SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs | 6 +- SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs | 14 +-- SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs | 10 +- SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs | 18 ++-- SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs | 40 ++++---- SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs | 14 +-- SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs | 16 ++-- SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs | 10 +- SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs | 22 ++--- SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_misc.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs | 30 +++--- SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs | 6 +- SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 94 +++++++++---------- SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs | 38 ++++---- SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs | 4 +- .../SDL3/ClangSharp/SDL_system.Android.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs | 6 +- SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs | 20 ++-- SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs | 4 +- SDL3-CS/generate_bindings.py | 1 + 40 files changed, 222 insertions(+), 221 deletions(-) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index 54a221f..2b12bef 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -48,11 +48,11 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetAudioDriver(int index); + public static extern byte* SDL_GetAudioDriver(int index); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetCurrentAudioDriver(); + public static extern byte* SDL_GetCurrentAudioDriver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_AudioDeviceID *")] @@ -64,7 +64,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_GetAudioDeviceName([NativeTypeName("SDL_AudioDeviceID")] uint devid); + public static extern byte* SDL_GetAudioDeviceName([NativeTypeName("SDL_AudioDeviceID")] uint devid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetAudioDeviceFormat([NativeTypeName("SDL_AudioDeviceID")] uint devid, SDL_AudioSpec* spec, int* sample_frames); @@ -164,7 +164,7 @@ public static unsafe partial class SDL3 public static extern int SDL_LoadWAV_IO(SDL_IOStream* src, [NativeTypeName("SDL_bool")] int closeio, SDL_AudioSpec* spec, [NativeTypeName("Uint8 **")] byte** audio_buf, [NativeTypeName("Uint32 *")] uint* audio_len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_LoadWAV([NativeTypeName("const char *")] sbyte* path, SDL_AudioSpec* spec, [NativeTypeName("Uint8 **")] byte** audio_buf, [NativeTypeName("Uint32 *")] uint* audio_len); + public static extern int SDL_LoadWAV([NativeTypeName("const char *")] byte* path, SDL_AudioSpec* spec, [NativeTypeName("Uint8 **")] byte** audio_buf, [NativeTypeName("Uint32 *")] uint* audio_len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_MixAudioFormat([NativeTypeName("Uint8 *")] byte* dst, [NativeTypeName("const Uint8 *")] byte* src, [NativeTypeName("SDL_AudioFormat")] ushort format, [NativeTypeName("Uint32")] uint len, int volume); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs index 1a451f0..0c6d021 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs @@ -58,11 +58,11 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetCameraDriver(int index); + public static extern byte* SDL_GetCameraDriver(int index); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetCurrentCameraDriver(); + public static extern byte* SDL_GetCurrentCameraDriver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_CameraDeviceID *")] @@ -73,7 +73,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_GetCameraDeviceName([NativeTypeName("SDL_CameraDeviceID")] uint instance_id); + public static extern byte* SDL_GetCameraDeviceName([NativeTypeName("SDL_CameraDeviceID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_CameraPosition SDL_GetCameraDevicePosition([NativeTypeName("SDL_CameraDeviceID")] uint instance_id); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs index 12ffb25..fa0c434 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs @@ -30,38 +30,38 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetClipboardText([NativeTypeName("const char *")] sbyte* text); + public static extern int SDL_SetClipboardText([NativeTypeName("const char *")] byte* text); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_GetClipboardText(); + public static extern byte* SDL_GetClipboardText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] public static extern int SDL_HasClipboardText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetPrimarySelectionText([NativeTypeName("const char *")] sbyte* text); + public static extern int SDL_SetPrimarySelectionText([NativeTypeName("const char *")] byte* text); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_GetPrimarySelectionText(); + public static extern byte* SDL_GetPrimarySelectionText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] public static extern int SDL_HasPrimarySelectionText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetClipboardData([NativeTypeName("SDL_ClipboardDataCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("SDL_ClipboardCleanupCallback")] delegate* unmanaged[Cdecl] cleanup, void* userdata, [NativeTypeName("const char **")] sbyte** mime_types, [NativeTypeName("size_t")] nuint num_mime_types); + public static extern int SDL_SetClipboardData([NativeTypeName("SDL_ClipboardDataCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("SDL_ClipboardCleanupCallback")] delegate* unmanaged[Cdecl] cleanup, void* userdata, [NativeTypeName("const char **")] byte** mime_types, [NativeTypeName("size_t")] nuint num_mime_types); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_ClearClipboardData(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_GetClipboardData([NativeTypeName("const char *")] sbyte* mime_type, [NativeTypeName("size_t *")] nuint* size); + public static extern void* SDL_GetClipboardData([NativeTypeName("const char *")] byte* mime_type, [NativeTypeName("size_t *")] nuint* size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasClipboardData([NativeTypeName("const char *")] sbyte* mime_type); + public static extern int SDL_HasClipboardData([NativeTypeName("const char *")] byte* mime_type); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs index 9b596bb..1bb77ec 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs @@ -30,21 +30,21 @@ namespace SDL public unsafe partial struct SDL_DialogFileFilter { [NativeTypeName("const char *")] - public sbyte* name; + public byte* name; [NativeTypeName("const char *")] - public sbyte* pattern; + public byte* pattern; } public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_ShowOpenFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] sbyte* default_location, [NativeTypeName("SDL_bool")] int allow_many); + public static extern void SDL_ShowOpenFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] byte* default_location, [NativeTypeName("SDL_bool")] int allow_many); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_ShowSaveFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] sbyte* default_location); + public static extern void SDL_ShowSaveFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] byte* default_location); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_ShowOpenFolderDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const char *")] sbyte* default_location, [NativeTypeName("SDL_bool")] int allow_many); + public static extern void SDL_ShowOpenFolderDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const char *")] byte* default_location, [NativeTypeName("SDL_bool")] int allow_many); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs index 4786096..af3eb8b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs @@ -40,11 +40,11 @@ public enum SDL_errorcode public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetError([NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern int SDL_SetError([NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetError(); + public static extern byte* SDL_GetError(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_ClearError(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs index 7a7275a..23f426c 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs @@ -247,7 +247,7 @@ public unsafe partial struct SDL_TextEditingEvent public uint windowID; [NativeTypeName("char *")] - public sbyte* text; + public byte* text; [NativeTypeName("Sint32")] public int start; @@ -270,7 +270,7 @@ public unsafe partial struct SDL_TextInputEvent public uint windowID; [NativeTypeName("char *")] - public sbyte* text; + public byte* text; } public partial struct SDL_MouseDeviceEvent @@ -864,10 +864,10 @@ public unsafe partial struct SDL_DropEvent public float y; [NativeTypeName("char *")] - public sbyte* source; + public byte* source; [NativeTypeName("char *")] - public sbyte* data; + public byte* data; } public partial struct SDL_ClipboardEvent diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs index 4b63439..21da2e6 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs @@ -71,34 +71,34 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_GetBasePath(); + public static extern byte* SDL_GetBasePath(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_GetPrefPath([NativeTypeName("const char *")] sbyte* org, [NativeTypeName("const char *")] sbyte* app); + public static extern byte* SDL_GetPrefPath([NativeTypeName("const char *")] byte* org, [NativeTypeName("const char *")] byte* app); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_GetUserFolder(SDL_Folder folder); + public static extern byte* SDL_GetUserFolder(SDL_Folder folder); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_CreateDirectory([NativeTypeName("const char *")] sbyte* path); + public static extern int SDL_CreateDirectory([NativeTypeName("const char *")] byte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_EnumerateDirectory([NativeTypeName("const char *")] sbyte* path, [NativeTypeName("SDL_EnumerateDirectoryCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_EnumerateDirectory([NativeTypeName("const char *")] byte* path, [NativeTypeName("SDL_EnumerateDirectoryCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_RemovePath([NativeTypeName("const char *")] sbyte* path); + public static extern int SDL_RemovePath([NativeTypeName("const char *")] byte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_RenamePath([NativeTypeName("const char *")] sbyte* oldpath, [NativeTypeName("const char *")] sbyte* newpath); + public static extern int SDL_RenamePath([NativeTypeName("const char *")] byte* oldpath, [NativeTypeName("const char *")] byte* newpath); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetPathInfo([NativeTypeName("const char *")] sbyte* path, SDL_PathInfo* info); + public static extern int SDL_GetPathInfo([NativeTypeName("const char *")] byte* path, SDL_PathInfo* info); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char **")] - public static extern sbyte** SDL_GlobDirectory([NativeTypeName("const char *")] sbyte* path, [NativeTypeName("const char *")] sbyte* pattern, [NativeTypeName("Uint32")] uint flags, int* count); + public static extern byte** SDL_GlobDirectory([NativeTypeName("const char *")] byte* path, [NativeTypeName("const char *")] byte* pattern, [NativeTypeName("Uint32")] uint flags, int* count); [NativeTypeName("#define SDL_GLOB_CASEINSENSITIVE (1 << 0)")] public const int SDL_GLOB_CASEINSENSITIVE = (1 << 0); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs index 93282a6..43be3d8 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs @@ -180,31 +180,31 @@ public partial struct _axis_e__Struct public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_AddGamepadMapping([NativeTypeName("const char *")] sbyte* mapping); + public static extern int SDL_AddGamepadMapping([NativeTypeName("const char *")] byte* mapping); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_AddGamepadMappingsFromIO(SDL_IOStream* src, [NativeTypeName("SDL_bool")] int closeio); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_AddGamepadMappingsFromFile([NativeTypeName("const char *")] sbyte* file); + public static extern int SDL_AddGamepadMappingsFromFile([NativeTypeName("const char *")] byte* file); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_ReloadGamepadMappings(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char **")] - public static extern sbyte** SDL_GetGamepadMappings(int* count); + public static extern byte** SDL_GetGamepadMappings(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_GetGamepadMappingForGUID([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid); + public static extern byte* SDL_GetGamepadMappingForGUID([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_GetGamepadMapping(SDL_Gamepad* gamepad); + public static extern byte* SDL_GetGamepadMapping(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetGamepadMapping([NativeTypeName("SDL_JoystickID")] uint instance_id, [NativeTypeName("const char *")] sbyte* mapping); + public static extern int SDL_SetGamepadMapping([NativeTypeName("SDL_JoystickID")] uint instance_id, [NativeTypeName("const char *")] byte* mapping); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] @@ -220,11 +220,11 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetGamepadInstanceName([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern byte* SDL_GetGamepadInstanceName([NativeTypeName("SDL_JoystickID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetGamepadInstancePath([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern byte* SDL_GetGamepadInstancePath([NativeTypeName("SDL_JoystickID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetGamepadInstancePlayerIndex([NativeTypeName("SDL_JoystickID")] uint instance_id); @@ -253,7 +253,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_GetGamepadInstanceMapping([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern byte* SDL_GetGamepadInstanceMapping([NativeTypeName("SDL_JoystickID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Gamepad* SDL_OpenGamepad([NativeTypeName("SDL_JoystickID")] uint instance_id); @@ -274,11 +274,11 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetGamepadName(SDL_Gamepad* gamepad); + public static extern byte* SDL_GetGamepadName(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetGamepadPath(SDL_Gamepad* gamepad); + public static extern byte* SDL_GetGamepadPath(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_GamepadType SDL_GetGamepadType(SDL_Gamepad* gamepad); @@ -310,7 +310,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetGamepadSerial(SDL_Gamepad* gamepad); + public static extern byte* SDL_GetGamepadSerial(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint64")] @@ -343,18 +343,18 @@ public static unsafe partial class SDL3 public static extern void SDL_UpdateGamepads(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_GamepadType SDL_GetGamepadTypeFromString([NativeTypeName("const char *")] sbyte* str); + public static extern SDL_GamepadType SDL_GetGamepadTypeFromString([NativeTypeName("const char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetGamepadStringForType(SDL_GamepadType type); + public static extern byte* SDL_GetGamepadStringForType(SDL_GamepadType type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_GamepadAxis SDL_GetGamepadAxisFromString([NativeTypeName("const char *")] sbyte* str); + public static extern SDL_GamepadAxis SDL_GetGamepadAxisFromString([NativeTypeName("const char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis); + public static extern byte* SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] @@ -365,11 +365,11 @@ public static unsafe partial class SDL3 public static extern short SDL_GetGamepadAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_GamepadButton SDL_GetGamepadButtonFromString([NativeTypeName("const char *")] sbyte* str); + public static extern SDL_GamepadButton SDL_GetGamepadButtonFromString([NativeTypeName("const char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetGamepadStringForButton(SDL_GamepadButton button); + public static extern byte* SDL_GetGamepadStringForButton(SDL_GamepadButton button); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] @@ -428,11 +428,11 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); + public static extern byte* SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); + public static extern byte* SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); [NativeTypeName("#define SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN")] public static ReadOnlySpan SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN => "SDL.joystick.cap.mono_led"u8; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs index da14e57..97a8d0b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_guid.g.cs @@ -43,9 +43,9 @@ public partial struct _data_e__FixedBuffer public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GUIDToString(SDL_GUID guid, [NativeTypeName("char *")] sbyte* pszGUID, int cbGUID); + public static extern int SDL_GUIDToString(SDL_GUID guid, [NativeTypeName("char *")] byte* pszGUID, int cbGUID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_GUID SDL_GUIDFromString([NativeTypeName("const char *")] sbyte* pchGUID); + public static extern SDL_GUID SDL_GUIDFromString([NativeTypeName("const char *")] byte* pchGUID); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs index dc975be..02d875b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs @@ -331,7 +331,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetHapticInstanceName([NativeTypeName("SDL_HapticID")] uint instance_id); + public static extern byte* SDL_GetHapticInstanceName([NativeTypeName("SDL_HapticID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Haptic* SDL_OpenHaptic([NativeTypeName("SDL_HapticID")] uint instance_id); @@ -345,7 +345,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetHapticName(SDL_Haptic* haptic); + public static extern byte* SDL_GetHapticName(SDL_Haptic* haptic); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs index a2e105f..1284976 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs @@ -44,7 +44,7 @@ public enum SDL_hid_bus_type public unsafe partial struct SDL_hid_device_info { [NativeTypeName("char *")] - public sbyte* path; + public byte* path; [NativeTypeName("unsigned short")] public ushort vendor_id; @@ -106,7 +106,7 @@ public static unsafe partial class SDL3 public static extern SDL_hid_device* SDL_hid_open([NativeTypeName("unsigned short")] ushort vendor_id, [NativeTypeName("unsigned short")] ushort product_id, [NativeTypeName("const wchar_t *")] IntPtr serial_number); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_hid_device* SDL_hid_open_path([NativeTypeName("const char *")] sbyte* 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 int SDL_hid_write(SDL_hid_device* dev, [NativeTypeName("const unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs index 9d0f2dc..c3882ee 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs @@ -39,32 +39,32 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] - public static extern int SDL_SetHintWithPriority([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* value, SDL_HintPriority priority); + public static extern int SDL_SetHintWithPriority([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value, SDL_HintPriority priority); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] - public static extern int SDL_SetHint([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* value); + public static extern int SDL_SetHint([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ResetHint([NativeTypeName("const char *")] sbyte* name); + public static extern int SDL_ResetHint([NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_ResetHints(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetHint([NativeTypeName("const char *")] sbyte* name); + public static extern byte* SDL_GetHint([NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetHintBoolean([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("SDL_bool")] int default_value); + public static extern int SDL_GetHintBoolean([NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_bool")] int default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_AddHintCallback([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_AddHintCallback([NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_DelHintCallback([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern void SDL_DelHintCallback([NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); [NativeTypeName("#define SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED \"SDL_ALLOW_ALT_TAB_WHILE_GRABBED\"")] public static ReadOnlySpan SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED => "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"u8; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs index 91172e0..1e1f7f9 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs @@ -63,7 +63,7 @@ public partial struct SDL_IOStream public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_IOStream* SDL_IOFromFile([NativeTypeName("const char *")] sbyte* file, [NativeTypeName("const char *")] sbyte* mode); + public static extern SDL_IOStream* SDL_IOFromFile([NativeTypeName("const char *")] byte* file, [NativeTypeName("const char *")] byte* mode); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_IOStream* SDL_IOFromMem(void* mem, [NativeTypeName("size_t")] nuint size); @@ -109,17 +109,17 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_IOprintf(SDL_IOStream* context, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern nuint SDL_IOprintf(SDL_IOStream* context, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_IOvprintf(SDL_IOStream* context, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); + public static extern nuint SDL_IOvprintf(SDL_IOStream* context, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void* SDL_LoadFile_IO(SDL_IOStream* src, [NativeTypeName("size_t *")] nuint* datasize, [NativeTypeName("SDL_bool")] int closeio); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_LoadFile([NativeTypeName("const char *")] sbyte* file, [NativeTypeName("size_t *")] nuint* datasize); + public static extern void* SDL_LoadFile([NativeTypeName("const char *")] byte* file, [NativeTypeName("size_t *")] nuint* datasize); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs index 229c0bb..6eece21 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs @@ -87,7 +87,7 @@ public unsafe partial struct SDL_VirtualJoystickDesc public uint axis_mask; [NativeTypeName("const char *")] - public sbyte* name; + public byte* name; public void* userdata; @@ -128,11 +128,11 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetJoystickInstanceName([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern byte* SDL_GetJoystickInstanceName([NativeTypeName("SDL_JoystickID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetJoystickInstancePath([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern byte* SDL_GetJoystickInstancePath([NativeTypeName("SDL_JoystickID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetJoystickInstancePlayerIndex([NativeTypeName("SDL_JoystickID")] uint instance_id); @@ -195,11 +195,11 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetJoystickName(SDL_Joystick* joystick); + public static extern byte* SDL_GetJoystickName(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetJoystickPath(SDL_Joystick* joystick); + public static extern byte* SDL_GetJoystickPath(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetJoystickPlayerIndex(SDL_Joystick* joystick); @@ -229,17 +229,17 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetJoystickSerial(SDL_Joystick* joystick); + public static extern byte* SDL_GetJoystickSerial(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_JoystickType SDL_GetJoystickType(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetJoystickGUIDString([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid, [NativeTypeName("char *")] sbyte* pszGUID, int cbGUID); + public static extern int SDL_GetJoystickGUIDString([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid, [NativeTypeName("char *")] byte* pszGUID, int cbGUID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_JoystickGUID")] - public static extern SDL_GUID SDL_GetJoystickGUIDFromString([NativeTypeName("const char *")] sbyte* pchGUID); + public static extern SDL_GUID SDL_GetJoystickGUIDFromString([NativeTypeName("const char *")] byte* pchGUID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_GetJoystickGUIDInfo([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid, [NativeTypeName("Uint16 *")] ushort* vendor, [NativeTypeName("Uint16 *")] ushort* product, [NativeTypeName("Uint16 *")] ushort* version, [NativeTypeName("Uint16 *")] ushort* crc16); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs index cf6960f..42036eb 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs @@ -53,7 +53,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetKeyboardInstanceName([NativeTypeName("SDL_KeyboardID")] uint instance_id); + public static extern byte* SDL_GetKeyboardInstanceName([NativeTypeName("SDL_KeyboardID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Window* SDL_GetKeyboardFocus(); @@ -80,18 +80,18 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetScancodeName(SDL_Scancode scancode); + public static extern byte* SDL_GetScancodeName(SDL_Scancode scancode); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Scancode SDL_GetScancodeFromName([NativeTypeName("const char *")] sbyte* name); + public static extern SDL_Scancode SDL_GetScancodeFromName([NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetKeyName([NativeTypeName("SDL_Keycode")] int key); + public static extern byte* SDL_GetKeyName([NativeTypeName("SDL_Keycode")] int key); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_Keycode")] - public static extern int SDL_GetKeyFromName([NativeTypeName("const char *")] sbyte* name); + public static extern int SDL_GetKeyFromName([NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_StartTextInput(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs index 28cb0c4..8354f3f 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs @@ -30,11 +30,11 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_LoadObject([NativeTypeName("const char *")] sbyte* sofile); + public static extern void* SDL_LoadObject([NativeTypeName("const char *")] byte* sofile); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_FunctionPointer")] - public static extern delegate* unmanaged[Cdecl] SDL_LoadFunction(void* handle, [NativeTypeName("const char *")] sbyte* name); + public static extern delegate* unmanaged[Cdecl] SDL_LoadFunction(void* handle, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_UnloadObject(void* handle); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs index 47d6d69..fe82701 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs @@ -30,10 +30,10 @@ namespace SDL public unsafe partial struct SDL_Locale { [NativeTypeName("const char *")] - public sbyte* language; + public byte* language; [NativeTypeName("const char *")] - public sbyte* country; + public byte* country; } public static unsafe partial class SDL3 diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs index 847444e..45e72a6 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs @@ -77,37 +77,37 @@ public static unsafe partial class SDL3 public static extern void SDL_LogResetPriorities(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_Log([NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern void SDL_Log([NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogVerbose(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern void SDL_LogVerbose(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogDebug(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern void SDL_LogDebug(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogInfo(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern void SDL_LogInfo(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogWarn(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern void SDL_LogWarn(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogError(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern void SDL_LogError(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogCritical(int category, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern void SDL_LogCritical(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogMessage(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern void SDL_LogMessage(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogMessageV(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); + public static extern void SDL_LogMessageV(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_GetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction *")] delegate* unmanaged[Cdecl]* callback, void** userdata); + public static extern void SDL_GetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction *")] delegate* unmanaged[Cdecl]* callback, void** userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern void SDL_SetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction")] delegate* unmanaged[Cdecl] callback, void* userdata); [NativeTypeName("#define SDL_MAX_LOG_MESSAGE 4096")] public const int SDL_MAX_LOG_MESSAGE = 4096; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs index 4ae3a7e..137103a 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs @@ -32,7 +32,7 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] - public static extern int SDL_RegisterApp([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("Uint32")] uint style, void* hInst); + public static extern int SDL_RegisterApp([NativeTypeName("const char *")] byte* name, [NativeTypeName("Uint32")] uint style, void* hInst); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs index 182b503..990ebc2 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs @@ -33,9 +33,9 @@ public static unsafe partial class SDL3 public static extern void SDL_SetMainReady(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_RunApp(int argc, [NativeTypeName("char *[]")] sbyte** argv, [NativeTypeName("SDL_main_func")] delegate* unmanaged[Cdecl] mainFunction, void* reserved); + public static extern int SDL_RunApp(int argc, [NativeTypeName("char *[]")] byte** argv, [NativeTypeName("SDL_main_func")] delegate* unmanaged[Cdecl] mainFunction, void* reserved); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_EnterAppMainCallbacks(int argc, [NativeTypeName("char *[]")] sbyte** argv, [NativeTypeName("SDL_AppInit_func")] delegate* unmanaged[Cdecl] appinit, [NativeTypeName("SDL_AppIterate_func")] delegate* unmanaged[Cdecl] appiter, [NativeTypeName("SDL_AppEvent_func")] delegate* unmanaged[Cdecl] appevent, [NativeTypeName("SDL_AppQuit_func")] delegate* unmanaged[Cdecl] appquit); + public static extern int SDL_EnterAppMainCallbacks(int argc, [NativeTypeName("char *[]")] byte** argv, [NativeTypeName("SDL_AppInit_func")] delegate* unmanaged[Cdecl] appinit, [NativeTypeName("SDL_AppIterate_func")] delegate* unmanaged[Cdecl] appiter, [NativeTypeName("SDL_AppEvent_func")] delegate* unmanaged[Cdecl] appevent, [NativeTypeName("SDL_AppQuit_func")] delegate* unmanaged[Cdecl] appquit); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs index a09bccb..fc52982 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs @@ -51,7 +51,7 @@ public unsafe partial struct SDL_MessageBoxButtonData public int buttonID; [NativeTypeName("const char *")] - public sbyte* text; + public byte* text; } public partial struct SDL_MessageBoxColor @@ -96,10 +96,10 @@ public unsafe partial struct SDL_MessageBoxData public SDL_Window* window; [NativeTypeName("const char *")] - public sbyte* title; + public byte* title; [NativeTypeName("const char *")] - public sbyte* message; + public byte* message; public int numbuttons; @@ -116,6 +116,6 @@ public static unsafe partial class SDL3 public static extern int SDL_ShowMessageBox([NativeTypeName("const SDL_MessageBoxData *")] SDL_MessageBoxData* messageboxdata, int* buttonid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ShowSimpleMessageBox([NativeTypeName("Uint32")] uint flags, [NativeTypeName("const char *")] sbyte* title, [NativeTypeName("const char *")] sbyte* message, SDL_Window* window); + public static extern int SDL_ShowSimpleMessageBox([NativeTypeName("Uint32")] uint flags, [NativeTypeName("const char *")] byte* title, [NativeTypeName("const char *")] byte* message, SDL_Window* window); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_misc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_misc.g.cs index ce86c00..d4d6b7e 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_misc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_misc.g.cs @@ -30,6 +30,6 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_OpenURL([NativeTypeName("const char *")] sbyte* url); + public static extern int SDL_OpenURL([NativeTypeName("const char *")] byte* url); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs index 483c3bb..a43bd03 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs @@ -74,7 +74,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetMouseInstanceName([NativeTypeName("SDL_MouseID")] uint instance_id); + public static extern byte* SDL_GetMouseInstanceName([NativeTypeName("SDL_MouseID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Window* SDL_GetMouseFocus(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs index bf1eb9d..099943a 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs @@ -85,7 +85,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetPenName([NativeTypeName("SDL_PenID")] uint instance_id); + public static extern byte* SDL_GetPenName([NativeTypeName("SDL_PenID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint32")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs index 4d3542e..9b6cda3 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs @@ -386,7 +386,7 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetPixelFormatName(SDL_PixelFormatEnum format); + public static extern byte* SDL_GetPixelFormatName(SDL_PixelFormatEnum format); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs index 5b559d7..8701e53 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs @@ -31,6 +31,6 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetPlatform(); + public static extern byte* SDL_GetPlatform(); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs index 21b85b1..25a4c62 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs @@ -57,53 +57,53 @@ public static unsafe partial class SDL3 public static extern void SDL_UnlockProperties([NativeTypeName("SDL_PropertiesID")] uint props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetPropertyWithCleanup([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, void* value, [NativeTypeName("void (*)(void *, void *)")] delegate* unmanaged[Cdecl] cleanup, void* userdata); + public static extern int SDL_SetPropertyWithCleanup([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, void* value, [NativeTypeName("void (*)(void *, void *)")] delegate* unmanaged[Cdecl] cleanup, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, void* value); + public static extern int SDL_SetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, void* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetStringProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* value); + public static extern int SDL_SetStringProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetNumberProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("Sint64")] long value); + public static extern int SDL_SetNumberProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("Sint64")] long value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetFloatProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, float value); + public static extern int SDL_SetFloatProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, float value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetBooleanProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("SDL_bool")] int value); + public static extern int SDL_SetBooleanProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_bool")] int value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name); + public static extern int SDL_HasProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_PropertyType SDL_GetPropertyType([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name); + public static extern SDL_PropertyType SDL_GetPropertyType([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_GetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, void* default_value); + public static extern void* SDL_GetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, void* default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetStringProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* default_value); + public static extern byte* SDL_GetStringProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Sint64")] - public static extern long SDL_GetNumberProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("Sint64")] long default_value); + public static extern long SDL_GetNumberProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("Sint64")] long default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float SDL_GetFloatProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, float default_value); + public static extern float SDL_GetFloatProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, float default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetBooleanProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("SDL_bool")] int default_value); + public static extern int SDL_GetBooleanProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_bool")] int default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ClearProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] sbyte* name); + public static extern int SDL_ClearProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_EnumerateProperties([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("SDL_EnumeratePropertiesCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_EnumerateProperties([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("SDL_EnumeratePropertiesCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_DestroyProperties([NativeTypeName("SDL_PropertiesID")] uint props); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs index faf90c1..c5c0291 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs @@ -37,7 +37,7 @@ public enum SDL_RendererFlags public unsafe partial struct SDL_RendererInfo { [NativeTypeName("const char *")] - public sbyte* name; + public byte* name; [NativeTypeName("Uint32")] public uint flags; @@ -98,13 +98,13 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetRenderDriver(int index); + public static extern byte* SDL_GetRenderDriver(int index); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_CreateWindowAndRenderer(int width, int height, [NativeTypeName("SDL_WindowFlags")] uint window_flags, SDL_Window** window, SDL_Renderer** renderer); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("Uint32")] uint flags); + public static extern SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, [NativeTypeName("const char *")] byte* name, [NativeTypeName("Uint32")] uint flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Renderer* SDL_CreateRendererWithProperties([NativeTypeName("SDL_PropertiesID")] uint props); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs index f5a59f5..7e81a0e 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs @@ -51,7 +51,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetSensorInstanceName([NativeTypeName("SDL_SensorID")] uint instance_id); + public static extern byte* SDL_GetSensorInstanceName([NativeTypeName("SDL_SensorID")] uint instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_SensorType SDL_GetSensorInstanceType([NativeTypeName("SDL_SensorID")] uint instance_id); @@ -71,7 +71,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetSensorName(SDL_Sensor* sensor); + public static extern byte* SDL_GetSensorName(SDL_Sensor* sensor); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_SensorType SDL_GetSensorType(SDL_Sensor* sensor); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index c52c4e1..932de96 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -71,10 +71,10 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_getenv([NativeTypeName("const char *")] sbyte* name); + public static extern byte* SDL_getenv([NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_setenv([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const char *")] sbyte* value, int overwrite); + public static extern int SDL_setenv([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value, int overwrite); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_qsort(void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *)")] delegate* unmanaged[Cdecl] compare); @@ -202,160 +202,160 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_strlen([NativeTypeName("const char *")] sbyte* str); + public static extern nuint SDL_strlen([NativeTypeName("const char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_strnlen([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("size_t")] nuint maxlen); + public static extern nuint SDL_strnlen([NativeTypeName("const char *")] byte* str, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_strlcpy([NativeTypeName("char *")] sbyte* dst, [NativeTypeName("const char *")] sbyte* src, [NativeTypeName("size_t")] nuint maxlen); + public static extern nuint SDL_strlcpy([NativeTypeName("char *")] byte* dst, [NativeTypeName("const char *")] byte* src, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_utf8strlcpy([NativeTypeName("char *")] sbyte* dst, [NativeTypeName("const char *")] sbyte* src, [NativeTypeName("size_t")] nuint dst_bytes); + public static extern nuint SDL_utf8strlcpy([NativeTypeName("char *")] byte* dst, [NativeTypeName("const char *")] byte* src, [NativeTypeName("size_t")] nuint dst_bytes); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_strlcat([NativeTypeName("char *")] sbyte* dst, [NativeTypeName("const char *")] sbyte* src, [NativeTypeName("size_t")] nuint maxlen); + public static extern nuint SDL_strlcat([NativeTypeName("char *")] byte* dst, [NativeTypeName("const char *")] byte* src, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strdup([NativeTypeName("const char *")] sbyte* str); + public static extern byte* SDL_strdup([NativeTypeName("const char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strndup([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("size_t")] nuint maxlen); + public static extern byte* SDL_strndup([NativeTypeName("const char *")] byte* str, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strrev([NativeTypeName("char *")] sbyte* str); + public static extern byte* SDL_strrev([NativeTypeName("char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strupr([NativeTypeName("char *")] sbyte* str); + public static extern byte* SDL_strupr([NativeTypeName("char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strlwr([NativeTypeName("char *")] sbyte* str); + public static extern byte* SDL_strlwr([NativeTypeName("char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strchr([NativeTypeName("const char *")] sbyte* str, int c); + public static extern byte* SDL_strchr([NativeTypeName("const char *")] byte* str, int c); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strrchr([NativeTypeName("const char *")] sbyte* str, int c); + public static extern byte* SDL_strrchr([NativeTypeName("const char *")] byte* str, int c); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strstr([NativeTypeName("const char *")] sbyte* haystack, [NativeTypeName("const char *")] sbyte* needle); + public static extern byte* SDL_strstr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strnstr([NativeTypeName("const char *")] sbyte* haystack, [NativeTypeName("const char *")] sbyte* needle, [NativeTypeName("size_t")] nuint maxlen); + public static extern byte* SDL_strnstr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strcasestr([NativeTypeName("const char *")] sbyte* haystack, [NativeTypeName("const char *")] sbyte* needle); + public static extern byte* SDL_strcasestr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_strtok_r([NativeTypeName("char *")] sbyte* s1, [NativeTypeName("const char *")] sbyte* s2, [NativeTypeName("char **")] sbyte** saveptr); + public static extern byte* SDL_strtok_r([NativeTypeName("char *")] byte* s1, [NativeTypeName("const char *")] byte* s2, [NativeTypeName("char **")] byte** saveptr); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_utf8strlen([NativeTypeName("const char *")] sbyte* str); + public static extern nuint SDL_utf8strlen([NativeTypeName("const char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_utf8strnlen([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("size_t")] nuint bytes); + public static extern nuint SDL_utf8strnlen([NativeTypeName("const char *")] byte* str, [NativeTypeName("size_t")] nuint bytes); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_itoa(int value, [NativeTypeName("char *")] sbyte* str, int radix); + public static extern byte* SDL_itoa(int value, [NativeTypeName("char *")] byte* str, int radix); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_uitoa([NativeTypeName("unsigned int")] uint value, [NativeTypeName("char *")] sbyte* str, int radix); + public static extern byte* SDL_uitoa([NativeTypeName("unsigned int")] uint value, [NativeTypeName("char *")] byte* str, int radix); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_ltoa([NativeTypeName("long")] int value, [NativeTypeName("char *")] sbyte* str, int radix); + public static extern byte* SDL_ltoa([NativeTypeName("long")] int value, [NativeTypeName("char *")] byte* str, int radix); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_ultoa([NativeTypeName("unsigned long")] uint value, [NativeTypeName("char *")] sbyte* str, int radix); + public static extern byte* SDL_ultoa([NativeTypeName("unsigned long")] uint value, [NativeTypeName("char *")] byte* str, int radix); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_lltoa([NativeTypeName("Sint64")] long value, [NativeTypeName("char *")] sbyte* str, int radix); + public static extern byte* SDL_lltoa([NativeTypeName("Sint64")] long value, [NativeTypeName("char *")] byte* str, int radix); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_ulltoa([NativeTypeName("Uint64")] ulong value, [NativeTypeName("char *")] sbyte* str, int radix); + public static extern byte* SDL_ulltoa([NativeTypeName("Uint64")] ulong value, [NativeTypeName("char *")] byte* str, int radix); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_atoi([NativeTypeName("const char *")] sbyte* str); + public static extern int SDL_atoi([NativeTypeName("const char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double SDL_atof([NativeTypeName("const char *")] sbyte* str); + public static extern double SDL_atof([NativeTypeName("const char *")] byte* str); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("long")] - public static extern int SDL_strtol([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("char **")] sbyte** endp, int @base); + public static extern int SDL_strtol([NativeTypeName("const char *")] byte* str, [NativeTypeName("char **")] byte** endp, int @base); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("unsigned long")] - public static extern uint SDL_strtoul([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("char **")] sbyte** endp, int @base); + public static extern uint SDL_strtoul([NativeTypeName("const char *")] byte* str, [NativeTypeName("char **")] byte** endp, int @base); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Sint64")] - public static extern long SDL_strtoll([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("char **")] sbyte** endp, int @base); + public static extern long SDL_strtoll([NativeTypeName("const char *")] byte* str, [NativeTypeName("char **")] byte** endp, int @base); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint64")] - public static extern ulong SDL_strtoull([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("char **")] sbyte** endp, int @base); + public static extern ulong SDL_strtoull([NativeTypeName("const char *")] byte* str, [NativeTypeName("char **")] byte** endp, int @base); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double SDL_strtod([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("char **")] sbyte** endp); + public static extern double SDL_strtod([NativeTypeName("const char *")] byte* str, [NativeTypeName("char **")] byte** endp); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_strcmp([NativeTypeName("const char *")] sbyte* str1, [NativeTypeName("const char *")] sbyte* str2); + public static extern int SDL_strcmp([NativeTypeName("const char *")] byte* str1, [NativeTypeName("const char *")] byte* str2); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_strncmp([NativeTypeName("const char *")] sbyte* str1, [NativeTypeName("const char *")] sbyte* str2, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_strncmp([NativeTypeName("const char *")] byte* str1, [NativeTypeName("const char *")] byte* str2, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_strcasecmp([NativeTypeName("const char *")] sbyte* str1, [NativeTypeName("const char *")] sbyte* str2); + public static extern int SDL_strcasecmp([NativeTypeName("const char *")] byte* str1, [NativeTypeName("const char *")] byte* str2); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_strncasecmp([NativeTypeName("const char *")] sbyte* str1, [NativeTypeName("const char *")] sbyte* str2, [NativeTypeName("size_t")] nuint maxlen); + public static extern int SDL_strncasecmp([NativeTypeName("const char *")] byte* str1, [NativeTypeName("const char *")] byte* str2, [NativeTypeName("size_t")] nuint maxlen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_sscanf([NativeTypeName("const char *")] sbyte* text, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern int SDL_sscanf([NativeTypeName("const char *")] byte* text, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_vsscanf([NativeTypeName("const char *")] sbyte* text, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); + public static extern int SDL_vsscanf([NativeTypeName("const char *")] byte* text, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_snprintf([NativeTypeName("char *")] sbyte* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern int SDL_snprintf([NativeTypeName("char *")] byte* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_swprintf([NativeTypeName("wchar_t *")] IntPtr text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] IntPtr fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_vsnprintf([NativeTypeName("char *")] sbyte* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); + public static extern int SDL_vsnprintf([NativeTypeName("char *")] byte* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_vswprintf([NativeTypeName("wchar_t *")] IntPtr text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] IntPtr fmt, [NativeTypeName("va_list")] sbyte* ap); + public static extern int SDL_vswprintf([NativeTypeName("wchar_t *")] IntPtr text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] IntPtr fmt, [NativeTypeName("va_list")] byte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_asprintf([NativeTypeName("char **")] sbyte** strp, [NativeTypeName("const char *")] sbyte* fmt, __arglist); + public static extern int SDL_asprintf([NativeTypeName("char **")] byte** strp, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_vasprintf([NativeTypeName("char **")] sbyte** strp, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap); + public static extern int SDL_vasprintf([NativeTypeName("char **")] byte** strp, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern double SDL_acos(double x); @@ -493,18 +493,18 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_iconv_t")] - public static extern SDL_iconv_data_t* SDL_iconv_open([NativeTypeName("const char *")] sbyte* tocode, [NativeTypeName("const char *")] sbyte* fromcode); + public static extern SDL_iconv_data_t* SDL_iconv_open([NativeTypeName("const char *")] byte* tocode, [NativeTypeName("const char *")] byte* fromcode); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_iconv_close([NativeTypeName("SDL_iconv_t")] SDL_iconv_data_t* cd); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_iconv([NativeTypeName("SDL_iconv_t")] SDL_iconv_data_t* cd, [NativeTypeName("const char **")] sbyte** inbuf, [NativeTypeName("size_t *")] nuint* inbytesleft, [NativeTypeName("char **")] sbyte** outbuf, [NativeTypeName("size_t *")] nuint* outbytesleft); + public static extern nuint SDL_iconv([NativeTypeName("SDL_iconv_t")] SDL_iconv_data_t* cd, [NativeTypeName("const char **")] byte** inbuf, [NativeTypeName("size_t *")] nuint* inbytesleft, [NativeTypeName("char **")] byte** outbuf, [NativeTypeName("size_t *")] nuint* outbytesleft); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern sbyte* SDL_iconv_string([NativeTypeName("const char *")] sbyte* tocode, [NativeTypeName("const char *")] sbyte* fromcode, [NativeTypeName("const char *")] sbyte* inbuf, [NativeTypeName("size_t")] nuint inbytesleft); + public static extern byte* SDL_iconv_string([NativeTypeName("const char *")] byte* tocode, [NativeTypeName("const char *")] byte* fromcode, [NativeTypeName("const char *")] byte* inbuf, [NativeTypeName("size_t")] nuint inbytesleft); public static int SDL_size_mul_overflow([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret) { diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs index 845189b..d169d98 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs @@ -36,25 +36,25 @@ public unsafe partial struct SDL_StorageInterface public delegate* unmanaged[Cdecl] ready; [NativeTypeName("int (*)(void *, const char *, SDL_EnumerateDirectoryCallback, void *)")] - public delegate* unmanaged[Cdecl], void*, int> enumerate; + public delegate* unmanaged[Cdecl], void*, int> enumerate; [NativeTypeName("int (*)(void *, const char *, SDL_PathInfo *)")] - public delegate* unmanaged[Cdecl] info; + public delegate* unmanaged[Cdecl] info; [NativeTypeName("int (*)(void *, const char *, void *, Uint64)")] - public delegate* unmanaged[Cdecl] read_file; + public delegate* unmanaged[Cdecl] read_file; [NativeTypeName("int (*)(void *, const char *, const void *, Uint64)")] - public delegate* unmanaged[Cdecl] write_file; + public delegate* unmanaged[Cdecl] write_file; [NativeTypeName("int (*)(void *, const char *)")] - public delegate* unmanaged[Cdecl] mkdir; + public delegate* unmanaged[Cdecl] mkdir; [NativeTypeName("int (*)(void *, const char *)")] - public delegate* unmanaged[Cdecl] remove; + public delegate* unmanaged[Cdecl] remove; [NativeTypeName("int (*)(void *, const char *, const char *)")] - public delegate* unmanaged[Cdecl] rename; + public delegate* unmanaged[Cdecl] rename; [NativeTypeName("Uint64 (*)(void *)")] public delegate* unmanaged[Cdecl] space_remaining; @@ -67,13 +67,13 @@ public partial struct SDL_Storage public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Storage* SDL_OpenTitleStorage([NativeTypeName("const char *")] sbyte* @override, [NativeTypeName("SDL_PropertiesID")] uint props); + public static extern SDL_Storage* SDL_OpenTitleStorage([NativeTypeName("const char *")] byte* @override, [NativeTypeName("SDL_PropertiesID")] uint props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Storage* SDL_OpenUserStorage([NativeTypeName("const char *")] sbyte* org, [NativeTypeName("const char *")] sbyte* app, [NativeTypeName("SDL_PropertiesID")] uint props); + public static extern SDL_Storage* SDL_OpenUserStorage([NativeTypeName("const char *")] byte* org, [NativeTypeName("const char *")] byte* app, [NativeTypeName("SDL_PropertiesID")] uint props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Storage* SDL_OpenFileStorage([NativeTypeName("const char *")] sbyte* path); + public static extern SDL_Storage* SDL_OpenFileStorage([NativeTypeName("const char *")] byte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Storage* SDL_OpenStorage([NativeTypeName("const SDL_StorageInterface *")] SDL_StorageInterface* iface, void* userdata); @@ -86,28 +86,28 @@ public static unsafe partial class SDL3 public static extern int SDL_StorageReady(SDL_Storage* storage); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetStorageFileSize(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, [NativeTypeName("Uint64 *")] ulong* length); + public static extern int SDL_GetStorageFileSize(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("Uint64 *")] ulong* length); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ReadStorageFile(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, void* destination, [NativeTypeName("Uint64")] ulong length); + public static extern int SDL_ReadStorageFile(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, void* destination, [NativeTypeName("Uint64")] ulong length); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_WriteStorageFile(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, [NativeTypeName("const void *")] void* source, [NativeTypeName("Uint64")] ulong length); + public static extern int SDL_WriteStorageFile(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("const void *")] void* source, [NativeTypeName("Uint64")] ulong length); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_CreateStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path); + public static extern int SDL_CreateStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_EnumerateStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, [NativeTypeName("SDL_EnumerateDirectoryCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_EnumerateStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("SDL_EnumerateDirectoryCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_RemoveStoragePath(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path); + public static extern int SDL_RemoveStoragePath(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_RenameStoragePath(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* oldpath, [NativeTypeName("const char *")] sbyte* newpath); + public static extern int SDL_RenameStoragePath(SDL_Storage* storage, [NativeTypeName("const char *")] byte* oldpath, [NativeTypeName("const char *")] byte* newpath); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetStoragePathInfo(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, SDL_PathInfo* info); + public static extern int SDL_GetStoragePathInfo(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, SDL_PathInfo* info); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint64")] @@ -115,6 +115,6 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char **")] - public static extern sbyte** SDL_GlobStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] sbyte* path, [NativeTypeName("const char *")] sbyte* pattern, [NativeTypeName("Uint32")] uint flags, int* count); + public static extern byte** SDL_GlobStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("const char *")] byte* pattern, [NativeTypeName("Uint32")] uint flags, int* count); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs index 90cbefb..1b0d6f4 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs @@ -108,13 +108,13 @@ public static unsafe partial class SDL3 public static extern SDL_Surface* SDL_LoadBMP_IO(SDL_IOStream* src, [NativeTypeName("SDL_bool")] int closeio); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Surface* SDL_LoadBMP([NativeTypeName("const char *")] sbyte* file); + public static extern SDL_Surface* SDL_LoadBMP([NativeTypeName("const char *")] byte* file); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SaveBMP_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("SDL_bool")] int closeio); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SaveBMP(SDL_Surface* surface, [NativeTypeName("const char *")] sbyte* file); + public static extern int SDL_SaveBMP(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetSurfaceRLE(SDL_Surface* surface, int flag); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs index a59ad8e..3d133e9 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs @@ -64,7 +64,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] [SupportedOSPlatform("Android")] - public static extern sbyte* SDL_AndroidGetInternalStoragePath(); + public static extern byte* SDL_AndroidGetInternalStoragePath(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] @@ -73,15 +73,15 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] [SupportedOSPlatform("Android")] - public static extern sbyte* SDL_AndroidGetExternalStoragePath(); + public static extern byte* SDL_AndroidGetExternalStoragePath(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] - public static extern int SDL_AndroidRequestPermission([NativeTypeName("const char *")] sbyte* permission, [NativeTypeName("SDL_AndroidRequestPermissionCallback")] delegate* unmanaged[Cdecl] cb, void* userdata); + public static extern int SDL_AndroidRequestPermission([NativeTypeName("const char *")] byte* permission, [NativeTypeName("SDL_AndroidRequestPermissionCallback")] delegate* unmanaged[Cdecl] cb, void* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] - public static extern int SDL_AndroidShowToast([NativeTypeName("const char *")] sbyte* message, int duration, int gravity, int xoffset, int yoffset); + public static extern int SDL_AndroidShowToast([NativeTypeName("const char *")] byte* message, int duration, int gravity, int xoffset, int yoffset); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs index 7774175..70fbd23 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs @@ -55,7 +55,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] [SupportedOSPlatform("Windows")] - public static extern sbyte* SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); + public static extern byte* SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs index 94d428b..d37d3fb 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs @@ -42,14 +42,14 @@ public enum SDL_ThreadPriority public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Thread* SDL_CreateThread([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] sbyte* name, void* data); + public static extern SDL_Thread* SDL_CreateThread([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] byte* name, void* data); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Thread* SDL_CreateThreadWithStackSize([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("const size_t")] nuint stacksize, void* data); + public static extern SDL_Thread* SDL_CreateThreadWithStackSize([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const size_t")] nuint stacksize, void* data); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetThreadName(SDL_Thread* thread); + public static extern byte* SDL_GetThreadName(SDL_Thread* thread); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_ThreadID")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs index 2c88a23..7fccbd2 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs @@ -55,7 +55,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetTouchDeviceName([NativeTypeName("SDL_TouchID")] ulong touchID); + public static extern byte* SDL_GetTouchDeviceName([NativeTypeName("SDL_TouchID")] ulong touchID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_TouchDeviceType SDL_GetTouchDeviceType([NativeTypeName("SDL_TouchID")] ulong touchID); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs index 9eab83e..efccb50 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs @@ -46,7 +46,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetRevision(); + public static extern byte* SDL_GetRevision(); [NativeTypeName("#define SDL_MAJOR_VERSION 3")] public const int SDL_MAJOR_VERSION = 3; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs index e32850e..69de60c 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs @@ -153,11 +153,11 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetVideoDriver(int index); + public static extern byte* SDL_GetVideoDriver(int index); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetCurrentVideoDriver(); + public static extern byte* SDL_GetCurrentVideoDriver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_SystemTheme SDL_GetSystemTheme(); @@ -176,7 +176,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetDisplayName([NativeTypeName("SDL_DisplayID")] uint displayID); + public static extern byte* SDL_GetDisplayName([NativeTypeName("SDL_DisplayID")] uint displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetDisplayBounds([NativeTypeName("SDL_DisplayID")] uint displayID, SDL_Rect* rect); @@ -242,7 +242,7 @@ public static unsafe partial class SDL3 public static extern uint SDL_GetWindowPixelFormat(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Window* SDL_CreateWindow([NativeTypeName("const char *")] sbyte* title, int w, int h, [NativeTypeName("SDL_WindowFlags")] uint flags); + public static extern SDL_Window* SDL_CreateWindow([NativeTypeName("const char *")] byte* title, int w, int h, [NativeTypeName("SDL_WindowFlags")] uint flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Window* SDL_CreatePopupWindow(SDL_Window* parent, int offset_x, int offset_y, int w, int h, [NativeTypeName("SDL_WindowFlags")] uint flags); @@ -269,11 +269,11 @@ public static unsafe partial class SDL3 public static extern uint SDL_GetWindowFlags(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetWindowTitle(SDL_Window* window, [NativeTypeName("const char *")] sbyte* title); + public static extern int SDL_SetWindowTitle(SDL_Window* window, [NativeTypeName("const char *")] byte* title); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* SDL_GetWindowTitle(SDL_Window* window); + public static extern byte* SDL_GetWindowTitle(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetWindowIcon(SDL_Window* window, SDL_Surface* icon); @@ -422,22 +422,22 @@ public static unsafe partial class SDL3 public static extern int SDL_DisableScreenSaver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GL_LoadLibrary([NativeTypeName("const char *")] sbyte* path); + public static extern int SDL_GL_LoadLibrary([NativeTypeName("const char *")] byte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_FunctionPointer")] - public static extern delegate* unmanaged[Cdecl] SDL_GL_GetProcAddress([NativeTypeName("const char *")] sbyte* proc); + public static extern delegate* unmanaged[Cdecl] SDL_GL_GetProcAddress([NativeTypeName("const char *")] byte* proc); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_FunctionPointer")] - public static extern delegate* unmanaged[Cdecl] SDL_EGL_GetProcAddress([NativeTypeName("const char *")] sbyte* proc); + public static extern delegate* unmanaged[Cdecl] SDL_EGL_GetProcAddress([NativeTypeName("const char *")] byte* proc); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_GL_UnloadLibrary(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GL_ExtensionSupported([NativeTypeName("const char *")] sbyte* extension); + public static extern int SDL_GL_ExtensionSupported([NativeTypeName("const char *")] byte* extension); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_GL_ResetAttributes(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs index 7966c07..fbe40c9 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs @@ -42,7 +42,7 @@ public partial struct VkAllocationCallbacks public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_Vulkan_LoadLibrary([NativeTypeName("const char *")] sbyte* path); + public static extern int SDL_Vulkan_LoadLibrary([NativeTypeName("const char *")] byte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_FunctionPointer")] @@ -53,7 +53,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *const *")] - public static extern sbyte** SDL_Vulkan_GetInstanceExtensions([NativeTypeName("Uint32 *")] uint* count); + public static extern byte** SDL_Vulkan_GetInstanceExtensions([NativeTypeName("Uint32 *")] uint* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 2fd6dbb..442d1af 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -175,6 +175,7 @@ def check_generated_functions(sdl_api, header, generated_file_paths): "--namespace", "SDL", "--remap", + "char=byte", "wchar_t *=IntPtr", # wchar_t has a platform-defined size "--additional", From dfe2b5b251a0dd580b1f73a9395c455e6b95215e Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 12:34:11 +0200 Subject: [PATCH 15/37] Remap C `void *` to C# `IntPtr` --- SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs | 9 ++-- SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs | 13 ++--- SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs | 6 ++- SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs | 7 +-- SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs | 22 ++++---- SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs | 3 +- SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs | 26 +++++----- SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs | 17 ++++--- SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs | 8 +-- SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs | 5 +- SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs | 3 +- SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs | 5 +- SDL3-CS/SDL3/ClangSharp/SDL_metal.g.cs | 8 +-- SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs | 10 ++-- SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs | 14 +++--- SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 50 +++++++++++-------- SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs | 29 +++++------ SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs | 17 ++++--- .../SDL3/ClangSharp/SDL_system.Android.g.cs | 9 ++-- .../SDL3/ClangSharp/SDL_system.Windows.g.cs | 3 +- SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs | 3 +- SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs | 10 ++-- SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs | 3 +- SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs | 24 +++++---- SDL3-CS/generate_bindings.py | 1 + 28 files changed, 182 insertions(+), 131 deletions(-) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs index 35662a2..fabd490 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs @@ -23,6 +23,7 @@ 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 @@ -65,12 +66,14 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] - public static extern int SDL_AtomicCompareAndSwapPointer(void** a, void* oldval, void* newval); + public static extern int SDL_AtomicCompareAndSwapPointer([NativeTypeName("void **")] IntPtr* a, [NativeTypeName("void*")] IntPtr oldval, [NativeTypeName("void*")] IntPtr newval); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_AtomicSetPtr(void** a, void* v); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_AtomicSetPtr([NativeTypeName("void **")] IntPtr* a, [NativeTypeName("void*")] IntPtr v); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_AtomicGetPtr(void** a); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_AtomicGetPtr([NativeTypeName("void **")] IntPtr* a); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index 2b12bef..ddaec8a 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -23,6 +23,7 @@ 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 @@ -122,10 +123,10 @@ public static unsafe partial class SDL3 public static extern int SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream* stream, float ratio); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_PutAudioStreamData(SDL_AudioStream* stream, [NativeTypeName("const void *")] void* buf, int len); + public static extern int SDL_PutAudioStreamData(SDL_AudioStream* stream, [NativeTypeName("const void *")] IntPtr buf, int len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetAudioStreamData(SDL_AudioStream* stream, void* buf, int len); + public static extern int SDL_GetAudioStreamData(SDL_AudioStream* stream, [NativeTypeName("void*")] IntPtr buf, int len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetAudioStreamAvailable(SDL_AudioStream* stream); @@ -146,19 +147,19 @@ public static unsafe partial class SDL3 public static extern int SDL_UnlockAudioStream(SDL_AudioStream* stream); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetAudioStreamGetCallback(SDL_AudioStream* stream, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_SetAudioStreamGetCallback(SDL_AudioStream* stream, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetAudioStreamPutCallback(SDL_AudioStream* stream, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_SetAudioStreamPutCallback(SDL_AudioStream* stream, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_DestroyAudioStream(SDL_AudioStream* stream); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_AudioStream* SDL_OpenAudioDeviceStream([NativeTypeName("SDL_AudioDeviceID")] uint devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern SDL_AudioStream* SDL_OpenAudioDeviceStream([NativeTypeName("SDL_AudioDeviceID")] uint devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetAudioPostmixCallback([NativeTypeName("SDL_AudioDeviceID")] uint devid, [NativeTypeName("SDL_AudioPostmixCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_SetAudioPostmixCallback([NativeTypeName("SDL_AudioDeviceID")] uint devid, [NativeTypeName("SDL_AudioPostmixCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_LoadWAV_IO(SDL_IOStream* src, [NativeTypeName("SDL_bool")] int closeio, SDL_AudioSpec* spec, [NativeTypeName("Uint8 **")] byte** audio_buf, [NativeTypeName("Uint32 *")] uint* audio_len); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs index fa0c434..e8c933d 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs @@ -23,6 +23,7 @@ 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 @@ -52,13 +53,14 @@ public static unsafe partial class SDL3 public static extern int SDL_HasPrimarySelectionText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetClipboardData([NativeTypeName("SDL_ClipboardDataCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("SDL_ClipboardCleanupCallback")] delegate* unmanaged[Cdecl] cleanup, void* userdata, [NativeTypeName("const char **")] byte** mime_types, [NativeTypeName("size_t")] nuint num_mime_types); + public static extern int SDL_SetClipboardData([NativeTypeName("SDL_ClipboardDataCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("SDL_ClipboardCleanupCallback")] delegate* unmanaged[Cdecl] cleanup, [NativeTypeName("void*")] IntPtr userdata, [NativeTypeName("const char **")] byte** mime_types, [NativeTypeName("size_t")] nuint num_mime_types); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_ClearClipboardData(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_GetClipboardData([NativeTypeName("const char *")] byte* mime_type, [NativeTypeName("size_t *")] nuint* size); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_GetClipboardData([NativeTypeName("const char *")] byte* mime_type, [NativeTypeName("size_t *")] nuint* size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs index 1bb77ec..9928277 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs @@ -23,6 +23,7 @@ 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 @@ -39,12 +40,12 @@ public unsafe partial struct SDL_DialogFileFilter public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_ShowOpenFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] byte* default_location, [NativeTypeName("SDL_bool")] int allow_many); + public static extern void SDL_ShowOpenFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] byte* default_location, [NativeTypeName("SDL_bool")] int allow_many); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_ShowSaveFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] byte* default_location); + public static extern void SDL_ShowSaveFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] byte* default_location); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_ShowOpenFolderDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, void* userdata, SDL_Window* window, [NativeTypeName("const char *")] byte* default_location, [NativeTypeName("SDL_bool")] int allow_many); + public static extern void SDL_ShowOpenFolderDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, SDL_Window* window, [NativeTypeName("const char *")] byte* default_location, [NativeTypeName("SDL_bool")] int allow_many); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs index 23f426c..f76cfdc 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs @@ -23,6 +23,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -918,7 +919,7 @@ public partial struct SDL_QuitEvent public ulong timestamp; } - public unsafe partial struct SDL_UserEvent + public partial struct SDL_UserEvent { [NativeTypeName("Uint32")] public uint type; @@ -935,9 +936,11 @@ public unsafe partial struct SDL_UserEvent [NativeTypeName("Sint32")] public int code; - public void* data1; + [NativeTypeName("void*")] + public IntPtr data1; - public void* data2; + [NativeTypeName("void*")] + public IntPtr data2; } [StructLayout(LayoutKind.Explicit)] @@ -1102,20 +1105,20 @@ public static unsafe partial class SDL3 public static extern int SDL_PushEvent(SDL_Event* @event); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetEventFilter([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, void* userdata); + public static extern void SDL_SetEventFilter([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetEventFilter([NativeTypeName("SDL_EventFilter *")] delegate* unmanaged[Cdecl]* filter, void** userdata); + public static extern int SDL_GetEventFilter([NativeTypeName("SDL_EventFilter *")] delegate* unmanaged[Cdecl]* filter, [NativeTypeName("void **")] IntPtr* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_AddEventWatch([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, void* userdata); + public static extern int SDL_AddEventWatch([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_DelEventWatch([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, void* userdata); + public static extern void SDL_DelEventWatch([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_FilterEvents([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, void* userdata); + public static extern void SDL_FilterEvents([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_SetEventEnabled([NativeTypeName("Uint32")] uint type, [NativeTypeName("SDL_bool")] int enabled); @@ -1129,7 +1132,8 @@ public static unsafe partial class SDL3 public static extern uint SDL_RegisterEvents(int numevents); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_AllocateEventMemory([NativeTypeName("size_t")] nuint size); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_AllocateEventMemory([NativeTypeName("size_t")] nuint size); [NativeTypeName("#define SDL_RELEASED 0")] public const int SDL_RELEASED = 0; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs index 21da2e6..655bb76 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs @@ -23,6 +23,7 @@ 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 @@ -85,7 +86,7 @@ public static unsafe partial class SDL3 public static extern int SDL_CreateDirectory([NativeTypeName("const char *")] byte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_EnumerateDirectory([NativeTypeName("const char *")] byte* path, [NativeTypeName("SDL_EnumerateDirectoryCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_EnumerateDirectory([NativeTypeName("const char *")] byte* path, [NativeTypeName("SDL_EnumerateDirectoryCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_RemovePath([NativeTypeName("const char *")] byte* path); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs index 43be3d8..e484c30 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs @@ -421,7 +421,7 @@ public static unsafe partial class SDL3 public static extern int SDL_SetGamepadLED(SDL_Gamepad* gamepad, [NativeTypeName("Uint8")] byte red, [NativeTypeName("Uint8")] byte green, [NativeTypeName("Uint8")] byte blue); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SendGamepadEffect(SDL_Gamepad* gamepad, [NativeTypeName("const void *")] void* data, int size); + public static extern int SDL_SendGamepadEffect(SDL_Gamepad* gamepad, [NativeTypeName("const void *")] IntPtr data, int size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_CloseGamepad(SDL_Gamepad* gamepad); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs index c3882ee..048ded0 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs @@ -61,10 +61,10 @@ public static unsafe partial class SDL3 public static extern int SDL_GetHintBoolean([NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_bool")] int default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_AddHintCallback([NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_AddHintCallback([NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_DelHintCallback([NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern void SDL_DelHintCallback([NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [NativeTypeName("#define SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED \"SDL_ALLOW_ALT_TAB_WHILE_GRABBED\"")] public static ReadOnlySpan SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED => "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"u8; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs index 1e1f7f9..ccb8534 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs @@ -41,19 +41,19 @@ public enum SDL_IOStatus public unsafe partial struct SDL_IOStreamInterface { [NativeTypeName("Sint64 (*)(void *)")] - public delegate* unmanaged[Cdecl] size; + public delegate* unmanaged[Cdecl] size; [NativeTypeName("Sint64 (*)(void *, Sint64, int)")] - public delegate* unmanaged[Cdecl] seek; + public delegate* unmanaged[Cdecl] seek; [NativeTypeName("size_t (*)(void *, void *, size_t, SDL_IOStatus *)")] - public delegate* unmanaged[Cdecl] read; + public delegate* unmanaged[Cdecl] read; [NativeTypeName("size_t (*)(void *, const void *, size_t, SDL_IOStatus *)")] - public delegate* unmanaged[Cdecl] write; + public delegate* unmanaged[Cdecl] write; [NativeTypeName("int (*)(void *)")] - public delegate* unmanaged[Cdecl] close; + public delegate* unmanaged[Cdecl] close; } public partial struct SDL_IOStream @@ -66,16 +66,16 @@ public static unsafe partial class SDL3 public static extern SDL_IOStream* SDL_IOFromFile([NativeTypeName("const char *")] byte* file, [NativeTypeName("const char *")] byte* mode); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_IOStream* SDL_IOFromMem(void* mem, [NativeTypeName("size_t")] nuint size); + public static extern SDL_IOStream* SDL_IOFromMem([NativeTypeName("void*")] IntPtr mem, [NativeTypeName("size_t")] nuint size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_IOStream* SDL_IOFromConstMem([NativeTypeName("const void *")] void* mem, [NativeTypeName("size_t")] nuint size); + public static extern SDL_IOStream* SDL_IOFromConstMem([NativeTypeName("const void *")] IntPtr mem, [NativeTypeName("size_t")] nuint size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_IOStream* SDL_IOFromDynamicMem(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_IOStream* SDL_OpenIO([NativeTypeName("const SDL_IOStreamInterface *")] SDL_IOStreamInterface* iface, void* userdata); + public static extern SDL_IOStream* SDL_OpenIO([NativeTypeName("const SDL_IOStreamInterface *")] SDL_IOStreamInterface* iface, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_CloseIO(SDL_IOStream* context); @@ -101,11 +101,11 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_ReadIO(SDL_IOStream* context, void* ptr, [NativeTypeName("size_t")] nuint size); + public static extern nuint SDL_ReadIO(SDL_IOStream* context, [NativeTypeName("void*")] IntPtr ptr, [NativeTypeName("size_t")] nuint size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] - public static extern nuint SDL_WriteIO(SDL_IOStream* context, [NativeTypeName("const void *")] void* ptr, [NativeTypeName("size_t")] nuint size); + public static extern nuint SDL_WriteIO(SDL_IOStream* context, [NativeTypeName("const void *")] IntPtr ptr, [NativeTypeName("size_t")] nuint size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -116,10 +116,12 @@ public static unsafe partial class SDL3 public static extern nuint SDL_IOvprintf(SDL_IOStream* context, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_LoadFile_IO(SDL_IOStream* src, [NativeTypeName("size_t *")] nuint* datasize, [NativeTypeName("SDL_bool")] int closeio); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_LoadFile_IO(SDL_IOStream* src, [NativeTypeName("size_t *")] nuint* datasize, [NativeTypeName("SDL_bool")] int closeio); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_LoadFile([NativeTypeName("const char *")] byte* file, [NativeTypeName("size_t *")] nuint* datasize); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_LoadFile([NativeTypeName("const char *")] byte* file, [NativeTypeName("size_t *")] nuint* datasize); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs index 6eece21..8ca7770 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs @@ -89,25 +89,26 @@ public unsafe partial struct SDL_VirtualJoystickDesc [NativeTypeName("const char *")] public byte* name; - public void* userdata; + [NativeTypeName("void*")] + public IntPtr userdata; [NativeTypeName("void (*)(void *)")] - public delegate* unmanaged[Cdecl] Update; + public delegate* unmanaged[Cdecl] Update; [NativeTypeName("void (*)(void *, int)")] - public delegate* unmanaged[Cdecl] SetPlayerIndex; + public delegate* unmanaged[Cdecl] SetPlayerIndex; [NativeTypeName("int (*)(void *, Uint16, Uint16)")] - public delegate* unmanaged[Cdecl] Rumble; + public delegate* unmanaged[Cdecl] Rumble; [NativeTypeName("int (*)(void *, Uint16, Uint16)")] - public delegate* unmanaged[Cdecl] RumbleTriggers; + public delegate* unmanaged[Cdecl] RumbleTriggers; [NativeTypeName("int (*)(void *, Uint8, Uint8, Uint8)")] - public delegate* unmanaged[Cdecl] SetLED; + public delegate* unmanaged[Cdecl] SetLED; [NativeTypeName("int (*)(void *, const void *, int)")] - public delegate* unmanaged[Cdecl] SendEffect; + public delegate* unmanaged[Cdecl] SendEffect; } public static unsafe partial class SDL3 @@ -303,7 +304,7 @@ public static unsafe partial class SDL3 public static extern int SDL_SetJoystickLED(SDL_Joystick* joystick, [NativeTypeName("Uint8")] byte red, [NativeTypeName("Uint8")] byte green, [NativeTypeName("Uint8")] byte blue); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SendJoystickEffect(SDL_Joystick* joystick, [NativeTypeName("const void *")] void* data, int size); + public static extern int SDL_SendJoystickEffect(SDL_Joystick* joystick, [NativeTypeName("const void *")] IntPtr data, int size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_CloseJoystick(SDL_Joystick* joystick); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs index 8354f3f..6afac12 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs @@ -23,6 +23,7 @@ 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 @@ -30,13 +31,14 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_LoadObject([NativeTypeName("const char *")] byte* sofile); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_LoadObject([NativeTypeName("const char *")] byte* sofile); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_FunctionPointer")] - public static extern delegate* unmanaged[Cdecl] SDL_LoadFunction(void* handle, [NativeTypeName("const char *")] byte* name); + public static extern delegate* unmanaged[Cdecl] SDL_LoadFunction([NativeTypeName("void*")] IntPtr handle, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_UnloadObject(void* handle); + public static extern void SDL_UnloadObject([NativeTypeName("void*")] IntPtr handle); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs index 45e72a6..78da5b8 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs @@ -23,6 +23,7 @@ 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 @@ -104,10 +105,10 @@ public static unsafe partial class SDL3 public static extern void SDL_LogMessageV(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_GetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction *")] delegate* unmanaged[Cdecl]* callback, void** userdata); + public static extern void SDL_GetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction *")] delegate* unmanaged[Cdecl]* callback, [NativeTypeName("void **")] IntPtr* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern void SDL_SetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [NativeTypeName("#define SDL_MAX_LOG_MESSAGE 4096")] public const int SDL_MAX_LOG_MESSAGE = 4096; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs index 137103a..d2e4bd4 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs @@ -23,6 +23,7 @@ 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; using System.Runtime.Versioning; @@ -32,7 +33,7 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] - public static extern int SDL_RegisterApp([NativeTypeName("const char *")] byte* name, [NativeTypeName("Uint32")] uint style, void* hInst); + public static extern int SDL_RegisterApp([NativeTypeName("const char *")] byte* name, [NativeTypeName("Uint32")] uint style, [NativeTypeName("void*")] IntPtr hInst); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs index 990ebc2..de43933 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.g.cs @@ -23,6 +23,7 @@ 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 @@ -33,9 +34,9 @@ public static unsafe partial class SDL3 public static extern void SDL_SetMainReady(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_RunApp(int argc, [NativeTypeName("char *[]")] byte** argv, [NativeTypeName("SDL_main_func")] delegate* unmanaged[Cdecl] mainFunction, void* reserved); + public static extern int SDL_RunApp(int argc, [NativeTypeName("char *[]")] byte** argv, [NativeTypeName("SDL_main_func")] delegate* unmanaged[Cdecl] mainFunction, [NativeTypeName("void*")] IntPtr reserved); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_EnterAppMainCallbacks(int argc, [NativeTypeName("char *[]")] byte** argv, [NativeTypeName("SDL_AppInit_func")] delegate* unmanaged[Cdecl] appinit, [NativeTypeName("SDL_AppIterate_func")] delegate* unmanaged[Cdecl] appiter, [NativeTypeName("SDL_AppEvent_func")] delegate* unmanaged[Cdecl] appevent, [NativeTypeName("SDL_AppQuit_func")] delegate* unmanaged[Cdecl] appquit); + public static extern int SDL_EnterAppMainCallbacks(int argc, [NativeTypeName("char *[]")] byte** argv, [NativeTypeName("SDL_AppInit_func")] delegate* unmanaged[Cdecl] appinit, [NativeTypeName("SDL_AppIterate_func")] delegate* unmanaged[Cdecl] appiter, [NativeTypeName("SDL_AppEvent_func")] delegate* unmanaged[Cdecl] appevent, [NativeTypeName("SDL_AppQuit_func")] delegate* unmanaged[Cdecl] appquit); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_metal.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_metal.g.cs index f90f44c..ae29905 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_metal.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_metal.g.cs @@ -23,6 +23,7 @@ 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 @@ -31,12 +32,13 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_MetalView")] - public static extern void* SDL_Metal_CreateView(SDL_Window* window); + public static extern IntPtr SDL_Metal_CreateView(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_Metal_DestroyView([NativeTypeName("SDL_MetalView")] void* view); + public static extern void SDL_Metal_DestroyView([NativeTypeName("SDL_MetalView")] IntPtr view); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_Metal_GetLayer([NativeTypeName("SDL_MetalView")] void* view); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_Metal_GetLayer([NativeTypeName("SDL_MetalView")] IntPtr view); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs index 25a4c62..4b7ecbf 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs @@ -23,6 +23,7 @@ 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 @@ -57,10 +58,10 @@ public static unsafe partial class SDL3 public static extern void SDL_UnlockProperties([NativeTypeName("SDL_PropertiesID")] uint props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetPropertyWithCleanup([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, void* value, [NativeTypeName("void (*)(void *, void *)")] delegate* unmanaged[Cdecl] cleanup, void* userdata); + public static extern int SDL_SetPropertyWithCleanup([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr value, [NativeTypeName("void (*)(void *, void *)")] delegate* unmanaged[Cdecl] cleanup, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, void* value); + public static extern int SDL_SetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetStringProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value); @@ -82,7 +83,8 @@ public static unsafe partial class SDL3 public static extern SDL_PropertyType SDL_GetPropertyType([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_GetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, void* default_value); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_GetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] @@ -103,7 +105,7 @@ public static unsafe partial class SDL3 public static extern int SDL_ClearProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_EnumerateProperties([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("SDL_EnumeratePropertiesCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_EnumerateProperties([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("SDL_EnumeratePropertiesCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_DestroyProperties([NativeTypeName("SDL_PropertiesID")] uint props); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs index c5c0291..6cc9f95 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs @@ -187,7 +187,7 @@ public static unsafe partial class SDL3 public static extern int SDL_GetTextureScaleMode(SDL_Texture* texture, SDL_ScaleMode* scaleMode); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_UpdateTexture(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("const void *")] void* pixels, int pitch); + public static extern int SDL_UpdateTexture(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("const void *")] IntPtr pixels, int pitch); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_UpdateYUVTexture(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("const Uint8 *")] byte* Yplane, int Ypitch, [NativeTypeName("const Uint8 *")] byte* Uplane, int Upitch, [NativeTypeName("const Uint8 *")] byte* Vplane, int Vpitch); @@ -196,7 +196,7 @@ public static unsafe partial class SDL3 public static extern int SDL_UpdateNVTexture(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("const Uint8 *")] byte* Yplane, int Ypitch, [NativeTypeName("const Uint8 *")] byte* UVplane, int UVpitch); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_LockTexture(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, void** pixels, int* pitch); + public static extern int SDL_LockTexture(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("void **")] IntPtr* pixels, int* pitch); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_LockTextureToSurface(SDL_Texture* texture, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, SDL_Surface** surface); @@ -312,10 +312,10 @@ public static unsafe partial class SDL3 public static extern int 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); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_RenderGeometryRaw(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const float *")] float* xy, int xy_stride, [NativeTypeName("const SDL_Color *")] SDL_Color* color, int color_stride, [NativeTypeName("const float *")] float* uv, int uv_stride, int num_vertices, [NativeTypeName("const void *")] void* indices, int num_indices, int size_indices); + public static extern int SDL_RenderGeometryRaw(SDL_Renderer* renderer, SDL_Texture* texture, [NativeTypeName("const float *")] float* xy, int xy_stride, [NativeTypeName("const SDL_Color *")] SDL_Color* 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)] - public static extern int SDL_RenderGeometryRawFloat(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 *")] void* indices, int num_indices, int size_indices); + public static extern int SDL_RenderGeometryRawFloat(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)] public static extern SDL_Surface* SDL_RenderReadPixels(SDL_Renderer* renderer, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); @@ -333,10 +333,12 @@ public static unsafe partial class SDL3 public static extern int SDL_FlushRenderer(SDL_Renderer* renderer); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_GetRenderMetalLayer(SDL_Renderer* renderer); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_GetRenderMetalLayer(SDL_Renderer* renderer); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_GetRenderMetalCommandEncoder(SDL_Renderer* renderer); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_GetRenderMetalCommandEncoder(SDL_Renderer* renderer); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_AddVulkanRenderSemaphores(SDL_Renderer* renderer, [NativeTypeName("Uint32")] uint wait_stage_mask, [NativeTypeName("Sint64")] long wait_semaphore, [NativeTypeName("Sint64")] long signal_semaphore); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index 932de96..577cbae 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -40,31 +40,35 @@ public partial struct SDL_iconv_data_t public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_malloc([NativeTypeName("size_t")] nuint size); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_malloc([NativeTypeName("size_t")] nuint size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_calloc([NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_calloc([NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_realloc(void* mem, [NativeTypeName("size_t")] nuint size); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_realloc([NativeTypeName("void*")] IntPtr mem, [NativeTypeName("size_t")] nuint size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_free(void* mem); + public static extern void SDL_free([NativeTypeName("void*")] IntPtr mem); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_GetOriginalMemoryFunctions([NativeTypeName("SDL_malloc_func *")] delegate* unmanaged[Cdecl]* malloc_func, [NativeTypeName("SDL_calloc_func *")] delegate* unmanaged[Cdecl]* calloc_func, [NativeTypeName("SDL_realloc_func *")] delegate* unmanaged[Cdecl]* realloc_func, [NativeTypeName("SDL_free_func *")] delegate* unmanaged[Cdecl]* free_func); + public static extern void SDL_GetOriginalMemoryFunctions([NativeTypeName("SDL_malloc_func *")] delegate* unmanaged[Cdecl]* malloc_func, [NativeTypeName("SDL_calloc_func *")] delegate* unmanaged[Cdecl]* calloc_func, [NativeTypeName("SDL_realloc_func *")] delegate* unmanaged[Cdecl]* realloc_func, [NativeTypeName("SDL_free_func *")] delegate* unmanaged[Cdecl]* free_func); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_GetMemoryFunctions([NativeTypeName("SDL_malloc_func *")] delegate* unmanaged[Cdecl]* malloc_func, [NativeTypeName("SDL_calloc_func *")] delegate* unmanaged[Cdecl]* calloc_func, [NativeTypeName("SDL_realloc_func *")] delegate* unmanaged[Cdecl]* realloc_func, [NativeTypeName("SDL_free_func *")] delegate* unmanaged[Cdecl]* free_func); + public static extern void SDL_GetMemoryFunctions([NativeTypeName("SDL_malloc_func *")] delegate* unmanaged[Cdecl]* malloc_func, [NativeTypeName("SDL_calloc_func *")] delegate* unmanaged[Cdecl]* calloc_func, [NativeTypeName("SDL_realloc_func *")] delegate* unmanaged[Cdecl]* realloc_func, [NativeTypeName("SDL_free_func *")] delegate* unmanaged[Cdecl]* free_func); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetMemoryFunctions([NativeTypeName("SDL_malloc_func")] delegate* unmanaged[Cdecl] malloc_func, [NativeTypeName("SDL_calloc_func")] delegate* unmanaged[Cdecl] calloc_func, [NativeTypeName("SDL_realloc_func")] delegate* unmanaged[Cdecl] realloc_func, [NativeTypeName("SDL_free_func")] delegate* unmanaged[Cdecl] free_func); + public static extern int SDL_SetMemoryFunctions([NativeTypeName("SDL_malloc_func")] delegate* unmanaged[Cdecl] malloc_func, [NativeTypeName("SDL_calloc_func")] delegate* unmanaged[Cdecl] calloc_func, [NativeTypeName("SDL_realloc_func")] delegate* unmanaged[Cdecl] realloc_func, [NativeTypeName("SDL_free_func")] delegate* unmanaged[Cdecl] free_func); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_aligned_alloc([NativeTypeName("size_t")] nuint alignment, [NativeTypeName("size_t")] nuint size); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_aligned_alloc([NativeTypeName("size_t")] nuint alignment, [NativeTypeName("size_t")] nuint size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_aligned_free(void* mem); + public static extern void SDL_aligned_free([NativeTypeName("void*")] IntPtr mem); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetNumAllocations(); @@ -77,16 +81,18 @@ public static unsafe partial class SDL3 public static extern int SDL_setenv([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value, int overwrite); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_qsort(void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *)")] delegate* unmanaged[Cdecl] compare); + public static extern void SDL_qsort([NativeTypeName("void*")] IntPtr @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *)")] delegate* unmanaged[Cdecl] compare); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_bsearch([NativeTypeName("const void *")] void* key, [NativeTypeName("const void *")] void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *)")] delegate* unmanaged[Cdecl] compare); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_bsearch([NativeTypeName("const void *")] IntPtr key, [NativeTypeName("const void *")] IntPtr @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(const void *, const void *)")] delegate* unmanaged[Cdecl] compare); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_qsort_r(void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(void *, const void *, const void *)")] delegate* unmanaged[Cdecl] compare, void* userdata); + public static extern void SDL_qsort_r([NativeTypeName("void*")] IntPtr @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(void *, const void *, const void *)")] delegate* unmanaged[Cdecl] compare, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_bsearch_r([NativeTypeName("const void *")] void* key, [NativeTypeName("const void *")] void* @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(void *, const void *, const void *)")] delegate* unmanaged[Cdecl] compare, void* userdata); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_bsearch_r([NativeTypeName("const void *")] IntPtr key, [NativeTypeName("const void *")] IntPtr @base, [NativeTypeName("size_t")] nuint nmemb, [NativeTypeName("size_t")] nuint size, [NativeTypeName("int (*)(void *, const void *, const void *)")] delegate* unmanaged[Cdecl] compare, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_abs(int x); @@ -135,26 +141,30 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint16")] - public static extern ushort SDL_crc16([NativeTypeName("Uint16")] ushort crc, [NativeTypeName("const void *")] void* data, [NativeTypeName("size_t")] nuint len); + public static extern ushort SDL_crc16([NativeTypeName("Uint16")] ushort crc, [NativeTypeName("const void *")] IntPtr data, [NativeTypeName("size_t")] nuint len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint32")] - public static extern uint SDL_crc32([NativeTypeName("Uint32")] uint crc, [NativeTypeName("const void *")] void* data, [NativeTypeName("size_t")] nuint len); + public static extern uint SDL_crc32([NativeTypeName("Uint32")] uint crc, [NativeTypeName("const void *")] IntPtr data, [NativeTypeName("size_t")] nuint len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_memcpy(void* dst, [NativeTypeName("const void *")] void* src, [NativeTypeName("size_t")] nuint len); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_memcpy([NativeTypeName("void*")] IntPtr dst, [NativeTypeName("const void *")] IntPtr src, [NativeTypeName("size_t")] nuint len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_memmove(void* dst, [NativeTypeName("const void *")] void* src, [NativeTypeName("size_t")] nuint len); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_memmove([NativeTypeName("void*")] IntPtr dst, [NativeTypeName("const void *")] IntPtr src, [NativeTypeName("size_t")] nuint len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_memset(void* dst, int c, [NativeTypeName("size_t")] nuint len); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_memset([NativeTypeName("void*")] IntPtr dst, int c, [NativeTypeName("size_t")] nuint len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_memset4(void* dst, [NativeTypeName("Uint32")] uint val, [NativeTypeName("size_t")] nuint dwords); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_memset4([NativeTypeName("void*")] IntPtr dst, [NativeTypeName("Uint32")] uint val, [NativeTypeName("size_t")] nuint dwords); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_memcmp([NativeTypeName("const void *")] void* s1, [NativeTypeName("const void *")] void* s2, [NativeTypeName("size_t")] nuint len); + public static extern int SDL_memcmp([NativeTypeName("const void *")] IntPtr s1, [NativeTypeName("const void *")] IntPtr s2, [NativeTypeName("size_t")] nuint len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs index d169d98..0d2eb83 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs @@ -23,6 +23,7 @@ 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 @@ -30,34 +31,34 @@ namespace SDL public unsafe partial struct SDL_StorageInterface { [NativeTypeName("int (*)(void *)")] - public delegate* unmanaged[Cdecl] close; + public delegate* unmanaged[Cdecl] close; [NativeTypeName("SDL_bool (*)(void *)")] - public delegate* unmanaged[Cdecl] ready; + public delegate* unmanaged[Cdecl] ready; [NativeTypeName("int (*)(void *, const char *, SDL_EnumerateDirectoryCallback, void *)")] - public delegate* unmanaged[Cdecl], void*, int> enumerate; + public delegate* unmanaged[Cdecl], IntPtr, int> enumerate; [NativeTypeName("int (*)(void *, const char *, SDL_PathInfo *)")] - public delegate* unmanaged[Cdecl] info; + public delegate* unmanaged[Cdecl] info; [NativeTypeName("int (*)(void *, const char *, void *, Uint64)")] - public delegate* unmanaged[Cdecl] read_file; + public delegate* unmanaged[Cdecl] read_file; [NativeTypeName("int (*)(void *, const char *, const void *, Uint64)")] - public delegate* unmanaged[Cdecl] write_file; + public delegate* unmanaged[Cdecl] write_file; [NativeTypeName("int (*)(void *, const char *)")] - public delegate* unmanaged[Cdecl] mkdir; + public delegate* unmanaged[Cdecl] mkdir; [NativeTypeName("int (*)(void *, const char *)")] - public delegate* unmanaged[Cdecl] remove; + public delegate* unmanaged[Cdecl] remove; [NativeTypeName("int (*)(void *, const char *, const char *)")] - public delegate* unmanaged[Cdecl] rename; + public delegate* unmanaged[Cdecl] rename; [NativeTypeName("Uint64 (*)(void *)")] - public delegate* unmanaged[Cdecl] space_remaining; + public delegate* unmanaged[Cdecl] space_remaining; } public partial struct SDL_Storage @@ -76,7 +77,7 @@ public static unsafe partial class SDL3 public static extern SDL_Storage* SDL_OpenFileStorage([NativeTypeName("const char *")] byte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Storage* SDL_OpenStorage([NativeTypeName("const SDL_StorageInterface *")] SDL_StorageInterface* iface, void* userdata); + public static extern SDL_Storage* SDL_OpenStorage([NativeTypeName("const SDL_StorageInterface *")] SDL_StorageInterface* iface, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_CloseStorage(SDL_Storage* storage); @@ -89,16 +90,16 @@ public static unsafe partial class SDL3 public static extern int SDL_GetStorageFileSize(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("Uint64 *")] ulong* length); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ReadStorageFile(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, void* destination, [NativeTypeName("Uint64")] ulong length); + public static extern int SDL_ReadStorageFile(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("void*")] IntPtr destination, [NativeTypeName("Uint64")] ulong length); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_WriteStorageFile(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("const void *")] void* source, [NativeTypeName("Uint64")] ulong length); + public static extern int SDL_WriteStorageFile(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("const void *")] IntPtr source, [NativeTypeName("Uint64")] ulong length); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_CreateStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_EnumerateStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("SDL_EnumerateDirectoryCallback")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern int SDL_EnumerateStorageDirectory(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("SDL_EnumerateDirectoryCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_RemoveStoragePath(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs index 1b0d6f4..3f4d3a4 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs @@ -59,13 +59,16 @@ public unsafe partial struct SDL_Surface public int pitch; - public void* pixels; + [NativeTypeName("void*")] + public IntPtr pixels; - public void* reserved; + [NativeTypeName("void*")] + public IntPtr reserved; public int locked; - public void* list_blitmap; + [NativeTypeName("void*")] + public IntPtr list_blitmap; public SDL_Rect clip_rect; @@ -80,7 +83,7 @@ public static unsafe partial class SDL3 public static extern SDL_Surface* SDL_CreateSurface(int width, int height, SDL_PixelFormatEnum format); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Surface* SDL_CreateSurfaceFrom(void* pixels, int width, int height, int pitch, SDL_PixelFormatEnum format); + public static extern SDL_Surface* SDL_CreateSurfaceFrom([NativeTypeName("void*")] IntPtr pixels, int width, int height, int pitch, SDL_PixelFormatEnum format); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_DestroySurface(SDL_Surface* surface); @@ -174,13 +177,13 @@ public static unsafe partial class SDL3 public static extern SDL_Surface* SDL_ConvertSurfaceFormatAndColorspace(SDL_Surface* surface, SDL_PixelFormatEnum pixel_format, SDL_Colorspace colorspace, [NativeTypeName("SDL_PropertiesID")] uint props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ConvertPixels(int width, int height, SDL_PixelFormatEnum src_format, [NativeTypeName("const void *")] void* src, int src_pitch, SDL_PixelFormatEnum dst_format, void* dst, int dst_pitch); + public static extern int SDL_ConvertPixels(int width, int height, SDL_PixelFormatEnum src_format, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormatEnum dst_format, [NativeTypeName("void*")] IntPtr dst, int dst_pitch); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormatEnum src_format, SDL_Colorspace src_colorspace, [NativeTypeName("SDL_PropertiesID")] uint src_properties, [NativeTypeName("const void *")] void* src, int src_pitch, SDL_PixelFormatEnum dst_format, SDL_Colorspace dst_colorspace, [NativeTypeName("SDL_PropertiesID")] uint dst_properties, void* dst, int dst_pitch); + public static extern int SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormatEnum src_format, SDL_Colorspace src_colorspace, [NativeTypeName("SDL_PropertiesID")] uint src_properties, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormatEnum dst_format, SDL_Colorspace dst_colorspace, [NativeTypeName("SDL_PropertiesID")] uint dst_properties, [NativeTypeName("void*")] IntPtr dst, int dst_pitch); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormatEnum src_format, [NativeTypeName("const void *")] void* src, int src_pitch, SDL_PixelFormatEnum dst_format, void* dst, int dst_pitch); + public static extern int SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormatEnum src_format, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormatEnum dst_format, [NativeTypeName("void*")] IntPtr dst, int dst_pitch); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_FillSurfaceRect(SDL_Surface* dst, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, [NativeTypeName("Uint32")] uint color); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs index 3d133e9..83dd054 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs @@ -23,6 +23,7 @@ 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; using System.Runtime.Versioning; @@ -31,12 +32,14 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] [SupportedOSPlatform("Android")] - public static extern void* SDL_AndroidGetJNIEnv(); + public static extern IntPtr SDL_AndroidGetJNIEnv(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] [SupportedOSPlatform("Android")] - public static extern void* SDL_AndroidGetActivity(); + public static extern IntPtr SDL_AndroidGetActivity(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] @@ -77,7 +80,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] - public static extern int SDL_AndroidRequestPermission([NativeTypeName("const char *")] byte* permission, [NativeTypeName("SDL_AndroidRequestPermissionCallback")] delegate* unmanaged[Cdecl] cb, void* userdata); + public static extern int SDL_AndroidRequestPermission([NativeTypeName("const char *")] byte* permission, [NativeTypeName("SDL_AndroidRequestPermissionCallback")] delegate* unmanaged[Cdecl] cb, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs index b61aac4..769b1c1 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs @@ -23,6 +23,7 @@ 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; using System.Runtime.Versioning; @@ -40,7 +41,7 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] - public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs index 6664394..e1c755c 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs @@ -31,7 +31,7 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetX11EventHook([NativeTypeName("SDL_X11EventHook")] delegate* unmanaged[Cdecl] callback, void* userdata); + public static extern void SDL_SetX11EventHook([NativeTypeName("SDL_X11EventHook")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs index 3d9f7f5..688380d 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs @@ -23,6 +23,7 @@ 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; using System.Runtime.Versioning; @@ -32,7 +33,7 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("iOS")] - public static extern int SDL_iPhoneSetAnimationCallback(SDL_Window* window, int interval, [NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] callback, void* callbackParam); + public static extern int SDL_iPhoneSetAnimationCallback(SDL_Window* window, int interval, [NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr callbackParam); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("iOS")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs index d37d3fb..9c77900 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs @@ -23,6 +23,7 @@ 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 @@ -42,10 +43,10 @@ public enum SDL_ThreadPriority public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Thread* SDL_CreateThread([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] byte* name, void* data); + public static extern SDL_Thread* SDL_CreateThread([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr data); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Thread* SDL_CreateThreadWithStackSize([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const size_t")] nuint stacksize, void* data); + public static extern SDL_Thread* SDL_CreateThreadWithStackSize([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const size_t")] nuint stacksize, [NativeTypeName("void*")] IntPtr data); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] @@ -73,10 +74,11 @@ public static unsafe partial class SDL3 public static extern uint SDL_CreateTLS(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_GetTLS([NativeTypeName("SDL_TLSID")] uint id); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_GetTLS([NativeTypeName("SDL_TLSID")] uint id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetTLS([NativeTypeName("SDL_TLSID")] uint id, [NativeTypeName("const void *")] void* value, [NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] destructor); + public static extern int SDL_SetTLS([NativeTypeName("SDL_TLSID")] uint id, [NativeTypeName("const void *")] IntPtr value, [NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] destructor); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_CleanupTLS(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs index d5f9c93..46e8e63 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs @@ -23,6 +23,7 @@ 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 @@ -53,7 +54,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_TimerID")] - public static extern uint SDL_AddTimer([NativeTypeName("Uint32")] uint interval, [NativeTypeName("SDL_TimerCallback")] delegate* unmanaged[Cdecl] callback, void* param2); + public static extern uint SDL_AddTimer([NativeTypeName("Uint32")] uint interval, [NativeTypeName("SDL_TimerCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr param2); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_bool")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs index 69de60c..ae769fe 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs @@ -35,7 +35,7 @@ public enum SDL_SystemTheme SDL_SYSTEM_THEME_DARK, } - public unsafe partial struct SDL_DisplayMode + public partial struct SDL_DisplayMode { [NativeTypeName("SDL_DisplayID")] public uint displayID; @@ -50,7 +50,8 @@ public unsafe partial struct SDL_DisplayMode public float refresh_rate; - public void* driverdata; + [NativeTypeName("void*")] + public IntPtr driverdata; } public enum SDL_DisplayOrientation @@ -235,7 +236,8 @@ public static unsafe partial class SDL3 public static extern SDL_DisplayMode* SDL_GetWindowFullscreenMode(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void* SDL_GetWindowICCProfile(SDL_Window* window, [NativeTypeName("size_t *")] nuint* size); + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_GetWindowICCProfile(SDL_Window* window, [NativeTypeName("size_t *")] nuint* size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint32")] @@ -400,7 +402,7 @@ public static unsafe partial class SDL3 public static extern int SDL_ShowWindowSystemMenu(SDL_Window* window, int x, int y); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetWindowHitTest(SDL_Window* window, [NativeTypeName("SDL_HitTest")] delegate* unmanaged[Cdecl] callback, void* callback_data); + public static extern int SDL_SetWindowHitTest(SDL_Window* window, [NativeTypeName("SDL_HitTest")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr callback_data); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetWindowShape(SDL_Window* window, SDL_Surface* shape); @@ -450,29 +452,29 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_GLContext")] - public static extern void* SDL_GL_CreateContext(SDL_Window* window); + public static extern IntPtr SDL_GL_CreateContext(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GL_MakeCurrent(SDL_Window* window, [NativeTypeName("SDL_GLContext")] void* context); + public static extern int SDL_GL_MakeCurrent(SDL_Window* window, [NativeTypeName("SDL_GLContext")] IntPtr context); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Window* SDL_GL_GetCurrentWindow(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_GLContext")] - public static extern void* SDL_GL_GetCurrentContext(); + public static extern IntPtr SDL_GL_GetCurrentContext(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_EGLDisplay")] - public static extern void* SDL_EGL_GetCurrentEGLDisplay(); + public static extern IntPtr SDL_EGL_GetCurrentEGLDisplay(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_EGLConfig")] - public static extern void* SDL_EGL_GetCurrentEGLConfig(); + public static extern IntPtr SDL_EGL_GetCurrentEGLConfig(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_EGLSurface")] - public static extern void* SDL_EGL_GetWindowEGLSurface(SDL_Window* window); + public static extern IntPtr SDL_EGL_GetWindowEGLSurface(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_EGL_SetEGLAttributeCallbacks([NativeTypeName("SDL_EGLAttribArrayCallback")] delegate* unmanaged[Cdecl] platformAttribCallback, [NativeTypeName("SDL_EGLIntArrayCallback")] delegate* unmanaged[Cdecl] surfaceAttribCallback, [NativeTypeName("SDL_EGLIntArrayCallback")] delegate* unmanaged[Cdecl] contextAttribCallback); @@ -487,7 +489,7 @@ public static unsafe partial class SDL3 public static extern int SDL_GL_SwapWindow(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GL_DeleteContext([NativeTypeName("SDL_GLContext")] void* context); + public static extern int SDL_GL_DeleteContext([NativeTypeName("SDL_GLContext")] IntPtr context); [NativeTypeName("#define SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER \"SDL.video.wayland.wl_display\"")] public static ReadOnlySpan SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER => "SDL.video.wayland.wl_display"u8; diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 442d1af..a8d71c6 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -175,6 +175,7 @@ def check_generated_functions(sdl_api, header, generated_file_paths): "--namespace", "SDL", "--remap", + "void*=IntPtr", "char=byte", "wchar_t *=IntPtr", # wchar_t has a platform-defined size From 75a9cde3f8d390b8614b077d387e184db97ff28e Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 12:37:14 +0200 Subject: [PATCH 16/37] Don't log potential typedef remappings Produces a lot of noise about unused remappings (as we're processing a header at a time). All remappings (except `SDL_JoystickGUID`) have been added. `SDL_JoystickGUID` is a remapping of a struct, so it's harded to do programatically. --- SDL3-CS/generate_bindings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index a8d71c6..567c9cf 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -166,7 +166,6 @@ def check_generated_functions(sdl_api, header, generated_file_paths): "latest-codegen", "windows-types", "generate-macro-bindings", - "log-potential-typedef-remappings", "--file-directory", SDL_include_root, "--include-directory", SDL_include_root, From a25b4be3b283531ed02e923d3fc3ee1894747a9b Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 12:54:12 +0200 Subject: [PATCH 17/37] Add [UnsupportedOSPlatform("windows")] to `SDL_CreateThread()` functions See commit: 72353a8ab9cb447879daad5e9cff8986581296de --- SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs | 3 +++ SDL3-CS/SDL3/SDL_thread.rsp | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 SDL3-CS/SDL3/SDL_thread.rsp diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs index 9c77900..4a2545f 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs @@ -25,6 +25,7 @@ 3. This notice may not be removed or altered from any source distribution. using System; using System.Runtime.InteropServices; +using System.Runtime.Versioning; namespace SDL { @@ -43,9 +44,11 @@ public enum SDL_ThreadPriority public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [UnsupportedOSPlatform("windows")] public static extern SDL_Thread* SDL_CreateThread([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr data); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [UnsupportedOSPlatform("windows")] public static extern SDL_Thread* SDL_CreateThreadWithStackSize([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const size_t")] nuint stacksize, [NativeTypeName("void*")] IntPtr data); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] diff --git a/SDL3-CS/SDL3/SDL_thread.rsp b/SDL3-CS/SDL3/SDL_thread.rsp new file mode 100644 index 0000000..6b497c5 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_thread.rsp @@ -0,0 +1,10 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +--with-using +# the SDL_CreateThread symbol name doesn't matter, it just needs to be any symbol defined in SDL_thread.h +SDL_CreateThread=System.Runtime.Versioning + +--with-attribute +SDL_CreateThread=UnsupportedOSPlatform("windows") +SDL_CreateThreadWithStackSize=UnsupportedOSPlatform("windows") From dfe0d2533cf399cafcdb7ad44f1196f272ab3d65 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 12:58:35 +0200 Subject: [PATCH 18/37] Add `[Flags]` attribute to mask/flags enums --- SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs | 2 ++ SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs | 2 ++ SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs | 3 +++ SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs | 1 + SDL3-CS/SDL3/SDL_init.rsp | 5 +++++ SDL3-CS/SDL3/SDL_keycode.rsp | 5 +++++ SDL3-CS/SDL3/SDL_messagebox.rsp | 6 ++++++ SDL3-CS/SDL3/SDL_render.rsp | 5 +++++ 8 files changed, 29 insertions(+) create mode 100644 SDL3-CS/SDL3/SDL_init.rsp create mode 100644 SDL3-CS/SDL3/SDL_keycode.rsp create mode 100644 SDL3-CS/SDL3/SDL_messagebox.rsp create mode 100644 SDL3-CS/SDL3/SDL_render.rsp diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs index 5076d55..0e83d12 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs @@ -23,10 +23,12 @@ 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 { + [Flags] public enum SDL_InitFlags { SDL_INIT_TIMER = 0x00000001, diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs index 570563f..48d611b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs @@ -23,6 +23,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +using System; using static SDL.SDL_Scancode; namespace SDL @@ -275,6 +276,7 @@ public enum SDL_KeyCode SDLK_ENDCALL = (SDL_SCANCODE_ENDCALL | (1 << 30)), } + [Flags] public enum SDL_Keymod { SDL_KMOD_NONE = 0x0000, diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs index fc52982..7e5ef84 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs @@ -23,11 +23,13 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace SDL { + [Flags] public enum SDL_MessageBoxFlags { SDL_MESSAGEBOX_ERROR = 0x00000010, @@ -37,6 +39,7 @@ public enum SDL_MessageBoxFlags SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100, } + [Flags] public enum SDL_MessageBoxButtonFlags { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs index 6cc9f95..e66dc17 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs @@ -29,6 +29,7 @@ 3. This notice may not be removed or altered from any source distribution. namespace SDL { + [Flags] public enum SDL_RendererFlags { SDL_RENDERER_PRESENTVSYNC = 0x00000004, diff --git a/SDL3-CS/SDL3/SDL_init.rsp b/SDL3-CS/SDL3/SDL_init.rsp new file mode 100644 index 0000000..b6345b4 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_init.rsp @@ -0,0 +1,5 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +--with-attribute +SDL_InitFlags=Flags diff --git a/SDL3-CS/SDL3/SDL_keycode.rsp b/SDL3-CS/SDL3/SDL_keycode.rsp new file mode 100644 index 0000000..15bb51a --- /dev/null +++ b/SDL3-CS/SDL3/SDL_keycode.rsp @@ -0,0 +1,5 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +--with-attribute +SDL_Keymod=Flags diff --git a/SDL3-CS/SDL3/SDL_messagebox.rsp b/SDL3-CS/SDL3/SDL_messagebox.rsp new file mode 100644 index 0000000..176d6b9 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_messagebox.rsp @@ -0,0 +1,6 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +--with-attribute +SDL_MessageBoxFlags=Flags +SDL_MessageBoxButtonFlags=Flags diff --git a/SDL3-CS/SDL3/SDL_render.rsp b/SDL3-CS/SDL3/SDL_render.rsp new file mode 100644 index 0000000..5c2e3c1 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_render.rsp @@ -0,0 +1,5 @@ +# Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +# See the LICENCE file in the repository root for full licence text. + +--with-attribute +SDL_RendererFlags=Flags From 409ecf7536ede08616cddc7ecb005a0c02776efa Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 13:17:28 +0200 Subject: [PATCH 19/37] Add C# enum "typedefs" for C typedefs This doesn't compile as ClangSharp fails to emit `unchecked` in `SDL_pen.g.cs` and `SDL_touch.g.cs`. And `(SDL_bool)` casts in `SDL_rect.g.cs`. --- SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs | 9 +- SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs | 49 +++--- SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs | 17 +-- SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs | 9 +- SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs | 42 ++---- SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs | 140 ++++++------------ SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs | 9 +- SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs | 65 ++++---- SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs | 24 ++- SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs | 12 +- SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs | 83 ++++------- SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs | 54 +++---- SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs | 30 ++-- SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs | 18 +-- SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs | 23 ++- SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs | 3 +- SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs | 46 +++--- SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs | 45 ++---- SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs | 18 +-- SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs | 19 +-- SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs | 9 +- SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs | 20 +-- .../SDL3/ClangSharp/SDL_system.Android.g.cs | 11 +- .../SDL3/ClangSharp/SDL_system.Windows.g.cs | 7 +- SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs | 5 +- SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs | 13 +- SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs | 11 +- SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs | 6 +- SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs | 18 +-- SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs | 87 +++++------ SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs | 3 +- SDL3-CS/SDL3/SDL_audio.cs | 23 +++ SDL3-CS/SDL3/SDL_camera.cs | 10 ++ SDL3-CS/SDL3/SDL_haptic.cs | 10 ++ SDL3-CS/SDL3/SDL_joystick.cs | 10 ++ SDL3-CS/SDL3/SDL_keyboard.cs | 10 ++ SDL3-CS/SDL3/SDL_keycode.cs | 10 ++ SDL3-CS/SDL3/SDL_mouse.cs | 10 ++ SDL3-CS/SDL3/SDL_pen.cs | 10 ++ SDL3-CS/SDL3/SDL_properties.cs | 10 ++ SDL3-CS/SDL3/SDL_sensor.cs | 10 ++ SDL3-CS/SDL3/SDL_stdinc.cs | 17 +++ SDL3-CS/SDL3/SDL_thread.cs | 13 ++ SDL3-CS/SDL3/SDL_timer.cs | 10 ++ SDL3-CS/SDL3/SDL_touch.cs | 13 ++ SDL3-CS/SDL3/SDL_video.cs | 42 ++++++ SDL3-CS/TypedefAttribute.cs | 17 +++ SDL3-CS/generate_bindings.py | 30 ++++ 51 files changed, 605 insertions(+), 563 deletions(-) create mode 100644 SDL3-CS/SDL3/SDL_audio.cs create mode 100644 SDL3-CS/SDL3/SDL_camera.cs create mode 100644 SDL3-CS/SDL3/SDL_haptic.cs create mode 100644 SDL3-CS/SDL3/SDL_joystick.cs create mode 100644 SDL3-CS/SDL3/SDL_keyboard.cs create mode 100644 SDL3-CS/SDL3/SDL_keycode.cs create mode 100644 SDL3-CS/SDL3/SDL_mouse.cs create mode 100644 SDL3-CS/SDL3/SDL_pen.cs create mode 100644 SDL3-CS/SDL3/SDL_properties.cs create mode 100644 SDL3-CS/SDL3/SDL_sensor.cs create mode 100644 SDL3-CS/SDL3/SDL_stdinc.cs create mode 100644 SDL3-CS/SDL3/SDL_thread.cs create mode 100644 SDL3-CS/SDL3/SDL_timer.cs create mode 100644 SDL3-CS/SDL3/SDL_touch.cs create mode 100644 SDL3-CS/SDL3/SDL_video.cs create mode 100644 SDL3-CS/TypedefAttribute.cs diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs index fabd490..6b324fe 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_atomic.g.cs @@ -36,8 +36,7 @@ public partial struct SDL_AtomicInt public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_TryLockSpinlock([NativeTypeName("SDL_SpinLock *")] int* @lock); + public static extern SDL_bool SDL_TryLockSpinlock([NativeTypeName("SDL_SpinLock *")] int* @lock); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_LockSpinlock([NativeTypeName("SDL_SpinLock *")] int* @lock); @@ -52,8 +51,7 @@ public static unsafe partial class SDL3 public static extern void SDL_MemoryBarrierAcquireFunction(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_AtomicCompareAndSwap(SDL_AtomicInt* a, int oldval, int newval); + public static extern SDL_bool SDL_AtomicCompareAndSwap(SDL_AtomicInt* a, int oldval, int newval); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_AtomicSet(SDL_AtomicInt* a, int v); @@ -65,8 +63,7 @@ public static unsafe partial class SDL3 public static extern int SDL_AtomicAdd(SDL_AtomicInt* a, int v); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_AtomicCompareAndSwapPointer([NativeTypeName("void **")] IntPtr* a, [NativeTypeName("void*")] IntPtr oldval, [NativeTypeName("void*")] IntPtr newval); + public static extern SDL_bool SDL_AtomicCompareAndSwapPointer([NativeTypeName("void **")] IntPtr* a, [NativeTypeName("void*")] IntPtr oldval, [NativeTypeName("void*")] IntPtr newval); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("void*")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index ddaec8a..1a6699b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -30,8 +30,7 @@ namespace SDL { public partial struct SDL_AudioSpec { - [NativeTypeName("SDL_AudioFormat")] - public ushort format; + public SDL_AudioFormat format; public int channels; @@ -56,42 +55,38 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetCurrentAudioDriver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_AudioDeviceID *")] - public static extern uint* SDL_GetAudioOutputDevices(int* count); + public static extern SDL_AudioDeviceID* SDL_GetAudioOutputDevices(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_AudioDeviceID *")] - public static extern uint* SDL_GetAudioCaptureDevices(int* count); + public static extern SDL_AudioDeviceID* SDL_GetAudioCaptureDevices(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetAudioDeviceName([NativeTypeName("SDL_AudioDeviceID")] uint devid); + public static extern byte* SDL_GetAudioDeviceName(SDL_AudioDeviceID devid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetAudioDeviceFormat([NativeTypeName("SDL_AudioDeviceID")] uint devid, SDL_AudioSpec* spec, int* sample_frames); + public static extern int SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec* spec, int* sample_frames); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_AudioDeviceID")] - public static extern uint SDL_OpenAudioDevice([NativeTypeName("SDL_AudioDeviceID")] uint devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec); + public static extern SDL_AudioDeviceID SDL_OpenAudioDevice(SDL_AudioDeviceID devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_PauseAudioDevice([NativeTypeName("SDL_AudioDeviceID")] uint dev); + public static extern int SDL_PauseAudioDevice(SDL_AudioDeviceID dev); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ResumeAudioDevice([NativeTypeName("SDL_AudioDeviceID")] uint dev); + public static extern int SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_AudioDevicePaused([NativeTypeName("SDL_AudioDeviceID")] uint dev); + public static extern SDL_bool SDL_AudioDevicePaused(SDL_AudioDeviceID dev); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_CloseAudioDevice([NativeTypeName("SDL_AudioDeviceID")] uint devid); + public static extern void SDL_CloseAudioDevice(SDL_AudioDeviceID devid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_BindAudioStreams([NativeTypeName("SDL_AudioDeviceID")] uint devid, SDL_AudioStream** streams, int num_streams); + public static extern int SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream** streams, int num_streams); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_BindAudioStream([NativeTypeName("SDL_AudioDeviceID")] uint devid, SDL_AudioStream* stream); + public static extern int SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream* stream); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_UnbindAudioStreams(SDL_AudioStream** streams, int num_streams); @@ -100,15 +95,13 @@ public static unsafe partial class SDL3 public static extern void SDL_UnbindAudioStream(SDL_AudioStream* stream); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_AudioDeviceID")] - public static extern uint SDL_GetAudioStreamDevice(SDL_AudioStream* stream); + public static extern SDL_AudioDeviceID SDL_GetAudioStreamDevice(SDL_AudioStream* stream); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_AudioStream* SDL_CreateAudioStream([NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* src_spec, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* dst_spec); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetAudioStreamProperties(SDL_AudioStream* stream); + public static extern SDL_PropertiesID SDL_GetAudioStreamProperties(SDL_AudioStream* stream); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetAudioStreamFormat(SDL_AudioStream* stream, SDL_AudioSpec* src_spec, SDL_AudioSpec* dst_spec); @@ -156,25 +149,25 @@ public static unsafe partial class SDL3 public static extern void SDL_DestroyAudioStream(SDL_AudioStream* stream); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_AudioStream* SDL_OpenAudioDeviceStream([NativeTypeName("SDL_AudioDeviceID")] uint devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); + public static extern SDL_AudioStream* SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec, [NativeTypeName("SDL_AudioStreamCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetAudioPostmixCallback([NativeTypeName("SDL_AudioDeviceID")] uint devid, [NativeTypeName("SDL_AudioPostmixCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); + public static extern int SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, [NativeTypeName("SDL_AudioPostmixCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_LoadWAV_IO(SDL_IOStream* src, [NativeTypeName("SDL_bool")] int closeio, SDL_AudioSpec* spec, [NativeTypeName("Uint8 **")] byte** audio_buf, [NativeTypeName("Uint32 *")] uint* audio_len); + public static extern int SDL_LoadWAV_IO(SDL_IOStream* src, SDL_bool closeio, SDL_AudioSpec* spec, [NativeTypeName("Uint8 **")] byte** audio_buf, [NativeTypeName("Uint32 *")] uint* audio_len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_LoadWAV([NativeTypeName("const char *")] byte* path, SDL_AudioSpec* spec, [NativeTypeName("Uint8 **")] byte** audio_buf, [NativeTypeName("Uint32 *")] uint* audio_len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_MixAudioFormat([NativeTypeName("Uint8 *")] byte* dst, [NativeTypeName("const Uint8 *")] byte* src, [NativeTypeName("SDL_AudioFormat")] ushort format, [NativeTypeName("Uint32")] uint len, int volume); + public static extern int SDL_MixAudioFormat([NativeTypeName("Uint8 *")] byte* dst, [NativeTypeName("const Uint8 *")] byte* src, SDL_AudioFormat format, [NativeTypeName("Uint32")] uint len, int volume); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_ConvertAudioSamples([NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* src_spec, [NativeTypeName("const Uint8 *")] byte* src_data, int src_len, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* dst_spec, [NativeTypeName("Uint8 **")] byte** dst_data, int* dst_len); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetSilenceValueForFormat([NativeTypeName("SDL_AudioFormat")] ushort format); + public static extern int SDL_GetSilenceValueForFormat(SDL_AudioFormat format); [NativeTypeName("#define SDL_AUDIO_MASK_BITSIZE (0xFF)")] public const int SDL_AUDIO_MASK_BITSIZE = (0xFF); @@ -222,10 +215,10 @@ public static unsafe partial class SDL3 public const int SDL_AUDIO_F32 = 0x8120; [NativeTypeName("#define SDL_AUDIO_DEVICE_DEFAULT_OUTPUT ((SDL_AudioDeviceID) 0xFFFFFFFF)")] - public const uint SDL_AUDIO_DEVICE_DEFAULT_OUTPUT = ((uint)(0xFFFFFFFF)); + public const SDL_AudioDeviceID SDL_AUDIO_DEVICE_DEFAULT_OUTPUT = ((SDL_AudioDeviceID)(0xFFFFFFFF)); [NativeTypeName("#define SDL_AUDIO_DEVICE_DEFAULT_CAPTURE ((SDL_AudioDeviceID) 0xFFFFFFFE)")] - public const uint SDL_AUDIO_DEVICE_DEFAULT_CAPTURE = ((uint)(0xFFFFFFFE)); + public const SDL_AudioDeviceID SDL_AUDIO_DEVICE_DEFAULT_CAPTURE = ((SDL_AudioDeviceID)(0xFFFFFFFE)); [NativeTypeName("#define SDL_MIX_MAXVOLUME 128")] public const int SDL_MIX_MAXVOLUME = 128; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs index 0c6d021..58d1dc4 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs @@ -65,32 +65,29 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetCurrentCameraDriver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_CameraDeviceID *")] - public static extern uint* SDL_GetCameraDevices(int* count); + public static extern SDL_CameraDeviceID* SDL_GetCameraDevices(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_CameraSpec* SDL_GetCameraDeviceSupportedFormats([NativeTypeName("SDL_CameraDeviceID")] uint devid, int* count); + public static extern SDL_CameraSpec* SDL_GetCameraDeviceSupportedFormats(SDL_CameraDeviceID devid, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetCameraDeviceName([NativeTypeName("SDL_CameraDeviceID")] uint instance_id); + public static extern byte* SDL_GetCameraDeviceName(SDL_CameraDeviceID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_CameraPosition SDL_GetCameraDevicePosition([NativeTypeName("SDL_CameraDeviceID")] uint instance_id); + public static extern SDL_CameraPosition SDL_GetCameraDevicePosition(SDL_CameraDeviceID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Camera* SDL_OpenCameraDevice([NativeTypeName("SDL_CameraDeviceID")] uint instance_id, [NativeTypeName("const SDL_CameraSpec *")] SDL_CameraSpec* spec); + public static extern SDL_Camera* SDL_OpenCameraDevice(SDL_CameraDeviceID instance_id, [NativeTypeName("const SDL_CameraSpec *")] SDL_CameraSpec* spec); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetCameraPermissionState(SDL_Camera* camera); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_CameraDeviceID")] - public static extern uint SDL_GetCameraInstanceID(SDL_Camera* camera); + public static extern SDL_CameraDeviceID SDL_GetCameraInstanceID(SDL_Camera* camera); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetCameraProperties(SDL_Camera* camera); + public static extern SDL_PropertiesID SDL_GetCameraProperties(SDL_Camera* camera); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetCameraFormat(SDL_Camera* camera, SDL_CameraSpec* spec); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs index e8c933d..cc068dd 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs @@ -38,8 +38,7 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetClipboardText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasClipboardText(); + public static extern SDL_bool SDL_HasClipboardText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetPrimarySelectionText([NativeTypeName("const char *")] byte* text); @@ -49,8 +48,7 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetPrimarySelectionText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasPrimarySelectionText(); + public static extern SDL_bool SDL_HasPrimarySelectionText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetClipboardData([NativeTypeName("SDL_ClipboardDataCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("SDL_ClipboardCleanupCallback")] delegate* unmanaged[Cdecl] cleanup, [NativeTypeName("void*")] IntPtr userdata, [NativeTypeName("const char **")] byte** mime_types, [NativeTypeName("size_t")] nuint num_mime_types); @@ -63,7 +61,6 @@ public static unsafe partial class SDL3 public static extern IntPtr SDL_GetClipboardData([NativeTypeName("const char *")] byte* mime_type, [NativeTypeName("size_t *")] nuint* size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasClipboardData([NativeTypeName("const char *")] byte* mime_type); + public static extern SDL_bool SDL_HasClipboardData([NativeTypeName("const char *")] byte* mime_type); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs index e315d56..b10e4b2 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.g.cs @@ -36,60 +36,46 @@ public static partial class SDL3 public static extern int SDL_GetCPUCacheLineSize(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasAltiVec(); + public static extern SDL_bool SDL_HasAltiVec(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasMMX(); + public static extern SDL_bool SDL_HasMMX(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasSSE(); + public static extern SDL_bool SDL_HasSSE(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasSSE2(); + public static extern SDL_bool SDL_HasSSE2(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasSSE3(); + public static extern SDL_bool SDL_HasSSE3(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasSSE41(); + public static extern SDL_bool SDL_HasSSE41(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasSSE42(); + public static extern SDL_bool SDL_HasSSE42(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasAVX(); + public static extern SDL_bool SDL_HasAVX(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasAVX2(); + public static extern SDL_bool SDL_HasAVX2(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasAVX512F(); + public static extern SDL_bool SDL_HasAVX512F(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasARMSIMD(); + public static extern SDL_bool SDL_HasARMSIMD(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasNEON(); + public static extern SDL_bool SDL_HasNEON(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasLSX(); + public static extern SDL_bool SDL_HasLSX(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasLASX(); + public static extern SDL_bool SDL_HasLASX(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetSystemRAM(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs index 9928277..365aa52 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.g.cs @@ -40,12 +40,12 @@ public unsafe partial struct SDL_DialogFileFilter public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_ShowOpenFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] byte* default_location, [NativeTypeName("SDL_bool")] int allow_many); + public static extern void SDL_ShowOpenFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] byte* default_location, SDL_bool allow_many); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_ShowSaveFileDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, SDL_Window* window, [NativeTypeName("const SDL_DialogFileFilter *")] SDL_DialogFileFilter* filters, [NativeTypeName("const char *")] byte* default_location); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_ShowOpenFolderDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, SDL_Window* window, [NativeTypeName("const char *")] byte* default_location, [NativeTypeName("SDL_bool")] int allow_many); + public static extern void SDL_ShowOpenFolderDialog([NativeTypeName("SDL_DialogFileCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata, SDL_Window* window, [NativeTypeName("const char *")] byte* default_location, SDL_bool allow_many); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs index f76cfdc..006f7e8 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs @@ -162,8 +162,7 @@ public partial struct SDL_DisplayEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_DisplayID")] - public uint displayID; + public SDL_DisplayID displayID; [NativeTypeName("Sint32")] public int data1; @@ -179,8 +178,7 @@ public partial struct SDL_WindowEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; [NativeTypeName("Sint32")] public int data1; @@ -199,8 +197,7 @@ public partial struct SDL_KeyboardDeviceEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_KeyboardID")] - public uint which; + public SDL_KeyboardID which; } public partial struct SDL_KeyboardEvent @@ -213,11 +210,9 @@ public partial struct SDL_KeyboardEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; - [NativeTypeName("SDL_KeyboardID")] - public uint which; + public SDL_KeyboardID which; [NativeTypeName("Uint8")] public byte state; @@ -244,8 +239,7 @@ public unsafe partial struct SDL_TextEditingEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; [NativeTypeName("char *")] public byte* text; @@ -267,8 +261,7 @@ public unsafe partial struct SDL_TextInputEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; [NativeTypeName("char *")] public byte* text; @@ -284,8 +277,7 @@ public partial struct SDL_MouseDeviceEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_MouseID")] - public uint which; + public SDL_MouseID which; } public partial struct SDL_MouseMotionEvent @@ -298,11 +290,9 @@ public partial struct SDL_MouseMotionEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; - [NativeTypeName("SDL_MouseID")] - public uint which; + public SDL_MouseID which; [NativeTypeName("Uint32")] public uint state; @@ -326,11 +316,9 @@ public partial struct SDL_MouseButtonEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; - [NativeTypeName("SDL_MouseID")] - public uint which; + public SDL_MouseID which; [NativeTypeName("Uint8")] public byte button; @@ -359,11 +347,9 @@ public partial struct SDL_MouseWheelEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; - [NativeTypeName("SDL_MouseID")] - public uint which; + public SDL_MouseID which; public float x; @@ -386,8 +372,7 @@ public partial struct SDL_JoyAxisEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; [NativeTypeName("Uint8")] public byte axis; @@ -418,8 +403,7 @@ public partial struct SDL_JoyBallEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; [NativeTypeName("Uint8")] public byte ball; @@ -450,8 +434,7 @@ public partial struct SDL_JoyHatEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; [NativeTypeName("Uint8")] public byte hat; @@ -476,8 +459,7 @@ public partial struct SDL_JoyButtonEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; [NativeTypeName("Uint8")] public byte button; @@ -502,8 +484,7 @@ public partial struct SDL_JoyDeviceEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; } public partial struct SDL_JoyBatteryEvent @@ -516,8 +497,7 @@ public partial struct SDL_JoyBatteryEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; public SDL_PowerState state; @@ -534,8 +514,7 @@ public partial struct SDL_GamepadAxisEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; [NativeTypeName("Uint8")] public byte axis; @@ -566,8 +545,7 @@ public partial struct SDL_GamepadButtonEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; [NativeTypeName("Uint8")] public byte button; @@ -592,8 +570,7 @@ public partial struct SDL_GamepadDeviceEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; } public partial struct SDL_GamepadTouchpadEvent @@ -606,8 +583,7 @@ public partial struct SDL_GamepadTouchpadEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; [NativeTypeName("Sint32")] public int touchpad; @@ -632,8 +608,7 @@ public partial struct SDL_GamepadSensorEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_JoystickID")] - public uint which; + public SDL_JoystickID which; [NativeTypeName("Sint32")] public int sensor; @@ -661,8 +636,7 @@ public partial struct SDL_AudioDeviceEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_AudioDeviceID")] - public uint which; + public SDL_AudioDeviceID which; [NativeTypeName("Uint8")] public byte iscapture; @@ -687,8 +661,7 @@ public partial struct SDL_CameraDeviceEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_CameraDeviceID")] - public uint which; + public SDL_CameraDeviceID which; [NativeTypeName("Uint8")] public byte padding1; @@ -710,11 +683,9 @@ public partial struct SDL_TouchFingerEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_TouchID")] - public ulong touchID; + public SDL_TouchID touchID; - [NativeTypeName("SDL_FingerID")] - public ulong fingerID; + public SDL_FingerID fingerID; public float x; @@ -726,8 +697,7 @@ public partial struct SDL_TouchFingerEvent public float pressure; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; } public partial struct SDL_PenTipEvent @@ -740,11 +710,9 @@ public partial struct SDL_PenTipEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; - [NativeTypeName("SDL_PenID")] - public uint which; + public SDL_PenID which; [NativeTypeName("Uint8")] public byte tip; @@ -779,11 +747,9 @@ public partial struct SDL_PenMotionEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; - [NativeTypeName("SDL_PenID")] - public uint which; + public SDL_PenID which; [NativeTypeName("Uint8")] public byte padding1; @@ -818,11 +784,9 @@ public partial struct SDL_PenButtonEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; - [NativeTypeName("SDL_PenID")] - public uint which; + public SDL_PenID which; [NativeTypeName("Uint8")] public byte button; @@ -857,8 +821,7 @@ public unsafe partial struct SDL_DropEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; public float x; @@ -892,8 +855,7 @@ public partial struct SDL_SensorEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_SensorID")] - public uint which; + public SDL_SensorID which; [NativeTypeName("float[6]")] public _data_e__FixedBuffer data; @@ -930,8 +892,7 @@ public partial struct SDL_UserEvent [NativeTypeName("Uint64")] public ulong timestamp; - [NativeTypeName("SDL_WindowID")] - public uint windowID; + public SDL_WindowID windowID; [NativeTypeName("Sint32")] public int code; @@ -1076,12 +1037,10 @@ public static unsafe partial class SDL3 public static extern int SDL_PeepEvents(SDL_Event* events, int numevents, SDL_eventaction action, [NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasEvent([NativeTypeName("Uint32")] uint type); + public static extern SDL_bool SDL_HasEvent([NativeTypeName("Uint32")] uint type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasEvents([NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); + public static extern SDL_bool SDL_HasEvents([NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_FlushEvent([NativeTypeName("Uint32")] uint type); @@ -1090,16 +1049,13 @@ public static unsafe partial class SDL3 public static extern void SDL_FlushEvents([NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_PollEvent(SDL_Event* @event); + public static extern SDL_bool SDL_PollEvent(SDL_Event* @event); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WaitEvent(SDL_Event* @event); + public static extern SDL_bool SDL_WaitEvent(SDL_Event* @event); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WaitEventTimeout(SDL_Event* @event, [NativeTypeName("Sint32")] int timeoutMS); + public static extern SDL_bool SDL_WaitEventTimeout(SDL_Event* @event, [NativeTypeName("Sint32")] int timeoutMS); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_PushEvent(SDL_Event* @event); @@ -1108,8 +1064,7 @@ public static unsafe partial class SDL3 public static extern void SDL_SetEventFilter([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetEventFilter([NativeTypeName("SDL_EventFilter *")] delegate* unmanaged[Cdecl]* filter, [NativeTypeName("void **")] IntPtr* userdata); + public static extern SDL_bool SDL_GetEventFilter([NativeTypeName("SDL_EventFilter *")] delegate* unmanaged[Cdecl]* filter, [NativeTypeName("void **")] IntPtr* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_AddEventWatch([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, [NativeTypeName("void*")] IntPtr userdata); @@ -1121,11 +1076,10 @@ public static unsafe partial class SDL3 public static extern void SDL_FilterEvents([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetEventEnabled([NativeTypeName("Uint32")] uint type, [NativeTypeName("SDL_bool")] int enabled); + public static extern void SDL_SetEventEnabled([NativeTypeName("Uint32")] uint type, SDL_bool enabled); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_EventEnabled([NativeTypeName("Uint32")] uint type); + public static extern SDL_bool SDL_EventEnabled([NativeTypeName("Uint32")] uint type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint32")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs index 655bb76..f6e7b35 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs @@ -58,14 +58,11 @@ public partial struct SDL_PathInfo [NativeTypeName("Uint64")] public ulong size; - [NativeTypeName("SDL_Time")] - public long create_time; + public SDL_Time create_time; - [NativeTypeName("SDL_Time")] - public long modify_time; + public SDL_Time modify_time; - [NativeTypeName("SDL_Time")] - public long access_time; + public SDL_Time access_time; } public static unsafe partial class SDL3 diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs index e484c30..936994d 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs @@ -183,7 +183,7 @@ public static unsafe partial class SDL3 public static extern int SDL_AddGamepadMapping([NativeTypeName("const char *")] byte* mapping); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_AddGamepadMappingsFromIO(SDL_IOStream* src, [NativeTypeName("SDL_bool")] int closeio); + public static extern int SDL_AddGamepadMappingsFromIO(SDL_IOStream* src, SDL_bool closeio); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_AddGamepadMappingsFromFile([NativeTypeName("const char *")] byte* file); @@ -204,73 +204,68 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetGamepadMapping(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetGamepadMapping([NativeTypeName("SDL_JoystickID")] uint instance_id, [NativeTypeName("const char *")] byte* mapping); + public static extern int SDL_SetGamepadMapping(SDL_JoystickID instance_id, [NativeTypeName("const char *")] byte* mapping); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasGamepad(); + public static extern SDL_bool SDL_HasGamepad(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_JoystickID *")] - public static extern uint* SDL_GetGamepads(int* count); + public static extern SDL_JoystickID* SDL_GetGamepads(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_IsGamepad([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_bool SDL_IsGamepad(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadInstanceName([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern byte* SDL_GetGamepadInstanceName(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadInstancePath([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern byte* SDL_GetGamepadInstancePath(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetGamepadInstancePlayerIndex([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern int SDL_GetGamepadInstancePlayerIndex(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_JoystickGUID")] - public static extern SDL_GUID SDL_GetGamepadInstanceGUID([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_GUID SDL_GetGamepadInstanceGUID(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint16")] - public static extern ushort SDL_GetGamepadInstanceVendor([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern ushort SDL_GetGamepadInstanceVendor(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint16")] - public static extern ushort SDL_GetGamepadInstanceProduct([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern ushort SDL_GetGamepadInstanceProduct(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint16")] - public static extern ushort SDL_GetGamepadInstanceProductVersion([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern ushort SDL_GetGamepadInstanceProductVersion(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_GamepadType SDL_GetGamepadInstanceType([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_GamepadType SDL_GetGamepadInstanceType(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_GamepadType SDL_GetRealGamepadInstanceType([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_GamepadType SDL_GetRealGamepadInstanceType(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetGamepadInstanceMapping([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern byte* SDL_GetGamepadInstanceMapping(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Gamepad* SDL_OpenGamepad([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_Gamepad* SDL_OpenGamepad(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Gamepad* SDL_GetGamepadFromInstanceID([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_Gamepad* SDL_GetGamepadFromInstanceID(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Gamepad* SDL_GetGamepadFromPlayerIndex(int player_index); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetGamepadProperties(SDL_Gamepad* gamepad); + public static extern SDL_PropertiesID SDL_GetGamepadProperties(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_JoystickID")] - public static extern uint SDL_GetGamepadInstanceID(SDL_Gamepad* gamepad); + public static extern SDL_JoystickID SDL_GetGamepadInstanceID(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] @@ -323,18 +318,16 @@ public static unsafe partial class SDL3 public static extern SDL_PowerState SDL_GetGamepadPowerInfo(SDL_Gamepad* gamepad, int* percent); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GamepadConnected(SDL_Gamepad* gamepad); + public static extern SDL_bool SDL_GamepadConnected(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Joystick* SDL_GetGamepadJoystick(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetGamepadEventsEnabled([NativeTypeName("SDL_bool")] int enabled); + public static extern void SDL_SetGamepadEventsEnabled(SDL_bool enabled); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GamepadEventsEnabled(); + public static extern SDL_bool SDL_GamepadEventsEnabled(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_GamepadBinding** SDL_GetGamepadBindings(SDL_Gamepad* gamepad, int* count); @@ -357,8 +350,7 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GamepadHasAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); + public static extern SDL_bool SDL_GamepadHasAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Sint16")] @@ -372,8 +364,7 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetGamepadStringForButton(SDL_GamepadButton button); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GamepadHasButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); + public static extern SDL_bool SDL_GamepadHasButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint8")] @@ -395,15 +386,13 @@ public static unsafe partial class SDL3 public static extern int SDL_GetGamepadTouchpadFinger(SDL_Gamepad* gamepad, int touchpad, int finger, [NativeTypeName("Uint8 *")] byte* state, float* x, float* y, float* pressure); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GamepadHasSensor(SDL_Gamepad* gamepad, SDL_SensorType type); + public static extern SDL_bool SDL_GamepadHasSensor(SDL_Gamepad* gamepad, SDL_SensorType type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetGamepadSensorEnabled(SDL_Gamepad* gamepad, SDL_SensorType type, [NativeTypeName("SDL_bool")] int enabled); + public static extern int SDL_SetGamepadSensorEnabled(SDL_Gamepad* gamepad, SDL_SensorType type, SDL_bool enabled); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GamepadSensorEnabled(SDL_Gamepad* gamepad, SDL_SensorType type); + public static extern SDL_bool SDL_GamepadSensorEnabled(SDL_Gamepad* gamepad, SDL_SensorType type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern float SDL_GetGamepadSensorDataRate(SDL_Gamepad* gamepad, SDL_SensorType type); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs index 02d875b..65da8bf 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs @@ -326,37 +326,33 @@ public partial struct SDL_HapticEffect public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_HapticID *")] - public static extern uint* SDL_GetHaptics(int* count); + public static extern SDL_HapticID* SDL_GetHaptics(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetHapticInstanceName([NativeTypeName("SDL_HapticID")] uint instance_id); + public static extern byte* SDL_GetHapticInstanceName(SDL_HapticID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Haptic* SDL_OpenHaptic([NativeTypeName("SDL_HapticID")] uint instance_id); + public static extern SDL_Haptic* SDL_OpenHaptic(SDL_HapticID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Haptic* SDL_GetHapticFromInstanceID([NativeTypeName("SDL_HapticID")] uint instance_id); + public static extern SDL_Haptic* SDL_GetHapticFromInstanceID(SDL_HapticID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_HapticID")] - public static extern uint SDL_GetHapticInstanceID(SDL_Haptic* haptic); + public static extern SDL_HapticID SDL_GetHapticInstanceID(SDL_Haptic* haptic); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] public static extern byte* SDL_GetHapticName(SDL_Haptic* haptic); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_IsMouseHaptic(); + public static extern SDL_bool SDL_IsMouseHaptic(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Haptic* SDL_OpenHapticFromMouse(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_IsJoystickHaptic(SDL_Joystick* joystick); + public static extern SDL_bool SDL_IsJoystickHaptic(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Haptic* SDL_OpenHapticFromJoystick(SDL_Joystick* joystick); @@ -378,8 +374,7 @@ public static unsafe partial class SDL3 public static extern int SDL_GetNumHapticAxes(SDL_Haptic* haptic); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HapticEffectSupported(SDL_Haptic* haptic, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* effect); + public static extern SDL_bool SDL_HapticEffectSupported(SDL_Haptic* haptic, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* effect); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_CreateHapticEffect(SDL_Haptic* haptic, [NativeTypeName("const SDL_HapticEffect *")] SDL_HapticEffect* effect); @@ -415,8 +410,7 @@ public static unsafe partial class SDL3 public static extern int SDL_StopHapticEffects(SDL_Haptic* haptic); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HapticRumbleSupported(SDL_Haptic* haptic); + public static extern SDL_bool SDL_HapticRumbleSupported(SDL_Haptic* haptic); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_InitHapticRumble(SDL_Haptic* haptic); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs index 1284976..21f3368 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs @@ -151,6 +151,6 @@ public static unsafe partial class SDL3 public static extern int SDL_hid_get_report_descriptor(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* buf, [NativeTypeName("size_t")] nuint buf_size); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_hid_ble_scan([NativeTypeName("SDL_bool")] int active); + public static extern void SDL_hid_ble_scan(SDL_bool active); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs index 048ded0..42ab6aa 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs @@ -38,16 +38,13 @@ public enum SDL_HintPriority public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_SetHintWithPriority([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value, SDL_HintPriority priority); + public static extern SDL_bool SDL_SetHintWithPriority([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value, SDL_HintPriority priority); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_SetHint([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value); + public static extern SDL_bool SDL_SetHint([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ResetHint([NativeTypeName("const char *")] byte* name); + public static extern SDL_bool SDL_ResetHint([NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_ResetHints(); @@ -57,8 +54,7 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetHint([NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetHintBoolean([NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_bool")] int default_value); + public static extern SDL_bool SDL_GetHintBoolean([NativeTypeName("const char *")] byte* name, SDL_bool default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_AddHintCallback([NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_HintCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs index ccb8534..abf3a55 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs @@ -81,8 +81,7 @@ public static unsafe partial class SDL3 public static extern int SDL_CloseIO(SDL_IOStream* context); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetIOProperties(SDL_IOStream* context); + public static extern SDL_PropertiesID SDL_GetIOProperties(SDL_IOStream* context); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_IOStatus SDL_GetIOStatus(SDL_IOStream* context); @@ -117,115 +116,89 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("void*")] - public static extern IntPtr SDL_LoadFile_IO(SDL_IOStream* src, [NativeTypeName("size_t *")] nuint* datasize, [NativeTypeName("SDL_bool")] int closeio); + public static extern IntPtr SDL_LoadFile_IO(SDL_IOStream* src, [NativeTypeName("size_t *")] nuint* datasize, SDL_bool closeio); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("void*")] public static extern IntPtr SDL_LoadFile([NativeTypeName("const char *")] byte* file, [NativeTypeName("size_t *")] nuint* datasize); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadU8(SDL_IOStream* src, [NativeTypeName("Uint8 *")] byte* value); + public static extern SDL_bool SDL_ReadU8(SDL_IOStream* src, [NativeTypeName("Uint8 *")] byte* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadU16LE(SDL_IOStream* src, [NativeTypeName("Uint16 *")] ushort* value); + public static extern SDL_bool SDL_ReadU16LE(SDL_IOStream* src, [NativeTypeName("Uint16 *")] ushort* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadS16LE(SDL_IOStream* src, [NativeTypeName("Sint16 *")] short* value); + public static extern SDL_bool SDL_ReadS16LE(SDL_IOStream* src, [NativeTypeName("Sint16 *")] short* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadU16BE(SDL_IOStream* src, [NativeTypeName("Uint16 *")] ushort* value); + public static extern SDL_bool SDL_ReadU16BE(SDL_IOStream* src, [NativeTypeName("Uint16 *")] ushort* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadS16BE(SDL_IOStream* src, [NativeTypeName("Sint16 *")] short* value); + public static extern SDL_bool SDL_ReadS16BE(SDL_IOStream* src, [NativeTypeName("Sint16 *")] short* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadU32LE(SDL_IOStream* src, [NativeTypeName("Uint32 *")] uint* value); + public static extern SDL_bool SDL_ReadU32LE(SDL_IOStream* src, [NativeTypeName("Uint32 *")] uint* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadS32LE(SDL_IOStream* src, [NativeTypeName("Sint32 *")] int* value); + public static extern SDL_bool SDL_ReadS32LE(SDL_IOStream* src, [NativeTypeName("Sint32 *")] int* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadU32BE(SDL_IOStream* src, [NativeTypeName("Uint32 *")] uint* value); + public static extern SDL_bool SDL_ReadU32BE(SDL_IOStream* src, [NativeTypeName("Uint32 *")] uint* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadS32BE(SDL_IOStream* src, [NativeTypeName("Sint32 *")] int* value); + public static extern SDL_bool SDL_ReadS32BE(SDL_IOStream* src, [NativeTypeName("Sint32 *")] int* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadU64LE(SDL_IOStream* src, [NativeTypeName("Uint64 *")] ulong* value); + public static extern SDL_bool SDL_ReadU64LE(SDL_IOStream* src, [NativeTypeName("Uint64 *")] ulong* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadS64LE(SDL_IOStream* src, [NativeTypeName("Sint64 *")] long* value); + public static extern SDL_bool SDL_ReadS64LE(SDL_IOStream* src, [NativeTypeName("Sint64 *")] long* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadU64BE(SDL_IOStream* src, [NativeTypeName("Uint64 *")] ulong* value); + public static extern SDL_bool SDL_ReadU64BE(SDL_IOStream* src, [NativeTypeName("Uint64 *")] ulong* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ReadS64BE(SDL_IOStream* src, [NativeTypeName("Sint64 *")] long* value); + public static extern SDL_bool SDL_ReadS64BE(SDL_IOStream* src, [NativeTypeName("Sint64 *")] long* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteU8(SDL_IOStream* dst, [NativeTypeName("Uint8")] byte value); + public static extern SDL_bool SDL_WriteU8(SDL_IOStream* dst, [NativeTypeName("Uint8")] byte value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteU16LE(SDL_IOStream* dst, [NativeTypeName("Uint16")] ushort value); + public static extern SDL_bool SDL_WriteU16LE(SDL_IOStream* dst, [NativeTypeName("Uint16")] ushort value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteS16LE(SDL_IOStream* dst, [NativeTypeName("Sint16")] short value); + public static extern SDL_bool SDL_WriteS16LE(SDL_IOStream* dst, [NativeTypeName("Sint16")] short value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteU16BE(SDL_IOStream* dst, [NativeTypeName("Uint16")] ushort value); + public static extern SDL_bool SDL_WriteU16BE(SDL_IOStream* dst, [NativeTypeName("Uint16")] ushort value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteS16BE(SDL_IOStream* dst, [NativeTypeName("Sint16")] short value); + public static extern SDL_bool SDL_WriteS16BE(SDL_IOStream* dst, [NativeTypeName("Sint16")] short value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteU32LE(SDL_IOStream* dst, [NativeTypeName("Uint32")] uint value); + public static extern SDL_bool SDL_WriteU32LE(SDL_IOStream* dst, [NativeTypeName("Uint32")] uint value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteS32LE(SDL_IOStream* dst, [NativeTypeName("Sint32")] int value); + public static extern SDL_bool SDL_WriteS32LE(SDL_IOStream* dst, [NativeTypeName("Sint32")] int value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteU32BE(SDL_IOStream* dst, [NativeTypeName("Uint32")] uint value); + public static extern SDL_bool SDL_WriteU32BE(SDL_IOStream* dst, [NativeTypeName("Uint32")] uint value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteS32BE(SDL_IOStream* dst, [NativeTypeName("Sint32")] int value); + public static extern SDL_bool SDL_WriteS32BE(SDL_IOStream* dst, [NativeTypeName("Sint32")] int value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteU64LE(SDL_IOStream* dst, [NativeTypeName("Uint64")] ulong value); + public static extern SDL_bool SDL_WriteU64LE(SDL_IOStream* dst, [NativeTypeName("Uint64")] ulong value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteS64LE(SDL_IOStream* dst, [NativeTypeName("Sint64")] long value); + public static extern SDL_bool SDL_WriteS64LE(SDL_IOStream* dst, [NativeTypeName("Sint64")] long value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteU64BE(SDL_IOStream* dst, [NativeTypeName("Uint64")] ulong value); + public static extern SDL_bool SDL_WriteU64BE(SDL_IOStream* dst, [NativeTypeName("Uint64")] ulong value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WriteS64BE(SDL_IOStream* dst, [NativeTypeName("Sint64")] long value); + public static extern SDL_bool SDL_WriteS64BE(SDL_IOStream* dst, [NativeTypeName("Sint64")] long value); [NativeTypeName("#define SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER \"SDL.iostream.windows.handle\"")] public static ReadOnlySpan SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER => "SDL.iostream.windows.handle"u8; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs index 8ca7770..baf4e90 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs @@ -120,66 +120,61 @@ public static unsafe partial class SDL3 public static extern void SDL_UnlockJoysticks(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasJoystick(); + public static extern SDL_bool SDL_HasJoystick(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_JoystickID *")] - public static extern uint* SDL_GetJoysticks(int* count); + public static extern SDL_JoystickID* SDL_GetJoysticks(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetJoystickInstanceName([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern byte* SDL_GetJoystickInstanceName(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetJoystickInstancePath([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern byte* SDL_GetJoystickInstancePath(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetJoystickInstancePlayerIndex([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern int SDL_GetJoystickInstancePlayerIndex(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_JoystickGUID")] - public static extern SDL_GUID SDL_GetJoystickInstanceGUID([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_GUID SDL_GetJoystickInstanceGUID(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint16")] - public static extern ushort SDL_GetJoystickInstanceVendor([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern ushort SDL_GetJoystickInstanceVendor(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint16")] - public static extern ushort SDL_GetJoystickInstanceProduct([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern ushort SDL_GetJoystickInstanceProduct(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint16")] - public static extern ushort SDL_GetJoystickInstanceProductVersion([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern ushort SDL_GetJoystickInstanceProductVersion(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_JoystickType SDL_GetJoystickInstanceType([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_JoystickType SDL_GetJoystickInstanceType(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Joystick* SDL_OpenJoystick([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_Joystick* SDL_OpenJoystick(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Joystick* SDL_GetJoystickFromInstanceID([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_Joystick* SDL_GetJoystickFromInstanceID(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Joystick* SDL_GetJoystickFromPlayerIndex(int player_index); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_JoystickID")] - public static extern uint SDL_AttachVirtualJoystick(SDL_JoystickType type, int naxes, int nbuttons, int nhats); + public static extern SDL_JoystickID SDL_AttachVirtualJoystick(SDL_JoystickType type, int naxes, int nbuttons, int nhats); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_JoystickID")] - public static extern uint SDL_AttachVirtualJoystickEx([NativeTypeName("const SDL_VirtualJoystickDesc *")] SDL_VirtualJoystickDesc* desc); + public static extern SDL_JoystickID SDL_AttachVirtualJoystickEx([NativeTypeName("const SDL_VirtualJoystickDesc *")] SDL_VirtualJoystickDesc* desc); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_DetachVirtualJoystick([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_IsJoystickVirtual([NativeTypeName("SDL_JoystickID")] uint instance_id); + public static extern SDL_bool SDL_IsJoystickVirtual(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetJoystickVirtualAxis(SDL_Joystick* joystick, int axis, [NativeTypeName("Sint16")] short value); @@ -191,8 +186,7 @@ public static unsafe partial class SDL3 public static extern int SDL_SetJoystickVirtualHat(SDL_Joystick* joystick, int hat, [NativeTypeName("Uint8")] byte value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetJoystickProperties(SDL_Joystick* joystick); + public static extern SDL_PropertiesID SDL_GetJoystickProperties(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] @@ -246,12 +240,10 @@ public static unsafe partial class SDL3 public static extern void SDL_GetJoystickGUIDInfo([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid, [NativeTypeName("Uint16 *")] ushort* vendor, [NativeTypeName("Uint16 *")] ushort* product, [NativeTypeName("Uint16 *")] ushort* version, [NativeTypeName("Uint16 *")] ushort* crc16); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_JoystickConnected(SDL_Joystick* joystick); + public static extern SDL_bool SDL_JoystickConnected(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_JoystickID")] - public static extern uint SDL_GetJoystickInstanceID(SDL_Joystick* joystick); + public static extern SDL_JoystickID SDL_GetJoystickInstanceID(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetNumJoystickAxes(SDL_Joystick* joystick); @@ -266,11 +258,10 @@ public static unsafe partial class SDL3 public static extern int SDL_GetNumJoystickButtons(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetJoystickEventsEnabled([NativeTypeName("SDL_bool")] int enabled); + public static extern void SDL_SetJoystickEventsEnabled(SDL_bool enabled); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_JoystickEventsEnabled(); + public static extern SDL_bool SDL_JoystickEventsEnabled(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_UpdateJoysticks(); @@ -280,8 +271,7 @@ public static unsafe partial class SDL3 public static extern short SDL_GetJoystickAxis(SDL_Joystick* joystick, int axis); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetJoystickAxisInitialState(SDL_Joystick* joystick, int axis, [NativeTypeName("Sint16 *")] short* state); + public static extern SDL_bool SDL_GetJoystickAxisInitialState(SDL_Joystick* joystick, int axis, [NativeTypeName("Sint16 *")] short* state); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetJoystickBall(SDL_Joystick* joystick, int ball, int* dx, int* dy); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs index 42036eb..3143ed1 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs @@ -31,8 +31,7 @@ public partial struct SDL_Keysym { public SDL_Scancode scancode; - [NativeTypeName("SDL_Keycode")] - public int sym; + public SDL_Keycode sym; [NativeTypeName("Uint16")] public ushort mod; @@ -44,16 +43,14 @@ public partial struct SDL_Keysym public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasKeyboard(); + public static extern SDL_bool SDL_HasKeyboard(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_KeyboardID *")] - public static extern uint* SDL_GetKeyboards(int* count); + public static extern SDL_KeyboardID* SDL_GetKeyboards(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetKeyboardInstanceName([NativeTypeName("SDL_KeyboardID")] uint instance_id); + public static extern byte* SDL_GetKeyboardInstanceName(SDL_KeyboardID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Window* SDL_GetKeyboardFocus(); @@ -72,11 +69,10 @@ public static unsafe partial class SDL3 public static extern void SDL_SetModState(SDL_Keymod modstate); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_Keycode")] - public static extern int SDL_GetKeyFromScancode(SDL_Scancode scancode); + public static extern SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Scancode SDL_GetScancodeFromKey([NativeTypeName("SDL_Keycode")] int key); + public static extern SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] @@ -87,18 +83,16 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetKeyName([NativeTypeName("SDL_Keycode")] int key); + public static extern byte* SDL_GetKeyName(SDL_Keycode key); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_Keycode")] - public static extern int SDL_GetKeyFromName([NativeTypeName("const char *")] byte* name); + public static extern SDL_Keycode SDL_GetKeyFromName([NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_StartTextInput(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_TextInputActive(); + public static extern SDL_bool SDL_TextInputActive(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_StopTextInput(); @@ -110,11 +104,9 @@ public static unsafe partial class SDL3 public static extern int SDL_SetTextInputRect([NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasScreenKeyboardSupport(); + public static extern SDL_bool SDL_HasScreenKeyboardSupport(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ScreenKeyboardShown(SDL_Window* window); + public static extern SDL_bool SDL_ScreenKeyboardShown(SDL_Window* window); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs index a43bd03..0213756 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs @@ -65,16 +65,14 @@ public enum SDL_MouseWheelDirection public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasMouse(); + public static extern SDL_bool SDL_HasMouse(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_MouseID *")] - public static extern uint* SDL_GetMice(int* count); + public static extern SDL_MouseID* SDL_GetMice(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetMouseInstanceName([NativeTypeName("SDL_MouseID")] uint instance_id); + public static extern byte* SDL_GetMouseInstanceName(SDL_MouseID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Window* SDL_GetMouseFocus(); @@ -98,14 +96,13 @@ public static unsafe partial class SDL3 public static extern int SDL_WarpMouseGlobal(float x, float y); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetRelativeMouseMode([NativeTypeName("SDL_bool")] int enabled); + public static extern int SDL_SetRelativeMouseMode(SDL_bool enabled); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_CaptureMouse([NativeTypeName("SDL_bool")] int enabled); + public static extern int SDL_CaptureMouse(SDL_bool enabled); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetRelativeMouseMode(); + public static extern SDL_bool SDL_GetRelativeMouseMode(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Cursor* SDL_CreateCursor([NativeTypeName("const Uint8 *")] byte* data, [NativeTypeName("const Uint8 *")] byte* mask, int w, int h, int hot_x, int hot_y); @@ -135,8 +132,7 @@ public static unsafe partial class SDL3 public static extern int SDL_HideCursor(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_CursorVisible(); + public static extern SDL_bool SDL_CursorVisible(); [NativeTypeName("#define SDL_BUTTON_LEFT 1")] public const int SDL_BUTTON_LEFT = 1; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs index 099943a..effec96 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs @@ -65,40 +65,37 @@ public partial struct SDL_PenCapabilityInfo public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PenID *")] - public static extern uint* SDL_GetPens(int* count); + public static extern SDL_PenID* SDL_GetPens(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint32")] - public static extern uint SDL_GetPenStatus([NativeTypeName("SDL_PenID")] uint instance_id, float* x, float* y, float* axes, [NativeTypeName("size_t")] nuint num_axes); + public static extern uint SDL_GetPenStatus(SDL_PenID instance_id, float* x, float* y, float* axes, [NativeTypeName("size_t")] nuint num_axes); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PenID")] - public static extern uint SDL_GetPenFromGUID(SDL_GUID guid); + public static extern SDL_PenID SDL_GetPenFromGUID(SDL_GUID guid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_GUID SDL_GetPenGUID([NativeTypeName("SDL_PenID")] uint instance_id); + public static extern SDL_GUID SDL_GetPenGUID(SDL_PenID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_PenConnected([NativeTypeName("SDL_PenID")] uint instance_id); + public static extern SDL_bool SDL_PenConnected(SDL_PenID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetPenName([NativeTypeName("SDL_PenID")] uint instance_id); + public static extern byte* SDL_GetPenName(SDL_PenID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint32")] - public static extern uint SDL_GetPenCapabilities([NativeTypeName("SDL_PenID")] uint instance_id, SDL_PenCapabilityInfo* capabilities); + public static extern uint SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo* capabilities); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_PenSubtype SDL_GetPenType([NativeTypeName("SDL_PenID")] uint instance_id); + public static extern SDL_PenSubtype SDL_GetPenType(SDL_PenID instance_id); [NativeTypeName("#define SDL_PEN_INVALID ((SDL_PenID)0)")] - public const uint SDL_PEN_INVALID = ((uint)(0)); + public const SDL_PenID SDL_PEN_INVALID = ((SDL_PenID)(0)); [NativeTypeName("#define SDL_PEN_MOUSEID ((SDL_MouseID)-2)")] - public const uint SDL_PEN_MOUSEID = unchecked((uint)(-2)); + public const SDL_MouseID SDL_PEN_MOUSEID = ((SDL_MouseID)(-2)); [NativeTypeName("#define SDL_PEN_INFO_UNKNOWN (-1)")] public const int SDL_PEN_INFO_UNKNOWN = (-1); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs index 9b6cda3..f1970e8 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs @@ -389,8 +389,7 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetPixelFormatName(SDL_PixelFormatEnum format); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetMasksForPixelFormatEnum(SDL_PixelFormatEnum format, int* bpp, [NativeTypeName("Uint32 *")] uint* Rmask, [NativeTypeName("Uint32 *")] uint* Gmask, [NativeTypeName("Uint32 *")] uint* Bmask, [NativeTypeName("Uint32 *")] uint* Amask); + public static extern SDL_bool SDL_GetMasksForPixelFormatEnum(SDL_PixelFormatEnum format, int* bpp, [NativeTypeName("Uint32 *")] uint* Rmask, [NativeTypeName("Uint32 *")] uint* Gmask, [NativeTypeName("Uint32 *")] uint* Bmask, [NativeTypeName("Uint32 *")] uint* Amask); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_PixelFormatEnum SDL_GetPixelFormatEnumForMasks(int bpp, [NativeTypeName("Uint32")] uint Rmask, [NativeTypeName("Uint32")] uint Gmask, [NativeTypeName("Uint32")] uint Bmask, [NativeTypeName("Uint32")] uint Amask); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs index 4b7ecbf..2414156 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs @@ -41,73 +41,69 @@ public enum SDL_PropertyType public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetGlobalProperties(); + public static extern SDL_PropertiesID SDL_GetGlobalProperties(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_CreateProperties(); + public static extern SDL_PropertiesID SDL_CreateProperties(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_CopyProperties([NativeTypeName("SDL_PropertiesID")] uint src, [NativeTypeName("SDL_PropertiesID")] uint dst); + public static extern int SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_LockProperties([NativeTypeName("SDL_PropertiesID")] uint props); + public static extern int SDL_LockProperties(SDL_PropertiesID props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_UnlockProperties([NativeTypeName("SDL_PropertiesID")] uint props); + public static extern void SDL_UnlockProperties(SDL_PropertiesID props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetPropertyWithCleanup([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr value, [NativeTypeName("void (*)(void *, void *)")] delegate* unmanaged[Cdecl] cleanup, [NativeTypeName("void*")] IntPtr userdata); + public static extern int SDL_SetPropertyWithCleanup(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr value, [NativeTypeName("void (*)(void *, void *)")] delegate* unmanaged[Cdecl] cleanup, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr value); + public static extern int SDL_SetProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetStringProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value); + public static extern int SDL_SetStringProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetNumberProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("Sint64")] long value); + public static extern int SDL_SetNumberProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("Sint64")] long value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetFloatProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, float value); + public static extern int SDL_SetFloatProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, float value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetBooleanProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_bool")] int value); + public static extern int SDL_SetBooleanProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, SDL_bool value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name); + public static extern SDL_bool SDL_HasProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_PropertyType SDL_GetPropertyType([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name); + public static extern SDL_PropertyType SDL_GetPropertyType(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("void*")] - public static extern IntPtr SDL_GetProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr default_value); + public static extern IntPtr SDL_GetProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetStringProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* default_value); + public static extern byte* SDL_GetStringProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Sint64")] - public static extern long SDL_GetNumberProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("Sint64")] long default_value); + public static extern long SDL_GetNumberProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("Sint64")] long default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float SDL_GetFloatProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, float default_value); + public static extern float SDL_GetFloatProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, float default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetBooleanProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("SDL_bool")] int default_value); + public static extern SDL_bool SDL_GetBooleanProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, SDL_bool default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ClearProperty([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("const char *")] byte* name); + public static extern int SDL_ClearProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_EnumerateProperties([NativeTypeName("SDL_PropertiesID")] uint props, [NativeTypeName("SDL_EnumeratePropertiesCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); + public static extern int SDL_EnumerateProperties(SDL_PropertiesID props, [NativeTypeName("SDL_EnumeratePropertiesCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_DestroyProperties([NativeTypeName("SDL_PropertiesID")] uint props); + public static extern void SDL_DestroyProperties(SDL_PropertiesID props); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs index 013ed3f..c3dc263 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs @@ -65,84 +65,69 @@ public partial struct SDL_FRect public static unsafe partial class SDL3 { - [return: NativeTypeName("SDL_bool")] - public static int SDL_PointInRect([NativeTypeName("const SDL_Point *")] SDL_Point* p, [NativeTypeName("const SDL_Rect *")] SDL_Rect* r) + public static SDL_bool SDL_PointInRect([NativeTypeName("const SDL_Point *")] SDL_Point* p, [NativeTypeName("const SDL_Rect *")] SDL_Rect* r) { return ((p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? 1 : 0; } - [return: NativeTypeName("SDL_bool")] - public static int SDL_RectEmpty([NativeTypeName("const SDL_Rect *")] SDL_Rect* r) + public static SDL_bool SDL_RectEmpty([NativeTypeName("const SDL_Rect *")] SDL_Rect* r) { return ((r == null) || (r->w <= 0) || (r->h <= 0)) ? 1 : 0; } - [return: NativeTypeName("SDL_bool")] - public static int SDL_RectsEqual([NativeTypeName("const SDL_Rect *")] SDL_Rect* a, [NativeTypeName("const SDL_Rect *")] SDL_Rect* b) + public static SDL_bool SDL_RectsEqual([NativeTypeName("const SDL_Rect *")] SDL_Rect* a, [NativeTypeName("const SDL_Rect *")] SDL_Rect* b) { return ((a) != null && (b) != null && (a->x == b->x) && (a->y == b->y) && (a->w == b->w) && (a->h == b->h)) ? 1 : 0; } [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasRectIntersection([NativeTypeName("const SDL_Rect *")] SDL_Rect* A, [NativeTypeName("const SDL_Rect *")] SDL_Rect* B); + public static extern SDL_bool SDL_HasRectIntersection([NativeTypeName("const SDL_Rect *")] SDL_Rect* A, [NativeTypeName("const SDL_Rect *")] SDL_Rect* B); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetRectIntersection([NativeTypeName("const SDL_Rect *")] SDL_Rect* A, [NativeTypeName("const SDL_Rect *")] SDL_Rect* B, SDL_Rect* result); + public static extern SDL_bool SDL_GetRectIntersection([NativeTypeName("const SDL_Rect *")] SDL_Rect* A, [NativeTypeName("const SDL_Rect *")] SDL_Rect* B, SDL_Rect* result); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetRectUnion([NativeTypeName("const SDL_Rect *")] SDL_Rect* A, [NativeTypeName("const SDL_Rect *")] SDL_Rect* B, SDL_Rect* result); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetRectEnclosingPoints([NativeTypeName("const SDL_Point *")] SDL_Point* points, int count, [NativeTypeName("const SDL_Rect *")] SDL_Rect* clip, SDL_Rect* result); + public static extern SDL_bool SDL_GetRectEnclosingPoints([NativeTypeName("const SDL_Point *")] SDL_Point* points, int count, [NativeTypeName("const SDL_Rect *")] SDL_Rect* clip, SDL_Rect* result); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetRectAndLineIntersection([NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, int* X1, int* Y1, int* X2, int* Y2); + public static extern SDL_bool SDL_GetRectAndLineIntersection([NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, int* X1, int* Y1, int* X2, int* Y2); - [return: NativeTypeName("SDL_bool")] - public static int SDL_PointInRectFloat([NativeTypeName("const SDL_FPoint *")] SDL_FPoint* p, [NativeTypeName("const SDL_FRect *")] SDL_FRect* r) + public static SDL_bool SDL_PointInRectFloat([NativeTypeName("const SDL_FPoint *")] SDL_FPoint* p, [NativeTypeName("const SDL_FRect *")] SDL_FRect* r) { return ((p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? 1 : 0; } - [return: NativeTypeName("SDL_bool")] - public static int SDL_RectEmptyFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* r) + public static SDL_bool SDL_RectEmptyFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* r) { return ((r == null) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? 1 : 0; } - [return: NativeTypeName("SDL_bool")] - public static int SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, [NativeTypeName("const float")] float epsilon) + public static SDL_bool SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, [NativeTypeName("const float")] 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)))) ? 1 : 0; } - [return: NativeTypeName("SDL_bool")] - public static int SDL_RectsEqualFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b) + public static SDL_bool SDL_RectsEqualFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b) { return SDL_RectsEqualEpsilon(a, b, 1.1920928955078125e-07F); } [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_HasRectIntersectionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* A, [NativeTypeName("const SDL_FRect *")] SDL_FRect* B); + public static extern SDL_bool SDL_HasRectIntersectionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* A, [NativeTypeName("const SDL_FRect *")] SDL_FRect* B); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetRectIntersectionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* A, [NativeTypeName("const SDL_FRect *")] SDL_FRect* B, SDL_FRect* result); + public static extern SDL_bool SDL_GetRectIntersectionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* A, [NativeTypeName("const SDL_FRect *")] SDL_FRect* B, SDL_FRect* result); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetRectUnionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* A, [NativeTypeName("const SDL_FRect *")] SDL_FRect* B, SDL_FRect* result); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetRectEnclosingPointsFloat([NativeTypeName("const SDL_FPoint *")] SDL_FPoint* points, int count, [NativeTypeName("const SDL_FRect *")] SDL_FRect* clip, SDL_FRect* result); + public static extern SDL_bool SDL_GetRectEnclosingPointsFloat([NativeTypeName("const SDL_FPoint *")] SDL_FPoint* points, int count, [NativeTypeName("const SDL_FRect *")] SDL_FRect* clip, SDL_FRect* result); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetRectAndLineIntersectionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* rect, float* X1, float* Y1, float* X2, float* Y2); + public static extern SDL_bool SDL_GetRectAndLineIntersectionFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* rect, float* X1, float* Y1, float* X2, float* Y2); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs index e66dc17..83c3526 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs @@ -102,13 +102,13 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetRenderDriver(int index); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_CreateWindowAndRenderer(int width, int height, [NativeTypeName("SDL_WindowFlags")] uint window_flags, SDL_Window** window, SDL_Renderer** renderer); + public static extern int SDL_CreateWindowAndRenderer(int width, int height, SDL_WindowFlags window_flags, SDL_Window** window, SDL_Renderer** renderer); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, [NativeTypeName("const char *")] byte* name, [NativeTypeName("Uint32")] uint flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Renderer* SDL_CreateRendererWithProperties([NativeTypeName("SDL_PropertiesID")] uint props); + public static extern SDL_Renderer* SDL_CreateRendererWithProperties(SDL_PropertiesID props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Renderer* SDL_CreateSoftwareRenderer(SDL_Surface* surface); @@ -123,8 +123,7 @@ public static unsafe partial class SDL3 public static extern int SDL_GetRendererInfo(SDL_Renderer* renderer, SDL_RendererInfo* info); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetRendererProperties(SDL_Renderer* renderer); + public static extern SDL_PropertiesID SDL_GetRendererProperties(SDL_Renderer* renderer); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetRenderOutputSize(SDL_Renderer* renderer, int* w, int* h); @@ -139,11 +138,10 @@ public static unsafe partial class SDL3 public static extern SDL_Texture* SDL_CreateTextureFromSurface(SDL_Renderer* renderer, SDL_Surface* surface); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Texture* SDL_CreateTextureWithProperties(SDL_Renderer* renderer, [NativeTypeName("SDL_PropertiesID")] uint props); + public static extern SDL_Texture* SDL_CreateTextureWithProperties(SDL_Renderer* renderer, SDL_PropertiesID props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetTextureProperties(SDL_Texture* texture); + public static extern SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture* texture); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Renderer* SDL_GetRendererFromTexture(SDL_Texture* texture); @@ -233,8 +231,7 @@ public static unsafe partial class SDL3 public static extern int SDL_GetRenderViewport(SDL_Renderer* renderer, SDL_Rect* rect); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_RenderViewportSet(SDL_Renderer* renderer); + public static extern SDL_bool SDL_RenderViewportSet(SDL_Renderer* renderer); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetRenderClipRect(SDL_Renderer* renderer, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); @@ -243,8 +240,7 @@ public static unsafe partial class SDL3 public static extern int SDL_GetRenderClipRect(SDL_Renderer* renderer, SDL_Rect* rect); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_RenderClipEnabled(SDL_Renderer* renderer); + public static extern SDL_bool SDL_RenderClipEnabled(SDL_Renderer* renderer); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetRenderScale(SDL_Renderer* renderer, float scaleX, float scaleY); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs index 7e81a0e..ddaa278 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs @@ -46,28 +46,26 @@ public enum SDL_SensorType public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_SensorID *")] - public static extern uint* SDL_GetSensors(int* count); + public static extern SDL_SensorID* SDL_GetSensors(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetSensorInstanceName([NativeTypeName("SDL_SensorID")] uint instance_id); + public static extern byte* SDL_GetSensorInstanceName(SDL_SensorID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_SensorType SDL_GetSensorInstanceType([NativeTypeName("SDL_SensorID")] uint instance_id); + public static extern SDL_SensorType SDL_GetSensorInstanceType(SDL_SensorID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetSensorInstanceNonPortableType([NativeTypeName("SDL_SensorID")] uint instance_id); + public static extern int SDL_GetSensorInstanceNonPortableType(SDL_SensorID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Sensor* SDL_OpenSensor([NativeTypeName("SDL_SensorID")] uint instance_id); + public static extern SDL_Sensor* SDL_OpenSensor(SDL_SensorID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Sensor* SDL_GetSensorFromInstanceID([NativeTypeName("SDL_SensorID")] uint instance_id); + public static extern SDL_Sensor* SDL_GetSensorFromInstanceID(SDL_SensorID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetSensorProperties(SDL_Sensor* sensor); + public static extern SDL_PropertiesID SDL_GetSensorProperties(SDL_Sensor* sensor); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] @@ -80,8 +78,7 @@ public static unsafe partial class SDL3 public static extern int SDL_GetSensorNonPortableType(SDL_Sensor* sensor); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_SensorID")] - public static extern uint SDL_GetSensorInstanceID(SDL_Sensor* sensor); + public static extern SDL_SensorID SDL_GetSensorInstanceID(SDL_Sensor* sensor); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetSensorData(SDL_Sensor* sensor, float* data, int num_values); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs index 0d2eb83..ba128a4 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_storage.g.cs @@ -34,7 +34,7 @@ public unsafe partial struct SDL_StorageInterface public delegate* unmanaged[Cdecl] close; [NativeTypeName("SDL_bool (*)(void *)")] - public delegate* unmanaged[Cdecl] ready; + public delegate* unmanaged[Cdecl] ready; [NativeTypeName("int (*)(void *, const char *, SDL_EnumerateDirectoryCallback, void *)")] public delegate* unmanaged[Cdecl], IntPtr, int> enumerate; @@ -68,10 +68,10 @@ public partial struct SDL_Storage public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Storage* SDL_OpenTitleStorage([NativeTypeName("const char *")] byte* @override, [NativeTypeName("SDL_PropertiesID")] uint props); + public static extern SDL_Storage* SDL_OpenTitleStorage([NativeTypeName("const char *")] byte* @override, SDL_PropertiesID props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Storage* SDL_OpenUserStorage([NativeTypeName("const char *")] byte* org, [NativeTypeName("const char *")] byte* app, [NativeTypeName("SDL_PropertiesID")] uint props); + public static extern SDL_Storage* SDL_OpenUserStorage([NativeTypeName("const char *")] byte* org, [NativeTypeName("const char *")] byte* app, SDL_PropertiesID props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Storage* SDL_OpenFileStorage([NativeTypeName("const char *")] byte* path); @@ -83,8 +83,7 @@ public static unsafe partial class SDL3 public static extern int SDL_CloseStorage(SDL_Storage* storage); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_StorageReady(SDL_Storage* storage); + public static extern SDL_bool SDL_StorageReady(SDL_Storage* storage); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetStorageFileSize(SDL_Storage* storage, [NativeTypeName("const char *")] byte* path, [NativeTypeName("Uint64 *")] ulong* length); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs index 3f4d3a4..efd53d2 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs @@ -89,8 +89,7 @@ public static unsafe partial class SDL3 public static extern void SDL_DestroySurface(SDL_Surface* surface); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetSurfaceProperties(SDL_Surface* surface); + public static extern SDL_PropertiesID SDL_GetSurfaceProperties(SDL_Surface* surface); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetSurfaceColorspace(SDL_Surface* surface, SDL_Colorspace colorspace); @@ -108,13 +107,13 @@ public static unsafe partial class SDL3 public static extern void SDL_UnlockSurface(SDL_Surface* surface); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Surface* SDL_LoadBMP_IO(SDL_IOStream* src, [NativeTypeName("SDL_bool")] int closeio); + public static extern SDL_Surface* SDL_LoadBMP_IO(SDL_IOStream* src, SDL_bool closeio); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Surface* SDL_LoadBMP([NativeTypeName("const char *")] byte* file); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SaveBMP_IO(SDL_Surface* surface, SDL_IOStream* dst, [NativeTypeName("SDL_bool")] int closeio); + public static extern int SDL_SaveBMP_IO(SDL_Surface* surface, SDL_IOStream* dst, SDL_bool closeio); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SaveBMP(SDL_Surface* surface, [NativeTypeName("const char *")] byte* file); @@ -123,15 +122,13 @@ public static unsafe partial class SDL3 public static extern int SDL_SetSurfaceRLE(SDL_Surface* surface, int flag); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_SurfaceHasRLE(SDL_Surface* surface); + public static extern SDL_bool SDL_SurfaceHasRLE(SDL_Surface* surface); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetSurfaceColorKey(SDL_Surface* surface, int flag, [NativeTypeName("Uint32")] uint key); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_SurfaceHasColorKey(SDL_Surface* surface); + public static extern SDL_bool SDL_SurfaceHasColorKey(SDL_Surface* surface); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetSurfaceColorKey(SDL_Surface* surface, [NativeTypeName("Uint32 *")] uint* key); @@ -155,8 +152,7 @@ public static unsafe partial class SDL3 public static extern int SDL_GetSurfaceBlendMode(SDL_Surface* surface, SDL_BlendMode* blendMode); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_SetSurfaceClipRect(SDL_Surface* surface, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); + public static extern SDL_bool SDL_SetSurfaceClipRect(SDL_Surface* surface, [NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetSurfaceClipRect(SDL_Surface* surface, SDL_Rect* rect); @@ -174,13 +170,13 @@ public static unsafe partial class SDL3 public static extern SDL_Surface* SDL_ConvertSurfaceFormat(SDL_Surface* surface, SDL_PixelFormatEnum pixel_format); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Surface* SDL_ConvertSurfaceFormatAndColorspace(SDL_Surface* surface, SDL_PixelFormatEnum pixel_format, SDL_Colorspace colorspace, [NativeTypeName("SDL_PropertiesID")] uint props); + public static extern SDL_Surface* SDL_ConvertSurfaceFormatAndColorspace(SDL_Surface* surface, SDL_PixelFormatEnum pixel_format, SDL_Colorspace colorspace, SDL_PropertiesID props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_ConvertPixels(int width, int height, SDL_PixelFormatEnum src_format, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormatEnum dst_format, [NativeTypeName("void*")] IntPtr dst, int dst_pitch); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormatEnum src_format, SDL_Colorspace src_colorspace, [NativeTypeName("SDL_PropertiesID")] uint src_properties, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormatEnum dst_format, SDL_Colorspace dst_colorspace, [NativeTypeName("SDL_PropertiesID")] uint dst_properties, [NativeTypeName("void*")] IntPtr dst, int dst_pitch); + public static extern int SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormatEnum src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormatEnum dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, [NativeTypeName("void*")] IntPtr dst, int dst_pitch); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormatEnum src_format, [NativeTypeName("const void *")] IntPtr src, int src_pitch, SDL_PixelFormatEnum dst_format, [NativeTypeName("void*")] IntPtr dst, int dst_pitch); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs index 83dd054..b5ad8c8 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs @@ -46,19 +46,16 @@ public static unsafe partial class SDL3 public static extern int SDL_GetAndroidSDKVersion(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] [SupportedOSPlatform("Android")] - public static extern int SDL_IsAndroidTV(); + public static extern SDL_bool SDL_IsAndroidTV(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] [SupportedOSPlatform("Android")] - public static extern int SDL_IsChromebook(); + public static extern SDL_bool SDL_IsChromebook(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] [SupportedOSPlatform("Android")] - public static extern int SDL_IsDeXMode(); + public static extern SDL_bool SDL_IsDeXMode(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] @@ -80,7 +77,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] - public static extern int SDL_AndroidRequestPermission([NativeTypeName("const char *")] byte* permission, [NativeTypeName("SDL_AndroidRequestPermissionCallback")] delegate* unmanaged[Cdecl] cb, [NativeTypeName("void*")] IntPtr userdata); + public static extern int SDL_AndroidRequestPermission([NativeTypeName("const char *")] byte* permission, [NativeTypeName("SDL_AndroidRequestPermissionCallback")] delegate* unmanaged[Cdecl] cb, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs index 769b1c1..dbf20c4 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.g.cs @@ -41,16 +41,15 @@ public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] - public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); + public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] - public static extern int SDL_Direct3D9GetAdapterIndex([NativeTypeName("SDL_DisplayID")] uint displayID); + public static extern int SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] [SupportedOSPlatform("Windows")] - public static extern int SDL_DXGIGetOutputInfo([NativeTypeName("SDL_DisplayID")] uint displayID, int* adapterIndex, int* outputIndex); + public static extern SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int* adapterIndex, int* outputIndex); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs index e1c755c..dc6bfe5 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs @@ -31,11 +31,10 @@ namespace SDL public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetX11EventHook([NativeTypeName("SDL_X11EventHook")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); + public static extern void SDL_SetX11EventHook([NativeTypeName("SDL_X11EventHook")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_IsTablet(); + public static extern SDL_bool SDL_IsTablet(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_OnApplicationWillTerminate(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs index 688380d..441566c 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs @@ -37,7 +37,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("iOS")] - public static extern void SDL_iPhoneSetEventPump([NativeTypeName("SDL_bool")] int enabled); + public static extern void SDL_iPhoneSetEventPump(SDL_bool enabled); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("iOS")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs index 4a2545f..57e9b60 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs @@ -56,12 +56,10 @@ public static unsafe partial class SDL3 public static extern byte* SDL_GetThreadName(SDL_Thread* thread); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_ThreadID")] - public static extern ulong SDL_GetCurrentThreadID(); + public static extern SDL_ThreadID SDL_GetCurrentThreadID(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_ThreadID")] - public static extern ulong SDL_GetThreadID(SDL_Thread* thread); + public static extern SDL_ThreadID SDL_GetThreadID(SDL_Thread* thread); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetThreadPriority(SDL_ThreadPriority priority); @@ -73,15 +71,14 @@ public static unsafe partial class SDL3 public static extern void SDL_DetachThread(SDL_Thread* thread); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_TLSID")] - public static extern uint SDL_CreateTLS(); + public static extern SDL_TLSID SDL_CreateTLS(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("void*")] - public static extern IntPtr SDL_GetTLS([NativeTypeName("SDL_TLSID")] uint id); + public static extern IntPtr SDL_GetTLS(SDL_TLSID id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetTLS([NativeTypeName("SDL_TLSID")] uint id, [NativeTypeName("const void *")] IntPtr value, [NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] destructor); + public static extern int SDL_SetTLS(SDL_TLSID id, [NativeTypeName("const void *")] IntPtr value, [NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] destructor); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_CleanupTLS(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs index 1994f7d..187c058 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs @@ -65,20 +65,19 @@ public enum SDL_TIME_FORMAT public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetCurrentTime([NativeTypeName("SDL_Time *")] long* ticks); + public static extern int SDL_GetCurrentTime(SDL_Time* ticks); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_TimeToDateTime([NativeTypeName("SDL_Time")] long ticks, SDL_DateTime* dt, [NativeTypeName("SDL_bool")] int localTime); + public static extern int SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime* dt, SDL_bool localTime); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_DateTimeToTime([NativeTypeName("const SDL_DateTime *")] SDL_DateTime* dt, [NativeTypeName("SDL_Time *")] long* ticks); + public static extern int SDL_DateTimeToTime([NativeTypeName("const SDL_DateTime *")] SDL_DateTime* dt, SDL_Time* ticks); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_TimeToWindows([NativeTypeName("SDL_Time")] long ticks, [NativeTypeName("Uint32 *")] uint* dwLowDateTime, [NativeTypeName("Uint32 *")] uint* dwHighDateTime); + public static extern void SDL_TimeToWindows(SDL_Time ticks, [NativeTypeName("Uint32 *")] uint* dwLowDateTime, [NativeTypeName("Uint32 *")] uint* dwHighDateTime); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_Time")] - public static extern long SDL_TimeFromWindows([NativeTypeName("Uint32")] uint dwLowDateTime, [NativeTypeName("Uint32")] uint dwHighDateTime); + public static extern SDL_Time SDL_TimeFromWindows([NativeTypeName("Uint32")] uint dwLowDateTime, [NativeTypeName("Uint32")] uint dwHighDateTime); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetDaysInMonth(int year, int month); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs index 46e8e63..48ad867 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_timer.g.cs @@ -53,12 +53,10 @@ public static unsafe partial class SDL3 public static extern void SDL_DelayNS([NativeTypeName("Uint64")] ulong ns); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_TimerID")] - public static extern uint SDL_AddTimer([NativeTypeName("Uint32")] uint interval, [NativeTypeName("SDL_TimerCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr param2); + public static extern SDL_TimerID SDL_AddTimer([NativeTypeName("Uint32")] uint interval, [NativeTypeName("SDL_TimerCallback")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr param2); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_RemoveTimer([NativeTypeName("SDL_TimerID")] uint id); + public static extern SDL_bool SDL_RemoveTimer(SDL_TimerID id); [NativeTypeName("#define SDL_MS_PER_SECOND 1000")] public const int SDL_MS_PER_SECOND = 1000; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs index 7fccbd2..5aee4bb 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs @@ -37,8 +37,7 @@ public enum SDL_TouchDeviceType public partial struct SDL_Finger { - [NativeTypeName("SDL_FingerID")] - public ulong id; + public SDL_FingerID id; public float x; @@ -50,26 +49,25 @@ public partial struct SDL_Finger public static unsafe partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_TouchID *")] - public static extern ulong* SDL_GetTouchDevices(int* count); + public static extern SDL_TouchID* SDL_GetTouchDevices(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetTouchDeviceName([NativeTypeName("SDL_TouchID")] ulong touchID); + public static extern byte* SDL_GetTouchDeviceName(SDL_TouchID touchID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_TouchDeviceType SDL_GetTouchDeviceType([NativeTypeName("SDL_TouchID")] ulong touchID); + public static extern SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID touchID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetNumTouchFingers([NativeTypeName("SDL_TouchID")] ulong touchID); + public static extern int SDL_GetNumTouchFingers(SDL_TouchID touchID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Finger* SDL_GetTouchFinger([NativeTypeName("SDL_TouchID")] ulong touchID, int index); + public static extern SDL_Finger* SDL_GetTouchFinger(SDL_TouchID touchID, int index); [NativeTypeName("#define SDL_TOUCH_MOUSEID ((SDL_MouseID)-1)")] - public const uint SDL_TOUCH_MOUSEID = unchecked((uint)(-1)); + public const SDL_MouseID SDL_TOUCH_MOUSEID = ((SDL_MouseID)(-1)); [NativeTypeName("#define SDL_MOUSE_TOUCHID ((SDL_TouchID)-1)")] - public const ulong SDL_MOUSE_TOUCHID = unchecked((ulong)(-1)); + public const SDL_TouchID SDL_MOUSE_TOUCHID = ((SDL_TouchID)(-1)); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs index ae769fe..9c3c60a 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs @@ -37,8 +37,7 @@ public enum SDL_SystemTheme public partial struct SDL_DisplayMode { - [NativeTypeName("SDL_DisplayID")] - public uint displayID; + public SDL_DisplayID displayID; public SDL_PixelFormatEnum format; @@ -164,63 +163,57 @@ public static unsafe partial class SDL3 public static extern SDL_SystemTheme SDL_GetSystemTheme(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_DisplayID *")] - public static extern uint* SDL_GetDisplays(int* count); + public static extern SDL_DisplayID* SDL_GetDisplays(int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_DisplayID")] - public static extern uint SDL_GetPrimaryDisplay(); + public static extern SDL_DisplayID SDL_GetPrimaryDisplay(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetDisplayProperties([NativeTypeName("SDL_DisplayID")] uint displayID); + public static extern SDL_PropertiesID SDL_GetDisplayProperties(SDL_DisplayID displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetDisplayName([NativeTypeName("SDL_DisplayID")] uint displayID); + public static extern byte* SDL_GetDisplayName(SDL_DisplayID displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetDisplayBounds([NativeTypeName("SDL_DisplayID")] uint displayID, SDL_Rect* rect); + public static extern int SDL_GetDisplayBounds(SDL_DisplayID displayID, SDL_Rect* rect); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_GetDisplayUsableBounds([NativeTypeName("SDL_DisplayID")] uint displayID, SDL_Rect* rect); + public static extern int SDL_GetDisplayUsableBounds(SDL_DisplayID displayID, SDL_Rect* rect); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_DisplayOrientation SDL_GetNaturalDisplayOrientation([NativeTypeName("SDL_DisplayID")] uint displayID); + public static extern SDL_DisplayOrientation SDL_GetNaturalDisplayOrientation(SDL_DisplayID displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_DisplayOrientation SDL_GetCurrentDisplayOrientation([NativeTypeName("SDL_DisplayID")] uint displayID); + public static extern SDL_DisplayOrientation SDL_GetCurrentDisplayOrientation(SDL_DisplayID displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float SDL_GetDisplayContentScale([NativeTypeName("SDL_DisplayID")] uint displayID); + public static extern float SDL_GetDisplayContentScale(SDL_DisplayID displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const SDL_DisplayMode **")] - public static extern SDL_DisplayMode** SDL_GetFullscreenDisplayModes([NativeTypeName("SDL_DisplayID")] uint displayID, int* count); + public static extern SDL_DisplayMode** SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const SDL_DisplayMode *")] - public static extern SDL_DisplayMode* SDL_GetClosestFullscreenDisplayMode([NativeTypeName("SDL_DisplayID")] uint displayID, int w, int h, float refresh_rate, [NativeTypeName("SDL_bool")] int include_high_density_modes); + public static extern SDL_DisplayMode* SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const SDL_DisplayMode *")] - public static extern SDL_DisplayMode* SDL_GetDesktopDisplayMode([NativeTypeName("SDL_DisplayID")] uint displayID); + public static extern SDL_DisplayMode* SDL_GetDesktopDisplayMode(SDL_DisplayID displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const SDL_DisplayMode *")] - public static extern SDL_DisplayMode* SDL_GetCurrentDisplayMode([NativeTypeName("SDL_DisplayID")] uint displayID); + public static extern SDL_DisplayMode* SDL_GetCurrentDisplayMode(SDL_DisplayID displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_DisplayID")] - public static extern uint SDL_GetDisplayForPoint([NativeTypeName("const SDL_Point *")] SDL_Point* point); + public static extern SDL_DisplayID SDL_GetDisplayForPoint([NativeTypeName("const SDL_Point *")] SDL_Point* point); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_DisplayID")] - public static extern uint SDL_GetDisplayForRect([NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); + public static extern SDL_DisplayID SDL_GetDisplayForRect([NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_DisplayID")] - public static extern uint SDL_GetDisplayForWindow(SDL_Window* window); + public static extern SDL_DisplayID SDL_GetDisplayForWindow(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern float SDL_GetWindowPixelDensity(SDL_Window* window); @@ -244,31 +237,28 @@ public static unsafe partial class SDL3 public static extern uint SDL_GetWindowPixelFormat(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Window* SDL_CreateWindow([NativeTypeName("const char *")] byte* title, int w, int h, [NativeTypeName("SDL_WindowFlags")] uint flags); + public static extern SDL_Window* SDL_CreateWindow([NativeTypeName("const char *")] byte* title, int w, int h, SDL_WindowFlags flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Window* SDL_CreatePopupWindow(SDL_Window* parent, int offset_x, int offset_y, int w, int h, [NativeTypeName("SDL_WindowFlags")] uint flags); + public static extern SDL_Window* SDL_CreatePopupWindow(SDL_Window* parent, int offset_x, int offset_y, int w, int h, SDL_WindowFlags flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Window* SDL_CreateWindowWithProperties([NativeTypeName("SDL_PropertiesID")] uint props); + public static extern SDL_Window* SDL_CreateWindowWithProperties(SDL_PropertiesID props); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_WindowID")] - public static extern uint SDL_GetWindowID(SDL_Window* window); + public static extern SDL_WindowID SDL_GetWindowID(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Window* SDL_GetWindowFromID([NativeTypeName("SDL_WindowID")] uint id); + public static extern SDL_Window* SDL_GetWindowFromID(SDL_WindowID id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Window* SDL_GetWindowParent(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_PropertiesID")] - public static extern uint SDL_GetWindowProperties(SDL_Window* window); + public static extern SDL_PropertiesID SDL_GetWindowProperties(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_WindowFlags")] - public static extern uint SDL_GetWindowFlags(SDL_Window* window); + public static extern SDL_WindowFlags SDL_GetWindowFlags(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetWindowTitle(SDL_Window* window, [NativeTypeName("const char *")] byte* title); @@ -311,13 +301,13 @@ public static unsafe partial class SDL3 public static extern int SDL_GetWindowMaximumSize(SDL_Window* window, int* w, int* h); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetWindowBordered(SDL_Window* window, [NativeTypeName("SDL_bool")] int bordered); + public static extern int SDL_SetWindowBordered(SDL_Window* window, SDL_bool bordered); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetWindowResizable(SDL_Window* window, [NativeTypeName("SDL_bool")] int resizable); + public static extern int SDL_SetWindowResizable(SDL_Window* window, SDL_bool resizable); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetWindowAlwaysOnTop(SDL_Window* window, [NativeTypeName("SDL_bool")] int on_top); + public static extern int SDL_SetWindowAlwaysOnTop(SDL_Window* window, SDL_bool on_top); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_ShowWindow(SDL_Window* window); @@ -338,14 +328,13 @@ public static unsafe partial class SDL3 public static extern int SDL_RestoreWindow(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetWindowFullscreen(SDL_Window* window, [NativeTypeName("SDL_bool")] int fullscreen); + public static extern int SDL_SetWindowFullscreen(SDL_Window* window, SDL_bool fullscreen); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SyncWindow(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_WindowHasSurface(SDL_Window* window); + public static extern SDL_bool SDL_WindowHasSurface(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Surface* SDL_GetWindowSurface(SDL_Window* window); @@ -360,18 +349,16 @@ public static unsafe partial class SDL3 public static extern int SDL_DestroyWindowSurface(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetWindowKeyboardGrab(SDL_Window* window, [NativeTypeName("SDL_bool")] int grabbed); + public static extern int SDL_SetWindowKeyboardGrab(SDL_Window* window, SDL_bool grabbed); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetWindowMouseGrab(SDL_Window* window, [NativeTypeName("SDL_bool")] int grabbed); + public static extern int SDL_SetWindowMouseGrab(SDL_Window* window, SDL_bool grabbed); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetWindowKeyboardGrab(SDL_Window* window); + public static extern SDL_bool SDL_GetWindowKeyboardGrab(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GetWindowMouseGrab(SDL_Window* window); + public static extern SDL_bool SDL_GetWindowMouseGrab(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Window* SDL_GetGrabbedWindow(); @@ -396,7 +383,7 @@ public static unsafe partial class SDL3 public static extern int SDL_SetWindowInputFocus(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_SetWindowFocusable(SDL_Window* window, [NativeTypeName("SDL_bool")] int focusable); + public static extern int SDL_SetWindowFocusable(SDL_Window* window, SDL_bool focusable); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_ShowWindowSystemMenu(SDL_Window* window, int x, int y); @@ -414,8 +401,7 @@ public static unsafe partial class SDL3 public static extern void SDL_DestroyWindow(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_ScreenSaverEnabled(); + public static extern SDL_bool SDL_ScreenSaverEnabled(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_EnableScreenSaver(); @@ -438,8 +424,7 @@ public static unsafe partial class SDL3 public static extern void SDL_GL_UnloadLibrary(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_GL_ExtensionSupported([NativeTypeName("const char *")] byte* extension); + public static extern SDL_bool SDL_GL_ExtensionSupported([NativeTypeName("const char *")] byte* extension); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_GL_ResetAttributes(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs index fbe40c9..a83e2fb 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs @@ -56,7 +56,6 @@ public static unsafe partial class SDL3 public static extern byte** SDL_Vulkan_GetInstanceExtensions([NativeTypeName("Uint32 *")] uint* count); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("SDL_bool")] - public static extern int SDL_Vulkan_CreateSurface(SDL_Window* window, [NativeTypeName("VkInstance")] VkInstance_T* instance, [NativeTypeName("const struct VkAllocationCallbacks *")] VkAllocationCallbacks* allocator, [NativeTypeName("VkSurfaceKHR *")] VkSurfaceKHR_T** surface); + public static extern SDL_bool SDL_Vulkan_CreateSurface(SDL_Window* window, [NativeTypeName("VkInstance")] VkInstance_T* instance, [NativeTypeName("const struct VkAllocationCallbacks *")] VkAllocationCallbacks* allocator, [NativeTypeName("VkSurfaceKHR *")] VkSurfaceKHR_T** surface); } } diff --git a/SDL3-CS/SDL3/SDL_audio.cs b/SDL3-CS/SDL3/SDL_audio.cs new file mode 100644 index 0000000..31248f0 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_audio.cs @@ -0,0 +1,23 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_AudioDeviceID : UInt32; + + [Typedef] + public enum SDL_AudioFormat : UInt16 + { + SDL_AUDIO_U8 = SDL3.SDL_AUDIO_U8, + SDL_AUDIO_S8 = SDL3.SDL_AUDIO_S8, + SDL_AUDIO_S16LE = SDL3.SDL_AUDIO_S16LE, + SDL_AUDIO_S16BE = SDL3.SDL_AUDIO_S16BE, + SDL_AUDIO_S32LE = SDL3.SDL_AUDIO_S32LE, + SDL_AUDIO_S32BE = SDL3.SDL_AUDIO_S32BE, + SDL_AUDIO_F32LE = SDL3.SDL_AUDIO_F32LE, + SDL_AUDIO_F32BE = SDL3.SDL_AUDIO_F32BE, + } +} diff --git a/SDL3-CS/SDL3/SDL_camera.cs b/SDL3-CS/SDL3/SDL_camera.cs new file mode 100644 index 0000000..f6f995a --- /dev/null +++ b/SDL3-CS/SDL3/SDL_camera.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_CameraDeviceID : UInt32; +} diff --git a/SDL3-CS/SDL3/SDL_haptic.cs b/SDL3-CS/SDL3/SDL_haptic.cs new file mode 100644 index 0000000..0d82795 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_haptic.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_HapticID : UInt32; +} diff --git a/SDL3-CS/SDL3/SDL_joystick.cs b/SDL3-CS/SDL3/SDL_joystick.cs new file mode 100644 index 0000000..3e881d0 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_joystick.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_JoystickID : UInt32; +} diff --git a/SDL3-CS/SDL3/SDL_keyboard.cs b/SDL3-CS/SDL3/SDL_keyboard.cs new file mode 100644 index 0000000..1082027 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_keyboard.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_KeyboardID : UInt32; +} diff --git a/SDL3-CS/SDL3/SDL_keycode.cs b/SDL3-CS/SDL3/SDL_keycode.cs new file mode 100644 index 0000000..fef36b9 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_keycode.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_Keycode : Int32; +} diff --git a/SDL3-CS/SDL3/SDL_mouse.cs b/SDL3-CS/SDL3/SDL_mouse.cs new file mode 100644 index 0000000..0af442b --- /dev/null +++ b/SDL3-CS/SDL3/SDL_mouse.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_MouseID : UInt32; +} diff --git a/SDL3-CS/SDL3/SDL_pen.cs b/SDL3-CS/SDL3/SDL_pen.cs new file mode 100644 index 0000000..2848637 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_pen.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_PenID : UInt32; +} diff --git a/SDL3-CS/SDL3/SDL_properties.cs b/SDL3-CS/SDL3/SDL_properties.cs new file mode 100644 index 0000000..deb01e7 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_properties.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_PropertiesID : UInt32; +} diff --git a/SDL3-CS/SDL3/SDL_sensor.cs b/SDL3-CS/SDL3/SDL_sensor.cs new file mode 100644 index 0000000..085a52b --- /dev/null +++ b/SDL3-CS/SDL3/SDL_sensor.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_SensorID : UInt32; +} diff --git a/SDL3-CS/SDL3/SDL_stdinc.cs b/SDL3-CS/SDL3/SDL_stdinc.cs new file mode 100644 index 0000000..d64e1b7 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_stdinc.cs @@ -0,0 +1,17 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_bool + { + SDL_FALSE = SDL3.SDL_FALSE, + SDL_TRUE = SDL3.SDL_TRUE + } + + [Typedef] + public enum SDL_Time : Int64; +} diff --git a/SDL3-CS/SDL3/SDL_thread.cs b/SDL3-CS/SDL3/SDL_thread.cs new file mode 100644 index 0000000..d030b4b --- /dev/null +++ b/SDL3-CS/SDL3/SDL_thread.cs @@ -0,0 +1,13 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_TLSID : UInt32; + + [Typedef] + public enum SDL_ThreadID : UInt64; +} diff --git a/SDL3-CS/SDL3/SDL_timer.cs b/SDL3-CS/SDL3/SDL_timer.cs new file mode 100644 index 0000000..bee2901 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_timer.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_TimerID : UInt32; +} diff --git a/SDL3-CS/SDL3/SDL_touch.cs b/SDL3-CS/SDL3/SDL_touch.cs new file mode 100644 index 0000000..d3f473e --- /dev/null +++ b/SDL3-CS/SDL3/SDL_touch.cs @@ -0,0 +1,13 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_FingerID : UInt64; + + [Typedef] + public enum SDL_TouchID : UInt64; +} diff --git a/SDL3-CS/SDL3/SDL_video.cs b/SDL3-CS/SDL3/SDL_video.cs new file mode 100644 index 0000000..391e501 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_video.cs @@ -0,0 +1,42 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + [Typedef] + public enum SDL_DisplayID : UInt32; + + [Typedef] + public enum SDL_WindowID : UInt32; + + [Flags] + [Typedef] + public enum SDL_WindowFlags : uint + { + SDL_WINDOW_FULLSCREEN = SDL3.SDL_WINDOW_FULLSCREEN, + SDL_WINDOW_OPENGL = SDL3.SDL_WINDOW_OPENGL, + SDL_WINDOW_OCCLUDED = SDL3.SDL_WINDOW_OCCLUDED, + SDL_WINDOW_HIDDEN = SDL3.SDL_WINDOW_HIDDEN, + SDL_WINDOW_BORDERLESS = SDL3.SDL_WINDOW_BORDERLESS, + SDL_WINDOW_RESIZABLE = SDL3.SDL_WINDOW_RESIZABLE, + SDL_WINDOW_MINIMIZED = SDL3.SDL_WINDOW_MINIMIZED, + SDL_WINDOW_MAXIMIZED = SDL3.SDL_WINDOW_MAXIMIZED, + SDL_WINDOW_MOUSE_GRABBED = SDL3.SDL_WINDOW_MOUSE_GRABBED, + SDL_WINDOW_INPUT_FOCUS = SDL3.SDL_WINDOW_INPUT_FOCUS, + SDL_WINDOW_MOUSE_FOCUS = SDL3.SDL_WINDOW_MOUSE_FOCUS, + SDL_WINDOW_EXTERNAL = SDL3.SDL_WINDOW_EXTERNAL, + SDL_WINDOW_HIGH_PIXEL_DENSITY = SDL3.SDL_WINDOW_HIGH_PIXEL_DENSITY, + SDL_WINDOW_MOUSE_CAPTURE = SDL3.SDL_WINDOW_MOUSE_CAPTURE, + SDL_WINDOW_ALWAYS_ON_TOP = SDL3.SDL_WINDOW_ALWAYS_ON_TOP, + SDL_WINDOW_UTILITY = SDL3.SDL_WINDOW_UTILITY, + SDL_WINDOW_TOOLTIP = SDL3.SDL_WINDOW_TOOLTIP, + SDL_WINDOW_POPUP_MENU = SDL3.SDL_WINDOW_POPUP_MENU, + SDL_WINDOW_KEYBOARD_GRABBED = SDL3.SDL_WINDOW_KEYBOARD_GRABBED, + SDL_WINDOW_VULKAN = SDL3.SDL_WINDOW_VULKAN, + SDL_WINDOW_METAL = SDL3.SDL_WINDOW_METAL, + SDL_WINDOW_TRANSPARENT = SDL3.SDL_WINDOW_TRANSPARENT, + SDL_WINDOW_NOT_FOCUSABLE = SDL3.SDL_WINDOW_NOT_FOCUSABLE, + } +} diff --git a/SDL3-CS/TypedefAttribute.cs b/SDL3-CS/TypedefAttribute.cs new file mode 100644 index 0000000..54d4f7e --- /dev/null +++ b/SDL3-CS/TypedefAttribute.cs @@ -0,0 +1,17 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Diagnostics; + +namespace SDL +{ + /// + /// Denotes a C typedef that is expressed as an enum in C#. + /// These need to be manually signaled to ClagnSharp so it uses the custom enum type instaed of the underlying type. + /// Handled by get_typedefs() in generate_bindings.py. + /// + [AttributeUsage(AttributeTargets.Enum)] + [Conditional("NEVER")] + public class TypedefAttribute : Attribute; +} diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 567c9cf..7410dc7 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -59,6 +59,13 @@ def rsp_files(self): if self.output_suffix is not None: yield csproj_root / f"{self.base}/{self.name}.{self.output_suffix}.rsp" + def cs_file(self): + """Location of the manually-written C# file that implements some parts of the header.""" + if self.output_suffix is None: + return csproj_root / f"{self.base}/{self.name}.cs" + else: + return csproj_root / f"{self.base}/{self.name}.{self.output_suffix}.cs" + def add(s: str): base, name = s.split("/") @@ -158,6 +165,22 @@ def check_generated_functions(sdl_api, header, generated_file_paths): print(f"[⚠️ Warning] Function {name} not found in generated files:", *generated_file_paths) +typedef_enum_regex = re.compile(r"\[Typedef]\s*public enum (SDL_\w+)", re.MULTILINE) + + +def get_typedefs(): + for header in headers: + cs_file = header.cs_file() + if cs_file.is_file(): + with open(cs_file, "r", encoding="utf-8") as f: + for match in typedef_enum_regex.finditer(f.read()): + yield match.group(1) + + +def typedef(t): + return f"{t}={t}" + + base_command = [ "dotnet", "tool", "run", "ClangSharpPInvokeGenerator", "--headerFile", csproj_root / "SDL.licenseheader", @@ -237,6 +260,13 @@ def generate_platform_specific_headers(sdl_api, header: Header, platforms): def main(): sdl_api = get_sdl_api_dump() + # typedefs are added globally as their types appear outside of the defining header + typedefs = list(get_typedefs()) + if typedefs: + base_command.append("--remap") + for type_name in typedefs: + base_command.append(typedef(type_name)) + for header in headers: output_file = run_clangsharp(base_command, header) check_generated_functions(sdl_api, header, [output_file]) From 9e4431653532af60fe659b96db93576fd5adf068 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 13:24:42 +0200 Subject: [PATCH 20/37] Fix invalid `int` -> `SDL_bool` conversion by manually changing SDL headers --- SDL3-CS/SDL-use-proper-types.patch | 15 +++++++++++++++ SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs | 12 ++++++------ SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 8 ++++---- SDL3-CS/generate_bindings.py | 1 + 4 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 SDL3-CS/SDL-use-proper-types.patch diff --git a/SDL3-CS/SDL-use-proper-types.patch b/SDL3-CS/SDL-use-proper-types.patch new file mode 100644 index 0000000..58ece12 --- /dev/null +++ b/SDL3-CS/SDL-use-proper-types.patch @@ -0,0 +1,15 @@ +diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h +index e6a387c31..46c225953 100644 +--- a/include/SDL3/SDL_stdinc.h ++++ b/include/SDL3/SDL_stdinc.h +@@ -132,8 +132,8 @@ char *alloca(); + /** + * A boolean type. + */ +-#define SDL_FALSE 0 +-#define SDL_TRUE 1 ++#define SDL_FALSE (SDL_bool)0 ++#define SDL_TRUE (SDL_bool)1 + typedef int SDL_bool; + + /** diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs index c3dc263..4fb3d30 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs @@ -67,17 +67,17 @@ public static unsafe partial class SDL3 { public static SDL_bool SDL_PointInRect([NativeTypeName("const SDL_Point *")] SDL_Point* p, [NativeTypeName("const SDL_Rect *")] SDL_Rect* r) { - return ((p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? 1 : 0; + return ((p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? (SDL_bool)(1) : (SDL_bool)(0); } public static SDL_bool SDL_RectEmpty([NativeTypeName("const SDL_Rect *")] SDL_Rect* r) { - return ((r == null) || (r->w <= 0) || (r->h <= 0)) ? 1 : 0; + return ((r == null) || (r->w <= 0) || (r->h <= 0)) ? (SDL_bool)(1) : (SDL_bool)(0); } public static SDL_bool SDL_RectsEqual([NativeTypeName("const SDL_Rect *")] SDL_Rect* a, [NativeTypeName("const SDL_Rect *")] SDL_Rect* b) { - return ((a) != null && (b) != null && (a->x == b->x) && (a->y == b->y) && (a->w == b->w) && (a->h == b->h)) ? 1 : 0; + return ((a) != null && (b) != null && (a->x == b->x) && (a->y == b->y) && (a->w == b->w) && (a->h == b->h)) ? (SDL_bool)(1) : (SDL_bool)(0); } [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -97,17 +97,17 @@ public static SDL_bool SDL_RectsEqual([NativeTypeName("const SDL_Rect *")] SDL_R public static SDL_bool SDL_PointInRectFloat([NativeTypeName("const SDL_FPoint *")] SDL_FPoint* p, [NativeTypeName("const SDL_FRect *")] SDL_FRect* r) { - return ((p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? 1 : 0; + return ((p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? (SDL_bool)(1) : (SDL_bool)(0); } public static SDL_bool SDL_RectEmptyFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* r) { - return ((r == null) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? 1 : 0; + return ((r == null) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? (SDL_bool)(1) : (SDL_bool)(0); } public static SDL_bool SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, [NativeTypeName("const float")] 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)))) ? 1 : 0; + 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)))) ? (SDL_bool)(1) : (SDL_bool)(0); } public static SDL_bool SDL_RectsEqualFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index 577cbae..fe2bba7 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -541,11 +541,11 @@ public static int SDL_size_add_overflow([NativeTypeName("size_t")] nuint a, [Nat [NativeTypeName("#define SDL_SIZE_MAX SIZE_MAX")] public const ulong SDL_SIZE_MAX = 0xffffffffffffffffUL; - [NativeTypeName("#define SDL_FALSE 0")] - public const int SDL_FALSE = 0; + [NativeTypeName("#define SDL_FALSE (SDL_bool)0")] + public const SDL_bool SDL_FALSE = (SDL_bool)(0); - [NativeTypeName("#define SDL_TRUE 1")] - public const int SDL_TRUE = 1; + [NativeTypeName("#define SDL_TRUE (SDL_bool)1")] + public const SDL_bool SDL_TRUE = (SDL_bool)(1); [NativeTypeName("#define SDL_MAX_SINT8 ((Sint8)0x7F)")] public const sbyte SDL_MAX_SINT8 = ((sbyte)(0x7F)); diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 7410dc7..8e34780 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -7,6 +7,7 @@ Prerequisites: - run `dotnet tool restore` (to install ClangSharpPInvokeGenerator) - https://github.com/libsdl-org/SDL checked out alongside this repository +- git apply `SDL-use-proper-types.patch` to SDL repo This script should be run manually. """ From caa48201d34a1d0d0da55cc9eebdde56402fc14c Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 13:32:07 +0200 Subject: [PATCH 21/37] Manually define broken constants --- SDL3-CS/ConstantAttribute.cs | 17 +++++++++++++++++ SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs | 3 --- SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs | 6 ------ SDL3-CS/SDL3/SDL_pen.cs | 6 ++++++ SDL3-CS/SDL3/SDL_touch.cs | 9 +++++++++ SDL3-CS/generate_bindings.py | 20 ++++++++++++++++++++ 6 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 SDL3-CS/ConstantAttribute.cs diff --git a/SDL3-CS/ConstantAttribute.cs b/SDL3-CS/ConstantAttribute.cs new file mode 100644 index 0000000..9dce031 --- /dev/null +++ b/SDL3-CS/ConstantAttribute.cs @@ -0,0 +1,17 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Diagnostics; + +namespace SDL +{ + /// + /// Denotes a manually defined constant. + /// Such consants should be excluded from ClangSharp generation to prevent warnings or duplicate definitions. + /// Handled by get_manually_written_symbols() in generate_bindings.py. + /// + [AttributeUsage(AttributeTargets.Field)] + [Conditional("NEVER")] + public class ConstantAttribute : Attribute; +} diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs index effec96..a2dabb4 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs @@ -94,9 +94,6 @@ public static unsafe partial class SDL3 [NativeTypeName("#define SDL_PEN_INVALID ((SDL_PenID)0)")] public const SDL_PenID SDL_PEN_INVALID = ((SDL_PenID)(0)); - [NativeTypeName("#define SDL_PEN_MOUSEID ((SDL_MouseID)-2)")] - public const SDL_MouseID SDL_PEN_MOUSEID = ((SDL_MouseID)(-2)); - [NativeTypeName("#define SDL_PEN_INFO_UNKNOWN (-1)")] public const int SDL_PEN_INFO_UNKNOWN = (-1); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs index 5aee4bb..777f015 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs @@ -63,11 +63,5 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Finger* SDL_GetTouchFinger(SDL_TouchID touchID, int index); - - [NativeTypeName("#define SDL_TOUCH_MOUSEID ((SDL_MouseID)-1)")] - public const SDL_MouseID SDL_TOUCH_MOUSEID = ((SDL_MouseID)(-1)); - - [NativeTypeName("#define SDL_MOUSE_TOUCHID ((SDL_TouchID)-1)")] - public const SDL_TouchID SDL_MOUSE_TOUCHID = ((SDL_TouchID)(-1)); } } diff --git a/SDL3-CS/SDL3/SDL_pen.cs b/SDL3-CS/SDL3/SDL_pen.cs index 2848637..ec3da99 100644 --- a/SDL3-CS/SDL3/SDL_pen.cs +++ b/SDL3-CS/SDL3/SDL_pen.cs @@ -7,4 +7,10 @@ namespace SDL { [Typedef] public enum SDL_PenID : UInt32; + + public static partial class SDL3 + { + [Constant] + public const SDL_MouseID SDL_PEN_MOUSEID = unchecked((SDL_MouseID)(-2)); + } } diff --git a/SDL3-CS/SDL3/SDL_touch.cs b/SDL3-CS/SDL3/SDL_touch.cs index d3f473e..b07724f 100644 --- a/SDL3-CS/SDL3/SDL_touch.cs +++ b/SDL3-CS/SDL3/SDL_touch.cs @@ -10,4 +10,13 @@ public enum SDL_FingerID : UInt64; [Typedef] public enum SDL_TouchID : UInt64; + + public static partial class SDL3 + { + [Constant] + public const SDL_MouseID SDL_TOUCH_MOUSEID = unchecked((SDL_MouseID)(-1)); + + [Constant] + public const SDL_TouchID SDL_MOUSE_TOUCHID = unchecked((SDL_TouchID)(-1)); + } } diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 8e34780..834f085 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -166,6 +166,21 @@ def check_generated_functions(sdl_api, header, generated_file_paths): print(f"[⚠️ Warning] Function {name} not found in generated files:", *generated_file_paths) +defined_constant_regex = re.compile(r"\[Constant]\s*public (const|static readonly) \w+ (SDL_\w+) = ", re.MULTILINE) + + +def get_manually_written_symbols(header): + """Returns symbols names whose definitions are manually written in C#.""" + cs_file = header.cs_file() + if cs_file.is_file(): + with open(cs_file, "r", encoding="utf-8") as f: + text = f.read() + for match in defined_constant_regex.finditer(text): + m = match.group(2) + assert m.startswith("SDL_") + yield m + + typedef_enum_regex = re.compile(r"\[Typedef]\s*public enum (SDL_\w+)", re.MULTILINE) @@ -217,6 +232,11 @@ def run_clangsharp(command, header: Header): if rsp.is_file(): cmd.append(f"@{rsp}") + to_exclude = list(get_manually_written_symbols(header)) + if to_exclude: + cmd.append("--exclude") + cmd.extend(to_exclude) + subprocess.run(cmd) return header.output_file() From 37da786af0b6d6de333e335382a85126ceb0c3c2 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 13:38:13 +0200 Subject: [PATCH 22/37] Define `SDL_FUNCTION_POINTER_IS_VOID_POINTER` --- SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs | 2 +- SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs | 4 ++-- SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs | 3 ++- SDL3-CS/generate_bindings.py | 3 +++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs index 6afac12..65d2668 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_loadso.g.cs @@ -36,7 +36,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_FunctionPointer")] - public static extern delegate* unmanaged[Cdecl] SDL_LoadFunction([NativeTypeName("void*")] IntPtr handle, [NativeTypeName("const char *")] byte* name); + public static extern IntPtr SDL_LoadFunction([NativeTypeName("void*")] IntPtr handle, [NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_UnloadObject([NativeTypeName("void*")] IntPtr handle); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs index 9c3c60a..69ff2ac 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs @@ -414,11 +414,11 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_FunctionPointer")] - public static extern delegate* unmanaged[Cdecl] SDL_GL_GetProcAddress([NativeTypeName("const char *")] byte* proc); + public static extern IntPtr SDL_GL_GetProcAddress([NativeTypeName("const char *")] byte* proc); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_FunctionPointer")] - public static extern delegate* unmanaged[Cdecl] SDL_EGL_GetProcAddress([NativeTypeName("const char *")] byte* proc); + public static extern IntPtr SDL_EGL_GetProcAddress([NativeTypeName("const char *")] byte* proc); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_GL_UnloadLibrary(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs index a83e2fb..f8c8039 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_vulkan.g.cs @@ -23,6 +23,7 @@ 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 @@ -46,7 +47,7 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("SDL_FunctionPointer")] - public static extern delegate* unmanaged[Cdecl] SDL_Vulkan_GetVkGetInstanceProcAddr(); + public static extern IntPtr SDL_Vulkan_GetVkGetInstanceProcAddr(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_Vulkan_UnloadLibrary(); diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 834f085..0144ad9 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -217,6 +217,9 @@ def typedef(t): "char=byte", "wchar_t *=IntPtr", # wchar_t has a platform-defined size + "--define-macro", + "SDL_FUNCTION_POINTER_IS_VOID_POINTER", + "--additional", "--undefine-macro=_WIN32", ] From 5747f163ac3edf1331b667f184ab7a50f1d55590 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 13:42:10 +0200 Subject: [PATCH 23/37] Manually implement endianness-specific audio formats --- SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs | 9 --------- SDL3-CS/SDL3/SDL_audio.cs | 12 ++++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index 1a6699b..1be047b 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -205,15 +205,6 @@ public static unsafe partial class SDL3 [NativeTypeName("#define SDL_AUDIO_F32BE 0x9120")] public const int SDL_AUDIO_F32BE = 0x9120; - [NativeTypeName("#define SDL_AUDIO_S16 SDL_AUDIO_S16LE")] - public const int SDL_AUDIO_S16 = 0x8010; - - [NativeTypeName("#define SDL_AUDIO_S32 SDL_AUDIO_S32LE")] - public const int SDL_AUDIO_S32 = 0x8020; - - [NativeTypeName("#define SDL_AUDIO_F32 SDL_AUDIO_F32LE")] - public const int SDL_AUDIO_F32 = 0x8120; - [NativeTypeName("#define SDL_AUDIO_DEVICE_DEFAULT_OUTPUT ((SDL_AudioDeviceID) 0xFFFFFFFF)")] public const SDL_AudioDeviceID SDL_AUDIO_DEVICE_DEFAULT_OUTPUT = ((SDL_AudioDeviceID)(0xFFFFFFFF)); diff --git a/SDL3-CS/SDL3/SDL_audio.cs b/SDL3-CS/SDL3/SDL_audio.cs index 31248f0..777cc84 100644 --- a/SDL3-CS/SDL3/SDL_audio.cs +++ b/SDL3-CS/SDL3/SDL_audio.cs @@ -20,4 +20,16 @@ public enum SDL_AudioFormat : UInt16 SDL_AUDIO_F32LE = SDL3.SDL_AUDIO_F32LE, SDL_AUDIO_F32BE = SDL3.SDL_AUDIO_F32BE, } + + public static partial class SDL3 + { + [Constant] + public static readonly SDL_AudioFormat SDL_AUDIO_S16 = BitConverter.IsLittleEndian ? SDL_AudioFormat.SDL_AUDIO_S16LE : SDL_AudioFormat.SDL_AUDIO_S16BE; + + [Constant] + public static readonly SDL_AudioFormat SDL_AUDIO_S32 = BitConverter.IsLittleEndian ? SDL_AudioFormat.SDL_AUDIO_S32LE : SDL_AudioFormat.SDL_AUDIO_S32BE; + + [Constant] + public static readonly SDL_AudioFormat SDL_AUDIO_F32 = BitConverter.IsLittleEndian ? SDL_AudioFormat.SDL_AUDIO_F32LE : SDL_AudioFormat.SDL_AUDIO_F32BE; + } } From b97a553ed4305956fb8294d23bf81487fbc175b1 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 13:45:49 +0200 Subject: [PATCH 24/37] Remap `SDL_KeyCode` enum to `SDL_Keycode` typedef This doesn't compile because of duplicate `SDL_Keycode` definition --- SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs | 2 +- SDL3-CS/SDL3/SDL_keycode.rsp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs index 48d611b..422ab22 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs @@ -28,7 +28,7 @@ 3. This notice may not be removed or altered from any source distribution. namespace SDL { - public enum SDL_KeyCode + public enum SDL_Keycode { SDLK_UNKNOWN = 0, SDLK_RETURN = '\r', diff --git a/SDL3-CS/SDL3/SDL_keycode.rsp b/SDL3-CS/SDL3/SDL_keycode.rsp index 15bb51a..2de70c7 100644 --- a/SDL3-CS/SDL3/SDL_keycode.rsp +++ b/SDL3-CS/SDL3/SDL_keycode.rsp @@ -3,3 +3,7 @@ --with-attribute SDL_Keymod=Flags + +# Remap the C `SDL_KeyCode` enum to the `SDL_Keycode` typedef +--remap +SDL_KeyCode=SDL_Keycode From 4b1a1e21025aeee8344b27772e40b47f6496077d Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 13:47:08 +0200 Subject: [PATCH 25/37] Move `SDL_Keycode` typdef to global python script to avoid duplicate definition --- SDL3-CS/SDL3/SDL_keycode.cs | 10 ---------- SDL3-CS/generate_bindings.py | 1 + 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 SDL3-CS/SDL3/SDL_keycode.cs diff --git a/SDL3-CS/SDL3/SDL_keycode.cs b/SDL3-CS/SDL3/SDL_keycode.cs deleted file mode 100644 index fef36b9..0000000 --- a/SDL3-CS/SDL3/SDL_keycode.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; - -namespace SDL -{ - [Typedef] - public enum SDL_Keycode : Int32; -} diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 0144ad9..a80402f 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -216,6 +216,7 @@ def typedef(t): "void*=IntPtr", "char=byte", "wchar_t *=IntPtr", # wchar_t has a platform-defined size + typedef("SDL_Keycode"), "--define-macro", "SDL_FUNCTION_POINTER_IS_VOID_POINTER", From 42b196611d3c2e2c718fdfd13a69279fe19463dd Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 14:05:52 +0200 Subject: [PATCH 26/37] Manually implement macro functions All of these get "Function like macro definition records are not supported: [...] Generated bindings may be incomplete." warnings when running ClangSharp. --- SDL3-CS/MacroAttribute.cs | 16 ++++ SDL3-CS/SDL3/SDL_atomic.cs | 14 ++++ SDL3-CS/SDL3/SDL_audio.cs | 27 +++++++ SDL3-CS/SDL3/SDL_error.cs | 21 +++++ SDL3-CS/SDL3/SDL_keycode.cs | 11 +++ SDL3-CS/SDL3/SDL_mouse.cs | 25 ++++++ SDL3-CS/SDL3/SDL_pen.cs | 21 +++++ SDL3-CS/SDL3/SDL_pixels.cs | 137 +++++++++++++++++++++++++++++++++ SDL3-CS/SDL3/SDL_quit.cs | 15 ++++ SDL3-CS/SDL3/SDL_stdinc.cs | 6 ++ SDL3-CS/SDL3/SDL_surface.cs | 11 +++ SDL3-CS/SDL3/SDL_system.iOS.cs | 21 +++++ SDL3-CS/SDL3/SDL_timer.cs | 21 +++++ SDL3-CS/SDL3/SDL_version.cs | 22 ++++++ SDL3-CS/SDL3/SDL_video.cs | 15 ++++ 15 files changed, 383 insertions(+) create mode 100644 SDL3-CS/MacroAttribute.cs create mode 100644 SDL3-CS/SDL3/SDL_atomic.cs create mode 100644 SDL3-CS/SDL3/SDL_error.cs create mode 100644 SDL3-CS/SDL3/SDL_keycode.cs create mode 100644 SDL3-CS/SDL3/SDL_pixels.cs create mode 100644 SDL3-CS/SDL3/SDL_quit.cs create mode 100644 SDL3-CS/SDL3/SDL_surface.cs create mode 100644 SDL3-CS/SDL3/SDL_system.iOS.cs create mode 100644 SDL3-CS/SDL3/SDL_version.cs diff --git a/SDL3-CS/MacroAttribute.cs b/SDL3-CS/MacroAttribute.cs new file mode 100644 index 0000000..ee07455 --- /dev/null +++ b/SDL3-CS/MacroAttribute.cs @@ -0,0 +1,16 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Diagnostics; + +namespace SDL +{ + /// + /// Denotes a manually implemented macro function. + /// Such functions should be excluded from ClangSharp generation to prevent warnings. + /// + [AttributeUsage(AttributeTargets.Method)] + [Conditional("NEVER")] + internal class MacroAttribute : Attribute; +} diff --git a/SDL3-CS/SDL3/SDL_atomic.cs b/SDL3-CS/SDL3/SDL_atomic.cs new file mode 100644 index 0000000..2feb9f5 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_atomic.cs @@ -0,0 +1,14 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace SDL +{ + public unsafe partial class SDL3 + { + [Macro] + public static int SDL_AtomicIncRef(SDL_AtomicInt* a) => SDL_AtomicAdd(a, 1); + + [Macro] + public static bool SDL_AtomicDecRef(SDL_AtomicInt* a) => SDL_AtomicAdd(a, -1) == 1; + } +} diff --git a/SDL3-CS/SDL3/SDL_audio.cs b/SDL3-CS/SDL3/SDL_audio.cs index 777cc84..df24453 100644 --- a/SDL3-CS/SDL3/SDL_audio.cs +++ b/SDL3-CS/SDL3/SDL_audio.cs @@ -31,5 +31,32 @@ public static partial class SDL3 [Constant] public static readonly SDL_AudioFormat SDL_AUDIO_F32 = BitConverter.IsLittleEndian ? SDL_AudioFormat.SDL_AUDIO_F32LE : SDL_AudioFormat.SDL_AUDIO_F32BE; + + [Macro] + public static int SDL_AUDIO_BITSIZE(SDL_AudioFormat x) => (UInt16)x & SDL_AUDIO_MASK_BITSIZE; + + [Macro] + public static int SDL_AUDIO_BYTESIZE(SDL_AudioFormat x) => SDL_AUDIO_BITSIZE(x) / 8; + + [Macro] + public static bool SDL_AUDIO_ISFLOAT(SDL_AudioFormat x) => ((UInt16)x & SDL_AUDIO_MASK_FLOAT) != 0; + + [Macro] + public static bool SDL_AUDIO_ISBIGENDIAN(SDL_AudioFormat x) => ((UInt16)x & SDL_AUDIO_MASK_BIG_ENDIAN) != 0; + + [Macro] + public static bool SDL_AUDIO_ISLITTLEENDIAN(SDL_AudioFormat x) => !SDL_AUDIO_ISBIGENDIAN(x); + + [Macro] + public static bool SDL_AUDIO_ISSIGNED(SDL_AudioFormat x) => ((UInt16)x & SDL_AUDIO_MASK_SIGNED) != 0; + + [Macro] + public static bool SDL_AUDIO_ISINT(SDL_AudioFormat x) => !SDL_AUDIO_ISFLOAT(x); + + [Macro] + public static bool SDL_AUDIO_ISUNSIGNED(SDL_AudioFormat x) => !SDL_AUDIO_ISSIGNED(x); + + [Macro] + public static int SDL_AUDIO_FRAMESIZE(SDL_AudioSpec x) => SDL_AUDIO_BYTESIZE((x).format) * (x).channels; } } diff --git a/SDL3-CS/SDL3/SDL_error.cs b/SDL3-CS/SDL3/SDL_error.cs new file mode 100644 index 0000000..e4f0e57 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_error.cs @@ -0,0 +1,21 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace SDL +{ + public static partial class SDL3 + { + [Macro] + public static int SDL_OutOfMemory() => SDL_Error(SDL_errorcode.SDL_ENOMEM); + + [Macro] + public static int SDL_Unsupported() => SDL_Error(SDL_errorcode.SDL_UNSUPPORTED); + + [Macro] + public static unsafe int SDL_InvalidParamError([NativeTypeName("const char *")] byte* param) + { + fixed (byte* fmt = "Parameter '%s' is invalid"u8) + return SDL_SetError(fmt, __arglist(param)); + } + } +} diff --git a/SDL3-CS/SDL3/SDL_keycode.cs b/SDL3-CS/SDL3/SDL_keycode.cs new file mode 100644 index 0000000..f6f8791 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_keycode.cs @@ -0,0 +1,11 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace SDL +{ + public static partial class SDL3 + { + [Macro] + public static SDL_Keycode SDL_SCANCODE_TO_KEYCODE(SDL_Scancode scancode) => (SDL_Keycode)((int)scancode | SDLK_SCANCODE_MASK); + } +} diff --git a/SDL3-CS/SDL3/SDL_mouse.cs b/SDL3-CS/SDL3/SDL_mouse.cs index 0af442b..85d61b9 100644 --- a/SDL3-CS/SDL3/SDL_mouse.cs +++ b/SDL3-CS/SDL3/SDL_mouse.cs @@ -7,4 +7,29 @@ namespace SDL { [Typedef] public enum SDL_MouseID : UInt32; + + public enum SDLButton + { + SDL_BUTTON_LEFT = SDL3.SDL_BUTTON_LEFT, + SDL_BUTTON_MIDDLE = SDL3.SDL_BUTTON_MIDDLE, + SDL_BUTTON_RIGHT = SDL3.SDL_BUTTON_RIGHT, + SDL_BUTTON_X1 = SDL3.SDL_BUTTON_X1, + SDL_BUTTON_X2 = SDL3.SDL_BUTTON_X2, + } + + [Flags] + public enum SDLButtonMask + { + SDL_BUTTON_LMASK = SDL3.SDL_BUTTON_LMASK, + SDL_BUTTON_MMASK = SDL3.SDL_BUTTON_MMASK, + SDL_BUTTON_RMASK = SDL3.SDL_BUTTON_RMASK, + SDL_BUTTON_X1MASK = SDL3.SDL_BUTTON_X1MASK, + SDL_BUTTON_X2MASK = SDL3.SDL_BUTTON_X2MASK, + } + + public static partial class SDL3 + { + [Macro] + public static SDLButtonMask SDL_BUTTON(SDLButton button) => (SDLButtonMask)(1 << ((int)button - 1)); + } } diff --git a/SDL3-CS/SDL3/SDL_pen.cs b/SDL3-CS/SDL3/SDL_pen.cs index ec3da99..58436e8 100644 --- a/SDL3-CS/SDL3/SDL_pen.cs +++ b/SDL3-CS/SDL3/SDL_pen.cs @@ -8,9 +8,30 @@ namespace SDL [Typedef] public enum SDL_PenID : UInt32; + [Flags] + public enum SDL_PEN_CAPABILITIES : uint + { + SDL_PEN_DOWN_MASK = SDL3.SDL_PEN_DOWN_MASK, + SDL_PEN_INK_MASK = SDL3.SDL_PEN_INK_MASK, + SDL_PEN_ERASER_MASK = SDL3.SDL_PEN_ERASER_MASK, + SDL_PEN_AXIS_PRESSURE_MASK = SDL3.SDL_PEN_AXIS_PRESSURE_MASK, + SDL_PEN_AXIS_XTILT_MASK = SDL3.SDL_PEN_AXIS_XTILT_MASK, + SDL_PEN_AXIS_YTILT_MASK = SDL3.SDL_PEN_AXIS_YTILT_MASK, + SDL_PEN_AXIS_DISTANCE_MASK = SDL3.SDL_PEN_AXIS_DISTANCE_MASK, + SDL_PEN_AXIS_ROTATION_MASK = SDL3.SDL_PEN_AXIS_ROTATION_MASK, + SDL_PEN_AXIS_SLIDER_MASK = SDL3.SDL_PEN_AXIS_SLIDER_MASK, + SDL_PEN_AXIS_BIDIRECTIONAL_MASKS = SDL3.SDL_PEN_AXIS_BIDIRECTIONAL_MASKS, + } + public static partial class SDL3 { [Constant] public const SDL_MouseID SDL_PEN_MOUSEID = unchecked((SDL_MouseID)(-2)); + + [Macro] + public static SDL_PEN_CAPABILITIES SDL_PEN_CAPABILITY(int capbit) => (SDL_PEN_CAPABILITIES)(1ul << (capbit)); + + [Macro] + public static SDL_PEN_CAPABILITIES SDL_PEN_AXIS_CAPABILITY(SDL_PenAxis axis) => SDL_PEN_CAPABILITY((int)axis + SDL_PEN_FLAG_AXIS_BIT_OFFSET); } } diff --git a/SDL3-CS/SDL3/SDL_pixels.cs b/SDL3-CS/SDL3/SDL_pixels.cs new file mode 100644 index 0000000..f23cfb2 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_pixels.cs @@ -0,0 +1,137 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + using static SDL_PixelFormatEnum; + using static SDL_PixelType; + using static SDL_PackedOrder; + using static SDL_PackedLayout; + using static SDL_MatrixCoefficients; + using static SDL_ColorRange; + + public static partial class SDL3 + { + [Macro] + public static SDL_PixelFormatEnum SDL_DEFINE_PIXELFOURCC(byte A, byte B, byte C, byte D) => (SDL_PixelFormatEnum)SDL_FOURCC(A, B, C, D); + + [Macro] + public static SDL_PixelFormatEnum SDL_DEFINE_PIXELFORMAT(int type, int order, int layout, int bits, int bytes) + => (SDL_PixelFormatEnum)((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | + ((bits) << 8) | ((bytes) << 0)); + + [Macro] + public static int SDL_PIXELFLAG(SDL_PixelFormatEnum X) => ((int)X >> 28) & 0x0F; + + [Macro] + public static SDL_PixelType SDL_PIXELTYPE(SDL_PixelFormatEnum X) => (SDL_PixelType)(((int)X >> 24) & 0x0F); + + [Macro] + public static SDL_PackedOrder SDL_PIXELORDER(SDL_PixelFormatEnum X) => (SDL_PackedOrder)(((int)X >> 20) & 0x0F); + + [Macro] + public static SDL_PackedLayout SDL_PIXELLAYOUT(SDL_PixelFormatEnum X) => (SDL_PackedLayout)(((int)X >> 16) & 0x0F); + + [Macro] + public static int SDL_BITSPERPIXEL(SDL_PixelFormatEnum X) => ((int)X >> 8) & 0xFF; + + [Macro] + public static int SDL_BYTESPERPIXEL(SDL_PixelFormatEnum X) => + (SDL_ISPIXELFORMAT_FOURCC(X) + ? ((((X) == SDL_PIXELFORMAT_YUY2) || + ((X) == SDL_PIXELFORMAT_UYVY) || + ((X) == SDL_PIXELFORMAT_YVYU) || + ((X) == SDL_PIXELFORMAT_P010)) + ? 2 + : 1) + : ((((int)X) >> 0) & 0xFF)); + + [Macro] + public static bool SDL_ISPIXELFORMAT_INDEXED(SDL_PixelFormatEnum format) => + (!SDL_ISPIXELFORMAT_FOURCC(format) && + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))); + + [Macro] + public static bool SDL_ISPIXELFORMAT_PACKED(SDL_PixelFormatEnum format) => + (!SDL_ISPIXELFORMAT_FOURCC(format) && + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32))); + + [Macro] + public static bool SDL_ISPIXELFORMAT_ARRAY(SDL_PixelFormatEnum format) => + (!SDL_ISPIXELFORMAT_FOURCC(format) && + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32))); + + [Macro] + public static bool SDL_ISPIXELFORMAT_ALPHA(SDL_PixelFormatEnum format) => + ((SDL_ISPIXELFORMAT_PACKED(format) && + ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))); + + [Macro] + public static bool SDL_ISPIXELFORMAT_10BIT(SDL_PixelFormatEnum format) => + (!SDL_ISPIXELFORMAT_FOURCC(format) && + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32) && + (SDL_PIXELLAYOUT(format) == SDL_PACKEDLAYOUT_2101010))); + + [Macro] + public static bool SDL_ISPIXELFORMAT_FLOAT(SDL_PixelFormatEnum format) => + (!SDL_ISPIXELFORMAT_FOURCC(format) && + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32))); + + [Macro] + public static bool SDL_ISPIXELFORMAT_FOURCC(SDL_PixelFormatEnum format) => + ((format != 0) && (SDL_PIXELFLAG(format) != 1)); + + [Macro] + public static SDL_Colorspace SDL_DEFINE_COLORSPACE(UInt32 type, UInt32 range, UInt32 primaries, UInt32 transfer, UInt32 matrix, UInt32 chroma) + => (SDL_Colorspace)(((type) << 28) | ((range) << 24) | ((chroma) << 20) | + ((primaries) << 10) | ((transfer) << 5) | ((matrix) << 0)); + + [Macro] + public static SDL_ColorType SDL_COLORSPACETYPE(SDL_Colorspace X) => (SDL_ColorType)(((int)X >> 28) & 0x0F); + + [Macro] + public static SDL_ColorRange SDL_COLORSPACERANGE(SDL_Colorspace X) => (SDL_ColorRange)(((int)X >> 24) & 0x0F); + + [Macro] + public static SDL_ChromaLocation SDL_COLORSPACECHROMA(SDL_Colorspace X) => (SDL_ChromaLocation)(((int)X >> 20) & 0x0F); + + [Macro] + public static SDL_ColorPrimaries SDL_COLORSPACEPRIMARIES(SDL_Colorspace X) => (SDL_ColorPrimaries)(((int)X >> 10) & 0x1F); + + [Macro] + public static SDL_TransferCharacteristics SDL_COLORSPACETRANSFER(SDL_Colorspace X) => (SDL_TransferCharacteristics)(((int)X >> 5) & 0x1F); + + [Macro] + public static SDL_MatrixCoefficients SDL_COLORSPACEMATRIX(SDL_Colorspace X) => (SDL_MatrixCoefficients)((int)X & 0x1F); + + [Macro] + public static bool SDL_ISCOLORSPACE_MATRIX_BT601(SDL_Colorspace X) => (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT601 || SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT470BG); + + [Macro] + public static bool SDL_ISCOLORSPACE_MATRIX_BT709(SDL_Colorspace X) => (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT709); + + [Macro] + public static bool SDL_ISCOLORSPACE_MATRIX_BT2020_NCL(SDL_Colorspace X) => (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT2020_NCL); + + [Macro] + public static bool SDL_ISCOLORSPACE_LIMITED_RANGE(SDL_Colorspace X) => (SDL_COLORSPACERANGE(X) != SDL_COLOR_RANGE_FULL); + + [Macro] + public static bool SDL_ISCOLORSPACE_FULL_RANGE(SDL_Colorspace X) => (SDL_COLORSPACERANGE(X) == SDL_COLOR_RANGE_FULL); + } +} diff --git a/SDL3-CS/SDL3/SDL_quit.cs b/SDL3-CS/SDL3/SDL_quit.cs new file mode 100644 index 0000000..71dedc3 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_quit.cs @@ -0,0 +1,15 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace SDL +{ + public partial class SDL3 + { + [Macro] + public static unsafe bool SDL_QuitRequested() + { + SDL_PumpEvents(); + return SDL_PeepEvents(null, 0, SDL_eventaction.SDL_PEEKEVENT, (uint)SDL_EventType.SDL_EVENT_QUIT, (uint)SDL_EventType.SDL_EVENT_QUIT) > 0; + } + } +} diff --git a/SDL3-CS/SDL3/SDL_stdinc.cs b/SDL3-CS/SDL3/SDL_stdinc.cs index d64e1b7..67084b2 100644 --- a/SDL3-CS/SDL3/SDL_stdinc.cs +++ b/SDL3-CS/SDL3/SDL_stdinc.cs @@ -14,4 +14,10 @@ public enum SDL_bool [Typedef] public enum SDL_Time : Int64; + + public partial class SDL3 + { + [Macro] + public static uint SDL_FOURCC(byte A, byte B, byte C, byte D) => (uint)((A << 0) | (B << 8) | (C << 16) | (D << 24)); + } } diff --git a/SDL3-CS/SDL3/SDL_surface.cs b/SDL3-CS/SDL3/SDL_surface.cs new file mode 100644 index 0000000..65e990a --- /dev/null +++ b/SDL3-CS/SDL3/SDL_surface.cs @@ -0,0 +1,11 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace SDL +{ + public static partial class SDL3 + { + [Macro] + public static unsafe bool SDL_MUSTLOCK(SDL_Surface* S) => (((S)->flags & SDL_RLEACCEL) != 0); + } +} diff --git a/SDL3-CS/SDL3/SDL_system.iOS.cs b/SDL3-CS/SDL3/SDL_system.iOS.cs new file mode 100644 index 0000000..c40537b --- /dev/null +++ b/SDL3-CS/SDL3/SDL_system.iOS.cs @@ -0,0 +1,21 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Runtime.Versioning; + +namespace SDL +{ + public static partial class SDL3 + { + [SupportedOSPlatform("iOS")] + [Macro] + public static unsafe int SDL_iOSSetAnimationCallback(SDL_Window* window, int interval, delegate* unmanaged[Cdecl] callback, IntPtr callbackParam) + => SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam); + + [SupportedOSPlatform("iOS")] + [Macro] + public static void SDL_iOSSetEventPump(SDL_bool enabled) + => SDL_iPhoneSetEventPump(enabled); + } +} diff --git a/SDL3-CS/SDL3/SDL_timer.cs b/SDL3-CS/SDL3/SDL_timer.cs index bee2901..4ec7dff 100644 --- a/SDL3-CS/SDL3/SDL_timer.cs +++ b/SDL3-CS/SDL3/SDL_timer.cs @@ -7,4 +7,25 @@ namespace SDL { [Typedef] public enum SDL_TimerID : UInt32; + + public static partial class SDL3 + { + [Macro] + public static UInt64 SDL_SECONDS_TO_NS(UInt64 S) => (((UInt64)(S)) * SDL_NS_PER_SECOND); + + [Macro] + public static UInt64 SDL_NS_TO_SECONDS(UInt64 NS) => ((NS) / SDL_NS_PER_SECOND); + + [Macro] + public static UInt64 SDL_MS_TO_NS(UInt64 MS) => (((UInt64)(MS)) * SDL_NS_PER_MS); + + [Macro] + public static UInt64 SDL_NS_TO_MS(UInt64 NS) => ((NS) / SDL_NS_PER_MS); + + [Macro] + public static UInt64 SDL_US_TO_NS(UInt64 US) => (((UInt64)(US)) * SDL_NS_PER_US); + + [Macro] + public static UInt64 SDL_NS_TO_US(UInt64 NS) => ((NS) / SDL_NS_PER_US); + } } diff --git a/SDL3-CS/SDL3/SDL_version.cs b/SDL3-CS/SDL3/SDL_version.cs new file mode 100644 index 0000000..69bd75c --- /dev/null +++ b/SDL3-CS/SDL3/SDL_version.cs @@ -0,0 +1,22 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace SDL +{ + public static partial class SDL3 + { + [Macro] + public static void SDL_VERSION(ref SDL_Version version) + { + version.major = SDL_MAJOR_VERSION; + version.minor = SDL_MINOR_VERSION; + version.patch = SDL_PATCHLEVEL; + } + + [Macro] + public static int SDL_VERSIONNUM(int X, int Y, int Z) => ((X) << 24 | (Y) << 8 | (Z) << 0); + + [Macro] + public static bool SDL_VERSION_ATLEAST(int X, int Y, int Z) => SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z); + } +} diff --git a/SDL3-CS/SDL3/SDL_video.cs b/SDL3-CS/SDL3/SDL_video.cs index 391e501..61d8d63 100644 --- a/SDL3-CS/SDL3/SDL_video.cs +++ b/SDL3-CS/SDL3/SDL_video.cs @@ -39,4 +39,19 @@ public enum SDL_WindowFlags : uint SDL_WINDOW_TRANSPARENT = SDL3.SDL_WINDOW_TRANSPARENT, SDL_WINDOW_NOT_FOCUSABLE = SDL3.SDL_WINDOW_NOT_FOCUSABLE, } + + public static partial class SDL3 + { + [Macro] + public static int SDL_WINDOWPOS_UNDEFINED_DISPLAY(int X) => (int)(SDL_WINDOWPOS_UNDEFINED_MASK | (X)); + + [Macro] + public static bool SDL_WINDOWPOS_ISUNDEFINED(int X) => (((X) & 0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK); + + [Macro] + public static int SDL_WINDOWPOS_CENTERED_DISPLAY(int X) => (int)(SDL_WINDOWPOS_CENTERED_MASK | (X)); + + [Macro] + public static bool SDL_WINDOWPOS_ISCENTERED(int X) => (((X) & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK); + } } From 702dc06a0318510c8a0365f88beb1bfe4d5b020b Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 14:07:38 +0200 Subject: [PATCH 27/37] Add `void *` overload for `SDL_free()` Useful as any pointer type can implicitly covert to void *. --- SDL3-CS/SDL3/SDL_stdinc.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SDL3-CS/SDL3/SDL_stdinc.cs b/SDL3-CS/SDL3/SDL_stdinc.cs index 67084b2..ca0fe5d 100644 --- a/SDL3-CS/SDL3/SDL_stdinc.cs +++ b/SDL3-CS/SDL3/SDL_stdinc.cs @@ -19,5 +19,7 @@ public partial class SDL3 { [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 unsafe void SDL_free(void* mem) => SDL_free((IntPtr)mem); } } From 711e004ecd40dabeb087ebab46a3e491f44c266c Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 14:08:42 +0200 Subject: [PATCH 28/37] Add `PtrToStringUTF8()` for `byte *` --- SDL3-CS/SDL3.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 SDL3-CS/SDL3.cs diff --git a/SDL3-CS/SDL3.cs b/SDL3-CS/SDL3.cs new file mode 100644 index 0000000..5b46e55 --- /dev/null +++ b/SDL3-CS/SDL3.cs @@ -0,0 +1,29 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + /// + /// Allocates a managed string and copies all characters up to the first null character from an unmanaged UTF-8 string into it. + /// + /// The address of the first character of the unmanaged string. + /// Whether to free the pointer after copying the string. + /// + /// A managed string that holds a copy of the unmanaged string if the value of the parameter is not null; otherwise, this method returns null. + /// + public static string? PtrToStringUTF8(byte* ptr, bool free = false) + { + string? s = Marshal.PtrToStringUTF8((IntPtr)ptr); + + if (free) + SDL_free(ptr); + + return s; + } + } +} From 9a5d2e4dbc53ba4f79f417f3b62293bdaebffd35 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 14:12:44 +0200 Subject: [PATCH 29/37] Add C# type-friendly properties/getters to some structs --- SDL3-CS/SDL3/SDL_events.cs | 37 ++++++++++++++++++++++++++++++++++++ SDL3-CS/SDL3/SDL_keyboard.cs | 5 +++++ 2 files changed, 42 insertions(+) create mode 100644 SDL3-CS/SDL3/SDL_events.cs diff --git a/SDL3-CS/SDL3/SDL_events.cs b/SDL3-CS/SDL3/SDL_events.cs new file mode 100644 index 0000000..fc8a7cd --- /dev/null +++ b/SDL3-CS/SDL3/SDL_events.cs @@ -0,0 +1,37 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace SDL +{ + public unsafe partial struct SDL_TextInputEvent + { + public string? GetText() => SDL3.PtrToStringUTF8(text); + } + + public unsafe partial struct SDL_TextEditingEvent + { + public string? GetText() => SDL3.PtrToStringUTF8(text); + } + + public unsafe partial struct SDL_DropEvent + { + public string? GetSource() => SDL3.PtrToStringUTF8(source); + + public string? GetData() => SDL3.PtrToStringUTF8(data); + } + + public partial struct SDL_MouseButtonEvent + { + public SDLButton Button => (SDLButton)button; + } + + public partial struct SDL_GamepadAxisEvent + { + public SDL_GamepadAxis Axis => (SDL_GamepadAxis)axis; + } + + public partial struct SDL_GamepadButtonEvent + { + public SDL_GamepadButton Button => (SDL_GamepadButton)button; + } +} diff --git a/SDL3-CS/SDL3/SDL_keyboard.cs b/SDL3-CS/SDL3/SDL_keyboard.cs index 1082027..885fbc9 100644 --- a/SDL3-CS/SDL3/SDL_keyboard.cs +++ b/SDL3-CS/SDL3/SDL_keyboard.cs @@ -7,4 +7,9 @@ namespace SDL { [Typedef] public enum SDL_KeyboardID : UInt32; + + public partial struct SDL_Keysym + { + public SDL_Keymod Mod => (SDL_Keymod)mod; + } } From 75db9b16c1bba5a97cd52f747a35a11cf73a5fa7 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 14:20:08 +0200 Subject: [PATCH 30/37] Add memory safe IDisposable overloads to array-returning functions This could be done with a source generator, but this is simpler. --- SDL3-CS/SDL3/SDL_audio.cs | 14 ++++++++ SDL3-CS/SDL3/SDL_camera.cs | 17 ++++++++++ SDL3-CS/SDL3/SDL_gamepad.cs | 35 ++++++++++++++++++++ SDL3-CS/SDL3/SDL_haptic.cs | 10 ++++++ SDL3-CS/SDL3/SDL_joystick.cs | 10 ++++++ SDL3-CS/SDL3/SDL_keyboard.cs | 10 ++++++ SDL3-CS/SDL3/SDL_mouse.cs | 7 ++++ SDL3-CS/SDL3/SDL_pen.cs | 7 ++++ SDL3-CS/SDL3/SDL_sensor.cs | 10 ++++++ SDL3-CS/SDL3/SDL_touch.cs | 7 ++++ SDL3-CS/SDL3/SDL_video.cs | 14 ++++++++ SDL3-CS/SDLArray.cs | 63 ++++++++++++++++++++++++++++++++++++ SDL3-CS/SDLPointerArray.cs | 44 +++++++++++++++++++++++++ 13 files changed, 248 insertions(+) create mode 100644 SDL3-CS/SDL3/SDL_gamepad.cs create mode 100644 SDL3-CS/SDLArray.cs create mode 100644 SDL3-CS/SDLPointerArray.cs diff --git a/SDL3-CS/SDL3/SDL_audio.cs b/SDL3-CS/SDL3/SDL_audio.cs index df24453..1a0fe41 100644 --- a/SDL3-CS/SDL3/SDL_audio.cs +++ b/SDL3-CS/SDL3/SDL_audio.cs @@ -58,5 +58,19 @@ public static partial class SDL3 [Macro] public static int SDL_AUDIO_FRAMESIZE(SDL_AudioSpec x) => SDL_AUDIO_BYTESIZE((x).format) * (x).channels; + + public static unsafe SDLArray? SDL_GetAudioOutputDevices() + { + int count; + var array = SDL_GetAudioOutputDevices(&count); + return SDLArray.Create(array, count); + } + + public static unsafe SDLArray? SDL_GetAudioCaptureDevices() + { + int count; + var array = SDL_GetAudioCaptureDevices(&count); + return SDLArray.Create(array, count); + } } } diff --git a/SDL3-CS/SDL3/SDL_camera.cs b/SDL3-CS/SDL3/SDL_camera.cs index f6f995a..b6a664e 100644 --- a/SDL3-CS/SDL3/SDL_camera.cs +++ b/SDL3-CS/SDL3/SDL_camera.cs @@ -7,4 +7,21 @@ namespace SDL { [Typedef] public enum SDL_CameraDeviceID : UInt32; + + public static partial class SDL3 + { + public static unsafe SDLArray? SDL_GetCameraDevices() + { + int count; + var array = SDL_GetCameraDevices(&count); + return SDLArray.Create(array, count); + } + + public static unsafe SDLArray? SDL_GetCameraDeviceSupportedFormats(SDL_CameraDeviceID devid) + { + int count; + var array = SDL_GetCameraDeviceSupportedFormats(devid, &count); + return SDLArray.Create(array, count); + } + } } diff --git a/SDL3-CS/SDL3/SDL_gamepad.cs b/SDL3-CS/SDL3/SDL_gamepad.cs new file mode 100644 index 0000000..f1c0a85 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_gamepad.cs @@ -0,0 +1,35 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public static partial class SDL3 + { + /// + /// An array of that can be passed to . + /// + public static unsafe SDLArray? SDL_GetGamepadMappings() + { + int count; + IntPtr* array = (IntPtr*)SDL_GetGamepadMappings(&count); + return SDLArray.Create(array, count); + } + + public static unsafe SDLArray? SDL_GetGamepads() + { + int count; + var array = SDL_GetGamepads(&count); + return SDLArray.Create(array, count); + } + + public static unsafe SDLPointerArray? SDL_GetGamepadBindings(SDL_Gamepad* gamepad) + { + int count; + var array = SDL_GetGamepadBindings(gamepad, &count); + return SDLArray.Create(array, count); + } + } +} diff --git a/SDL3-CS/SDL3/SDL_haptic.cs b/SDL3-CS/SDL3/SDL_haptic.cs index 0d82795..eede833 100644 --- a/SDL3-CS/SDL3/SDL_haptic.cs +++ b/SDL3-CS/SDL3/SDL_haptic.cs @@ -7,4 +7,14 @@ namespace SDL { [Typedef] public enum SDL_HapticID : UInt32; + + public static partial class SDL3 + { + public static unsafe SDLArray? SDL_GetHaptics() + { + int count; + var array = SDL_GetHaptics(&count); + return SDLArray.Create(array, count); + } + } } diff --git a/SDL3-CS/SDL3/SDL_joystick.cs b/SDL3-CS/SDL3/SDL_joystick.cs index 3e881d0..5dff357 100644 --- a/SDL3-CS/SDL3/SDL_joystick.cs +++ b/SDL3-CS/SDL3/SDL_joystick.cs @@ -7,4 +7,14 @@ namespace SDL { [Typedef] public enum SDL_JoystickID : UInt32; + + public static partial class SDL3 + { + public static unsafe SDLArray? SDL_GetJoysticks() + { + int count; + var array = SDL_GetJoysticks(&count); + return SDLArray.Create(array, count); + } + } } diff --git a/SDL3-CS/SDL3/SDL_keyboard.cs b/SDL3-CS/SDL3/SDL_keyboard.cs index 885fbc9..b5e32b3 100644 --- a/SDL3-CS/SDL3/SDL_keyboard.cs +++ b/SDL3-CS/SDL3/SDL_keyboard.cs @@ -12,4 +12,14 @@ public partial struct SDL_Keysym { public SDL_Keymod Mod => (SDL_Keymod)mod; } + + public static partial class SDL3 + { + public static unsafe SDLArray? SDL_GetKeyboards() + { + int count; + var array = SDL_GetKeyboards(&count); + return SDLArray.Create(array, count); + } + } } diff --git a/SDL3-CS/SDL3/SDL_mouse.cs b/SDL3-CS/SDL3/SDL_mouse.cs index 85d61b9..62be8af 100644 --- a/SDL3-CS/SDL3/SDL_mouse.cs +++ b/SDL3-CS/SDL3/SDL_mouse.cs @@ -31,5 +31,12 @@ public static partial class SDL3 { [Macro] public static SDLButtonMask SDL_BUTTON(SDLButton button) => (SDLButtonMask)(1 << ((int)button - 1)); + + public static unsafe SDLArray? SDL_GetMice() + { + int count; + var array = SDL_GetMice(&count); + return SDLArray.Create(array, count); + } } } diff --git a/SDL3-CS/SDL3/SDL_pen.cs b/SDL3-CS/SDL3/SDL_pen.cs index 58436e8..06f064b 100644 --- a/SDL3-CS/SDL3/SDL_pen.cs +++ b/SDL3-CS/SDL3/SDL_pen.cs @@ -33,5 +33,12 @@ public static partial class SDL3 [Macro] public static SDL_PEN_CAPABILITIES SDL_PEN_AXIS_CAPABILITY(SDL_PenAxis axis) => SDL_PEN_CAPABILITY((int)axis + SDL_PEN_FLAG_AXIS_BIT_OFFSET); + + public static unsafe SDLArray? SDL_GetPens() + { + int count; + var array = SDL_GetPens(&count); + return SDLArray.Create(array, count); + } } } diff --git a/SDL3-CS/SDL3/SDL_sensor.cs b/SDL3-CS/SDL3/SDL_sensor.cs index 085a52b..2361554 100644 --- a/SDL3-CS/SDL3/SDL_sensor.cs +++ b/SDL3-CS/SDL3/SDL_sensor.cs @@ -7,4 +7,14 @@ namespace SDL { [Typedef] public enum SDL_SensorID : UInt32; + + public static partial class SDL3 + { + public static unsafe SDLArray? SDL_GetSensors() + { + int count; + var array = SDL_GetSensors(&count); + return SDLArray.Create(array, count); + } + } } diff --git a/SDL3-CS/SDL3/SDL_touch.cs b/SDL3-CS/SDL3/SDL_touch.cs index b07724f..772ac51 100644 --- a/SDL3-CS/SDL3/SDL_touch.cs +++ b/SDL3-CS/SDL3/SDL_touch.cs @@ -18,5 +18,12 @@ public static partial class SDL3 [Constant] public const SDL_TouchID SDL_MOUSE_TOUCHID = unchecked((SDL_TouchID)(-1)); + + public static unsafe SDLArray? SDL_GetTouchDevices() + { + int count; + var array = SDL_GetTouchDevices(&count); + return SDLArray.Create(array, count); + } } } diff --git a/SDL3-CS/SDL3/SDL_video.cs b/SDL3-CS/SDL3/SDL_video.cs index 61d8d63..83c02fe 100644 --- a/SDL3-CS/SDL3/SDL_video.cs +++ b/SDL3-CS/SDL3/SDL_video.cs @@ -53,5 +53,19 @@ public static partial class SDL3 [Macro] public static bool SDL_WINDOWPOS_ISCENTERED(int X) => (((X) & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK); + + public static unsafe SDLArray? SDL_GetDisplays() + { + int count; + var array = SDL_GetDisplays(&count); + return SDLArray.Create(array, count); + } + + public static unsafe SDLPointerArray? SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID) + { + int count; + var array = SDL_GetFullscreenDisplayModes(displayID, &count); + return SDLArray.Create(array, count); + } } } diff --git a/SDL3-CS/SDLArray.cs b/SDL3-CS/SDLArray.cs new file mode 100644 index 0000000..65858f5 --- /dev/null +++ b/SDL3-CS/SDLArray.cs @@ -0,0 +1,63 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL +{ + public sealed unsafe class SDLArray : IDisposable + where T : unmanaged + { + private readonly T* array; + public readonly int Count; + private bool isDisposed; + + internal SDLArray(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); + return array[index]; + } + } + + public void Dispose() + { + if (isDisposed) + return; + + isDisposed = true; + SDL3.SDL_free(array); + } + } + + internal static unsafe class SDLArray + { + internal static SDLArray? Create(T* array, int count) + where T : unmanaged + { + if (array == null) + return null; + + return new SDLArray(array, count); + } + + internal static SDLPointerArray? Create(T** array, int count) + where T : unmanaged + { + if (array == null) + return null; + + return new SDLPointerArray(array, count); + } + + } +} diff --git a/SDL3-CS/SDLPointerArray.cs b/SDL3-CS/SDLPointerArray.cs new file mode 100644 index 0000000..806266b --- /dev/null +++ b/SDL3-CS/SDLPointerArray.cs @@ -0,0 +1,44 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Diagnostics; + +namespace SDL +{ + // T* can't be used as a type parameter, so this has to be a separate class + public sealed unsafe class SDLPointerArray : IDisposable + where T : unmanaged + { + private readonly T** array; + public readonly int Count; + private bool isDisposed; + + internal SDLPointerArray(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); + } + } +} From c5e3181962023079a634367e575b98420fbf657d Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 14:24:33 +0200 Subject: [PATCH 31/37] Add source generator for `ReadOnlySpan` overloads of C `const char *` functions --- SDL3-CS.SourceGeneration/Changes.cs | 33 ++++ .../FriendlyOverloadGenerator.cs | 173 ++++++++++++++++++ SDL3-CS.SourceGeneration/GeneratedMethod.cs | 19 ++ SDL3-CS.SourceGeneration/Helper.cs | 77 ++++++++ .../Properties/launchSettings.json | 9 + .../SDL3-CS.SourceGeneration.csproj | 25 +++ .../UnfriendlyMethodFinder.cs | 59 ++++++ SDL3-CS.sln | 6 + SDL3-CS/SDL3-CS.csproj | 4 + 9 files changed, 405 insertions(+) create mode 100644 SDL3-CS.SourceGeneration/Changes.cs create mode 100644 SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs create mode 100644 SDL3-CS.SourceGeneration/GeneratedMethod.cs create mode 100644 SDL3-CS.SourceGeneration/Helper.cs create mode 100644 SDL3-CS.SourceGeneration/Properties/launchSettings.json create mode 100644 SDL3-CS.SourceGeneration/SDL3-CS.SourceGeneration.csproj create mode 100644 SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs diff --git a/SDL3-CS.SourceGeneration/Changes.cs b/SDL3-CS.SourceGeneration/Changes.cs new file mode 100644 index 0000000..02a70eb --- /dev/null +++ b/SDL3-CS.SourceGeneration/Changes.cs @@ -0,0 +1,33 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace SDL3.SourceGeneration +{ + [Flags] + public enum Changes + { + None, + + /// + /// Change const char* function parameters to ReadOnlySpan<byte>. + /// + ChangeParamsToReadOnlySpan = 1 << 0, + + /// + /// Change char * or const char * return type to . + /// + ChangeReturnTypeToString = 1 << 1, + + /// + /// Call SDL_free on the returned pointer. + /// + FreeReturnedPointer = 1 << 2, + + /// + /// Remove from method name. + /// + TrimUnsafeFromName = 1 << 3, + } +} diff --git a/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs b/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs new file mode 100644 index 0000000..387c1df --- /dev/null +++ b/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs @@ -0,0 +1,173 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace SDL3.SourceGeneration +{ + [Generator] + public class FriendlyOverloadGenerator : ISourceGenerator + { + public void Initialize(GeneratorInitializationContext context) + { + context.RegisterForSyntaxNotifications(() => new UnfriendlyMethodFinder()); + } + + private const string file_header = @"// +#nullable enable + +using System; + +"; + + public void Execute(GeneratorExecutionContext context) + { + var finder = (UnfriendlyMethodFinder)context.SyntaxReceiver!; + foreach (var kvp in finder.Methods) + { + string filename = kvp.Key; + var foundMethods = kvp.Value; + + var result = new StringBuilder(); + result.Append(file_header); + result.Append( + SyntaxFactory.NamespaceDeclaration( + SyntaxFactory.IdentifierName("SDL")) + .WithMembers( + SyntaxFactory.SingletonList( + SyntaxFactory.ClassDeclaration("SDL3") + .WithModifiers( + SyntaxFactory.TokenList( + SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), + SyntaxFactory.Token(SyntaxKind.PartialKeyword))) + .WithMembers(SyntaxFactory.List(foundMethods.Select(makeFriendlyMethod))))) + .NormalizeWhitespace()); + + context.AddSource(filename, result.ToString()); + } + } + + private static MemberDeclarationSyntax makeFriendlyMethod(GeneratedMethod gm) + { + var returnType = gm.RequiredChanges.HasFlag(Changes.ChangeReturnTypeToString) + ? SyntaxFactory.ParseTypeName("string?") + : gm.NativeMethod.ReturnType; + + var identifier = gm.RequiredChanges.HasFlag(Changes.TrimUnsafeFromName) + ? SyntaxFactory.Identifier(gm.NativeMethod.Identifier.ValueText.Replace(Helper.UnsafePrefix, string.Empty)) + : gm.NativeMethod.Identifier; + + return SyntaxFactory.MethodDeclaration(returnType, identifier) + .WithModifiers( + SyntaxFactory.TokenList( + SyntaxFactory.Token(SyntaxKind.PublicKeyword), + SyntaxFactory.Token(SyntaxKind.StaticKeyword))) + .WithParameterList( + SyntaxFactory.ParameterList( + SyntaxFactory.SeparatedList(transformParams(gm)))) + .WithBody( + SyntaxFactory.Block( + makeMethodBody(gm))); + } + + private static IEnumerable transformParams(GeneratedMethod gm) + { + foreach (var param in gm.NativeMethod.ParameterList.Parameters) + { + if (param.IsTypeConstCharPtr()) + { + Debug.Assert(gm.RequiredChanges.HasFlag(Changes.ChangeParamsToReadOnlySpan)); + yield return param.WithType(SyntaxFactory.ParseTypeName("ReadOnlySpan")) + .WithAttributeLists(SyntaxFactory.List()); + } + else + { + yield return param.WithAttributeLists(SyntaxFactory.List()); // remove [NativeTypeName] + } + } + } + + private const string pointer_suffix = "Ptr"; + + private static StatementSyntax makeMethodBody(GeneratedMethod gm) + { + var expr = makeReturn(gm); + + foreach (var param in gm.NativeMethod.ParameterList.Parameters.Where(p => p.IsTypeConstCharPtr()).Reverse()) + { + Debug.Assert(gm.RequiredChanges.HasFlag(Changes.ChangeParamsToReadOnlySpan)); + + expr = SyntaxFactory.FixedStatement( + SyntaxFactory.VariableDeclaration( + SyntaxFactory.ParseTypeName("byte*"), + SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.VariableDeclarator( + param.Identifier.ValueText + pointer_suffix) + .WithInitializer( + SyntaxFactory.EqualsValueClause( + SyntaxFactory.IdentifierName(param.Identifier))))), + expr); + } + + return expr; + } + + private static StatementSyntax makeReturn(GeneratedMethod gm) + { + ExpressionSyntax expr; + + if (gm.RequiredChanges.HasFlag(Changes.ChangeReturnTypeToString)) + { + expr = SyntaxFactory.InvocationExpression( + SyntaxFactory.IdentifierName("PtrToStringUTF8")) + .WithArguments(new[] + { + SyntaxFactory.Argument(makeFunctionCall(gm)), + SyntaxFactory.Argument(SyntaxFactory.LiteralExpression( + gm.RequiredChanges.HasFlag(Changes.FreeReturnedPointer) + ? SyntaxKind.TrueLiteralExpression + : SyntaxKind.FalseLiteralExpression)) + } + ); + } + else + { + expr = makeFunctionCall(gm); + } + + if (gm.NativeMethod.ReturnType.IsVoid()) + return SyntaxFactory.ExpressionStatement(expr); + + return SyntaxFactory.ReturnStatement(expr); + } + + private static InvocationExpressionSyntax makeFunctionCall(GeneratedMethod gm) + { + return SyntaxFactory.InvocationExpression( + SyntaxFactory.IdentifierName(gm.NativeMethod.Identifier)) + .WithArguments(makeArguments(gm)); + } + + private static IEnumerable makeArguments(GeneratedMethod gm) + { + foreach (var param in gm.NativeMethod.ParameterList.Parameters) + { + if (param.IsTypeConstCharPtr()) + { + Debug.Assert(gm.RequiredChanges.HasFlag(Changes.ChangeParamsToReadOnlySpan)); + yield return SyntaxFactory.Argument(SyntaxFactory.IdentifierName(param.Identifier.ValueText + pointer_suffix)); + } + else + { + yield return SyntaxFactory.Argument(SyntaxFactory.IdentifierName(param.Identifier)); + } + } + } + } +} diff --git a/SDL3-CS.SourceGeneration/GeneratedMethod.cs b/SDL3-CS.SourceGeneration/GeneratedMethod.cs new file mode 100644 index 0000000..693d97a --- /dev/null +++ b/SDL3-CS.SourceGeneration/GeneratedMethod.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace SDL3.SourceGeneration +{ + public record GeneratedMethod + { + public readonly MethodDeclarationSyntax NativeMethod; + public readonly Changes RequiredChanges; + + public GeneratedMethod(MethodDeclarationSyntax nativeMethod, Changes requiredChanges) + { + NativeMethod = nativeMethod; + RequiredChanges = requiredChanges; + } + } +} diff --git a/SDL3-CS.SourceGeneration/Helper.cs b/SDL3-CS.SourceGeneration/Helper.cs new file mode 100644 index 0000000..39e0fec --- /dev/null +++ b/SDL3-CS.SourceGeneration/Helper.cs @@ -0,0 +1,77 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace SDL3.SourceGeneration +{ + public static class Helper + { + public const string UnsafePrefix = "Unsafe_"; + + public static bool IsVoid(this TypeSyntax type) => type is PredefinedTypeSyntax predefined + && predefined.Keyword.IsKind(SyntaxKind.VoidKeyword); + + public static bool IsBytePtr(this TypeSyntax? type) => type is PointerTypeSyntax syntax + && syntax.ElementType is PredefinedTypeSyntax predefined + && predefined.Keyword.IsKind(SyntaxKind.ByteKeyword); + + public static IEnumerable GetReturnAttributes(this MethodDeclarationSyntax method) + { + foreach (var list in method.AttributeLists) + { + if (list.Target?.Identifier.IsKind(SyntaxKind.ReturnKeyword) == true) + { + foreach (var attribute in list.Attributes) + yield return attribute; + } + } + } + + public static IEnumerable GetAttributes(this ParameterSyntax parameter) + { + foreach (var list in parameter.AttributeLists) + { + foreach (var attribute in list.Attributes) + yield return attribute; + } + } + + public static bool IsConstCharPtr(this AttributeSyntax attribute) + { + if (attribute.Name is IdentifierNameSyntax identifier + && identifier.Identifier.ValueText == "NativeTypeName" + && attribute.ArgumentList != null) + { + return attribute.ArgumentList.Arguments.Any(a => a.Expression is LiteralExpressionSyntax literal + && isConstCharPtr(literal.Token.ValueText)); + } + + return false; + } + + private static bool isConstCharPtr(string text) + { + switch (text) + { + case "const char*": + case "const char *": + return true; + + default: + return false; + } + } + + public static bool IsReturnTypeConstCharPtr(this MethodDeclarationSyntax method) => method.GetReturnAttributes().Any(IsConstCharPtr); + + public static bool IsTypeConstCharPtr(this ParameterSyntax parameter) => parameter.GetAttributes().Any(IsConstCharPtr); + + public static InvocationExpressionSyntax WithArguments(this InvocationExpressionSyntax invocationExpression, IEnumerable arguments) + => invocationExpression.WithArgumentList(SyntaxFactory.ArgumentList(SyntaxFactory.SeparatedList(arguments))); + } +} diff --git a/SDL3-CS.SourceGeneration/Properties/launchSettings.json b/SDL3-CS.SourceGeneration/Properties/launchSettings.json new file mode 100644 index 0000000..76566e2 --- /dev/null +++ b/SDL3-CS.SourceGeneration/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "DebugRoslynSourceGenerator": { + "commandName": "DebugRoslynComponent", + "targetProject": "../SDL3-CS/SDL3-CS.csproj" + } + } +} diff --git a/SDL3-CS.SourceGeneration/SDL3-CS.SourceGeneration.csproj b/SDL3-CS.SourceGeneration/SDL3-CS.SourceGeneration.csproj new file mode 100644 index 0000000..987a1ca --- /dev/null +++ b/SDL3-CS.SourceGeneration/SDL3-CS.SourceGeneration.csproj @@ -0,0 +1,25 @@ + + + + netstandard2.0 + false + enable + latest + + true + true + + SDL3.SourceGeneration + SDL3.SourceGeneration + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + diff --git a/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs new file mode 100644 index 0000000..56bfa67 --- /dev/null +++ b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs @@ -0,0 +1,59 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace SDL3.SourceGeneration +{ + public class UnfriendlyMethodFinder : ISyntaxReceiver + { + public readonly Dictionary> Methods = new(); + + public void OnVisitSyntaxNode(SyntaxNode syntaxNode) + { + if (syntaxNode is MethodDeclarationSyntax method) + { + string name = method.Identifier.ValueText; + bool isUnsafe = name.StartsWith($"{Helper.UnsafePrefix}SDL_"); + + if (!name.StartsWith("SDL_") && !isUnsafe) + return; + + if (method.ParameterList.Parameters.Any(p => p.Identifier.IsKind(SyntaxKind.ArgListKeyword))) + return; + + var changes = Changes.None; + + // if the method is not marked unsafe, the `byte*` is not a string. + if (method.ReturnType.IsBytePtr() && isUnsafe) + { + changes |= Changes.ChangeReturnTypeToString | Changes.TrimUnsafeFromName; + + if (!method.IsReturnTypeConstCharPtr()) + changes |= Changes.FreeReturnedPointer; + } + + foreach (var parameter in method.ParameterList.Parameters) + { + if (parameter.IsTypeConstCharPtr()) + changes |= Changes.ChangeParamsToReadOnlySpan; + } + + if (changes != Changes.None) + { + string fileName = Path.GetFileName(method.SyntaxTree.FilePath); + + if (!Methods.TryGetValue(fileName, out var list)) + Methods[fileName] = list = []; + + list.Add(new GeneratedMethod(method, changes)); + } + } + } + } +} diff --git a/SDL3-CS.sln b/SDL3-CS.sln index 45f3332..e3d75c1 100644 --- a/SDL3-CS.sln +++ b/SDL3-CS.sln @@ -15,6 +15,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS", "SDL3-CS\SDL3-CS.csproj", "{3AEE5979-6974-4BD6-9BB1-1409B0BB469B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.SourceGeneration", "SDL3-CS.SourceGeneration\SDL3-CS.SourceGeneration.csproj", "{432C86D0-D371-4D01-BFFE-01D2CDCCA7B8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -28,5 +30,9 @@ Global {3AEE5979-6974-4BD6-9BB1-1409B0BB469B}.Debug|Any CPU.Build.0 = Debug|Any CPU {3AEE5979-6974-4BD6-9BB1-1409B0BB469B}.Release|Any CPU.ActiveCfg = Release|Any CPU {3AEE5979-6974-4BD6-9BB1-1409B0BB469B}.Release|Any CPU.Build.0 = Release|Any CPU + {432C86D0-D371-4D01-BFFE-01D2CDCCA7B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {432C86D0-D371-4D01-BFFE-01D2CDCCA7B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {432C86D0-D371-4D01-BFFE-01D2CDCCA7B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {432C86D0-D371-4D01-BFFE-01D2CDCCA7B8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/SDL3-CS/SDL3-CS.csproj b/SDL3-CS/SDL3-CS.csproj index 6b3d095..9ddb845 100644 --- a/SDL3-CS/SDL3-CS.csproj +++ b/SDL3-CS/SDL3-CS.csproj @@ -8,4 +8,8 @@ $(NoWarn);SYSLIB1054;CA1401 + + + + From 91cef07624991122370cc7a0a35c0f243ab393f1 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 14:36:36 +0200 Subject: [PATCH 32/37] Add friendly `string?` overloads to C `(const) char *` functions This is done by adding a `Unsafe_` prefix to `(const) char *` (C# `byte*`) functions. I am using `string?` instead of `ReadOnlyMemory?` because the returned pointer can get invalidated and cause memory-safety issues. The returned pointer is automatically freed if the return type is `char *`. I've checked that the documentation for all functions (except in SDL_stdinc.h) requires calling `SDL_free()` on the pointer. --- SDL3-CS.SourceGeneration/Helper.cs | 3 + SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs | 12 +-- SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs | 12 +-- SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs | 12 +-- SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs | 52 ++++++------- SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs | 20 ++--- SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs | 12 +-- SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 76 +++++++++---------- .../SDL3/ClangSharp/SDL_system.Android.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs | 4 +- SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs | 16 ++-- SDL3-CS/generate_bindings.py | 17 +++++ 26 files changed, 166 insertions(+), 146 deletions(-) diff --git a/SDL3-CS.SourceGeneration/Helper.cs b/SDL3-CS.SourceGeneration/Helper.cs index 39e0fec..2eb2dad 100644 --- a/SDL3-CS.SourceGeneration/Helper.cs +++ b/SDL3-CS.SourceGeneration/Helper.cs @@ -11,6 +11,9 @@ namespace SDL3.SourceGeneration { public static class Helper { + /// + /// Needs to match unsafe_prefix in generate_bindings.py. + /// public const string UnsafePrefix = "Unsafe_"; public static bool IsVoid(this TypeSyntax type) => type is PredefinedTypeSyntax predefined diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs index 1be047b..f2abf5c 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -46,13 +46,13 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetNumAudioDrivers(); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetAudioDriver", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetAudioDriver(int index); + public static extern byte* Unsafe_SDL_GetAudioDriver(int index); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCurrentAudioDriver", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetCurrentAudioDriver(); + public static extern byte* Unsafe_SDL_GetCurrentAudioDriver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_AudioDeviceID* SDL_GetAudioOutputDevices(int* count); @@ -60,9 +60,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_AudioDeviceID* SDL_GetAudioCaptureDevices(int* count); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetAudioDeviceName", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetAudioDeviceName(SDL_AudioDeviceID devid); + public static extern byte* Unsafe_SDL_GetAudioDeviceName(SDL_AudioDeviceID devid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec* spec, int* sample_frames); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs index 58d1dc4..2b7b5f0 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_camera.g.cs @@ -56,13 +56,13 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetNumCameraDrivers(); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraDriver", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetCameraDriver(int index); + public static extern byte* Unsafe_SDL_GetCameraDriver(int index); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCurrentCameraDriver", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetCurrentCameraDriver(); + public static extern byte* Unsafe_SDL_GetCurrentCameraDriver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_CameraDeviceID* SDL_GetCameraDevices(int* count); @@ -70,9 +70,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_CameraSpec* SDL_GetCameraDeviceSupportedFormats(SDL_CameraDeviceID devid, int* count); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraDeviceName", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetCameraDeviceName(SDL_CameraDeviceID instance_id); + public static extern byte* Unsafe_SDL_GetCameraDeviceName(SDL_CameraDeviceID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_CameraPosition SDL_GetCameraDevicePosition(SDL_CameraDeviceID instance_id); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs index cc068dd..eecc249 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs @@ -33,9 +33,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetClipboardText([NativeTypeName("const char *")] byte* text); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetClipboardText", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetClipboardText(); + public static extern byte* Unsafe_SDL_GetClipboardText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_HasClipboardText(); @@ -43,9 +43,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetPrimarySelectionText([NativeTypeName("const char *")] byte* text); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPrimarySelectionText", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetPrimarySelectionText(); + public static extern byte* Unsafe_SDL_GetPrimarySelectionText(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_HasPrimarySelectionText(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs index af3eb8b..1b5a02c 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_error.g.cs @@ -42,9 +42,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetError([NativeTypeName("const char *")] byte* fmt, __arglist); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetError", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetError(); + public static extern byte* Unsafe_SDL_GetError(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_ClearError(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs index f6e7b35..fe780b0 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.g.cs @@ -67,17 +67,17 @@ public partial struct SDL_PathInfo public static unsafe partial class SDL3 { - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetBasePath", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetBasePath(); + public static extern byte* Unsafe_SDL_GetBasePath(); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPrefPath", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetPrefPath([NativeTypeName("const char *")] byte* org, [NativeTypeName("const char *")] byte* app); + public static extern byte* Unsafe_SDL_GetPrefPath([NativeTypeName("const char *")] byte* org, [NativeTypeName("const char *")] byte* app); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetUserFolder", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetUserFolder(SDL_Folder folder); + public static extern byte* Unsafe_SDL_GetUserFolder(SDL_Folder folder); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_CreateDirectory([NativeTypeName("const char *")] byte* path); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs index 936994d..bbc7bf8 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs @@ -195,13 +195,13 @@ public static unsafe partial class SDL3 [return: NativeTypeName("char **")] public static extern byte** SDL_GetGamepadMappings(int* count); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadMappingForGUID", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetGamepadMappingForGUID([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid); + public static extern byte* Unsafe_SDL_GetGamepadMappingForGUID([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadMapping", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetGamepadMapping(SDL_Gamepad* gamepad); + public static extern byte* Unsafe_SDL_GetGamepadMapping(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetGamepadMapping(SDL_JoystickID instance_id, [NativeTypeName("const char *")] byte* mapping); @@ -215,13 +215,13 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_IsGamepad(SDL_JoystickID instance_id); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadInstanceName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadInstanceName(SDL_JoystickID instance_id); + public static extern byte* Unsafe_SDL_GetGamepadInstanceName(SDL_JoystickID instance_id); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadInstancePath", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadInstancePath(SDL_JoystickID instance_id); + public static extern byte* Unsafe_SDL_GetGamepadInstancePath(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetGamepadInstancePlayerIndex(SDL_JoystickID instance_id); @@ -248,9 +248,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_GamepadType SDL_GetRealGamepadInstanceType(SDL_JoystickID instance_id); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadInstanceMapping", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_GetGamepadInstanceMapping(SDL_JoystickID instance_id); + public static extern byte* Unsafe_SDL_GetGamepadInstanceMapping(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Gamepad* SDL_OpenGamepad(SDL_JoystickID instance_id); @@ -267,13 +267,13 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_JoystickID SDL_GetGamepadInstanceID(SDL_Gamepad* gamepad); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadName(SDL_Gamepad* gamepad); + public static extern byte* Unsafe_SDL_GetGamepadName(SDL_Gamepad* gamepad); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadPath", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadPath(SDL_Gamepad* gamepad); + public static extern byte* Unsafe_SDL_GetGamepadPath(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_GamepadType SDL_GetGamepadType(SDL_Gamepad* gamepad); @@ -303,9 +303,9 @@ public static unsafe partial class SDL3 [return: NativeTypeName("Uint16")] public static extern ushort SDL_GetGamepadFirmwareVersion(SDL_Gamepad* gamepad); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadSerial", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadSerial(SDL_Gamepad* gamepad); + public static extern byte* Unsafe_SDL_GetGamepadSerial(SDL_Gamepad* gamepad); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint64")] @@ -338,16 +338,16 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_GamepadType SDL_GetGamepadTypeFromString([NativeTypeName("const char *")] byte* str); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadStringForType", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadStringForType(SDL_GamepadType type); + public static extern byte* Unsafe_SDL_GetGamepadStringForType(SDL_GamepadType type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_GamepadAxis SDL_GetGamepadAxisFromString([NativeTypeName("const char *")] byte* str); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadStringForAxis", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis); + public static extern byte* Unsafe_SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_GamepadHasAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); @@ -359,9 +359,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_GamepadButton SDL_GetGamepadButtonFromString([NativeTypeName("const char *")] byte* str); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadStringForButton", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadStringForButton(SDL_GamepadButton button); + public static extern byte* Unsafe_SDL_GetGamepadStringForButton(SDL_GamepadButton button); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_GamepadHasButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); @@ -415,13 +415,13 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_CloseGamepad(SDL_Gamepad* gamepad); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadAppleSFSymbolsNameForButton", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); + public static extern byte* Unsafe_SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadAppleSFSymbolsNameForAxis", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); + public static extern byte* Unsafe_SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad* gamepad, SDL_GamepadAxis axis); [NativeTypeName("#define SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN")] public static ReadOnlySpan SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN => "SDL.joystick.cap.mono_led"u8; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs index 65da8bf..bd8f7cd 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs @@ -328,9 +328,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_HapticID* SDL_GetHaptics(int* count); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetHapticInstanceName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetHapticInstanceName(SDL_HapticID instance_id); + public static extern byte* Unsafe_SDL_GetHapticInstanceName(SDL_HapticID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Haptic* SDL_OpenHaptic(SDL_HapticID instance_id); @@ -341,9 +341,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_HapticID SDL_GetHapticInstanceID(SDL_Haptic* haptic); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetHapticName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetHapticName(SDL_Haptic* haptic); + public static extern byte* Unsafe_SDL_GetHapticName(SDL_Haptic* haptic); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_IsMouseHaptic(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs index 42ab6aa..9cea507 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs @@ -49,9 +49,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_ResetHints(); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetHint", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetHint([NativeTypeName("const char *")] byte* name); + public static extern byte* Unsafe_SDL_GetHint([NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_GetHintBoolean([NativeTypeName("const char *")] byte* name, SDL_bool default_value); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs index baf4e90..3dc1a27 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs @@ -125,13 +125,13 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_JoystickID* SDL_GetJoysticks(int* count); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickInstanceName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetJoystickInstanceName(SDL_JoystickID instance_id); + public static extern byte* Unsafe_SDL_GetJoystickInstanceName(SDL_JoystickID instance_id); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickInstancePath", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetJoystickInstancePath(SDL_JoystickID instance_id); + public static extern byte* Unsafe_SDL_GetJoystickInstancePath(SDL_JoystickID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetJoystickInstancePlayerIndex(SDL_JoystickID instance_id); @@ -188,13 +188,13 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_PropertiesID SDL_GetJoystickProperties(SDL_Joystick* joystick); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetJoystickName(SDL_Joystick* joystick); + public static extern byte* Unsafe_SDL_GetJoystickName(SDL_Joystick* joystick); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickPath", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetJoystickPath(SDL_Joystick* joystick); + public static extern byte* Unsafe_SDL_GetJoystickPath(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetJoystickPlayerIndex(SDL_Joystick* joystick); @@ -222,9 +222,9 @@ public static unsafe partial class SDL3 [return: NativeTypeName("Uint16")] public static extern ushort SDL_GetJoystickFirmwareVersion(SDL_Joystick* joystick); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickSerial", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetJoystickSerial(SDL_Joystick* joystick); + public static extern byte* Unsafe_SDL_GetJoystickSerial(SDL_Joystick* joystick); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_JoystickType SDL_GetJoystickType(SDL_Joystick* joystick); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs index 3143ed1..02803e5 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs @@ -48,9 +48,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_KeyboardID* SDL_GetKeyboards(int* count); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetKeyboardInstanceName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetKeyboardInstanceName(SDL_KeyboardID instance_id); + public static extern byte* Unsafe_SDL_GetKeyboardInstanceName(SDL_KeyboardID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Window* SDL_GetKeyboardFocus(); @@ -74,16 +74,16 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetScancodeName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetScancodeName(SDL_Scancode scancode); + public static extern byte* Unsafe_SDL_GetScancodeName(SDL_Scancode scancode); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Scancode SDL_GetScancodeFromName([NativeTypeName("const char *")] byte* name); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetKeyName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetKeyName(SDL_Keycode key); + public static extern byte* Unsafe_SDL_GetKeyName(SDL_Keycode key); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Keycode SDL_GetKeyFromName([NativeTypeName("const char *")] byte* name); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs index 0213756..e98c846 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs @@ -70,9 +70,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_MouseID* SDL_GetMice(int* count); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetMouseInstanceName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetMouseInstanceName(SDL_MouseID instance_id); + public static extern byte* Unsafe_SDL_GetMouseInstanceName(SDL_MouseID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Window* SDL_GetMouseFocus(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs index a2dabb4..9fc75f3 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pen.g.cs @@ -80,9 +80,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_PenConnected(SDL_PenID instance_id); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPenName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetPenName(SDL_PenID instance_id); + public static extern byte* Unsafe_SDL_GetPenName(SDL_PenID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint32")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs index f1970e8..76d04ce 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs @@ -384,9 +384,9 @@ public partial struct _padding_e__FixedBuffer public static unsafe partial class SDL3 { - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPixelFormatName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetPixelFormatName(SDL_PixelFormatEnum format); + public static extern byte* Unsafe_SDL_GetPixelFormatName(SDL_PixelFormatEnum format); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_GetMasksForPixelFormatEnum(SDL_PixelFormatEnum format, int* bpp, [NativeTypeName("Uint32 *")] uint* Rmask, [NativeTypeName("Uint32 *")] uint* Gmask, [NativeTypeName("Uint32 *")] uint* Bmask, [NativeTypeName("Uint32 *")] uint* Amask); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs index 8701e53..dd8bef7 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_platform.g.cs @@ -29,8 +29,8 @@ namespace SDL { public static unsafe partial class SDL3 { - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPlatform", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetPlatform(); + public static extern byte* Unsafe_SDL_GetPlatform(); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs index 2414156..20172d2 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs @@ -83,9 +83,9 @@ public static unsafe partial class SDL3 [return: NativeTypeName("void*")] public static extern IntPtr SDL_GetProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("void*")] IntPtr default_value); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetStringProperty", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetStringProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* default_value); + public static extern byte* Unsafe_SDL_GetStringProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* default_value); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Sint64")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs index 83c3526..409edd6 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs @@ -97,9 +97,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetNumRenderDrivers(); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetRenderDriver", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetRenderDriver(int index); + public static extern byte* Unsafe_SDL_GetRenderDriver(int index); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_CreateWindowAndRenderer(int width, int height, SDL_WindowFlags window_flags, SDL_Window** window, SDL_Renderer** renderer); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs index ddaa278..636cd60 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs @@ -48,9 +48,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_SensorID* SDL_GetSensors(int* count); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetSensorInstanceName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetSensorInstanceName(SDL_SensorID instance_id); + public static extern byte* Unsafe_SDL_GetSensorInstanceName(SDL_SensorID instance_id); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_SensorType SDL_GetSensorInstanceType(SDL_SensorID instance_id); @@ -67,9 +67,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_PropertiesID SDL_GetSensorProperties(SDL_Sensor* sensor); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetSensorName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetSensorName(SDL_Sensor* sensor); + public static extern byte* Unsafe_SDL_GetSensorName(SDL_Sensor* sensor); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_SensorType SDL_GetSensorType(SDL_Sensor* sensor); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index fe2bba7..0d7b1cc 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -73,9 +73,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetNumAllocations(); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_getenv", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_getenv([NativeTypeName("const char *")] byte* name); + public static extern byte* Unsafe_SDL_getenv([NativeTypeName("const char *")] byte* name); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_setenv([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value, int overwrite); @@ -230,49 +230,49 @@ public static unsafe partial class SDL3 [return: NativeTypeName("size_t")] public static extern nuint SDL_strlcat([NativeTypeName("char *")] byte* dst, [NativeTypeName("const char *")] byte* src, [NativeTypeName("size_t")] nuint maxlen); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strdup", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_strdup([NativeTypeName("const char *")] byte* str); + public static extern byte* Unsafe_SDL_strdup([NativeTypeName("const char *")] byte* str); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strndup", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_strndup([NativeTypeName("const char *")] byte* str, [NativeTypeName("size_t")] nuint maxlen); + public static extern byte* Unsafe_SDL_strndup([NativeTypeName("const char *")] byte* str, [NativeTypeName("size_t")] nuint maxlen); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strrev", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_strrev([NativeTypeName("char *")] byte* str); + public static extern byte* Unsafe_SDL_strrev([NativeTypeName("char *")] byte* str); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strupr", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_strupr([NativeTypeName("char *")] byte* str); + public static extern byte* Unsafe_SDL_strupr([NativeTypeName("char *")] byte* str); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strlwr", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_strlwr([NativeTypeName("char *")] byte* str); + public static extern byte* Unsafe_SDL_strlwr([NativeTypeName("char *")] byte* str); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strchr", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_strchr([NativeTypeName("const char *")] byte* str, int c); + public static extern byte* Unsafe_SDL_strchr([NativeTypeName("const char *")] byte* str, int c); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strrchr", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_strrchr([NativeTypeName("const char *")] byte* str, int c); + public static extern byte* Unsafe_SDL_strrchr([NativeTypeName("const char *")] byte* str, int c); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strstr", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_strstr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle); + public static extern byte* Unsafe_SDL_strstr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strnstr", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_strnstr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle, [NativeTypeName("size_t")] nuint maxlen); + public static extern byte* Unsafe_SDL_strnstr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle, [NativeTypeName("size_t")] nuint maxlen); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strcasestr", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_strcasestr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle); + public static extern byte* Unsafe_SDL_strcasestr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strtok_r", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* 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* s1, [NativeTypeName("const char *")] byte* s2, [NativeTypeName("char **")] byte** saveptr); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -282,29 +282,29 @@ public static unsafe partial class SDL3 [return: NativeTypeName("size_t")] public static extern nuint SDL_utf8strnlen([NativeTypeName("const char *")] byte* str, [NativeTypeName("size_t")] nuint bytes); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_itoa", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_itoa(int value, [NativeTypeName("char *")] byte* str, int radix); + public static extern byte* Unsafe_SDL_itoa(int value, [NativeTypeName("char *")] byte* str, int radix); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_uitoa", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_uitoa([NativeTypeName("unsigned int")] uint value, [NativeTypeName("char *")] byte* str, int radix); + public static extern byte* Unsafe_SDL_uitoa([NativeTypeName("unsigned int")] uint value, [NativeTypeName("char *")] byte* str, int radix); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_ltoa", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_ltoa([NativeTypeName("long")] int value, [NativeTypeName("char *")] byte* str, int radix); + public static extern byte* Unsafe_SDL_ltoa([NativeTypeName("long")] int value, [NativeTypeName("char *")] byte* str, int radix); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_ultoa", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_ultoa([NativeTypeName("unsigned long")] uint value, [NativeTypeName("char *")] byte* str, int radix); + public static extern byte* Unsafe_SDL_ultoa([NativeTypeName("unsigned long")] uint value, [NativeTypeName("char *")] byte* str, int radix); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_lltoa", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_lltoa([NativeTypeName("Sint64")] long value, [NativeTypeName("char *")] byte* str, int radix); + public static extern byte* Unsafe_SDL_lltoa([NativeTypeName("Sint64")] long value, [NativeTypeName("char *")] byte* str, int radix); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_ulltoa", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_ulltoa([NativeTypeName("Uint64")] ulong value, [NativeTypeName("char *")] byte* str, int radix); + public static extern byte* Unsafe_SDL_ulltoa([NativeTypeName("Uint64")] ulong value, [NativeTypeName("char *")] byte* str, int radix); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_atoi([NativeTypeName("const char *")] byte* str); @@ -512,9 +512,9 @@ public static unsafe partial class SDL3 [return: NativeTypeName("size_t")] public static extern nuint SDL_iconv([NativeTypeName("SDL_iconv_t")] SDL_iconv_data_t* cd, [NativeTypeName("const char **")] byte** inbuf, [NativeTypeName("size_t *")] nuint* inbytesleft, [NativeTypeName("char **")] byte** outbuf, [NativeTypeName("size_t *")] nuint* outbytesleft); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_iconv_string", ExactSpelling = true)] [return: NativeTypeName("char *")] - public static extern byte* SDL_iconv_string([NativeTypeName("const char *")] byte* tocode, [NativeTypeName("const char *")] byte* fromcode, [NativeTypeName("const char *")] byte* inbuf, [NativeTypeName("size_t")] nuint inbytesleft); + public static extern byte* Unsafe_SDL_iconv_string([NativeTypeName("const char *")] byte* tocode, [NativeTypeName("const char *")] byte* fromcode, [NativeTypeName("const char *")] byte* inbuf, [NativeTypeName("size_t")] nuint inbytesleft); public static int SDL_size_mul_overflow([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret) { diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs index b5ad8c8..4e2deec 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs @@ -61,19 +61,19 @@ public static unsafe partial class SDL3 [SupportedOSPlatform("Android")] public static extern void SDL_AndroidBackButton(); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_AndroidGetInternalStoragePath", ExactSpelling = true)] [return: NativeTypeName("const char *")] [SupportedOSPlatform("Android")] - public static extern byte* SDL_AndroidGetInternalStoragePath(); + public static extern byte* Unsafe_SDL_AndroidGetInternalStoragePath(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] public static extern int SDL_AndroidGetExternalStorageState([NativeTypeName("Uint32 *")] uint* state); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_AndroidGetExternalStoragePath", ExactSpelling = true)] [return: NativeTypeName("const char *")] [SupportedOSPlatform("Android")] - public static extern byte* SDL_AndroidGetExternalStoragePath(); + public static extern byte* Unsafe_SDL_AndroidGetExternalStoragePath(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Android")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs index 70fbd23..3ceaa67 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs @@ -52,10 +52,10 @@ public static unsafe partial class SDL3 [SupportedOSPlatform("Windows")] public static extern IntPtr SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_WinRTGetFSPathUTF8", ExactSpelling = true)] [return: NativeTypeName("const char *")] [SupportedOSPlatform("Windows")] - public static extern byte* SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); + public static extern byte* Unsafe_SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [SupportedOSPlatform("Windows")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs index 57e9b60..4fd87ca 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs @@ -51,9 +51,9 @@ public static unsafe partial class SDL3 [UnsupportedOSPlatform("windows")] public static extern SDL_Thread* SDL_CreateThreadWithStackSize([NativeTypeName("SDL_ThreadFunction")] delegate* unmanaged[Cdecl] fn, [NativeTypeName("const char *")] byte* name, [NativeTypeName("const size_t")] nuint stacksize, [NativeTypeName("void*")] IntPtr data); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetThreadName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetThreadName(SDL_Thread* thread); + public static extern byte* Unsafe_SDL_GetThreadName(SDL_Thread* thread); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_ThreadID SDL_GetCurrentThreadID(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs index 777f015..c5389e7 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_touch.g.cs @@ -51,9 +51,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_TouchID* SDL_GetTouchDevices(int* count); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetTouchDeviceName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetTouchDeviceName(SDL_TouchID touchID); + public static extern byte* Unsafe_SDL_GetTouchDeviceName(SDL_TouchID touchID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID touchID); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs index efccb50..21969cb 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_version.g.cs @@ -44,9 +44,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetVersion(SDL_Version* ver); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetRevision", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetRevision(); + public static extern byte* Unsafe_SDL_GetRevision(); [NativeTypeName("#define SDL_MAJOR_VERSION 3")] public const int SDL_MAJOR_VERSION = 3; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs index 69ff2ac..4651e30 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs @@ -151,13 +151,13 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetNumVideoDrivers(); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetVideoDriver", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetVideoDriver(int index); + public static extern byte* Unsafe_SDL_GetVideoDriver(int index); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCurrentVideoDriver", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetCurrentVideoDriver(); + public static extern byte* Unsafe_SDL_GetCurrentVideoDriver(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_SystemTheme SDL_GetSystemTheme(); @@ -171,9 +171,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_PropertiesID SDL_GetDisplayProperties(SDL_DisplayID displayID); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetDisplayName", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetDisplayName(SDL_DisplayID displayID); + public static extern byte* Unsafe_SDL_GetDisplayName(SDL_DisplayID displayID); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_GetDisplayBounds(SDL_DisplayID displayID, SDL_Rect* rect); @@ -263,9 +263,9 @@ public static unsafe partial class SDL3 [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetWindowTitle(SDL_Window* window, [NativeTypeName("const char *")] byte* title); - [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetWindowTitle", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern byte* SDL_GetWindowTitle(SDL_Window* window); + public static extern byte* Unsafe_SDL_GetWindowTitle(SDL_Window* window); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int SDL_SetWindowIcon(SDL_Window* window, SDL_Surface* icon); diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index a80402f..b5a9835 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -18,6 +18,9 @@ import subprocess import sys +# Needs to match SDL3.SourceGeneration.Helper.UnsafePrefix +unsafe_prefix = "Unsafe_" + SDL_root = pathlib.Path("../../SDL") SDL_include_root = SDL_root / "include" SDL3_header_base = "SDL3" # base folder of header files @@ -282,6 +285,12 @@ def generate_platform_specific_headers(sdl_api, header: Header, platforms): check_generated_functions(sdl_api, header, output_files) +def get_string_returning_functions(sdl_api): + for f in sdl_api: + if f["retval"] in ("const char*", "char*"): + yield f + + def main(): sdl_api = get_sdl_api_dump() @@ -292,6 +301,14 @@ def main(): for type_name in typedefs: base_command.append(typedef(type_name)) + str_ret_funcs = list(get_string_returning_functions(sdl_api)) + if str_ret_funcs: + base_command.append("--remap") + for func in str_ret_funcs: + name = func["name"] + # add unsafe prefix to `const char *` functions so that the source generator can make friendly overloads with the unprefixed name. + base_command.append(f"{name}={unsafe_prefix}{name}") + for header in headers: output_file = run_clangsharp(base_command, header) check_generated_functions(sdl_api, header, [output_file]) From e85349e3fa4802640dc4ff8eba280dfbeeadb9cb Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 14:43:18 +0200 Subject: [PATCH 33/37] Change SDL sources to use more proper types This helps consumers avoid having to do ugly casts as was previously done in `SDL_quit.cs`. It's very important that the underlying type doesn't change as that might break ABI compat. --- SDL3-CS/SDL-use-proper-types.patch | 317 +++++++++++++++++++- SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs | 23 +- SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs | 9 +- SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs | 24 +- SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs | 8 +- SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs | 5 +- SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs | 8 +- SDL3-CS/SDL3/SDL_quit.cs | 2 +- 8 files changed, 352 insertions(+), 44 deletions(-) diff --git a/SDL3-CS/SDL-use-proper-types.patch b/SDL3-CS/SDL-use-proper-types.patch index 58ece12..631fdba 100644 --- a/SDL3-CS/SDL-use-proper-types.patch +++ b/SDL3-CS/SDL-use-proper-types.patch @@ -1,5 +1,308 @@ +diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h +index b178d2ade..5c54b9ab5 100644 +--- a/include/SDL3/SDL.h ++++ b/include/SDL3/SDL.h +@@ -29,6 +29,8 @@ + #ifndef SDL_h_ + #define SDL_h_ + ++#error Don't build with enum type changes ++ + #include + #include + #include +diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h +index 0fddf1f24..36b98b569 100644 +--- a/include/SDL3/SDL_events.h ++++ b/include/SDL3/SDL_events.h +@@ -244,7 +244,7 @@ typedef enum + */ + typedef struct SDL_CommonEvent + { +- Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */ ++ SDL_EventType type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */ + Uint32 reserved; + Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ + } SDL_CommonEvent; +@@ -726,7 +726,7 @@ typedef struct SDL_QuitEvent + */ + typedef struct SDL_UserEvent + { +- Uint32 type; /**< ::SDL_EVENT_USER through ::SDL_EVENT_LAST-1, Uint32 because these are not in the SDL_EventType enumeration */ ++ SDL_EventType type; /**< ::SDL_EVENT_USER through ::SDL_EVENT_LAST-1, Uint32 because these are not in the SDL_EventType enumeration */ + Uint32 reserved; + Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ + SDL_WindowID windowID; /**< The associated window if any */ +@@ -741,7 +741,7 @@ typedef struct SDL_UserEvent + */ + typedef union SDL_Event + { +- Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */ ++ SDL_EventType type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */ + SDL_CommonEvent common; /**< Common event data */ + SDL_DisplayEvent display; /**< Display event data */ + SDL_WindowEvent window; /**< Window event data */ +@@ -868,7 +868,7 @@ typedef enum + * \sa SDL_PumpEvents + * \sa SDL_PushEvent + */ +-extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType); ++extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, SDL_EventType minType, SDL_EventType maxType); + /* @} */ + + /** +@@ -885,7 +885,7 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL + * + * \sa SDL_HasEvents + */ +-extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); ++extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(SDL_EventType type); + + + /** +@@ -904,7 +904,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); + * + * \sa SDL_HasEvents + */ +-extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); ++extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(SDL_EventType minType, SDL_EventType maxType); + + /** + * Clear events of a specific type from the event queue. +@@ -930,7 +930,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); + * + * \sa SDL_FlushEvents + */ +-extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); ++extern DECLSPEC void SDLCALL SDL_FlushEvent(SDL_EventType type); + + /** + * Clear events of a range of types from the event queue. +@@ -955,7 +955,7 @@ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); + * + * \sa SDL_FlushEvent + */ +-extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType); ++extern DECLSPEC void SDLCALL SDL_FlushEvents(SDL_EventType minType, SDL_EventType maxType); + + /** + * Poll for currently pending events. +@@ -1234,7 +1234,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *user + * + * \sa SDL_IsEventEnabled + */ +-extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); ++extern DECLSPEC void SDLCALL SDL_SetEventEnabled(SDL_EventType type, SDL_bool enabled); + + /** + * Query the state of processing events by type. +@@ -1246,7 +1246,7 @@ extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); + * + * \sa SDL_SetEventEnabled + */ +-extern DECLSPEC SDL_bool SDLCALL SDL_EventEnabled(Uint32 type); ++extern DECLSPEC SDL_bool SDLCALL SDL_EventEnabled(SDL_EventType type); + + /** + * Allocate a set of user-defined events, and return the beginning event +diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h +index d1b925270..30cc4a8b7 100644 +--- a/include/SDL3/SDL_init.h ++++ b/include/SDL3/SDL_init.h +@@ -110,7 +110,7 @@ typedef enum + * \sa SDL_SetMainReady + * \sa SDL_WasInit + */ +-extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); ++extern DECLSPEC int SDLCALL SDL_Init(SDL_InitFlags flags); + + /** + * Compatibility function to initialize the SDL library. +@@ -127,7 +127,7 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); + * \sa SDL_Quit + * \sa SDL_QuitSubSystem + */ +-extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); ++extern DECLSPEC int SDLCALL SDL_InitSubSystem(SDL_InitFlags flags); + + /** + * Shut down specific SDL subsystems. +@@ -142,7 +142,7 @@ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); + * \sa SDL_InitSubSystem + * \sa SDL_Quit + */ +-extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); ++extern DECLSPEC void SDLCALL SDL_QuitSubSystem(SDL_InitFlags flags); + + /** + * Get a mask of the specified subsystems which are currently initialized. +@@ -156,7 +156,7 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); + * \sa SDL_Init + * \sa SDL_InitSubSystem + */ +-extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); ++extern DECLSPEC SDL_InitFlags SDLCALL SDL_WasInit(SDL_InitFlags flags); + + /** + * Clean up all initialized subsystems. +diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h +index 99d2f2c36..eef01cac7 100644 +--- a/include/SDL3/SDL_log.h ++++ b/include/SDL3/SDL_log.h +@@ -135,7 +135,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); + * \sa SDL_LogResetPriorities + * \sa SDL_LogSetAllPriority + */ +-extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, ++extern DECLSPEC void SDLCALL SDL_LogSetPriority(SDL_LogCategory category, + SDL_LogPriority priority); + + /** +@@ -148,7 +148,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, + * + * \sa SDL_LogSetPriority + */ +-extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); ++extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(SDL_LogCategory category); + + /** + * Reset all priorities to default. +@@ -201,7 +201,7 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, . + * \sa SDL_LogMessageV + * \sa SDL_LogWarn + */ +-extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); ++extern DECLSPEC void SDLCALL SDL_LogVerbose(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + + /** + * Log a message with SDL_LOG_PRIORITY_DEBUG. +@@ -222,7 +222,7 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI + * \sa SDL_LogVerbose + * \sa SDL_LogWarn + */ +-extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); ++extern DECLSPEC void SDLCALL SDL_LogDebug(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + + /** + * Log a message with SDL_LOG_PRIORITY_INFO. +@@ -243,7 +243,7 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING + * \sa SDL_LogVerbose + * \sa SDL_LogWarn + */ +-extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); ++extern DECLSPEC void SDLCALL SDL_LogInfo(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + + /** + * Log a message with SDL_LOG_PRIORITY_WARN. +@@ -264,7 +264,7 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING + * \sa SDL_LogMessageV + * \sa SDL_LogVerbose + */ +-extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); ++extern DECLSPEC void SDLCALL SDL_LogWarn(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + + /** + * Log a message with SDL_LOG_PRIORITY_ERROR. +@@ -285,7 +285,7 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING + * \sa SDL_LogVerbose + * \sa SDL_LogWarn + */ +-extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); ++extern DECLSPEC void SDLCALL SDL_LogError(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + + /** + * Log a message with SDL_LOG_PRIORITY_CRITICAL. +@@ -306,7 +306,7 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING + * \sa SDL_LogVerbose + * \sa SDL_LogWarn + */ +-extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); ++extern DECLSPEC void SDLCALL SDL_LogCritical(SDL_LogCategory category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + + /** + * Log a message with the specified category and priority. +@@ -328,7 +328,7 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR + * \sa SDL_LogVerbose + * \sa SDL_LogWarn + */ +-extern DECLSPEC void SDLCALL SDL_LogMessage(int category, ++extern DECLSPEC void SDLCALL SDL_LogMessage(SDL_LogCategory category, + SDL_LogPriority priority, + SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3); + +@@ -351,7 +351,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, + * \sa SDL_LogVerbose + * \sa SDL_LogWarn + */ +-extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, ++extern DECLSPEC void SDLCALL SDL_LogMessageV(SDL_LogCategory category, + SDL_LogPriority priority, + SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); + +@@ -365,7 +365,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, + * \param priority the priority of the message + * \param message the message being output + */ +-typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); ++typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, SDL_LogCategory category, SDL_LogPriority priority, const char *message); + + /** + * Get the current log output function. +diff --git a/include/SDL3/SDL_messagebox.h b/include/SDL3/SDL_messagebox.h +index 3d6855275..2b540a3fa 100644 +--- a/include/SDL3/SDL_messagebox.h ++++ b/include/SDL3/SDL_messagebox.h +@@ -58,7 +58,7 @@ typedef enum + */ + typedef struct + { +- Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ ++ SDL_MessageBoxButtonFlags flags; /**< ::SDL_MessageBoxButtonFlags */ + int buttonID; /**< User defined button id (value returned via SDL_ShowMessageBox) */ + const char *text; /**< The UTF-8 button text */ + } SDL_MessageBoxButtonData; +@@ -94,7 +94,7 @@ typedef struct + */ + typedef struct + { +- Uint32 flags; /**< ::SDL_MessageBoxFlags */ ++ SDL_MessageBoxFlags flags; /**< ::SDL_MessageBoxFlags */ + SDL_Window *window; /**< Parent window, can be NULL */ + const char *title; /**< UTF-8 title */ + const char *message; /**< UTF-8 message text */ +@@ -180,7 +180,7 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message + * + * \sa SDL_ShowMessageBox + */ +-extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); ++extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window); + + + /* Ends C function definitions when using C++ */ +diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h +index 5024931e7..f1f61be21 100644 +--- a/include/SDL3/SDL_render.h ++++ b/include/SDL3/SDL_render.h +@@ -80,7 +80,7 @@ typedef enum + typedef struct SDL_RendererInfo + { + const char *name; /**< The name of the renderer */ +- Uint32 flags; /**< Supported ::SDL_RendererFlags */ ++ SDL_RendererFlags flags; /**< Supported ::SDL_RendererFlags */ + int num_texture_formats; /**< The number of available texture formats */ + SDL_PixelFormatEnum texture_formats[16]; /**< The available texture formats */ + int max_texture_width; /**< The maximum texture width */ +@@ -225,7 +225,7 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, S + * \sa SDL_GetRenderDriver + * \sa SDL_GetRendererInfo + */ +-extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags); ++extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name, SDL_RendererFlags flags); + + /** + * Create a 2D rendering context for a window, with the specified properties. diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h -index e6a387c31..46c225953 100644 +index e6a387c31..8aafb96c8 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -132,8 +132,8 @@ char *alloca(); @@ -13,3 +316,15 @@ index e6a387c31..46c225953 100644 typedef int SDL_bool; /** +@@ -192,8 +192,8 @@ typedef uint64_t Uint64; + * They can be converted between POSIX time_t values with SDL_NS_TO_SECONDS() and SDL_SECONDS_TO_NS(), + * and between Windows FILETIME values with SDL_TimeToWindows() and SDL_TimeFromWindows(). + */ +-#define SDL_MAX_TIME SDL_MAX_SINT64 +-#define SDL_MIN_TIME SDL_MIN_SINT64 ++#define SDL_MAX_TIME (SDL_Time)SDL_MAX_SINT64 ++#define SDL_MIN_TIME (SDL_Time)SDL_MIN_SINT64 + typedef Sint64 SDL_Time; + + /* @} *//* Basic data types */ + \ No newline at end of file diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs index 006f7e8..5cf20ff 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs @@ -142,8 +142,7 @@ public enum SDL_EventType public partial struct SDL_CommonEvent { - [NativeTypeName("Uint32")] - public uint type; + public SDL_EventType type; [NativeTypeName("Uint32")] public uint reserved; @@ -883,8 +882,7 @@ public partial struct SDL_QuitEvent public partial struct SDL_UserEvent { - [NativeTypeName("Uint32")] - public uint type; + public SDL_EventType type; [NativeTypeName("Uint32")] public uint reserved; @@ -908,8 +906,7 @@ public partial struct SDL_UserEvent public partial struct SDL_Event { [FieldOffset(0)] - [NativeTypeName("Uint32")] - public uint type; + public SDL_EventType type; [FieldOffset(0)] public SDL_CommonEvent common; @@ -1034,19 +1031,19 @@ public static unsafe partial class SDL3 public static extern void SDL_PumpEvents(); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_PeepEvents(SDL_Event* events, int numevents, SDL_eventaction action, [NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); + public static extern int SDL_PeepEvents(SDL_Event* events, int numevents, SDL_eventaction action, SDL_EventType minType, SDL_EventType maxType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_bool SDL_HasEvent([NativeTypeName("Uint32")] uint type); + public static extern SDL_bool SDL_HasEvent(SDL_EventType type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_bool SDL_HasEvents([NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); + public static extern SDL_bool SDL_HasEvents(SDL_EventType minType, SDL_EventType maxType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_FlushEvent([NativeTypeName("Uint32")] uint type); + public static extern void SDL_FlushEvent(SDL_EventType type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_FlushEvents([NativeTypeName("Uint32")] uint minType, [NativeTypeName("Uint32")] uint maxType); + public static extern void SDL_FlushEvents(SDL_EventType minType, SDL_EventType maxType); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_bool SDL_PollEvent(SDL_Event* @event); @@ -1076,10 +1073,10 @@ public static unsafe partial class SDL3 public static extern void SDL_FilterEvents([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, [NativeTypeName("void*")] IntPtr userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetEventEnabled([NativeTypeName("Uint32")] uint type, SDL_bool enabled); + public static extern void SDL_SetEventEnabled(SDL_EventType type, SDL_bool enabled); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_bool SDL_EventEnabled([NativeTypeName("Uint32")] uint type); + public static extern SDL_bool SDL_EventEnabled(SDL_EventType type); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("Uint32")] diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs index 0e83d12..844476a 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_init.g.cs @@ -45,17 +45,16 @@ public enum SDL_InitFlags public static partial class SDL3 { [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_Init([NativeTypeName("Uint32")] uint flags); + public static extern int SDL_Init(SDL_InitFlags flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_InitSubSystem([NativeTypeName("Uint32")] uint flags); + public static extern int SDL_InitSubSystem(SDL_InitFlags flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_QuitSubSystem([NativeTypeName("Uint32")] uint flags); + public static extern void SDL_QuitSubSystem(SDL_InitFlags flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - [return: NativeTypeName("Uint32")] - public static extern uint SDL_WasInit([NativeTypeName("Uint32")] uint flags); + public static extern SDL_InitFlags SDL_WasInit(SDL_InitFlags flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_Quit(); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs index 78da5b8..57a9929 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs @@ -69,10 +69,10 @@ public static unsafe partial class SDL3 public static extern void SDL_LogSetAllPriority(SDL_LogPriority priority); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogSetPriority(int category, SDL_LogPriority priority); + public static extern void SDL_LogSetPriority(SDL_LogCategory category, SDL_LogPriority priority); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_LogPriority SDL_LogGetPriority(int category); + public static extern SDL_LogPriority SDL_LogGetPriority(SDL_LogCategory category); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void SDL_LogResetPriorities(); @@ -81,34 +81,34 @@ public static unsafe partial class SDL3 public static extern void SDL_Log([NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogVerbose(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogVerbose(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogDebug(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogDebug(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogInfo(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogInfo(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogWarn(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogWarn(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogError(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogError(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogCritical(int category, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogCritical(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogMessage(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, __arglist); + public static extern void SDL_LogMessage(SDL_LogCategory category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, __arglist); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_LogMessageV(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); + public static extern void SDL_LogMessageV(SDL_LogCategory category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_GetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction *")] delegate* unmanaged[Cdecl]* callback, [NativeTypeName("void **")] IntPtr* userdata); + public static extern void SDL_GetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction *")] delegate* unmanaged[Cdecl]* callback, [NativeTypeName("void **")] IntPtr* userdata); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void SDL_SetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); + public static extern void SDL_SetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction")] delegate* unmanaged[Cdecl] callback, [NativeTypeName("void*")] IntPtr userdata); [NativeTypeName("#define SDL_MAX_LOG_MESSAGE 4096")] public const int SDL_MAX_LOG_MESSAGE = 4096; diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs index 7e5ef84..dee9332 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs @@ -48,8 +48,7 @@ public enum SDL_MessageBoxButtonFlags public unsafe partial struct SDL_MessageBoxButtonData { - [NativeTypeName("Uint32")] - public uint flags; + public SDL_MessageBoxButtonFlags flags; public int buttonID; @@ -93,8 +92,7 @@ public partial struct _colors_e__FixedBuffer public unsafe partial struct SDL_MessageBoxData { - [NativeTypeName("Uint32")] - public uint flags; + public SDL_MessageBoxFlags flags; public SDL_Window* window; @@ -119,6 +117,6 @@ public static unsafe partial class SDL3 public static extern int SDL_ShowMessageBox([NativeTypeName("const SDL_MessageBoxData *")] SDL_MessageBoxData* messageboxdata, int* buttonid); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int SDL_ShowSimpleMessageBox([NativeTypeName("Uint32")] uint flags, [NativeTypeName("const char *")] byte* title, [NativeTypeName("const char *")] byte* message, SDL_Window* window); + public static extern int SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, [NativeTypeName("const char *")] byte* title, [NativeTypeName("const char *")] byte* message, SDL_Window* window); } } diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs index 409edd6..12c830d 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs @@ -40,8 +40,7 @@ public unsafe partial struct SDL_RendererInfo [NativeTypeName("const char *")] public byte* name; - [NativeTypeName("Uint32")] - public uint flags; + public SDL_RendererFlags flags; public int num_texture_formats; @@ -105,7 +104,7 @@ public static unsafe partial class SDL3 public static extern int SDL_CreateWindowAndRenderer(int width, int height, SDL_WindowFlags window_flags, SDL_Window** window, SDL_Renderer** renderer); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, [NativeTypeName("const char *")] byte* name, [NativeTypeName("Uint32")] uint flags); + public static extern SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, [NativeTypeName("const char *")] byte* name, SDL_RendererFlags flags); [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern SDL_Renderer* SDL_CreateRendererWithProperties(SDL_PropertiesID props); diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs index 0d7b1cc..2bd0ad8 100644 --- a/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -595,11 +595,11 @@ public static int SDL_size_add_overflow([NativeTypeName("size_t")] nuint a, [Nat [NativeTypeName("#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull))")] public const ulong SDL_MIN_UINT64 = ((ulong)(0x0000000000000000UL)); - [NativeTypeName("#define SDL_MAX_TIME SDL_MAX_SINT64")] - public const long SDL_MAX_TIME = ((long)(0x7FFFFFFFFFFFFFFFL)); + [NativeTypeName("#define SDL_MAX_TIME (SDL_Time)SDL_MAX_SINT64")] + public const SDL_Time SDL_MAX_TIME = (SDL_Time)((long)(0x7FFFFFFFFFFFFFFFL)); - [NativeTypeName("#define SDL_MIN_TIME SDL_MIN_SINT64")] - public const long SDL_MIN_TIME = ((long)(~0x7FFFFFFFFFFFFFFFL)); + [NativeTypeName("#define SDL_MIN_TIME (SDL_Time)SDL_MIN_SINT64")] + public const SDL_Time SDL_MIN_TIME = (SDL_Time)((long)(~0x7FFFFFFFFFFFFFFFL)); [NativeTypeName("#define SDL_FLT_EPSILON 1.1920928955078125e-07F")] public const float SDL_FLT_EPSILON = 1.1920928955078125e-07F; diff --git a/SDL3-CS/SDL3/SDL_quit.cs b/SDL3-CS/SDL3/SDL_quit.cs index 71dedc3..4f3d7d4 100644 --- a/SDL3-CS/SDL3/SDL_quit.cs +++ b/SDL3-CS/SDL3/SDL_quit.cs @@ -9,7 +9,7 @@ public partial class SDL3 public static unsafe bool SDL_QuitRequested() { SDL_PumpEvents(); - return SDL_PeepEvents(null, 0, SDL_eventaction.SDL_PEEKEVENT, (uint)SDL_EventType.SDL_EVENT_QUIT, (uint)SDL_EventType.SDL_EVENT_QUIT) > 0; + return SDL_PeepEvents(null, 0, SDL_eventaction.SDL_PEEKEVENT, SDL_EventType.SDL_EVENT_QUIT, SDL_EventType.SDL_EVENT_QUIT) > 0; } } } From bb9834d0a95eb6fffe0e422856c50acb7f1dca71 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 14:47:39 +0200 Subject: [PATCH 34/37] Add sample/tests project Just a playground to see how the string/type/array friendly overloads work. You'll have to provide the SDL3 library manually. --- SDL3-CS.Tests/MyWindow.cs | 238 +++++++++++++++++++++++++++++ SDL3-CS.Tests/ObjectHandle.cs | 95 ++++++++++++ SDL3-CS.Tests/Program.cs | 64 ++++++++ SDL3-CS.Tests/SDL3-CS.Tests.csproj | 16 ++ SDL3-CS.sln | 6 + 5 files changed, 419 insertions(+) create mode 100644 SDL3-CS.Tests/MyWindow.cs create mode 100644 SDL3-CS.Tests/ObjectHandle.cs create mode 100644 SDL3-CS.Tests/Program.cs create mode 100644 SDL3-CS.Tests/SDL3-CS.Tests.csproj diff --git a/SDL3-CS.Tests/MyWindow.cs b/SDL3-CS.Tests/MyWindow.cs new file mode 100644 index 0000000..e23e98b --- /dev/null +++ b/SDL3-CS.Tests/MyWindow.cs @@ -0,0 +1,238 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using osu.Framework.Allocation; +using SDL; +using static SDL.SDL3; + +namespace SDL3.Tests +{ + public sealed unsafe class MyWindow : IDisposable + { + private bool flash; + private ObjectHandle objectHandle { get; } + private SDL_Window* SDLWindowHandle; + private SDL_Renderer* Renderer; + private readonly bool initSuccess; + + private const SDL_InitFlags initFlags = SDL_InitFlags.SDL_INIT_VIDEO | SDL_InitFlags.SDL_INIT_GAMEPAD; + + public MyWindow() + { + if (SDL_InitSubSystem(initFlags) < 0) + throw new InvalidOperationException($"failed to initialise SDL. Error: {SDL_GetError()}"); + + initSuccess = true; + + objectHandle = new ObjectHandle(this, GCHandleType.Normal); + } + + public void Setup() + { + SDL_SetGamepadEventsEnabled(SDL_bool.SDL_TRUE); + SDL_SetEventFilter(&nativeFilter, objectHandle.Handle); + + if (OperatingSystem.IsWindows()) + SDL_SetWindowsMessageHook(&wndProc, objectHandle.Handle); + } + + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })] + private static SDL_bool wndProc(IntPtr userdata, MSG* message) + { + var handle = new ObjectHandle(userdata); + if (handle.GetTarget(out var window)) + { + Console.WriteLine($"from {window}, message: {message->message}"); + } + + return SDL_TRUE; // sample use of definition from SDL3 class, not SDL_bool enum + } + + // ReSharper disable once UseCollectionExpression + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })] + private static int nativeFilter(IntPtr userdata, SDL_Event* e) + { + var handle = new ObjectHandle(userdata); + if (handle.GetTarget(out var window)) + return window.handleEventFromFilter(e); + + return 1; + } + + public Action? EventFilter; + + private int handleEventFromFilter(SDL_Event* e) + { + switch (e->type) + { + case SDL_EventType.SDL_EVENT_KEY_UP: + case SDL_EventType.SDL_EVENT_KEY_DOWN: + handleKeyFromFilter(e->key); + break; + + default: + EventFilter?.Invoke(*e); + break; + } + + return 1; + } + + private void handleKeyFromFilter(SDL_KeyboardEvent e) + { + if (e.keysym.sym == SDL_Keycode.SDLK_f) + { + flash = true; + } + } + + public void Create() + { + SDLWindowHandle = SDL_CreateWindow("hello"u8, 800, 600, SDL_WindowFlags.SDL_WINDOW_RESIZABLE | SDL_WindowFlags.SDL_WINDOW_HIGH_PIXEL_DENSITY); + Renderer = SDL_CreateRenderer(SDLWindowHandle, (byte*)null, SDL_RendererFlags.SDL_RENDERER_PRESENTVSYNC); + } + + private void handleEvent(SDL_Event e) + { + switch (e.type) + { + case SDL_EventType.SDL_EVENT_QUIT: + run = false; + break; + + case SDL_EventType.SDL_EVENT_KEY_DOWN: + switch (e.key.keysym.sym) + { + case SDL_Keycode.SDLK_r: + bool old = SDL_GetRelativeMouseMode() == SDL_bool.SDL_TRUE; + SDL_SetRelativeMouseMode(old ? SDL_bool.SDL_FALSE : SDL_bool.SDL_TRUE); + break; + + case SDL_Keycode.SDLK_v: + string? text = SDL_GetClipboardText(); + Console.WriteLine($"clipboard: {text}"); + break; + + case SDL_Keycode.SDLK_F10: + SDL_SetWindowFullscreen(SDLWindowHandle, SDL_bool.SDL_FALSE); + break; + + case SDL_Keycode.SDLK_F11: + SDL_SetWindowFullscreen(SDLWindowHandle, SDL_bool.SDL_TRUE); + break; + + case SDL_Keycode.SDLK_j: + { + using var gamepads = SDL_GetGamepads(); + + if (gamepads == null || gamepads.Count == 0) + break; + + var gamepad = SDL_OpenGamepad(gamepads[0]); + + int count; + var bindings = SDL_GetGamepadBindings(gamepad, &count); + for (int i = 0; i < count; i++) + { + var binding = *bindings[i]; + Console.WriteLine(binding.input_type); + Console.WriteLine(binding.output_type); + Console.WriteLine(); + } + + SDL_CloseGamepad(gamepad); + break; + } + + case SDL_Keycode.SDLK_F1: + SDL_StartTextInput(); + break; + + case SDL_Keycode.SDLK_F2: + SDL_StopTextInput(); + break; + + case SDL_Keycode.SDLK_m: + SDL_Keymod mod = e.key.keysym.Mod; + Console.WriteLine(mod); + break; + } + + break; + + case SDL_EventType.SDL_EVENT_TEXT_INPUT: + Console.WriteLine(e.text.GetText()); + break; + + case SDL_EventType.SDL_EVENT_GAMEPAD_ADDED: + Console.WriteLine($"gamepad added: {e.gdevice.which}"); + break; + + case SDL_EventType.SDL_EVENT_WINDOW_PEN_ENTER: + SDL_PenCapabilityInfo info; + var cap = (SDL_PEN_CAPABILITIES)SDL_GetPenCapabilities((SDL_PenID)e.window.data1, &info); + + if (cap.HasFlag(SDL_PEN_CAPABILITIES.SDL_PEN_AXIS_XTILT_MASK)) + Console.WriteLine("has pen xtilt axis"); + + Console.WriteLine(info.max_tilt); + break; + } + } + + private bool run = true; + + private const int events_per_peep = 64; + private readonly SDL_Event[] events = new SDL_Event[events_per_peep]; + + private void pollEvents() + { + SDL_PumpEvents(); + + int eventsRead; + + do + { + fixed (SDL_Event* buf = events) + eventsRead = SDL_PeepEvents(buf, events_per_peep, SDL_eventaction.SDL_GETEVENT, SDL_EventType.SDL_EVENT_FIRST, SDL_EventType.SDL_EVENT_LAST); + + for (int i = 0; i < eventsRead; i++) + handleEvent(events[i]); + } while (eventsRead == events_per_peep); + } + + private float frame; + + public void Run() + { + while (run) + { + if (flash) + { + flash = false; + Console.WriteLine("flash!"); + } + + pollEvents(); + + SDL_SetRenderDrawColorFloat(Renderer, SDL_sinf(frame) / 2 + 0.5f, SDL_cosf(frame) / 2 + 0.5f, 0.3f, 1.0f); + SDL_RenderClear(Renderer); + SDL_RenderPresent(Renderer); + + frame += 0.015f; + + Thread.Sleep(10); + } + } + + public void Dispose() + { + if (initSuccess) + SDL_QuitSubSystem(initFlags); + + objectHandle.Dispose(); + } + } +} diff --git a/SDL3-CS.Tests/ObjectHandle.cs b/SDL3-CS.Tests/ObjectHandle.cs new file mode 100644 index 0000000..4252799 --- /dev/null +++ b/SDL3-CS.Tests/ObjectHandle.cs @@ -0,0 +1,95 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using System.Runtime.InteropServices; + +namespace osu.Framework.Allocation +{ + /// + /// Wrapper on that supports the pattern. + /// + public struct ObjectHandle : IDisposable + where T : class + { + /// + /// The pointer from the , if it is allocated. Otherwise . + /// + public IntPtr Handle => handle.IsAllocated ? GCHandle.ToIntPtr(handle) : IntPtr.Zero; + + /// + /// The address of target object, if it is allocated and pinned. Otherwise . + /// Note: This is not the same as the . + /// + public IntPtr Address => handle.IsAllocated ? handle.AddrOfPinnedObject() : IntPtr.Zero; + + public bool IsAllocated => handle.IsAllocated; + + private GCHandle handle; + + private readonly bool fromPointer; + + /// + /// Wraps the provided object with a , using the given . + /// + /// The target object to wrap. + /// The handle type to use. + public ObjectHandle(T target, GCHandleType handleType) + { + handle = GCHandle.Alloc(target, handleType); + fromPointer = false; + } + + /// + /// Recreates an based on the passed . + /// Disposing this object will not free the handle, the original object must be disposed instead. + /// + /// Handle. + public ObjectHandle(IntPtr handle) + { + this.handle = GCHandle.FromIntPtr(handle); + fromPointer = true; + } + + /// + /// Gets the object being referenced. + /// Returns true if successful and populates with the referenced object. + /// Returns false If the handle is not allocated or the target is not of type . + /// + /// Populates this parameter with the targeted object. + public bool GetTarget(out T target) + { + if (!handle.IsAllocated) + { + target = default; + return false; + } + + try + { + if (handle.Target is T value) + { + target = value; + return true; + } + } + catch (InvalidOperationException) + { + } + + target = default; + return false; + } + + #region IDisposable Support + + public void Dispose() + { + if (!fromPointer && handle.IsAllocated) + handle.Free(); + } + + #endregion + } +} diff --git a/SDL3-CS.Tests/Program.cs b/SDL3-CS.Tests/Program.cs new file mode 100644 index 0000000..045e97a --- /dev/null +++ b/SDL3-CS.Tests/Program.cs @@ -0,0 +1,64 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Diagnostics; +using System.Text; +using SDL; +using static SDL.SDL3; + +namespace SDL3.Tests +{ + public static class Program + { + private static void Main() + { + Console.OutputEncoding = Encoding.UTF8; + + SDL_SetHint(SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, "null byte \0 in string"u8); + Debug.Assert(SDL_GetHint(SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4) == "null byte "); + + SDL_SetHint(SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, "1"u8); + + using (var window = new MyWindow()) + { + Console.WriteLine($"SDL revision: {SDL_GetRevision()}"); + + printDisplays(); + + window.Setup(); + window.Create(); + + const SDL_Keymod state = SDL_Keymod.SDL_KMOD_CAPS | SDL_Keymod.SDL_KMOD_ALT; + SDL_SetModState(state); + Debug.Assert(SDL_GetModState() == state); + + window.Run(); + } + + SDL_Quit(); + } + + private static void printDisplays() + { + using var displays = SDL_GetDisplays(); + if (displays == null) + return; + + for (int i = 0; i < displays.Count; i++) + { + SDL_DisplayID id = displays[i]; + Console.WriteLine(id); + + using var modes = SDL_GetFullscreenDisplayModes(id); + if (modes == null) + continue; + + for (int j = 0; j < modes.Count; j++) + { + SDL_DisplayMode mode = modes[j]; + Console.WriteLine($"{mode.w}x{mode.h}@{mode.refresh_rate}"); + } + } + } + } +} diff --git a/SDL3-CS.Tests/SDL3-CS.Tests.csproj b/SDL3-CS.Tests/SDL3-CS.Tests.csproj new file mode 100644 index 0000000..0fe8dc8 --- /dev/null +++ b/SDL3-CS.Tests/SDL3-CS.Tests.csproj @@ -0,0 +1,16 @@ + + + + Exe + net8.0 + SDL3.Tests + enable + enable + true + + + + + + + diff --git a/SDL3-CS.sln b/SDL3-CS.sln index e3d75c1..98f5ca6 100644 --- a/SDL3-CS.sln +++ b/SDL3-CS.sln @@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS", "SDL3-CS\SDL3-CS. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.SourceGeneration", "SDL3-CS.SourceGeneration\SDL3-CS.SourceGeneration.csproj", "{432C86D0-D371-4D01-BFFE-01D2CDCCA7B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests", "SDL3-CS.Tests\SDL3-CS.Tests.csproj", "{CF980481-8227-4BED-970E-6433C83F64CB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -34,5 +36,9 @@ Global {432C86D0-D371-4D01-BFFE-01D2CDCCA7B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {432C86D0-D371-4D01-BFFE-01D2CDCCA7B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {432C86D0-D371-4D01-BFFE-01D2CDCCA7B8}.Release|Any CPU.Build.0 = Release|Any CPU + {CF980481-8227-4BED-970E-6433C83F64CB}.Debug|Any CPU.ActiveCfg = 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.Build.0 = Release|Any CPU EndGlobalSection EndGlobal From 3edde4807279b7acfc665b427408607bf7e11983 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 6 Apr 2024 15:37:29 +0200 Subject: [PATCH 35/37] Add [MustDisposeResource] annoations to array helpers --- SDL3-CS/SDL3-CS.csproj | 4 ++++ SDL3-CS/SDL3/SDL_audio.cs | 3 +++ SDL3-CS/SDL3/SDL_gamepad.cs | 4 ++++ SDL3-CS/SDL3/SDL_haptic.cs | 2 ++ SDL3-CS/SDL3/SDL_joystick.cs | 2 ++ SDL3-CS/SDL3/SDL_keyboard.cs | 2 ++ SDL3-CS/SDL3/SDL_mouse.cs | 2 ++ SDL3-CS/SDL3/SDL_pen.cs | 2 ++ SDL3-CS/SDL3/SDL_sensor.cs | 2 ++ SDL3-CS/SDL3/SDL_touch.cs | 2 ++ SDL3-CS/SDL3/SDL_video.cs | 3 +++ SDL3-CS/SDLArray.cs | 5 ++++- SDL3-CS/SDLPointerArray.cs | 2 ++ 13 files changed, 34 insertions(+), 1 deletion(-) diff --git a/SDL3-CS/SDL3-CS.csproj b/SDL3-CS/SDL3-CS.csproj index 9ddb845..cff8be8 100644 --- a/SDL3-CS/SDL3-CS.csproj +++ b/SDL3-CS/SDL3-CS.csproj @@ -12,4 +12,8 @@ + + + + diff --git a/SDL3-CS/SDL3/SDL_audio.cs b/SDL3-CS/SDL3/SDL_audio.cs index 1a0fe41..9743dac 100644 --- a/SDL3-CS/SDL3/SDL_audio.cs +++ b/SDL3-CS/SDL3/SDL_audio.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -59,6 +60,7 @@ public static partial class SDL3 [Macro] public static int SDL_AUDIO_FRAMESIZE(SDL_AudioSpec x) => SDL_AUDIO_BYTESIZE((x).format) * (x).channels; + [MustDisposeResource] public static unsafe SDLArray? SDL_GetAudioOutputDevices() { int count; @@ -66,6 +68,7 @@ public static partial class SDL3 return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLArray? SDL_GetAudioCaptureDevices() { int count; diff --git a/SDL3-CS/SDL3/SDL_gamepad.cs b/SDL3-CS/SDL3/SDL_gamepad.cs index f1c0a85..b22e209 100644 --- a/SDL3-CS/SDL3/SDL_gamepad.cs +++ b/SDL3-CS/SDL3/SDL_gamepad.cs @@ -3,6 +3,7 @@ using System; using System.Runtime.InteropServices; +using JetBrains.Annotations; namespace SDL { @@ -11,6 +12,7 @@ public static partial class SDL3 /// /// An array of that can be passed to . /// + [MustDisposeResource] public static unsafe SDLArray? SDL_GetGamepadMappings() { int count; @@ -18,6 +20,7 @@ public static partial class SDL3 return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLArray? SDL_GetGamepads() { int count; @@ -25,6 +28,7 @@ public static partial class SDL3 return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLPointerArray? SDL_GetGamepadBindings(SDL_Gamepad* gamepad) { int count; diff --git a/SDL3-CS/SDL3/SDL_haptic.cs b/SDL3-CS/SDL3/SDL_haptic.cs index eede833..9b52131 100644 --- a/SDL3-CS/SDL3/SDL_haptic.cs +++ b/SDL3-CS/SDL3/SDL_haptic.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -10,6 +11,7 @@ public enum SDL_HapticID : UInt32; public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetHaptics() { int count; diff --git a/SDL3-CS/SDL3/SDL_joystick.cs b/SDL3-CS/SDL3/SDL_joystick.cs index 5dff357..fdc7a2f 100644 --- a/SDL3-CS/SDL3/SDL_joystick.cs +++ b/SDL3-CS/SDL3/SDL_joystick.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -10,6 +11,7 @@ public enum SDL_JoystickID : UInt32; public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetJoysticks() { int count; diff --git a/SDL3-CS/SDL3/SDL_keyboard.cs b/SDL3-CS/SDL3/SDL_keyboard.cs index b5e32b3..cdd4ced 100644 --- a/SDL3-CS/SDL3/SDL_keyboard.cs +++ b/SDL3-CS/SDL3/SDL_keyboard.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -15,6 +16,7 @@ public partial struct SDL_Keysym public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetKeyboards() { int count; diff --git a/SDL3-CS/SDL3/SDL_mouse.cs b/SDL3-CS/SDL3/SDL_mouse.cs index 62be8af..2d473b6 100644 --- a/SDL3-CS/SDL3/SDL_mouse.cs +++ b/SDL3-CS/SDL3/SDL_mouse.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -32,6 +33,7 @@ public static partial class SDL3 [Macro] public static SDLButtonMask SDL_BUTTON(SDLButton button) => (SDLButtonMask)(1 << ((int)button - 1)); + [MustDisposeResource] public static unsafe SDLArray? SDL_GetMice() { int count; diff --git a/SDL3-CS/SDL3/SDL_pen.cs b/SDL3-CS/SDL3/SDL_pen.cs index 06f064b..aab107e 100644 --- a/SDL3-CS/SDL3/SDL_pen.cs +++ b/SDL3-CS/SDL3/SDL_pen.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -34,6 +35,7 @@ public static partial class SDL3 [Macro] public static SDL_PEN_CAPABILITIES SDL_PEN_AXIS_CAPABILITY(SDL_PenAxis axis) => SDL_PEN_CAPABILITY((int)axis + SDL_PEN_FLAG_AXIS_BIT_OFFSET); + [MustDisposeResource] public static unsafe SDLArray? SDL_GetPens() { int count; diff --git a/SDL3-CS/SDL3/SDL_sensor.cs b/SDL3-CS/SDL3/SDL_sensor.cs index 2361554..540b22c 100644 --- a/SDL3-CS/SDL3/SDL_sensor.cs +++ b/SDL3-CS/SDL3/SDL_sensor.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -10,6 +11,7 @@ public enum SDL_SensorID : UInt32; public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetSensors() { int count; diff --git a/SDL3-CS/SDL3/SDL_touch.cs b/SDL3-CS/SDL3/SDL_touch.cs index 772ac51..8c8ae44 100644 --- a/SDL3-CS/SDL3/SDL_touch.cs +++ b/SDL3-CS/SDL3/SDL_touch.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -19,6 +20,7 @@ public static partial class SDL3 [Constant] public const SDL_TouchID SDL_MOUSE_TOUCHID = unchecked((SDL_TouchID)(-1)); + [MustDisposeResource] public static unsafe SDLArray? SDL_GetTouchDevices() { int count; diff --git a/SDL3-CS/SDL3/SDL_video.cs b/SDL3-CS/SDL3/SDL_video.cs index 83c02fe..335eaf5 100644 --- a/SDL3-CS/SDL3/SDL_video.cs +++ b/SDL3-CS/SDL3/SDL_video.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -54,6 +55,7 @@ public static partial class SDL3 [Macro] public static bool SDL_WINDOWPOS_ISCENTERED(int X) => (((X) & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK); + [MustDisposeResource] public static unsafe SDLArray? SDL_GetDisplays() { int count; @@ -61,6 +63,7 @@ public static partial class SDL3 return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLPointerArray? SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID) { int count; diff --git a/SDL3-CS/SDLArray.cs b/SDL3-CS/SDLArray.cs index 65858f5..229ad8a 100644 --- a/SDL3-CS/SDLArray.cs +++ b/SDL3-CS/SDLArray.cs @@ -2,9 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { + [MustDisposeResource] public sealed unsafe class SDLArray : IDisposable where T : unmanaged { @@ -41,6 +43,7 @@ public void Dispose() internal static unsafe class SDLArray { + [MustDisposeResource] internal static SDLArray? Create(T* array, int count) where T : unmanaged { @@ -50,6 +53,7 @@ internal static unsafe class SDLArray return new SDLArray(array, count); } + [MustDisposeResource] internal static SDLPointerArray? Create(T** array, int count) where T : unmanaged { @@ -58,6 +62,5 @@ internal static unsafe class SDLArray return new SDLPointerArray(array, count); } - } } diff --git a/SDL3-CS/SDLPointerArray.cs b/SDL3-CS/SDLPointerArray.cs index 806266b..4e1d93b 100644 --- a/SDL3-CS/SDLPointerArray.cs +++ b/SDL3-CS/SDLPointerArray.cs @@ -3,10 +3,12 @@ using System; using System.Diagnostics; +using JetBrains.Annotations; namespace SDL { // T* can't be used as a type parameter, so this has to be a separate class + [MustDisposeResource] public sealed unsafe class SDLPointerArray : IDisposable where T : unmanaged { From 8003b85aa20f24bcfe41b66dd2d0fbf78000bfe5 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sun, 7 Apr 2024 12:28:18 +0900 Subject: [PATCH 36/37] Add DotSettings --- SDL3-CS.sln.DotSettings | 782 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 782 insertions(+) create mode 100644 SDL3-CS.sln.DotSettings diff --git a/SDL3-CS.sln.DotSettings b/SDL3-CS.sln.DotSettings new file mode 100644 index 0000000..21fd1f1 --- /dev/null +++ b/SDL3-CS.sln.DotSettings @@ -0,0 +1,782 @@ + + True + True + True + True + True + ExplicitlyExcluded + ExplicitlyExcluded + g_*.cs + WARNING + WARNING + WARNING + WARNING + HINT + HINT + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + HINT + DO_NOT_SHOW + WARNING + WARNING + HINT + HINT + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + HINT + WARNING + HINT + SUGGESTION + HINT + HINT + HINT + WARNING + DO_NOT_SHOW + WARNING + WARNING + WARNING + WARNING + DO_NOT_SHOW + WARNING + WARNING + WARNING + DO_NOT_SHOW + WARNING + WARNING + WARNING + WARNING + WARNING + HINT + WARNING + HINT + DO_NOT_SHOW + WARNING + DO_NOT_SHOW + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + HINT + WARNING + DO_NOT_SHOW + WARNING + HINT + DO_NOT_SHOW + HINT + HINT + HINT + DO_NOT_SHOW + WARNING + HINT + HINT + HINT + WARNING + WARNING + HINT + DO_NOT_SHOW + HINT + HINT + HINT + HINT + WARNING + DO_NOT_SHOW + DO_NOT_SHOW + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + HINT + WARNING + WARNING + WARNING + WARNING + HINT + HINT + WARNING + HINT + HINT + HINT + HINT + HINT + HINT + HINT + DO_NOT_SHOW + HINT + HINT + WARNING + HINT + HINT + WARNING + HINT + WARNING + WARNING + WARNING + WARNING + HINT + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + ERROR + WARNING + HINT + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + HINT + WARNING + WARNING + SUGGESTION + DO_NOT_SHOW + DO_NOT_SHOW + WARNING + WARNING + WARNING + WARNING + WARNING + HINT + WARNING + HINT + HINT + HINT + HINT + HINT + HINT + HINT + HINT + HINT + HINT + DO_NOT_SHOW + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + HINT + WARNING + HINT + HINT + WARNING + WARNING + Low + True + <?xml version="1.0" encoding="utf-16"?><Profile name="Code Cleanup (peppy)"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSUpdateFileHeader>True</CSUpdateFileHeader><CSCodeStyleAttributes ArrangeTypeAccessModifier="False" ArrangeTypeMemberAccessModifier="False" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="False" ArrangeBraces="False" ArrangeAttributes="False" ArrangeArgumentsStyle="False" /><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CSArrangeQualifiers>True</CSArrangeQualifiers></Profile> + Code Cleanup (peppy) + RequiredForMultiline + RequiredForMultiline + RequiredForMultiline + RequiredForMultiline + RequiredForMultiline + RequiredForMultiline + RequiredForMultiline + RequiredForMultiline + ExpressionBody + BlockScoped + ExplicitlyTyped + True + True + True + True + True + True + True + True + 1 + 1 + True + True + True + True + 1 + 1 + True + NEVER + NEVER + False + NEVER + False + CHOP_IF_LONG + True + 200 + <?xml version="1.0" encoding="utf-16"?> +<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> + <TypePattern DisplayName="COM interfaces or structs"> + <TypePattern.Match> + <Or> + <And> + <Kind Is="Interface" /> + <Or> + <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" /> + <HasAttribute Name="System.Runtime.InteropServices.ComImport" /> + </Or> + </And> + <Kind Is="Struct" /> + </Or> + </TypePattern.Match> + </TypePattern> + <TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All"> + <TypePattern.Match> + <And> + <Kind Is="Class" /> + <HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="True" /> + </And> + </TypePattern.Match> + <Entry DisplayName="Setup/Teardown Methods"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <Or> + <HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.FixtureSetUpAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.FixtureTearDownAttribute" Inherited="True" /> + </Or> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="All other members" /> + <Entry Priority="100" DisplayName="Test Methods"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="NUnit.Framework.TestAttribute" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + <TypePattern DisplayName="Default Pattern"> + <Group DisplayName="Fields/Properties"> + <Group DisplayName="Public Fields"> + <Entry DisplayName="Constant Fields"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Or> + <Kind Is="Constant" /> + <Readonly /> + <And> + <Static /> + <Readonly /> + </And> + </Or> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Static Fields"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Static /> + <Not> + <Readonly /> + </Not> + <Kind Is="Field" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Normal Fields"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Not> + <Or> + <Static /> + <Readonly /> + </Or> + </Not> + <Kind Is="Field" /> + </And> + </Entry.Match> + </Entry> + </Group> + <Entry DisplayName="Public Properties"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Property" /> + </And> + </Entry.Match> + </Entry> + <Group DisplayName="Internal Fields"> + <Entry DisplayName="Constant Fields"> + <Entry.Match> + <And> + <Access Is="Internal" /> + <Or> + <Kind Is="Constant" /> + <Readonly /> + <And> + <Static /> + <Readonly /> + </And> + </Or> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Static Fields"> + <Entry.Match> + <And> + <Access Is="Internal" /> + <Static /> + <Not> + <Readonly /> + </Not> + <Kind Is="Field" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Normal Fields"> + <Entry.Match> + <And> + <Access Is="Internal" /> + <Not> + <Or> + <Static /> + <Readonly /> + </Or> + </Not> + <Kind Is="Field" /> + </And> + </Entry.Match> + </Entry> + </Group> + <Entry DisplayName="Internal Properties"> + <Entry.Match> + <And> + <Access Is="Internal" /> + <Kind Is="Property" /> + </And> + </Entry.Match> + </Entry> + <Group DisplayName="Protected Fields"> + <Entry DisplayName="Constant Fields"> + <Entry.Match> + <And> + <Access Is="Protected" /> + <Or> + <Kind Is="Constant" /> + <Readonly /> + <And> + <Static /> + <Readonly /> + </And> + </Or> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Static Fields"> + <Entry.Match> + <And> + <Access Is="Protected" /> + <Static /> + <Not> + <Readonly /> + </Not> + <Kind Is="Field" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Normal Fields"> + <Entry.Match> + <And> + <Access Is="Protected" /> + <Not> + <Or> + <Static /> + <Readonly /> + </Or> + </Not> + <Kind Is="Field" /> + </And> + </Entry.Match> + </Entry> + </Group> + <Entry DisplayName="Protected Properties"> + <Entry.Match> + <And> + <Access Is="Protected" /> + <Kind Is="Property" /> + </And> + </Entry.Match> + </Entry> + <Group DisplayName="Private Fields"> + <Entry DisplayName="Constant Fields"> + <Entry.Match> + <And> + <Access Is="Private" /> + <Or> + <Kind Is="Constant" /> + <Readonly /> + <And> + <Static /> + <Readonly /> + </And> + </Or> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Static Fields"> + <Entry.Match> + <And> + <Access Is="Private" /> + <Static /> + <Not> + <Readonly /> + </Not> + <Kind Is="Field" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Normal Fields"> + <Entry.Match> + <And> + <Access Is="Private" /> + <Not> + <Or> + <Static /> + <Readonly /> + </Or> + </Not> + <Kind Is="Field" /> + </And> + </Entry.Match> + </Entry> + </Group> + <Entry DisplayName="Private Properties"> + <Entry.Match> + <And> + <Access Is="Private" /> + <Kind Is="Property" /> + </And> + </Entry.Match> + </Entry> + </Group> + <Group DisplayName="Constructor/Destructor"> + <Entry DisplayName="Ctor"> + <Entry.Match> + <Kind Is="Constructor" /> + </Entry.Match> + </Entry> + <Region Name="Disposal"> + <Entry DisplayName="Dtor"> + <Entry.Match> + <Kind Is="Destructor" /> + </Entry.Match> + </Entry> + <Entry DisplayName="Dispose()"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Method" /> + <Name Is="Dispose" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Dispose(true)"> + <Entry.Match> + <And> + <Access Is="Protected" /> + <Or> + <Virtual /> + <Override /> + </Or> + <Kind Is="Method" /> + <Name Is="Dispose" /> + </And> + </Entry.Match> + </Entry> + </Region> + </Group> + <Group DisplayName="Methods"> + <Group DisplayName="Public"> + <Entry DisplayName="Static Methods"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Static /> + <Kind Is="Method" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Methods"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Not> + <Static /> + </Not> + <Kind Is="Method" /> + </And> + </Entry.Match> + </Entry> + </Group> + <Group DisplayName="Internal"> + <Entry DisplayName="Static Methods"> + <Entry.Match> + <And> + <Access Is="Internal" /> + <Static /> + <Kind Is="Method" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Methods"> + <Entry.Match> + <And> + <Access Is="Internal" /> + <Not> + <Static /> + </Not> + <Kind Is="Method" /> + </And> + </Entry.Match> + </Entry> + </Group> + <Group DisplayName="Protected"> + <Entry DisplayName="Static Methods"> + <Entry.Match> + <And> + <Access Is="Protected" /> + <Static /> + <Kind Is="Method" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Methods"> + <Entry.Match> + <And> + <Access Is="Protected" /> + <Not> + <Static /> + </Not> + <Kind Is="Method" /> + </And> + </Entry.Match> + </Entry> + </Group> + <Group DisplayName="Private"> + <Entry DisplayName="Static Methods"> + <Entry.Match> + <And> + <Access Is="Private" /> + <Static /> + <Kind Is="Method" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Methods"> + <Entry.Match> + <And> + <Access Is="Private" /> + <Not> + <Static /> + </Not> + <Kind Is="Method" /> + </And> + </Entry.Match> + </Entry> + </Group> + </Group> + </TypePattern> +</Patterns> + UseExplicitType + UseVarWhenEvident + UseVarWhenEvident + False + False + 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. + + True + Replace + True + False + True + True + False + False + True + False + False + True + True + True + + + AABB + API + ARGB + BNG + BPM + D + GC + GL + GLSL + GMT + HID + HSL + HSV + HUD + ID + IL + IOS + IOSGL + IP + IPC + JIT + LTRB + MD + NRT + NS + OS + PM + PP + QAT + RGB + RGBA + RNG + SDL + SHA + SRGB + SS + TK + UI + WM + False + <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> + <Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"><ExtraRule Prefix="_" Suffix="" Style="aaBb" /></Policy> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Type parameters"><ElementKinds><Kind Name="TYPE_PARAMETER" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"><ExtraRule Prefix="_" Suffix="" Style="aaBb" /></Policy></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Constant fields (not private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local functions"><ElementKinds><Kind Name="LOCAL_FUNCTION" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Enum members"><ElementKinds><Kind Name="ENUM_MEMBER" /></ElementKinds></Descriptor><Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="private methods"><ElementKinds><Kind Name="ASYNC_METHOD" /><Kind Name="METHOD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public" Description="internal/protected/public methods"><ElementKinds><Kind Name="ASYNC_METHOD" /><Kind Name="METHOD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="private properties"><ElementKinds><Kind Name="PROPERTY" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local constants"><ElementKinds><Kind Name="LOCAL_CONSTANT" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static readonly fields (not private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public" Description="internal/protected/public properties"><ElementKinds><Kind Name="PROPERTY" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> \ No newline at end of file From 913afa5b4fa7e0cfaffc3f37f79647f1de75c9ac Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sun, 7 Apr 2024 12:31:45 +0900 Subject: [PATCH 37/37] Refactorings + auto styling --- Directory.Build.props | 4 +- .../FriendlyOverloadGenerator.cs | 75 ++++++++++--------- .../UnfriendlyMethodFinder.cs | 7 +- SDL3-CS.Tests/MyWindow.cs | 27 +++---- SDL3-CS.Tests/ObjectHandle.cs | 2 +- SDL3-CS.Tests/Program.cs | 2 +- SDL3-CS.sln.DotSettings | 1 + SDL3-CS/ConstantAttribute.cs | 2 +- SDL3-CS/SDL3/SDL_camera.cs | 3 + SDL3-CS/TypedefAttribute.cs | 2 +- 10 files changed, 66 insertions(+), 59 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index a22ba87..0af7e08 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -21,7 +21,7 @@ SDL3-CS Automated release. MIT - https://github.com/ppy/osu-framework - https://github.com/ppy/osu-framework + https://github.com/ppy/SDL3-CS + https://github.com/ppy/SDL3-CS diff --git a/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs b/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs index 387c1df..0830bd1 100644 --- a/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs +++ b/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs @@ -29,6 +29,7 @@ public void Initialize(GeneratorInitializationContext context) public void Execute(GeneratorExecutionContext context) { var finder = (UnfriendlyMethodFinder)context.SyntaxReceiver!; + foreach (var kvp in finder.Methods) { string filename = kvp.Key; @@ -38,16 +39,16 @@ public void Execute(GeneratorExecutionContext context) result.Append(file_header); result.Append( SyntaxFactory.NamespaceDeclaration( - SyntaxFactory.IdentifierName("SDL")) - .WithMembers( - SyntaxFactory.SingletonList( - SyntaxFactory.ClassDeclaration("SDL3") - .WithModifiers( - SyntaxFactory.TokenList( - SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), - SyntaxFactory.Token(SyntaxKind.PartialKeyword))) - .WithMembers(SyntaxFactory.List(foundMethods.Select(makeFriendlyMethod))))) - .NormalizeWhitespace()); + SyntaxFactory.IdentifierName("SDL")) + .WithMembers( + SyntaxFactory.SingletonList( + SyntaxFactory.ClassDeclaration("SDL3") + .WithModifiers( + SyntaxFactory.TokenList( + SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), + SyntaxFactory.Token(SyntaxKind.PartialKeyword))) + .WithMembers(SyntaxFactory.List(foundMethods.Select(makeFriendlyMethod))))) + .NormalizeWhitespace()); context.AddSource(filename, result.ToString()); } @@ -64,16 +65,16 @@ private static MemberDeclarationSyntax makeFriendlyMethod(GeneratedMethod gm) : gm.NativeMethod.Identifier; return SyntaxFactory.MethodDeclaration(returnType, identifier) - .WithModifiers( - SyntaxFactory.TokenList( - SyntaxFactory.Token(SyntaxKind.PublicKeyword), - SyntaxFactory.Token(SyntaxKind.StaticKeyword))) - .WithParameterList( - SyntaxFactory.ParameterList( - SyntaxFactory.SeparatedList(transformParams(gm)))) - .WithBody( - SyntaxFactory.Block( - makeMethodBody(gm))); + .WithModifiers( + SyntaxFactory.TokenList( + SyntaxFactory.Token(SyntaxKind.PublicKeyword), + SyntaxFactory.Token(SyntaxKind.StaticKeyword))) + .WithParameterList( + SyntaxFactory.ParameterList( + SyntaxFactory.SeparatedList(transformParams(gm)))) + .WithBody( + SyntaxFactory.Block( + makeMethodBody(gm))); } private static IEnumerable transformParams(GeneratedMethod gm) @@ -84,7 +85,7 @@ private static IEnumerable transformParams(GeneratedMethod gm) { Debug.Assert(gm.RequiredChanges.HasFlag(Changes.ChangeParamsToReadOnlySpan)); yield return param.WithType(SyntaxFactory.ParseTypeName("ReadOnlySpan")) - .WithAttributeLists(SyntaxFactory.List()); + .WithAttributeLists(SyntaxFactory.List()); } else { @@ -108,10 +109,10 @@ private static StatementSyntax makeMethodBody(GeneratedMethod gm) SyntaxFactory.ParseTypeName("byte*"), SyntaxFactory.SingletonSeparatedList( SyntaxFactory.VariableDeclarator( - param.Identifier.ValueText + pointer_suffix) - .WithInitializer( - SyntaxFactory.EqualsValueClause( - SyntaxFactory.IdentifierName(param.Identifier))))), + param.Identifier.ValueText + pointer_suffix) + .WithInitializer( + SyntaxFactory.EqualsValueClause( + SyntaxFactory.IdentifierName(param.Identifier))))), expr); } @@ -125,16 +126,16 @@ private static StatementSyntax makeReturn(GeneratedMethod gm) if (gm.RequiredChanges.HasFlag(Changes.ChangeReturnTypeToString)) { expr = SyntaxFactory.InvocationExpression( - SyntaxFactory.IdentifierName("PtrToStringUTF8")) - .WithArguments(new[] - { - SyntaxFactory.Argument(makeFunctionCall(gm)), - SyntaxFactory.Argument(SyntaxFactory.LiteralExpression( - gm.RequiredChanges.HasFlag(Changes.FreeReturnedPointer) - ? SyntaxKind.TrueLiteralExpression - : SyntaxKind.FalseLiteralExpression)) - } - ); + SyntaxFactory.IdentifierName("PtrToStringUTF8")) + .WithArguments(new[] + { + SyntaxFactory.Argument(makeFunctionCall(gm)), + SyntaxFactory.Argument(SyntaxFactory.LiteralExpression( + gm.RequiredChanges.HasFlag(Changes.FreeReturnedPointer) + ? SyntaxKind.TrueLiteralExpression + : SyntaxKind.FalseLiteralExpression)) + } + ); } else { @@ -150,8 +151,8 @@ private static StatementSyntax makeReturn(GeneratedMethod gm) private static InvocationExpressionSyntax makeFunctionCall(GeneratedMethod gm) { return SyntaxFactory.InvocationExpression( - SyntaxFactory.IdentifierName(gm.NativeMethod.Identifier)) - .WithArguments(makeArguments(gm)); + SyntaxFactory.IdentifierName(gm.NativeMethod.Identifier)) + .WithArguments(makeArguments(gm)); } private static IEnumerable makeArguments(GeneratedMethod gm) diff --git a/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs index 56bfa67..944fa3c 100644 --- a/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs +++ b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -12,16 +13,16 @@ namespace SDL3.SourceGeneration { public class UnfriendlyMethodFinder : ISyntaxReceiver { - public readonly Dictionary> Methods = new(); + public readonly Dictionary> Methods = new Dictionary>(); public void OnVisitSyntaxNode(SyntaxNode syntaxNode) { if (syntaxNode is MethodDeclarationSyntax method) { string name = method.Identifier.ValueText; - bool isUnsafe = name.StartsWith($"{Helper.UnsafePrefix}SDL_"); + bool isUnsafe = name.StartsWith($"{Helper.UnsafePrefix}SDL_", StringComparison.Ordinal); - if (!name.StartsWith("SDL_") && !isUnsafe) + if (!name.StartsWith("SDL_", StringComparison.Ordinal) && !isUnsafe) return; if (method.ParameterList.Parameters.Any(p => p.Identifier.IsKind(SyntaxKind.ArgListKeyword))) diff --git a/SDL3-CS.Tests/MyWindow.cs b/SDL3-CS.Tests/MyWindow.cs index e23e98b..b647deb 100644 --- a/SDL3-CS.Tests/MyWindow.cs +++ b/SDL3-CS.Tests/MyWindow.cs @@ -3,7 +3,6 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using osu.Framework.Allocation; using SDL; using static SDL.SDL3; @@ -13,15 +12,15 @@ public sealed unsafe class MyWindow : IDisposable { private bool flash; private ObjectHandle objectHandle { get; } - private SDL_Window* SDLWindowHandle; - private SDL_Renderer* Renderer; + private SDL_Window* sdlWindowHandle; + private SDL_Renderer* renderer; private readonly bool initSuccess; - private const SDL_InitFlags initFlags = SDL_InitFlags.SDL_INIT_VIDEO | SDL_InitFlags.SDL_INIT_GAMEPAD; + private const SDL_InitFlags init_flags = SDL_InitFlags.SDL_INIT_VIDEO | SDL_InitFlags.SDL_INIT_GAMEPAD; public MyWindow() { - if (SDL_InitSubSystem(initFlags) < 0) + if (SDL_InitSubSystem(init_flags) < 0) throw new InvalidOperationException($"failed to initialise SDL. Error: {SDL_GetError()}"); initSuccess = true; @@ -42,6 +41,7 @@ public void Setup() private static SDL_bool wndProc(IntPtr userdata, MSG* message) { var handle = new ObjectHandle(userdata); + if (handle.GetTarget(out var window)) { Console.WriteLine($"from {window}, message: {message->message}"); @@ -90,8 +90,8 @@ private void handleKeyFromFilter(SDL_KeyboardEvent e) public void Create() { - SDLWindowHandle = SDL_CreateWindow("hello"u8, 800, 600, SDL_WindowFlags.SDL_WINDOW_RESIZABLE | SDL_WindowFlags.SDL_WINDOW_HIGH_PIXEL_DENSITY); - Renderer = SDL_CreateRenderer(SDLWindowHandle, (byte*)null, SDL_RendererFlags.SDL_RENDERER_PRESENTVSYNC); + sdlWindowHandle = SDL_CreateWindow("hello"u8, 800, 600, SDL_WindowFlags.SDL_WINDOW_RESIZABLE | SDL_WindowFlags.SDL_WINDOW_HIGH_PIXEL_DENSITY); + renderer = SDL_CreateRenderer(sdlWindowHandle, (byte*)null, SDL_RendererFlags.SDL_RENDERER_PRESENTVSYNC); } private void handleEvent(SDL_Event e) @@ -116,11 +116,11 @@ private void handleEvent(SDL_Event e) break; case SDL_Keycode.SDLK_F10: - SDL_SetWindowFullscreen(SDLWindowHandle, SDL_bool.SDL_FALSE); + SDL_SetWindowFullscreen(sdlWindowHandle, SDL_bool.SDL_FALSE); break; case SDL_Keycode.SDLK_F11: - SDL_SetWindowFullscreen(SDLWindowHandle, SDL_bool.SDL_TRUE); + SDL_SetWindowFullscreen(sdlWindowHandle, SDL_bool.SDL_TRUE); break; case SDL_Keycode.SDLK_j: @@ -134,6 +134,7 @@ private void handleEvent(SDL_Event e) int count; var bindings = SDL_GetGamepadBindings(gamepad, &count); + for (int i = 0; i < count; i++) { var binding = *bindings[i]; @@ -217,9 +218,9 @@ public void Run() pollEvents(); - SDL_SetRenderDrawColorFloat(Renderer, SDL_sinf(frame) / 2 + 0.5f, SDL_cosf(frame) / 2 + 0.5f, 0.3f, 1.0f); - SDL_RenderClear(Renderer); - SDL_RenderPresent(Renderer); + SDL_SetRenderDrawColorFloat(renderer, SDL_sinf(frame) / 2 + 0.5f, SDL_cosf(frame) / 2 + 0.5f, 0.3f, 1.0f); + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); frame += 0.015f; @@ -230,7 +231,7 @@ public void Run() public void Dispose() { if (initSuccess) - SDL_QuitSubSystem(initFlags); + SDL_QuitSubSystem(init_flags); objectHandle.Dispose(); } diff --git a/SDL3-CS.Tests/ObjectHandle.cs b/SDL3-CS.Tests/ObjectHandle.cs index 4252799..1cd332f 100644 --- a/SDL3-CS.Tests/ObjectHandle.cs +++ b/SDL3-CS.Tests/ObjectHandle.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; -namespace osu.Framework.Allocation +namespace SDL3.Tests { /// /// Wrapper on that supports the pattern. diff --git a/SDL3-CS.Tests/Program.cs b/SDL3-CS.Tests/Program.cs index 045e97a..6e87f94 100644 --- a/SDL3-CS.Tests/Program.cs +++ b/SDL3-CS.Tests/Program.cs @@ -10,7 +10,7 @@ namespace SDL3.Tests { public static class Program { - private static void Main() + public static void Main() { Console.OutputEncoding = Encoding.UTF8; diff --git a/SDL3-CS.sln.DotSettings b/SDL3-CS.sln.DotSettings index 21fd1f1..45e9c9e 100644 --- a/SDL3-CS.sln.DotSettings +++ b/SDL3-CS.sln.DotSettings @@ -54,6 +54,7 @@ WARNING WARNING WARNING + DO_NOT_SHOW HINT WARNING HINT diff --git a/SDL3-CS/ConstantAttribute.cs b/SDL3-CS/ConstantAttribute.cs index 9dce031..12c1059 100644 --- a/SDL3-CS/ConstantAttribute.cs +++ b/SDL3-CS/ConstantAttribute.cs @@ -8,7 +8,7 @@ namespace SDL { /// /// Denotes a manually defined constant. - /// Such consants should be excluded from ClangSharp generation to prevent warnings or duplicate definitions. + /// Such constants should be excluded from ClangSharp generation to prevent warnings or duplicate definitions. /// Handled by get_manually_written_symbols() in generate_bindings.py. /// [AttributeUsage(AttributeTargets.Field)] diff --git a/SDL3-CS/SDL3/SDL_camera.cs b/SDL3-CS/SDL3/SDL_camera.cs index b6a664e..714929b 100644 --- a/SDL3-CS/SDL3/SDL_camera.cs +++ b/SDL3-CS/SDL3/SDL_camera.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; namespace SDL { @@ -10,6 +11,7 @@ public enum SDL_CameraDeviceID : UInt32; public static partial class SDL3 { + [MustDisposeResource] public static unsafe SDLArray? SDL_GetCameraDevices() { int count; @@ -17,6 +19,7 @@ public static partial class SDL3 return SDLArray.Create(array, count); } + [MustDisposeResource] public static unsafe SDLArray? SDL_GetCameraDeviceSupportedFormats(SDL_CameraDeviceID devid) { int count; diff --git a/SDL3-CS/TypedefAttribute.cs b/SDL3-CS/TypedefAttribute.cs index 54d4f7e..901271c 100644 --- a/SDL3-CS/TypedefAttribute.cs +++ b/SDL3-CS/TypedefAttribute.cs @@ -8,7 +8,7 @@ namespace SDL { /// /// Denotes a C typedef that is expressed as an enum in C#. - /// These need to be manually signaled to ClagnSharp so it uses the custom enum type instaed of the underlying type. + /// These need to be manually signaled to ClangSharp so it uses the custom enum type instead of the underlying type. /// Handled by get_typedefs() in generate_bindings.py. /// [AttributeUsage(AttributeTargets.Enum)]