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/.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..2e2f897 --- /dev/null +++ b/.gitignore @@ -0,0 +1,339 @@ +## 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 +*.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 + +sdl.json 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/.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/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..0af7e08 --- /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/SDL3-CS + https://github.com/ppy/SDL3-CS + + 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.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..0830bd1 --- /dev/null +++ b/SDL3-CS.SourceGeneration/FriendlyOverloadGenerator.cs @@ -0,0 +1,174 @@ +// 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..2eb2dad --- /dev/null +++ b/SDL3-CS.SourceGeneration/Helper.cs @@ -0,0 +1,80 @@ +// 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 + { + /// + /// 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 + && 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..944fa3c --- /dev/null +++ b/SDL3-CS.SourceGeneration/UnfriendlyMethodFinder.cs @@ -0,0 +1,60 @@ +// 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; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace SDL3.SourceGeneration +{ + public class UnfriendlyMethodFinder : ISyntaxReceiver + { + 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_", StringComparison.Ordinal); + + if (!name.StartsWith("SDL_", StringComparison.Ordinal) && !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.Tests/MyWindow.cs b/SDL3-CS.Tests/MyWindow.cs new file mode 100644 index 0000000..b647deb --- /dev/null +++ b/SDL3-CS.Tests/MyWindow.cs @@ -0,0 +1,239 @@ +// 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 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 init_flags = SDL_InitFlags.SDL_INIT_VIDEO | SDL_InitFlags.SDL_INIT_GAMEPAD; + + public MyWindow() + { + if (SDL_InitSubSystem(init_flags) < 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(init_flags); + + objectHandle.Dispose(); + } + } +} diff --git a/SDL3-CS.Tests/ObjectHandle.cs b/SDL3-CS.Tests/ObjectHandle.cs new file mode 100644 index 0000000..1cd332f --- /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 SDL3.Tests +{ + /// + /// 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..6e87f94 --- /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 + { + public 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.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..98f5ca6 --- /dev/null +++ b/SDL3-CS.sln @@ -0,0 +1,44 @@ + +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 +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 + 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 + {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 + {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 diff --git a/SDL3-CS.sln.DotSettings b/SDL3-CS.sln.DotSettings new file mode 100644 index 0000000..45e9c9e --- /dev/null +++ b/SDL3-CS.sln.DotSettings @@ -0,0 +1,783 @@ + + 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 + DO_NOT_SHOW + 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 diff --git a/SDL3-CS/ConstantAttribute.cs b/SDL3-CS/ConstantAttribute.cs new file mode 100644 index 0000000..12c1059 --- /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 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)] + [Conditional("NEVER")] + public class ConstantAttribute : Attribute; +} 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/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-use-proper-types.patch b/SDL3-CS/SDL-use-proper-types.patch new file mode 100644 index 0000000..631fdba --- /dev/null +++ b/SDL3-CS/SDL-use-proper-types.patch @@ -0,0 +1,330 @@ +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..8aafb96c8 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; + + /** +@@ -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/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..cff8be8 --- /dev/null +++ b/SDL3-CS/SDL3-CS.csproj @@ -0,0 +1,19 @@ + + + + net8.0 + SDL + enable + true + $(NoWarn);SYSLIB1054;CA1401 + + + + + + + + + + + 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; + } + } +} 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..6b324fe --- /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; +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)] + 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); + + [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)] + 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); + + [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)] + 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*")] + public static extern IntPtr SDL_AtomicSetPtr([NativeTypeName("void **")] IntPtr* a, [NativeTypeName("void*")] IntPtr v); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [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 new file mode 100644 index 0000000..f2abf5c --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs @@ -0,0 +1,217 @@ +/* + + 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_AudioSpec + { + public SDL_AudioFormat 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, EntryPoint = "SDL_GetAudioDriver", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetAudioDriver(int index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCurrentAudioDriver", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetCurrentAudioDriver(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_AudioDeviceID* SDL_GetAudioOutputDevices(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_AudioDeviceID* SDL_GetAudioCaptureDevices(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetAudioDeviceName", ExactSpelling = true)] + [return: NativeTypeName("char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_AudioDeviceID dev); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_AudioDevicePaused(SDL_AudioDeviceID dev); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_CloseAudioDevice(SDL_AudioDeviceID devid); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnbindAudioStream(SDL_AudioStream* stream); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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)] + 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); + + [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 *")] IntPtr buf, int len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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, [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, [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(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(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, 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, 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(SDL_AudioFormat 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_DEVICE_DEFAULT_OUTPUT ((SDL_AudioDeviceID) 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 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_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..2b7b5f0 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_camera.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 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, EntryPoint = "SDL_GetCameraDriver", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetCameraDriver(int index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCurrentCameraDriver", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetCurrentCameraDriver(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_CameraDeviceID* SDL_GetCameraDevices(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_CameraSpec* SDL_GetCameraDeviceSupportedFormats(SDL_CameraDeviceID devid, int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCameraDeviceName", ExactSpelling = true)] + [return: NativeTypeName("char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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)] + public static extern SDL_CameraDeviceID SDL_GetCameraInstanceID(SDL_Camera* camera); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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..eecc249 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_clipboard.g.cs @@ -0,0 +1,66 @@ +/* + + 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 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, EntryPoint = "SDL_GetClipboardText", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_GetClipboardText(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPrimarySelectionText", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_GetPrimarySelectionText(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_ClearClipboardData(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [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)] + 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 new file mode 100644 index 0000000..b10e4b2 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_cpuinfo.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 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)] + public static extern SDL_bool SDL_HasAltiVec(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasMMX(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasSSE(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasSSE2(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasSSE3(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasSSE41(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasSSE42(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasAVX(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasAVX2(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasAVX512F(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasARMSIMD(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasNEON(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasLSX(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool 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..365aa52 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_dialog.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; +using System.Runtime.InteropServices; + +namespace SDL +{ + public unsafe partial struct SDL_DialogFileFilter + { + [NativeTypeName("const char *")] + public byte* name; + + [NativeTypeName("const char *")] + 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, [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, SDL_bool 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..1b5a02c --- /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 *")] byte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetError", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_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..5cf20ff --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_events.g.cs @@ -0,0 +1,1101 @@ +/* + + 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_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 + { + public SDL_EventType 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; + + public SDL_DisplayID 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; + + public SDL_WindowID 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; + + public SDL_KeyboardID which; + } + + public partial struct SDL_KeyboardEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + public SDL_WindowID windowID; + + public SDL_KeyboardID 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; + + public SDL_WindowID windowID; + + [NativeTypeName("char *")] + public byte* 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; + + public SDL_WindowID windowID; + + [NativeTypeName("char *")] + public byte* text; + } + + public partial struct SDL_MouseDeviceEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + public SDL_MouseID which; + } + + public partial struct SDL_MouseMotionEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + public SDL_WindowID windowID; + + public SDL_MouseID 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; + + public SDL_WindowID windowID; + + public SDL_MouseID 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; + + public SDL_WindowID windowID; + + public SDL_MouseID 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; + + public SDL_JoystickID 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; + + public SDL_JoystickID 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; + + public SDL_JoystickID 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; + + public SDL_JoystickID 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; + + public SDL_JoystickID which; + } + + public partial struct SDL_JoyBatteryEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + public SDL_JoystickID 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; + + public SDL_JoystickID 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; + + public SDL_JoystickID 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; + + public SDL_JoystickID which; + } + + public partial struct SDL_GamepadTouchpadEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + public SDL_JoystickID 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; + + public SDL_JoystickID 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; + + public SDL_AudioDeviceID 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; + + public SDL_CameraDeviceID 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; + + public SDL_TouchID touchID; + + public SDL_FingerID fingerID; + + public float x; + + public float y; + + public float dx; + + public float dy; + + public float pressure; + + public SDL_WindowID windowID; + } + + public partial struct SDL_PenTipEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + public SDL_WindowID windowID; + + public SDL_PenID 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; + + public SDL_WindowID windowID; + + public SDL_PenID 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; + + public SDL_WindowID windowID; + + public SDL_PenID 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; + + public SDL_WindowID windowID; + + public float x; + + public float y; + + [NativeTypeName("char *")] + public byte* source; + + [NativeTypeName("char *")] + public byte* 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; + + public SDL_SensorID 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 partial struct SDL_UserEvent + { + public SDL_EventType type; + + [NativeTypeName("Uint32")] + public uint reserved; + + [NativeTypeName("Uint64")] + public ulong timestamp; + + public SDL_WindowID windowID; + + [NativeTypeName("Sint32")] + public int code; + + [NativeTypeName("void*")] + public IntPtr data1; + + [NativeTypeName("void*")] + public IntPtr data2; + } + + [StructLayout(LayoutKind.Explicit)] + public partial struct SDL_Event + { + [FieldOffset(0)] + public SDL_EventType 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, SDL_EventType minType, SDL_EventType maxType); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasEvent(SDL_EventType type); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_EventType type); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WaitEvent(SDL_Event* @event); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_SetEventFilter([NativeTypeName("SDL_EventFilter")] delegate* unmanaged[Cdecl] filter, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_EventType 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)] + [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; + + [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..fe780b0 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_filesystem.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; +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; + + public SDL_Time create_time; + + public SDL_Time modify_time; + + public SDL_Time access_time; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetBasePath", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_GetBasePath(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPrefPath", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_GetPrefPath([NativeTypeName("const char *")] byte* org, [NativeTypeName("const char *")] byte* app); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetUserFolder", ExactSpelling = true)] + [return: NativeTypeName("char *")] + 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); + + [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, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 *")] byte* oldpath, [NativeTypeName("const char *")] byte* newpath); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 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 new file mode 100644 index 0000000..bbc7bf8 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_gamepad.g.cs @@ -0,0 +1,441 @@ +/* + + 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 *")] byte* mapping); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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 byte** SDL_GetGamepadMappings(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadMappingForGUID", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_GetGamepadMappingForGUID([NativeTypeName("SDL_JoystickGUID")] SDL_GUID guid); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadMapping", ExactSpelling = true)] + [return: NativeTypeName("char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasGamepad(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_JoystickID* SDL_GetGamepads(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_IsGamepad(SDL_JoystickID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadInstanceName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetGamepadInstanceName(SDL_JoystickID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadInstancePath", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickGUID")] + 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(SDL_JoystickID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + 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(SDL_JoystickID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_JoystickID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadInstanceMapping", ExactSpelling = true)] + [return: NativeTypeName("char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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)] + public static extern SDL_PropertiesID SDL_GetGamepadProperties(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_JoystickID SDL_GetGamepadInstanceID(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetGamepadName(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadPath", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [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, EntryPoint = "SDL_GetGamepadSerial", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_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)] + 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(SDL_bool enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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 *")] byte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadStringForType", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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, EntryPoint = "SDL_GetGamepadStringForAxis", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [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 *")] byte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadStringForButton", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [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)] + 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, SDL_bool enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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 *")] IntPtr data, int size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_CloseGamepad(SDL_Gamepad* gamepad); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadAppleSFSymbolsNameForButton", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad* gamepad, SDL_GamepadButton button); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetGamepadAppleSFSymbolsNameForAxis", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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; + + [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..97a8d0b --- /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 *")] byte* pszGUID, int cbGUID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 new file mode 100644 index 0000000..bd8f7cd --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_haptic.g.cs @@ -0,0 +1,499 @@ +/* + + 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)] + public static extern SDL_HapticID* SDL_GetHaptics(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetHapticInstanceName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Haptic* SDL_GetHapticFromInstanceID(SDL_HapticID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_HapticID SDL_GetHapticInstanceID(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetHapticName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetHapticName(SDL_Haptic* haptic); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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)] + 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); + + [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)] + 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); + + [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)] + 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); + + [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..21f3368 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hidapi.g.cs @@ -0,0 +1,156 @@ +/* + + 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_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 byte* path; + + [NativeTypeName("unsigned short")] + public ushort vendor_id; + + [NativeTypeName("unsigned short")] + public ushort product_id; + + [NativeTypeName("wchar_t *")] + public IntPtr serial_number; + + [NativeTypeName("unsigned short")] + public ushort release_number; + + [NativeTypeName("wchar_t *")] + public IntPtr manufacturer_string; + + [NativeTypeName("wchar_t *")] + public IntPtr 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)] + 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 *")] 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(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(SDL_hid_device* dev, int nonblock); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(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(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(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 *")] 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 *")] 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 *")] 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 *")] 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_bool 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..9cea507 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_hints.g.cs @@ -0,0 +1,650 @@ +/* + + 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)] + 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)] + public static extern SDL_bool SDL_SetHint([NativeTypeName("const char *")] byte* name, [NativeTypeName("const char *")] byte* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetHint", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [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); + + [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, [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; + + [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..844476a --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_init.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; +using System.Runtime.InteropServices; + +namespace SDL +{ + [Flags] + 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(SDL_InitFlags flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_InitSubSystem(SDL_InitFlags flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_QuitSubSystem(SDL_InitFlags flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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_iostream.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs new file mode 100644 index 0000000..abf3a55 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_iostream.g.cs @@ -0,0 +1,227 @@ +/* + + 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 *)")] + public delegate* unmanaged[Cdecl] size; + + [NativeTypeName("Sint64 (*)(void *, Sint64, int)")] + public delegate* unmanaged[Cdecl] seek; + + [NativeTypeName("size_t (*)(void *, void *, size_t, SDL_IOStatus *)")] + public delegate* unmanaged[Cdecl] read; + + [NativeTypeName("size_t (*)(void *, const void *, size_t, SDL_IOStatus *)")] + public delegate* unmanaged[Cdecl] write; + + [NativeTypeName("int (*)(void *)")] + 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 *")] byte* file, [NativeTypeName("const char *")] byte* mode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 *")] 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, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CloseIO(SDL_IOStream* context); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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, [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 *")] IntPtr 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 *")] 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 *")] byte* fmt, [NativeTypeName("va_list")] byte* ap); + + [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, 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)] + public static extern SDL_bool SDL_ReadU8(SDL_IOStream* src, [NativeTypeName("Uint8 *")] byte* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadU16LE(SDL_IOStream* src, [NativeTypeName("Uint16 *")] ushort* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadS16LE(SDL_IOStream* src, [NativeTypeName("Sint16 *")] short* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadU16BE(SDL_IOStream* src, [NativeTypeName("Uint16 *")] ushort* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadS16BE(SDL_IOStream* src, [NativeTypeName("Sint16 *")] short* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadU32LE(SDL_IOStream* src, [NativeTypeName("Uint32 *")] uint* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadS32LE(SDL_IOStream* src, [NativeTypeName("Sint32 *")] int* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadU32BE(SDL_IOStream* src, [NativeTypeName("Uint32 *")] uint* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadS32BE(SDL_IOStream* src, [NativeTypeName("Sint32 *")] int* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadU64LE(SDL_IOStream* src, [NativeTypeName("Uint64 *")] ulong* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadS64LE(SDL_IOStream* src, [NativeTypeName("Sint64 *")] long* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadU64BE(SDL_IOStream* src, [NativeTypeName("Uint64 *")] ulong* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_ReadS64BE(SDL_IOStream* src, [NativeTypeName("Sint64 *")] long* value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteU8(SDL_IOStream* dst, [NativeTypeName("Uint8")] byte value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteU16LE(SDL_IOStream* dst, [NativeTypeName("Uint16")] ushort value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteS16LE(SDL_IOStream* dst, [NativeTypeName("Sint16")] short value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteU16BE(SDL_IOStream* dst, [NativeTypeName("Uint16")] ushort value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteS16BE(SDL_IOStream* dst, [NativeTypeName("Sint16")] short value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteU32LE(SDL_IOStream* dst, [NativeTypeName("Uint32")] uint value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteS32LE(SDL_IOStream* dst, [NativeTypeName("Sint32")] int value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteU32BE(SDL_IOStream* dst, [NativeTypeName("Uint32")] uint value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteS32BE(SDL_IOStream* dst, [NativeTypeName("Sint32")] int value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteU64LE(SDL_IOStream* dst, [NativeTypeName("Uint64")] ulong value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteS64LE(SDL_IOStream* dst, [NativeTypeName("Sint64")] long value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_WriteU64BE(SDL_IOStream* dst, [NativeTypeName("Uint64")] ulong value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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; + + [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..3dc1a27 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_joystick.g.cs @@ -0,0 +1,362 @@ +/* + + 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 byte* name; + + [NativeTypeName("void*")] + public IntPtr userdata; + + [NativeTypeName("void (*)(void *)")] + public delegate* unmanaged[Cdecl] Update; + + [NativeTypeName("void (*)(void *, int)")] + public delegate* unmanaged[Cdecl] SetPlayerIndex; + + [NativeTypeName("int (*)(void *, Uint16, Uint16)")] + public delegate* unmanaged[Cdecl] Rumble; + + [NativeTypeName("int (*)(void *, Uint16, Uint16)")] + public delegate* unmanaged[Cdecl] RumbleTriggers; + + [NativeTypeName("int (*)(void *, Uint8, Uint8, Uint8)")] + public delegate* unmanaged[Cdecl] SetLED; + + [NativeTypeName("int (*)(void *, const void *, int)")] + 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)] + public static extern SDL_bool SDL_HasJoystick(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_JoystickID* SDL_GetJoysticks(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickInstanceName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetJoystickInstanceName(SDL_JoystickID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickInstancePath", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_JoystickGUID")] + 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(SDL_JoystickID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint16")] + 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(SDL_JoystickID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_JoystickID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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)] + public static extern SDL_JoystickID SDL_AttachVirtualJoystick(SDL_JoystickType type, int naxes, int nbuttons, int nhats); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_JoystickID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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)] + public static extern SDL_PropertiesID SDL_GetJoystickProperties(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetJoystickName(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetJoystickPath", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [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, EntryPoint = "SDL_GetJoystickSerial", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 *")] 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_JoystickConnected(SDL_Joystick* joystick); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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(SDL_bool enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool 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)] + 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); + + [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 *")] IntPtr 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..02803e5 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keyboard.g.cs @@ -0,0 +1,112 @@ +/* + + 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; + + public SDL_Keycode sym; + + [NativeTypeName("Uint16")] + public ushort mod; + + [NativeTypeName("Uint32")] + public uint unused; + } + + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_HasKeyboard(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_KeyboardID* SDL_GetKeyboards(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetKeyboardInstanceName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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(); + + [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)] + public static extern SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetScancodeName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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, EntryPoint = "SDL_GetKeyName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_StartTextInput(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool 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)] + public static extern SDL_bool SDL_HasScreenKeyboardSupport(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool 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..422ab22 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_keycode.g.cs @@ -0,0 +1,307 @@ +/* + + 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 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)), + } + + [Flags] + 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..65d2668 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_loadso.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; +using System.Runtime.InteropServices; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [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 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_locale.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_locale.g.cs new file mode 100644 index 0000000..fe82701 --- /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 byte* language; + + [NativeTypeName("const char *")] + public byte* 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..57a9929 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_log.g.cs @@ -0,0 +1,116 @@ +/* + + 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_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(SDL_LogCategory category, SDL_LogPriority priority); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_LogPriority SDL_LogGetPriority(SDL_LogCategory 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 *")] byte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_LogCategory category, [NativeTypeName("const char *")] byte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 new file mode 100644 index 0000000..d2e4bd4 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.Windows.g.cs @@ -0,0 +1,46 @@ +/* + + 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; +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 *")] byte* name, [NativeTypeName("Uint32")] uint style, [NativeTypeName("void*")] IntPtr 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(); + } +} 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..de43933 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_main.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; +using System.Runtime.InteropServices; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [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 *[]")] 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); + } +} 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..dee9332 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_messagebox.g.cs @@ -0,0 +1,122 @@ +/* + + 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 +{ + [Flags] + 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, + } + + [Flags] + public enum SDL_MessageBoxButtonFlags + { + SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, + SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002, + } + + public unsafe partial struct SDL_MessageBoxButtonData + { + public SDL_MessageBoxButtonFlags flags; + + public int buttonID; + + [NativeTypeName("const char *")] + public byte* 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 + { + public SDL_MessageBoxFlags flags; + + public SDL_Window* window; + + [NativeTypeName("const char *")] + public byte* title; + + [NativeTypeName("const char *")] + public byte* 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(SDL_MessageBoxFlags flags, [NativeTypeName("const char *")] byte* title, [NativeTypeName("const char *")] byte* 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..ae29905 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_metal.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; +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 IntPtr SDL_Metal_CreateView(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_Metal_DestroyView([NativeTypeName("SDL_MetalView")] IntPtr view); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_Metal_GetLayer([NativeTypeName("SDL_MetalView")] IntPtr 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..d4d6b7e --- /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 *")] byte* 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..e98c846 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_mouse.g.cs @@ -0,0 +1,167 @@ +/* + + 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)] + public static extern SDL_bool SDL_HasMouse(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_MouseID* SDL_GetMice(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetMouseInstanceName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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(); + + [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(SDL_bool enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CaptureMouse(SDL_bool enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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)] + public static extern SDL_bool 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..9fc75f3 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pen.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; +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)] + 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(SDL_PenID instance_id, float* x, float* y, float* axes, [NativeTypeName("size_t")] nuint num_axes); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PenID SDL_GetPenFromGUID(SDL_GUID guid); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GUID SDL_GetPenGUID(SDL_PenID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_PenConnected(SDL_PenID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetPenName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetPenName(SDL_PenID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("Uint32")] + 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(SDL_PenID instance_id); + + [NativeTypeName("#define SDL_PEN_INVALID ((SDL_PenID)0)")] + public const SDL_PenID SDL_PEN_INVALID = ((SDL_PenID)(0)); + + [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..76d04ce --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs @@ -0,0 +1,435 @@ +/* + + 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, + } + + [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)), + 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, + } + + [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_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, EntryPoint = "SDL_GetPixelFormatName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [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..dd8bef7 --- /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, EntryPoint = "SDL_GetPlatform", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_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..20172d2 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_properties.g.cs @@ -0,0 +1,109 @@ +/* + + 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_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)] + public static extern SDL_PropertiesID SDL_GetGlobalProperties(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PropertiesID SDL_CreateProperties(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_PropertiesID props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_UnlockProperties(SDL_PropertiesID props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(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(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(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(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, float value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetBooleanProperty(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, SDL_bool value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [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, EntryPoint = "SDL_GetStringProperty", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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")] + 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(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name, float default_value); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_PropertiesID props, [NativeTypeName("const char *")] byte* name); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_PropertiesID 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..4fb3d30 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_rect.g.cs @@ -0,0 +1,133 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System.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 + { + 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))) ? (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)) ? (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)) ? (SDL_bool)(1) : (SDL_bool)(0); + } + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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)] + 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)] + 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)] + public static extern SDL_bool SDL_GetRectAndLineIntersection([NativeTypeName("const SDL_Rect *")] SDL_Rect* rect, int* X1, int* Y1, int* X2, int* Y2); + + 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))) ? (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)) ? (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)))) ? (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) + { + return SDL_RectsEqualEpsilon(a, b, 1.1920928955078125e-07F); + } + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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)] + 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)] + 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)] + 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 new file mode 100644 index 0000000..12c830d --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_render.g.cs @@ -0,0 +1,573 @@ +/* + + 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 +{ + [Flags] + public enum SDL_RendererFlags + { + SDL_RENDERER_PRESENTVSYNC = 0x00000004, + } + + public unsafe partial struct SDL_RendererInfo + { + [NativeTypeName("const char *")] + public byte* name; + + public SDL_RendererFlags 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, EntryPoint = "SDL_GetRenderDriver", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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)] + 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); + + [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, SDL_PropertiesID props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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 *")] 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); + + [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, [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); + + [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)] + 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); + + [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)] + 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); + + [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 *")] 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 *")] 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); + + [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)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_GetRenderMetalLayer(SDL_Renderer* renderer); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [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); + + [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..636cd60 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_sensor.g.cs @@ -0,0 +1,95 @@ +/* + + 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)] + public static extern SDL_SensorID* SDL_GetSensors(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetSensorInstanceName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSensorInstanceNonPortableType(SDL_SensorID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_SensorID instance_id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PropertiesID SDL_GetSensorProperties(SDL_Sensor* sensor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetSensorName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetSensorNonPortableType(SDL_Sensor* sensor); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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..2bd0ad8 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_stdinc.g.cs @@ -0,0 +1,649 @@ +/* + + 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)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_malloc([NativeTypeName("size_t")] nuint size); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [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)] + [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([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); + + [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)] + [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([NativeTypeName("void*")] IntPtr mem); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumAllocations(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_getenv", ExactSpelling = true)] + [return: NativeTypeName("char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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)] + [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([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)] + [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); + + [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 *")] 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 *")] IntPtr data, [NativeTypeName("size_t")] nuint len); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [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)] + [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)] + [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)] + [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 *")] IntPtr s1, [NativeTypeName("const void *")] IntPtr 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 *")] IntPtr wstr); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + 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 *")] 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 *")] 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 IntPtr SDL_wcsdup([NativeTypeName("const wchar_t *")] IntPtr wstr); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("wchar_t *")] + 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 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 *")] 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 *")] 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 *")] 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 *")] 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 *")] IntPtr str, [NativeTypeName("wchar_t **")] IntPtr* endp, int @base); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + 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 *")] 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 *")] 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 *")] 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 *")] byte* dst, [NativeTypeName("const char *")] byte* src, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strdup", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_strdup([NativeTypeName("const char *")] byte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strndup", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_strndup([NativeTypeName("const char *")] byte* str, [NativeTypeName("size_t")] nuint maxlen); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strrev", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_strrev([NativeTypeName("char *")] byte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strupr", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_strupr([NativeTypeName("char *")] byte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strlwr", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_strlwr([NativeTypeName("char *")] byte* str); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strchr", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_strchr([NativeTypeName("const char *")] byte* str, int c); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strrchr", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_strrchr([NativeTypeName("const char *")] byte* str, int c); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strstr", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_strstr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strnstr", ExactSpelling = true)] + [return: NativeTypeName("char *")] + 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, EntryPoint = "SDL_strcasestr", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_strcasestr([NativeTypeName("const char *")] byte* haystack, [NativeTypeName("const char *")] byte* needle); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_strtok_r", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_strtok_r([NativeTypeName("char *")] byte* s1, [NativeTypeName("const char *")] byte* s2, [NativeTypeName("char **")] byte** saveptr); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + 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 *")] byte* str, [NativeTypeName("size_t")] nuint bytes); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_itoa", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_itoa(int value, [NativeTypeName("char *")] byte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_uitoa", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_uitoa([NativeTypeName("unsigned int")] uint value, [NativeTypeName("char *")] byte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_ltoa", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_ltoa([NativeTypeName("long")] int value, [NativeTypeName("char *")] byte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_ultoa", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_ultoa([NativeTypeName("unsigned long")] uint value, [NativeTypeName("char *")] byte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_lltoa", ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern byte* Unsafe_SDL_lltoa([NativeTypeName("Sint64")] long value, [NativeTypeName("char *")] byte* str, int radix); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_ulltoa", ExactSpelling = true)] + [return: NativeTypeName("char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 *")] 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 *")] 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 *")] 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 *")] byte* str, [NativeTypeName("char **")] byte** endp, int @base); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 *")] byte* str1, [NativeTypeName("const char *")] byte* str2); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 *")] byte* str1, [NativeTypeName("const char *")] byte* str2); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 *")] byte* text, [NativeTypeName("const char *")] byte* fmt, __arglist); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 *")] 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 *")] 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")] byte* ap); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 **")] 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); + + [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 *")] 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 **")] byte** inbuf, [NativeTypeName("size_t *")] nuint* inbytesleft, [NativeTypeName("char **")] byte** outbuf, [NativeTypeName("size_t *")] nuint* outbytesleft); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_iconv_string", ExactSpelling = true)] + [return: NativeTypeName("char *")] + 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) + { + if (a != 0 && b > 0xffffffffffffffffUL / a) + { + return -1; + } + + *ret = a * b; + return 0; + } + + 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; + } + + [NativeTypeName("#define SDL_SIZE_MAX SIZE_MAX")] + public const ulong SDL_SIZE_MAX = 0xffffffffffffffffUL; + + [NativeTypeName("#define SDL_FALSE (SDL_bool)0")] + public const SDL_bool SDL_FALSE = (SDL_bool)(0); + + [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)); + + [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_Time)SDL_MAX_SINT64")] + public const SDL_Time SDL_MAX_TIME = (SDL_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; + + [NativeTypeName("#define SDL_PRIs64 \"lld\"")] + public static ReadOnlySpan SDL_PRIs64 => "lld"u8; + + [NativeTypeName("#define SDL_PRIu64 \"llu\"")] + public static ReadOnlySpan SDL_PRIu64 => "llu"u8; + + [NativeTypeName("#define SDL_PRIx64 \"llx\"")] + public static ReadOnlySpan SDL_PRIx64 => "llx"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; + + [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_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..ba128a4 --- /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; +using System.Runtime.InteropServices; + +namespace SDL +{ + public unsafe partial struct SDL_StorageInterface + { + [NativeTypeName("int (*)(void *)")] + public delegate* unmanaged[Cdecl] close; + + [NativeTypeName("SDL_bool (*)(void *)")] + public delegate* unmanaged[Cdecl] ready; + + [NativeTypeName("int (*)(void *, const char *, SDL_EnumerateDirectoryCallback, void *)")] + public delegate* unmanaged[Cdecl], IntPtr, int> enumerate; + + [NativeTypeName("int (*)(void *, const char *, SDL_PathInfo *)")] + public delegate* unmanaged[Cdecl] info; + + [NativeTypeName("int (*)(void *, const char *, void *, Uint64)")] + public delegate* unmanaged[Cdecl] read_file; + + [NativeTypeName("int (*)(void *, const char *, const void *, Uint64)")] + public delegate* unmanaged[Cdecl] write_file; + + [NativeTypeName("int (*)(void *, const char *)")] + public delegate* unmanaged[Cdecl] mkdir; + + [NativeTypeName("int (*)(void *, const char *)")] + public delegate* unmanaged[Cdecl] remove; + + [NativeTypeName("int (*)(void *, const char *, const char *)")] + public delegate* unmanaged[Cdecl] rename; + + [NativeTypeName("Uint64 (*)(void *)")] + 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 *")] 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, SDL_PropertiesID props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_CloseStorage(SDL_Storage* storage); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 *")] 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, [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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 *")] byte* 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 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 new file mode 100644 index 0000000..efd53d2 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_surface.g.cs @@ -0,0 +1,238 @@ +/* + + 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; + + [NativeTypeName("void*")] + public IntPtr pixels; + + [NativeTypeName("void*")] + public IntPtr reserved; + + public int locked; + + [NativeTypeName("void*")] + public IntPtr 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([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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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, 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, SDL_bool closeio); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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)] + 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); + + [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)] + 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); + + [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, 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, 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); + + [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.Android.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs new file mode 100644 index 0000000..4e2deec --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Android.g.cs @@ -0,0 +1,96 @@ +/* + + 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; +using System.Runtime.Versioning; + +namespace SDL +{ + public static unsafe partial class SDL3 + { + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + [SupportedOSPlatform("Android")] + public static extern IntPtr SDL_AndroidGetJNIEnv(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + [SupportedOSPlatform("Android")] + public static extern IntPtr SDL_AndroidGetActivity(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern int SDL_GetAndroidSDKVersion(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern SDL_bool SDL_IsAndroidTV(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern SDL_bool SDL_IsChromebook(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern SDL_bool SDL_IsDeXMode(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + public static extern void SDL_AndroidBackButton(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_AndroidGetInternalStoragePath", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + [SupportedOSPlatform("Android")] + 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, EntryPoint = "SDL_AndroidGetExternalStoragePath", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + [SupportedOSPlatform("Android")] + public static extern byte* Unsafe_SDL_AndroidGetExternalStoragePath(); + + [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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Android")] + 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")] + 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..b2c9e9e --- /dev/null +++ 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/ClangSharp/SDL_system.WinRT.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs new file mode 100644 index 0000000..3ceaa67 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.WinRT.g.cs @@ -0,0 +1,64 @@ +/* + + 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; +using System.Runtime.Versioning; + +namespace SDL +{ + 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 IntPtr SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_WinRTGetFSPathUTF8", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + [SupportedOSPlatform("Windows")] + public static extern byte* Unsafe_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..dbf20c4 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.Windows.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; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace SDL +{ + 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, [NativeTypeName("void*")] IntPtr userdata); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern int SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("Windows")] + public static extern SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID 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.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs new file mode 100644 index 0000000..dc6bfe5 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.g.cs @@ -0,0 +1,57 @@ +/* + + 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 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool 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_system.iOS.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs new file mode 100644 index 0000000..441566c --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_system.iOS.g.cs @@ -0,0 +1,46 @@ +/* + + 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; +using System.Runtime.Versioning; + +namespace SDL +{ + 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, [NativeTypeName("void*")] IntPtr callbackParam); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("iOS")] + public static extern void SDL_iPhoneSetEventPump(SDL_bool enabled); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [SupportedOSPlatform("iOS")] + public static extern void SDL_OnApplicationDidChangeStatusBarOrientation(); + } +} 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..4fd87ca --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_thread.g.cs @@ -0,0 +1,86 @@ +/* + + 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; +using System.Runtime.Versioning; + +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)] + [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, EntryPoint = "SDL_GetThreadName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetThreadName(SDL_Thread* thread); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_ThreadID SDL_GetCurrentThreadID(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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)] + public static extern SDL_TLSID SDL_CreateTLS(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_GetTLS(SDL_TLSID id); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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 new file mode 100644 index 0000000..187c058 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_time.g.cs @@ -0,0 +1,97 @@ +/* + + 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(SDL_Time* ticks); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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, SDL_Time* ticks); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_TimeToWindows(SDL_Time ticks, [NativeTypeName("Uint32 *")] uint* dwLowDateTime, [NativeTypeName("Uint32 *")] uint* dwHighDateTime); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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..48ad867 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_timer.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; +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)] + 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)] + 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; + + [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..c5389e7 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_touch.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 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 + { + public SDL_FingerID id; + + public float x; + + public float y; + + public float pressure; + } + + 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, EntryPoint = "SDL_GetTouchDeviceName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_GetNumTouchFingers(SDL_TouchID touchID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Finger* SDL_GetTouchFinger(SDL_TouchID touchID, int index); + } +} 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..21969cb --- /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, EntryPoint = "SDL_GetRevision", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_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..4651e30 --- /dev/null +++ b/SDL3-CS/SDL3/ClangSharp/SDL_video.g.cs @@ -0,0 +1,755 @@ +/* + + 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 partial struct SDL_DisplayMode + { + public SDL_DisplayID displayID; + + public SDL_PixelFormatEnum format; + + public int w; + + public int h; + + public float pixel_density; + + public float refresh_rate; + + [NativeTypeName("void*")] + public IntPtr 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, EntryPoint = "SDL_GetVideoDriver", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetVideoDriver(int index); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetCurrentVideoDriver", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Unsafe_SDL_GetCurrentVideoDriver(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_SystemTheme SDL_GetSystemTheme(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_DisplayID* SDL_GetDisplays(int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_DisplayID SDL_GetPrimaryDisplay(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_PropertiesID SDL_GetDisplayProperties(SDL_DisplayID displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetDisplayName", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_DisplayID displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_DisplayOrientation SDL_GetCurrentDisplayOrientation(SDL_DisplayID displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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(SDL_DisplayID displayID, int* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const SDL_DisplayMode *")] + 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(SDL_DisplayID displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const SDL_DisplayMode *")] + public static extern SDL_DisplayMode* SDL_GetCurrentDisplayMode(SDL_DisplayID displayID); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_DisplayID SDL_GetDisplayForPoint([NativeTypeName("const SDL_Point *")] SDL_Point* point); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_DisplayID SDL_GetDisplayForRect([NativeTypeName("const SDL_Rect *")] SDL_Rect* rect); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [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)] + [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")] + 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, 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, SDL_WindowFlags flags); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_Window* SDL_CreateWindowWithProperties(SDL_PropertiesID props); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_WindowID SDL_GetWindowID(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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)] + public static extern SDL_PropertiesID SDL_GetWindowProperties(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetWindowTitle", ExactSpelling = true)] + [return: NativeTypeName("const char *")] + 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); + + [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, SDL_bool bordered); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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, SDL_bool 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, 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)] + 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); + + [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, SDL_bool grabbed); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int SDL_SetWindowMouseGrab(SDL_Window* window, SDL_bool grabbed); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool SDL_GetWindowKeyboardGrab(SDL_Window* window); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_bool 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, SDL_bool 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, [NativeTypeName("void*")] IntPtr 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)] + public static extern SDL_bool 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 *")] byte* path); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_FunctionPointer")] + 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 IntPtr 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)] + 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(); + + [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 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")] 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 IntPtr SDL_GL_GetCurrentContext(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_EGLDisplay")] + public static extern IntPtr SDL_EGL_GetCurrentEGLDisplay(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_EGLConfig")] + public static extern IntPtr SDL_EGL_GetCurrentEGLConfig(); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_EGLSurface")] + 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); + + [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")] 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; + + [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..f8c8039 --- /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; +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 *")] byte* path); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("SDL_FunctionPointer")] + public static extern IntPtr 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 byte** SDL_Vulkan_GetInstanceExtensions([NativeTypeName("Uint32 *")] uint* count); + + [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + 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_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 new file mode 100644 index 0000000..9743dac --- /dev/null +++ b/SDL3-CS/SDL3/SDL_audio.cs @@ -0,0 +1,79 @@ +// 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 JetBrains.Annotations; + +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, + } + + 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; + + [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; + + [MustDisposeResource] + public static unsafe SDLArray? SDL_GetAudioOutputDevices() + { + int count; + var array = SDL_GetAudioOutputDevices(&count); + return SDLArray.Create(array, count); + } + + [MustDisposeResource] + 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 new file mode 100644 index 0000000..714929b --- /dev/null +++ b/SDL3-CS/SDL3/SDL_camera.cs @@ -0,0 +1,30 @@ +// 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 JetBrains.Annotations; + +namespace SDL +{ + [Typedef] + public enum SDL_CameraDeviceID : UInt32; + + public static partial class SDL3 + { + [MustDisposeResource] + public static unsafe SDLArray? SDL_GetCameraDevices() + { + int count; + var array = SDL_GetCameraDevices(&count); + return SDLArray.Create(array, count); + } + + [MustDisposeResource] + 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_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_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_gamepad.cs b/SDL3-CS/SDL3/SDL_gamepad.cs new file mode 100644 index 0000000..b22e209 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_gamepad.cs @@ -0,0 +1,39 @@ +// 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; +using JetBrains.Annotations; + +namespace SDL +{ + public static partial class SDL3 + { + /// + /// An array of that can be passed to . + /// + [MustDisposeResource] + public static unsafe SDLArray? SDL_GetGamepadMappings() + { + int count; + IntPtr* array = (IntPtr*)SDL_GetGamepadMappings(&count); + return SDLArray.Create(array, count); + } + + [MustDisposeResource] + public static unsafe SDLArray? SDL_GetGamepads() + { + int count; + var array = SDL_GetGamepads(&count); + return SDLArray.Create(array, count); + } + + [MustDisposeResource] + 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 new file mode 100644 index 0000000..9b52131 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_haptic.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. + +using System; +using JetBrains.Annotations; + +namespace SDL +{ + [Typedef] + public enum SDL_HapticID : UInt32; + + public static partial class SDL3 + { + [MustDisposeResource] + 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_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 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_joystick.cs b/SDL3-CS/SDL3/SDL_joystick.cs new file mode 100644 index 0000000..fdc7a2f --- /dev/null +++ b/SDL3-CS/SDL3/SDL_joystick.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. + +using System; +using JetBrains.Annotations; + +namespace SDL +{ + [Typedef] + public enum SDL_JoystickID : UInt32; + + public static partial class SDL3 + { + [MustDisposeResource] + 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 new file mode 100644 index 0000000..cdd4ced --- /dev/null +++ b/SDL3-CS/SDL3/SDL_keyboard.cs @@ -0,0 +1,27 @@ +// 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 JetBrains.Annotations; + +namespace SDL +{ + [Typedef] + public enum SDL_KeyboardID : UInt32; + + public partial struct SDL_Keysym + { + public SDL_Keymod Mod => (SDL_Keymod)mod; + } + + public static partial class SDL3 + { + [MustDisposeResource] + 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_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_keycode.rsp b/SDL3-CS/SDL3/SDL_keycode.rsp new file mode 100644 index 0000000..2de70c7 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_keycode.rsp @@ -0,0 +1,9 @@ +# 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 + +# Remap the C `SDL_KeyCode` enum to the `SDL_Keycode` typedef +--remap +SDL_KeyCode=SDL_Keycode 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 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_mouse.cs b/SDL3-CS/SDL3/SDL_mouse.cs new file mode 100644 index 0000000..2d473b6 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_mouse.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 JetBrains.Annotations; + +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)); + + [MustDisposeResource] + 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 new file mode 100644 index 0000000..aab107e --- /dev/null +++ b/SDL3-CS/SDL3/SDL_pen.cs @@ -0,0 +1,46 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using JetBrains.Annotations; + +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); + + [MustDisposeResource] + 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_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_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/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_quit.cs b/SDL3-CS/SDL3/SDL_quit.cs new file mode 100644 index 0000000..4f3d7d4 --- /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, SDL_EventType.SDL_EVENT_QUIT, SDL_EventType.SDL_EVENT_QUIT) > 0; + } + } +} 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 diff --git a/SDL3-CS/SDL3/SDL_sensor.cs b/SDL3-CS/SDL3/SDL_sensor.cs new file mode 100644 index 0000000..540b22c --- /dev/null +++ b/SDL3-CS/SDL3/SDL_sensor.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. + +using System; +using JetBrains.Annotations; + +namespace SDL +{ + [Typedef] + public enum SDL_SensorID : UInt32; + + public static partial class SDL3 + { + [MustDisposeResource] + 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_stdinc.cs b/SDL3-CS/SDL3/SDL_stdinc.cs new file mode 100644 index 0000000..ca0fe5d --- /dev/null +++ b/SDL3-CS/SDL3/SDL_stdinc.cs @@ -0,0 +1,25 @@ +// 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; + + 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); + } +} 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 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.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 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 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_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 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_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") diff --git a/SDL3-CS/SDL3/SDL_timer.cs b/SDL3-CS/SDL3/SDL_timer.cs new file mode 100644 index 0000000..4ec7dff --- /dev/null +++ b/SDL3-CS/SDL3/SDL_timer.cs @@ -0,0 +1,31 @@ +// 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; + + 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_touch.cs b/SDL3-CS/SDL3/SDL_touch.cs new file mode 100644 index 0000000..8c8ae44 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_touch.cs @@ -0,0 +1,31 @@ +// 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 JetBrains.Annotations; + +namespace SDL +{ + [Typedef] + 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)); + + [MustDisposeResource] + 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_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 new file mode 100644 index 0000000..335eaf5 --- /dev/null +++ b/SDL3-CS/SDL3/SDL_video.cs @@ -0,0 +1,74 @@ +// 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 JetBrains.Annotations; + +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, + } + + 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); + + [MustDisposeResource] + public static unsafe SDLArray? SDL_GetDisplays() + { + int count; + var array = SDL_GetDisplays(&count); + return SDLArray.Create(array, count); + } + + [MustDisposeResource] + 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..229ad8a --- /dev/null +++ b/SDL3-CS/SDLArray.cs @@ -0,0 +1,66 @@ +// 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 JetBrains.Annotations; + +namespace SDL +{ + [MustDisposeResource] + 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 + { + [MustDisposeResource] + internal static SDLArray? Create(T* array, int count) + where T : unmanaged + { + if (array == null) + return null; + + return new SDLArray(array, count); + } + + [MustDisposeResource] + 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..4e1d93b --- /dev/null +++ b/SDL3-CS/SDLPointerArray.cs @@ -0,0 +1,46 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Diagnostics; +using JetBrains.Annotations; + +namespace SDL +{ + // 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 + { + 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); + } + } +} diff --git a/SDL3-CS/TypedefAttribute.cs b/SDL3-CS/TypedefAttribute.cs new file mode 100644 index 0000000..901271c --- /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 ClangSharp so it uses the custom enum type instead 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 new file mode 100644 index 0000000..b5a9835 --- /dev/null +++ b/SDL3-CS/generate_bindings.py @@ -0,0 +1,331 @@ +# 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 +- git apply `SDL-use-proper-types.patch` to SDL repo + +This script should be run manually. +""" + +import json +import pathlib +import re +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 + +csproj_root = pathlib.Path(".") + + +class Header: + """Represents a SDL header file that is used in ClangSharp generation.""" + + def __init__(self, base: str, name: str, output_suffix=None): + assert base == SDL3_header_base + 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() + + 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.""" + 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 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("/") + 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_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_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"), +] + + +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) + + +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) + + +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", + + "--config", + "latest-codegen", + "windows-types", + "generate-macro-bindings", + + "--file-directory", SDL_include_root, + "--include-directory", SDL_include_root, + "--libraryPath", "SDL3", + "--methodClassName", "SDL3", + "--namespace", "SDL", + + "--remap", + "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", + + "--additional", + "--undefine-macro=_WIN32", +] + + +def run_clangsharp(command, header: Header): + cmd = command + [ + "--file", header.input_file(), + "--output", header.output_file(), + ] + + for rsp in header.rsp_files(): + 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() + + +# 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 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() + + # 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)) + + 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]) + + 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() 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